windows: Fix build. Closes #894

This commit is contained in:
Hylke Bons 2012-08-10 19:04:11 +01:00
parent 199a35269a
commit ae3495d388
5 changed files with 44 additions and 35 deletions

View file

@ -45,14 +45,9 @@
<Link>SparkleRepoGit.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SparkleLib.csproj">
<Project>{2C914413-B31C-4362-93C7-1AE34F09112A}</Project>
<Name>SparkleLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
@ -65,4 +60,10 @@
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<ProjectReference Include="..\SparkleLib.csproj">
<Project>{2C914413-B31C-4362-93C7-1AE34F09112A}</Project>
<Name>SparkleLib</Name>
</ProjectReference>
</ItemGroup>
</Project>

View file

@ -18,7 +18,6 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Security.Principal;
using System.Xml;
namespace SparkleLib {

View file

@ -10,7 +10,6 @@
<RootNamespace>SparkleLib</RootNamespace>
<AssemblyName>SparkleLib</AssemblyName>
<ReleaseVersion />
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

View file

@ -128,29 +128,39 @@ namespace SparkleShare {
public override bool CreateSparkleShareFolder ()
{
if (!Directory.Exists (FoldersPath)) {
Directory.CreateDirectory (FoldersPath);
File.SetAttributes (FoldersPath, File.GetAttributes (FoldersPath) | FileAttributes.System);
if (Directory.Exists (FoldersPath))
return false;
return true;
Directory.CreateDirectory (FoldersPath);
File.SetAttributes (FoldersPath, File.GetAttributes (FoldersPath) | FileAttributes.System);
} else if (!File.Exists (icon_file_path)) {
SparkleLogger.LogInfo ("Config", "Created '" + FoldersPath + "'");
string app_path = Path.GetDirectoryName (Forms.Application.ExecutablePath);
string icon_file_path = Path.Combine (app_path, "Pixmaps", "sparkleshare-folder.ico");
if (!File.Exists (icon_file_path)) {
string ini_file_path = Path.Combine (FoldersPath, "desktop.ini");
string app_path = Path.GetDirectoryName (Application.ExecutablePath);
string icon_file_path = Path.Combine (app_path, "Pixmaps", "sparkleshare-folder.ico");
string ini_file "[.ShellClassInfo]" +
string ini_file = "[.ShellClassInfo]" +
"IconFile=" + icon_file_path +
"IconIndex=0" +
"InfoTip=SparkleShare";
File.WriteAllText (ini_file_path, ini_file);
File.SetAttributes (ini_file_path,
File.GetAttributes (ini_file_path) | FileAttributes.Hidden | FileAttributes.System);
SparkleHelpers.DebugInfo ("Config", "Created '" + FoldersPath + "'");
}
try {
File.Create (ini_file_path).Close ();
File.WriteAllText (ini_file_path, ini_file);
File.SetAttributes (ini_file_path,
File.GetAttributes (ini_file_path) | FileAttributes.Hidden | FileAttributes.System);
} catch (IOException e) {
SparkleLogger.LogInfo ("Config",
"Failed setting icon for '" + FoldersPath + "': " + e.Message);
}
return true;
}
return false;
}
@ -184,7 +194,7 @@ namespace SparkleShare {
string auth_sock = Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK");
if (!string.IsNullOrEmpty (auth_sock)) {
SparkleHelpers.DebugInfo ("Controller", "Using existing ssh-agent with PID=" + this.ssh_agent_pid);
SparkleLogger.LogInfo ("Controller", "Using existing ssh-agent with PID=" + this.ssh_agent_pid);
return;
}
@ -211,10 +221,10 @@ namespace SparkleShare {
Int32.TryParse (ssh_pid, out this.ssh_agent_pid);
Environment.SetEnvironmentVariable ("SSH_AGENT_PID", ssh_pid);
SparkleHelpers.DebugInfo ("Controller", "ssh-agent started, PID=" + ssh_pid);
SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=" + ssh_pid);
} else {
SparkleHelpers.DebugInfo ("Controller", "ssh-agent started, PID=Unknown");
SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=Unknown");
}
}
@ -228,7 +238,7 @@ namespace SparkleShare {
Process.GetProcessById (this.ssh_agent_pid).Kill ();
} catch (ArgumentException e) {
SparkleHelpers.DebugInfo ("SSH", "Could not stop ssh-agent: " + e.Message);
SparkleLogger.LogInfo ("SSH", "Could not stop ssh-agent: " + e.Message);
}
}
}

View file

@ -72,13 +72,15 @@ namespace SparkleShare {
TextAlignment = TextAlignment.Right,
FontWeight = FontWeights.Bold
};
string name = System.Security.Principal.WindowsIdentity.GetCurrent ().Name;
name = name.Split ("\\".ToCharArray ()) [1];
TextBox name_box = new TextBox () {
Text = Controller.GuessedUserName,
Text = name,
Width = 175
};
TextBlock email_label = new TextBlock () {
Text = "Email:",
Width = 150,
@ -87,11 +89,9 @@ namespace SparkleShare {
};
TextBox email_box = new TextBox () {
Width = 175,
Text = Controller.GuessedUserEmail
Width = 175
};
Button cancel_button = new Button () {
Content = "Cancel"