Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixd a bunch. #69

Merged
merged 6 commits into from
This page is out of date. Refresh to see the latest.
View
2  Cli.csproj
@@ -39,7 +39,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <UseVSHostingProcess>false</UseVSHostingProcess>
+ <UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
View
26 ElevationProxy/ElevationProxyMain.cs
@@ -1,12 +1,12 @@
-//-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
// <copyright company="CoApp Project">
-// Copyright (c) 2010-2012 Garrett Serack and CoApp Contributors.
+// Copyright (c) 2010-2012 Garrett Serack and CoApp Contributors.
// Contributors can be discovered using the 'git log' command.
// All rights reserved.
// </copyright>
// <license>
// The software is licensed under the Apache 2.0 License (the "License")
-// You may not use the software except in compliance with the License.
+// You may not use the software except in compliance with the License.
// </license>
//-----------------------------------------------------------------------
@@ -115,7 +115,7 @@ public struct SidIdentifierAuthority {
private byte[] _ssmessage;
- internal static void ElevateSelf() {
+ internal static void ElevateSelf(bool processCreated) {
try {
var ntAuth = new SidIdentifierAuthority();
ntAuth.Value = new byte[] {0, 0, 0, 0, 0, 5};
@@ -129,6 +129,7 @@ public struct SidIdentifierAuthority {
// :) Seems that we need to elevate?
}
+ if (!processCreated) {
// we're not an admin I guess.
try {
var process = new Process {
@@ -137,7 +138,7 @@ public struct SidIdentifierAuthority {
WorkingDirectory = Environment.CurrentDirectory,
FileName = Assembly.GetEntryAssembly().Location,
Verb = "runas",
- Arguments = Environment.GetCommandLineArgs().Skip(1).Aggregate(string.Empty, (current, each) => current + " \"" + each + "\"").Trim(),
+ Arguments = Environment.GetCommandLineArgs().Skip(1).Aggregate(string.Empty, (current, each) => current + " \"" + each + "\"").Trim() + " __EPM1__",
ErrorDialog = true,
ErrorDialogParentHandle = GetForegroundWindow(),
WindowStyle = ProcessWindowStyle.Maximized,
@@ -155,6 +156,7 @@ public struct SidIdentifierAuthority {
} catch {
// nWindow.Fail(LocalizedMessage.IDS_REQUIRES_ADMIN_RIGHTS, "The installer requires administrator permissions.");
}
+ }
// we should have elevated, or failed to. either way, GTFO.
Environment.Exit(0);
@@ -210,14 +212,14 @@ public struct SidIdentifierAuthority {
System.Windows.Forms.MessageBox.Show("Required: PipeName", "CoApp Elevation Proxy", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
- ElevateSelf();
+ ElevateSelf(args.Length == 2 && args[1] == "__EPM1__");
var epm = new ElevationProxyMain {
ClientPipeName = args[0]
};
epm.Go();
}
- private void AsyncCopyTo( Stream fromPipe, Stream toPipe ) {
+ private void oldAsyncCopyTo( Stream fromPipe, Stream toPipe ) {
var buffer = new byte[BufferSize];
fromPipe.BeginRead(buffer, 0, BufferSize, ar => {
var i = fromPipe.EndRead(ar);
@@ -227,6 +229,16 @@ public struct SidIdentifierAuthority {
}, null).AsyncWaitHandle.WaitOne();
}
+ private void AsyncCopyTo(Stream fromPipe, Stream toPipe) {
+ var buffer = new byte[BufferSize];
+ var ar = fromPipe.BeginRead(buffer, 0, BufferSize, null, null);
+ var i = fromPipe.EndRead(ar);
+ if (i > 0) {
+ toPipe.Write(buffer, 0, i);
+ }
+ }
+
+
private void AsyncCopyToWithSnoop( Stream fromPipe, Stream toPipe) {
var buffer = new byte[BufferSize];
fromPipe.BeginRead(buffer, 0, BufferSize, ar => {
View
2  Packaging/Client/UI/Installer.cs
@@ -71,7 +71,7 @@ public class Installer : MarshalByRefObject, INotifyPropertyChanged {
if (((AppDomain.CurrentDomain.GetData("COAPP_INSTALLED") as string) ?? "false").IsTrue()) {
// we'd better make sure that the most recent version of the service is running.
EngineServiceManager.InstallAndStartService();
-
+ EnvironmentUtility.BroadcastChange();
}
bool wasCreated;
var ewhSec = new EventWaitHandleSecurity();
View
3  cli/CoAppMain.cs
@@ -316,9 +316,6 @@ public class CoAppMain : AsyncConsoleProgram {
Console.WriteLine( _packageManager.GetConfigurationValue("test", "something").Result);
return 0;
-
- break;
-
case "show-debug":
var l = 5;
if( parameters.Any() ) {
View
18 copkg/.buildinfo
@@ -9,18 +9,21 @@
}
commit-version {
+ compiler:vc11;
// do the work neccessary to push the updated version.inc files or equivalent.
// do the commit, not the push.
}
update-version {
+ compiler:vc11;
build-command: @"
cscript //e:jscript scripts\increment-build-version.js
";
}
release {
+ compiler:vc11;
default: true;
// builds the binaries in "Release" mode but does not sign them.
set : cfg = "Release";
@@ -35,6 +38,7 @@ release {
}
debug {
+ compiler:vc11;
// builds binaries in debug mode
default: false;
set : cfg = "Debug";
@@ -46,6 +50,7 @@ debug {
}
package {
+ compiler:vc11;
default: false;
set : cfg = "Release";
uses : sign-anycpu;
@@ -67,12 +72,13 @@ package {
}
sign-anycpu {
+ compiler:vc11;
set : release_dir = @"output\any\Release\bin\";
default: false;
uses: {
- anycpu, resources
+ anycpu //, resources
};
targets: {
@@ -93,7 +99,7 @@ sign-anycpu {
anycpu {
default: no;
platform : x86;
- compiler: vc10;
+ compiler: vc11;
uses: clean;
@@ -117,7 +123,7 @@ resources {
default: false;
platform : x86;
- compiler: vc10;
+ compiler: vc11;
uses: clean;
targets: {
@@ -148,6 +154,7 @@ resources {
// use:
// ptk rehash-prerequisites
rehash-prerequisites {
+ compiler:vc11;
set : cfg = "Release";
set : release_dir = @"output\any\Release\bin\";
default: false;
@@ -180,7 +187,7 @@ rehash-prerequisites {
rehash-x86 {
default: false;
platform : x86;
- compiler: vc10;
+ compiler: vc11;
uses: clean;
targets: {
@@ -195,7 +202,7 @@ rehash-x86 {
rehash-x64 {
default: false;
platform : x64;
- compiler: vc10;
+ compiler: vc11;
uses: clean;
targets: {
@@ -208,6 +215,7 @@ rehash-x64 {
}
clean {
+ compiler:vc11;
default: no;
clean-command: @"
View
4 source/CoApp.Bootstrap.VersionInfo.h
@@ -1,3 +1,3 @@
// This is an autogenerated file (see inc-build-numbers.js)
-#define COAPP_TOOLKIT_VERSION 1,2,0,444
-#define COAPP_TOOLKIT_VERSION_STR "1.2.0.444\0"
+#define COAPP_TOOLKIT_VERSION 1,2,0,453
+#define COAPP_TOOLKIT_VERSION_STR "1.2.0.453\0"
View
4 source/CoApp.Toolkit.AssemblyStrongName.cs
@@ -14,8 +14,8 @@
// we publish it, so now we will have just one set of Version lines, and no strong
// naming until publishing.
-[assembly: AssemblyVersion("1.2.0.444")]
-[assembly: AssemblyFileVersion("1.2.0.444")]
+[assembly: AssemblyVersion("1.2.0.453")]
+[assembly: AssemblyFileVersion("1.2.0.453")]
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
internal class AssemblyBugtrackerAttribute : Attribute {
View
38 toolkit/Extensions/FilesystemExtensions.cs
@@ -151,6 +151,44 @@ public static class FilesystemExtensions {
TryToHandlePendingRenames(true);
}
+ public static IEnumerable<string> GetAllCustomFilePaths(this string filename, string currentDirectory ) {
+
+ // check system etc
+ var chkPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "etc", filename);
+ if (File.Exists(chkPath)) {
+ yield return chkPath;
+ }
+
+ // check roaming user etc
+ chkPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "etc", filename);
+ if (File.Exists(chkPath)) {
+ yield return chkPath;
+ }
+
+ // check local user etc
+ chkPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "etc", filename);
+ if (File.Exists(chkPath)) {
+ yield return chkPath;
+ }
+
+ foreach( var dir in currentDirectory.GetDirectoryStack().Reverse() ) {
+ chkPath = Path.Combine(dir, filename);
+ if (File.Exists(chkPath)) {
+ yield return chkPath;
+ }
+ }
+ }
+
+ public static IEnumerable<string> GetDirectoryStack(this string currentDirectory ) {
+ currentDirectory = currentDirectory ?? Environment.CurrentDirectory;
+ while( !string.IsNullOrEmpty(currentDirectory) ) {
+ if( Directory.Exists(currentDirectory)) {
+ yield return currentDirectory;
+ }
+ currentDirectory = Path.GetDirectoryName(currentDirectory);
+ }
+ }
+
public static string GetCustomFilePath(this string filename, string currentDirectory = null) {
try {
// check user etc
View
18 toolkit/Extensions/StringExtensions.cs
@@ -854,5 +854,23 @@ public static class StringExtensions {
}
return false;
}
+
+ public static string EmptyAsNull( this string str) {
+ return (string.IsNullOrEmpty(str) ? null : str);
+ }
+
+
+ /// <summary>
+ /// Checks to see if strings are equal, with empty strings being considered equal to null.
+ /// </summary>
+ /// <param name="str1">First String to compare</param>
+ /// <param name="str2">Second String to compare</param>
+ /// <returns></returns>
+ public static bool EqualsEx(this string str1, string str2 ) {
+ if( string.IsNullOrEmpty(str1) && string.IsNullOrEmpty(str2)) {
+ return true;
+ }
+ return str1 == str2;
+ }
}
}
View
10 toolkit/Extensions/WebExtensions.cs
@@ -87,6 +87,8 @@ public static class WebExtensions {
resultCode = -1;
var webRequest = (HttpWebRequest)WebRequest.Create(url);
+ webRequest.Proxy = GetProxy();
+
webRequest.CookieContainer = Cookies.GetCookieContainer();
switch (requestType) {
@@ -264,5 +266,13 @@ public static class WebExtensions {
public static bool IsHttpScheme(this Uri uri, bool acceptHttps = true) {
return (uri.Scheme == Uri.UriSchemeHttp || (acceptHttps && uri.Scheme == Uri.UriSchemeHttps));
}
+
+ //see https://github.com/coapp/coapp/issues/58
+ public static IWebProxy GetProxy()
+ {
+ if (WebRequest.DefaultWebProxy.GetProxy(new Uri("http://www.coapp.org/")).AbsoluteUri == "http://www.coapp.org/")
+ return null;
+ else return WebRequest.DefaultWebProxy;
+ }
}
}
View
6 toolkit/Win32/EnvironmentUtility.cs
@@ -18,20 +18,18 @@ namespace CoApp.Toolkit.Win32 {
using Extensions;
public static class EnvironmentUtility {
-#if !COAPP_ENGINE_CORE
private const Int32 HWND_BROADCAST = 0xffff;
private const Int32 WM_SETTINGCHANGE = 0x001A;
private const Int32 SMTO_ABORTIFHUNG = 0x0002;
-#endif
public static void BroadcastChange() {
#if COAPP_ENGINE_CORE
Rehash.ForceProcessToReloadEnvironment("explorer", "services");
-#else
+#endif
Task.Factory.StartNew(() => {
User32.SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, "Environment", SMTO_ABORTIFHUNG, 1000, IntPtr.Zero);
});
-#endif
+
}
public static string GetSystemEnvironmentVariable(string name) {
Something went wrong with that request. Please try again.