From 5501a448b560111e96ab33c88b3f0299c11ae6b7 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 11 Jun 2011 21:52:41 +0200 Subject: [PATCH] reset to upstream/master, add windows files and fixes --- .gitattributes | 2 + .gitignore | 8 +- SparkleLib/Git/SparkleRepoGit.cs | 7 +- SparkleLib/SparkleBackend.cs | 1 + SparkleLib/SparkleFetcherBase.cs | 16 +- SparkleLib/windows/AssemblyInfo.cs | 14 ++ SparkleLib/windows/Defines.tt | 46 ++++++ SparkleLib/windows/GlobalAssemblyInfo.tt | 25 +++ SparkleLib/windows/SparkleLib.csproj | 159 +++++++++++++++++++ SparkleLib/windows/getversion.tt | 41 +++++ SparkleLib/windows/transform_tt.cmd | 7 + SparkleShare/SparkleUI.cs | 21 +++ SparkleShare/Windows/AssemblyInfo.cs | 14 ++ SparkleShare/Windows/Notification.cs | 70 ++++++++ SparkleShare/Windows/SparkleBubble.cs | 35 ++++ SparkleShare/Windows/SparkleShare.csproj | 143 +++++++++++++++++ SparkleShare/Windows/SparkleShare.sln | 31 ++++ SparkleShare/Windows/SparkleWinController.cs | 150 +++++++++++++++++ SparkleShare/Windows/transform_tt.cmd | 8 + 19 files changed, 791 insertions(+), 7 deletions(-) create mode 100644 .gitattributes create mode 100644 SparkleLib/windows/AssemblyInfo.cs create mode 100644 SparkleLib/windows/Defines.tt create mode 100644 SparkleLib/windows/GlobalAssemblyInfo.tt create mode 100644 SparkleLib/windows/SparkleLib.csproj create mode 100644 SparkleLib/windows/getversion.tt create mode 100644 SparkleLib/windows/transform_tt.cmd create mode 100644 SparkleShare/Windows/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/Notification.cs create mode 100644 SparkleShare/Windows/SparkleBubble.cs create mode 100644 SparkleShare/Windows/SparkleShare.csproj create mode 100644 SparkleShare/Windows/SparkleShare.sln create mode 100644 SparkleShare/Windows/SparkleWinController.cs create mode 100644 SparkleShare/Windows/transform_tt.cmd diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..4cadb26b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +.gitattributes eol=lf +.gitmodules eol=lf diff --git a/.gitignore b/.gitignore index 9375b1ff..105a8346 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ *.app *.pidb *.gmo +*.bak +*.suo +*.sln.cache po/POTFILES Makefile.in Makefile @@ -22,6 +25,7 @@ INSTALL aclocal.m4 autom4te.cache/ bin/ +obj/ install-sh libtool ltmain.sh @@ -33,7 +37,9 @@ SparkleLib/AssemblyInfo.cs build/m4/shave/shave build/m4/*.m4 build/m4/shave/shave-libtool -Defines.cs +SparkleLib/Defines.cs +SparkleLib/windows/Defines.cs +SparkleLib/windows/GlobalAssemblyInfo.cs SparkleShare/sparkleshare po/sparkleshare.pot SparkleShare/Nautilus/sparkleshare-nautilus-extension.py diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 382f6f21..68773182 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -348,7 +348,12 @@ namespace SparkleLib { List change_sets = new List (); SparkleGit git_log = new SparkleGit (LocalPath, "log -" + count + " --raw -M --date=iso"); - Console.OutputEncoding = System.Text.Encoding.Unicode; + if ((SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX)) { + // this causes an IOException on windows + Console.OutputEncoding = System.Text.Encoding.Unicode; + } + git_log.Start (); // Reading the standard output HAS to go before diff --git a/SparkleLib/SparkleBackend.cs b/SparkleLib/SparkleBackend.cs index 248cd3f6..ee9d1208 100644 --- a/SparkleLib/SparkleBackend.cs +++ b/SparkleLib/SparkleBackend.cs @@ -32,6 +32,7 @@ namespace SparkleLib { public SparkleBackend (string name, string [] paths) { Name = name; + Path = "git"; // default foreach (string path in paths) { if (File.Exists (path)) { diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index 37e2984e..aecc4681 100644 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -136,9 +136,12 @@ namespace SparkleLib { writer.Close (); } - UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); - file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | + if ((SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX)) { + UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); + file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | FileAccessPermissions.UserWrite); + } SparkleHelpers.DebugInfo ("Fetcher", "Disabled host key checking"); } @@ -174,10 +177,13 @@ namespace SparkleLib { TextWriter writer = new StreamWriter (ssh_config_file_path); writer.WriteLine (current_ssh_config); writer.Close (); + if ((SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX)) { - UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); - file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | - FileAccessPermissions.UserWrite); + UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); + file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | + FileAccessPermissions.UserWrite); + } } } diff --git a/SparkleLib/windows/AssemblyInfo.cs b/SparkleLib/windows/AssemblyInfo.cs new file mode 100644 index 00000000..9d14d314 --- /dev/null +++ b/SparkleLib/windows/AssemblyInfo.cs @@ -0,0 +1,14 @@ +/* + * AssemblyInfo.cs + * + * This is free software. See COPYING for details. + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle ("SparkleLib")] +[assembly: AssemblyDescription ("SparkleShare is a simple file sharing and collaboration tool.")] + +[assembly: Guid ("38092E48-5DCC-4d23-8109-9D994E710ACF")] diff --git a/SparkleLib/windows/Defines.tt b/SparkleLib/windows/Defines.tt new file mode 100644 index 00000000..ffbc5538 --- /dev/null +++ b/SparkleLib/windows/Defines.tt @@ -0,0 +1,46 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +<#@ template language="C#v3.5" HostSpecific="true" #> +<#@ output extension="cs" #> + +<#@ include file="getversion.tt" #> + +<# + PlatformID platform = Environment.OSVersion.Platform; + bool IsWindows = (platform == PlatformID.Win32NT + || platform == PlatformID.Win32S + || platform == PlatformID.Win32Windows + || platform == PlatformID.WinCE); +#> + +using System; + +namespace SparkleLib { + + public class Defines { + + public const string VERSION = "<#= VERSION #>"; + public const string LOCALE_DIR = "@prefix@/share/locale"; + public const string DATAROOTDIR = "@expanded_datadir@"; + public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@"; + public const string PREFIX = "@prefix@"; + public const string OPEN_COMMAND = "xdg-open"; + + } + +} + diff --git a/SparkleLib/windows/GlobalAssemblyInfo.tt b/SparkleLib/windows/GlobalAssemblyInfo.tt new file mode 100644 index 00000000..104f2caf --- /dev/null +++ b/SparkleLib/windows/GlobalAssemblyInfo.tt @@ -0,0 +1,25 @@ +/* + * GlobalAssemblyInfo.cs + * + * This is free software. See COPYING for details. + */ +<#@ template language="C#v3.5" HostSpecific="true" #> +<#@ output extension="cs" #> + +<#@ include file="getversion.tt" #> + +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyProduct("SparkleShare")] + +[assembly: AssemblyVersion("<#= ASM_VERSION #>")] +[assembly: AssemblyFileVersion("<#= ASM_FILE_VERSION #>")] +[assembly: AssemblyInformationalVersion("<#= VERSION #>")] + +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +#else +[assembly: AssemblyConfiguration("Release")] +#endif + diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj new file mode 100644 index 00000000..56edeae5 --- /dev/null +++ b/SparkleLib/windows/SparkleLib.csproj @@ -0,0 +1,159 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {2C914413-B31C-4362-93C7-1AE34F09112A} + Library + SparkleLib + SparkleLib + + + 2.0 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + ..\..\bin + DEBUG + prompt + 4 + false + + + none + false + ..\..\bin + prompt + 4 + false + + + + + + False + ..\..\bin\Meebey.SmartIrc4net.dll + + + + + + SparkleFetcherGit.cs + Component + + + SparkleRepoGit.cs + + + SparkleFetcherHg.cs + Component + + + SparkleRepoHg.cs + + + SparkleFetcherScp.cs + Component + + + SparkleRepoScp.cs + + + SparkleConfig.cs + + + SparkleRepoBase.cs + + + + Defines.tt + Code + True + True + + + + + + + + + + + True + True + GlobalAssemblyInfo.tt + + + + + + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + + + TextTemplatingFileGenerator + Defines.cs + + + TextTemplatingFileGenerator + GlobalAssemblyInfo.cs + + + + + + + + + + + + + + + + + + + + + $(ProjectDir)transform_tt.cmd + + \ No newline at end of file diff --git a/SparkleLib/windows/getversion.tt b/SparkleLib/windows/getversion.tt new file mode 100644 index 00000000..ec359ecd --- /dev/null +++ b/SparkleLib/windows/getversion.tt @@ -0,0 +1,41 @@ +<#@ import namespace="System" #> +<#@ import namespace="System.IO" #> +<#@ import namespace="System.Diagnostics" #> +<#@ import namespace="System.Text.RegularExpressions" #> + +<# + // Add msysgit to path, as we cannot asume it is added to the path + // Asume it is installed in @"C:\msysgit\msysgit\bin" for now + string MSysGit=@"C:\msysgit\msysgit"; + + string newPath = MSysGit + @"\bin" + ";" + + MSysGit + @"\mingw\bin" + ";" + + MSysGit + @"\cmd" + ";" + + System.Environment.ExpandEnvironmentVariables ("%PATH%"); + System.Environment.SetEnvironmentVariable ("PATH", newPath); + + Process process = new Process(); + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.CreateNoWindow = true; + process.StartInfo.FileName = "git"; + process.StartInfo.Arguments = "describe --tags --dirty=-d --always"; + process.StartInfo.WorkingDirectory = Path.GetDirectoryName(Host.TemplateFile); + process.Start(); + + String DescribeOutput=process.StandardOutput.ReadLine(); + + Match m = Regex.Match(DescribeOutput, @"(\d+)\.(\d+)(?:-rc(\d+))?-(\d+)"); + int[] version = new int [4]; + for(int i=1; i <= 4; i++) + Int32.TryParse(m.Groups[i].Value, out version[i-1]); + + String VERSION=DescribeOutput; + String ASM_VERSION=String.Format("{0}.{1}",version[0],version[1]); + String ASM_FILE_VERSION=String.Format("{0}.{1}.{2}.{3}",version[0],version[1],version[2],version[3]); + +#> + +// VERSION=<#= VERSION #> +// ASM_VERSION=<#= ASM_VERSION #> + diff --git a/SparkleLib/windows/transform_tt.cmd b/SparkleLib/windows/transform_tt.cmd new file mode 100644 index 00000000..9079fbdc --- /dev/null +++ b/SparkleLib/windows/transform_tt.cmd @@ -0,0 +1,7 @@ +@echo off + +echo running texttransform.. +cd %~dp0 + +"%CommonProgramFiles%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" -out Defines.cs Defines.tt +"%CommonProgramFiles%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" -out GlobalAssemblyInfo.cs GlobalAssemblyInfo.tt diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index abc506f7..5561c94f 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -49,6 +49,27 @@ namespace SparkleShare { // Initialize the application Application.Init (); + GLib.ExceptionManager.UnhandledException += delegate (GLib.UnhandledExceptionArgs exArgs) { + Exception UnhandledException = (Exception)exArgs.ExceptionObject; + string ExceptionMessage = UnhandledException.Message.ToString (); + MessageDialog ExceptionDialog = new MessageDialog (null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, + "Unhandled Exception!\n" + UnhandledException.GetType ().ToString ()); + ExceptionDialog.Title = "ERROR"; + + while (UnhandledException != null) { + Console.WriteLine ("\n\n" + + "Unhandled exception\n" + + "-------------------\n" + + UnhandledException.Message + "\n\n" + + UnhandledException.StackTrace); + UnhandledException = UnhandledException.InnerException; + } + + ExceptionDialog.Run (); + ExceptionDialog.Destroy (); + + }; + // Create the statusicon StatusIcon = new SparkleStatusIcon (); diff --git a/SparkleShare/Windows/AssemblyInfo.cs b/SparkleShare/Windows/AssemblyInfo.cs new file mode 100644 index 00000000..092685d9 --- /dev/null +++ b/SparkleShare/Windows/AssemblyInfo.cs @@ -0,0 +1,14 @@ +/* + * AssemblyInfo.cs + * + * This is free software. See COPYING for details. + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle ("SparkleShare")] +[assembly: AssemblyDescription ("SparkleShare is a simple file sharing and collaboration tool.")] + +[assembly: Guid ("A8F34995-DB20-4bf2-AA27-869B15B8C2F9")] diff --git a/SparkleShare/Windows/Notification.cs b/SparkleShare/Windows/Notification.cs new file mode 100644 index 00000000..1b165739 --- /dev/null +++ b/SparkleShare/Windows/Notification.cs @@ -0,0 +1,70 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +using System; +using Gdk; + +namespace Notifications +{ + public enum Urgency : byte { + Low = 0, + Normal, + Critical + } + + public class ActionArgs : EventArgs { + private string action; + public string Action { + get { return action; } + } + + public ActionArgs (string action) { + this.action = action; + } + } + + public delegate void ActionHandler (object o, ActionArgs args); + + public class Notification + { + public Pixbuf Icon; + + public Notification () + { + } + + public Notification (string title, string subtext) + { + } + + public void AddAction (string action, string label, ActionHandler handler) + { + } + + public void RemoveAction (string action) + { + } + + public void ClearActions () + { + } + + public void Show () + { + } + } +} diff --git a/SparkleShare/Windows/SparkleBubble.cs b/SparkleShare/Windows/SparkleBubble.cs new file mode 100644 index 00000000..4e96228e --- /dev/null +++ b/SparkleShare/Windows/SparkleBubble.cs @@ -0,0 +1,35 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +using System; +using Notifications; + +namespace SparkleShare { + + public class SparkleBubble : Notification { + + public SparkleBubble (string title, string subtext) : base (title, subtext) + { + } + + // Checks whether the system allows adding buttons to a notification, + // prevents error messages in Ubuntu. + new public void AddAction (string action, string label, ActionHandler handler) + { + } + } +} diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj new file mode 100644 index 00000000..9a706ea1 --- /dev/null +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -0,0 +1,143 @@ + + + + Debug + AnyCPU + 9.0.21022 + {728483AA-E34B-4441-BF2C-C8BC2901E4E0} + Exe + SparkleShare + 2.0 + SparkleShare + + + 2.0 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + ..\..\bin + DEBUG + prompt + 4 + + + none + false + ..\..\bin + prompt + 4 + + + + + + + + + + + + + + + + False + ..\..\bin\webkit-sharp.dll + + + + + GlobalAssemblyInfo.cs + True + True + GlobalAssemblyInfo.tt + + + + + + + + + + + + + + + + + + + + + {2C914413-B31C-4362-93C7-1AE34F09112A} + SparkleLib + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + + + + + + GlobalAssemblyInfo.tt + TextTemplatingFileGenerator + GlobalAssemblyInfo.cs + + + + $(ProjectDir)transform_tt.cmd + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleShare.sln b/SparkleShare/Windows/SparkleShare.sln new file mode 100644 index 00000000..83b5e5a1 --- /dev/null +++ b/SparkleShare/Windows/SparkleShare.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare", "SparkleShare.csproj", "{728483AA-E34B-4441-BF2C-C8BC2901E4E0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleLib", "..\..\SparkleLib\windows\SparkleLib.csproj", "{2C914413-B31C-4362-93C7-1AE34F09112A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.Build.0 = Release|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = SparkleShare.csproj + outputpath = bin + name = SparkleShare + EndGlobalSection +EndGlobal diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleWinController.cs new file mode 100644 index 00000000..89ff239b --- /dev/null +++ b/SparkleShare/Windows/SparkleWinController.cs @@ -0,0 +1,150 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using Mono.Unix; +using Mono.Unix.Native; +using SparkleLib; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; + +namespace SparkleShare { + + public class SparkleWinController : SparkleController { + + public SparkleWinController () : base () + { + } + + public override void Initialize () + { + // Add msysgit to path, as we cannot asume it is added to the path + // Asume it is installed in @"C:\msysgit\msysgit\bin" for now + string MSysGit=@"C:\msysgit\msysgit"; + + string newPath = MSysGit + @"\bin" + ";" + + MSysGit + @"\mingw\bin" + ";" + + MSysGit + @"\cmd" + ";" + + System.Environment.ExpandEnvironmentVariables ("%PATH%"); + System.Environment.SetEnvironmentVariable ("PATH", newPath); + System.Environment.SetEnvironmentVariable ("PLINK_PROTOCOL", "ssh"); + System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); + + StartSshAgent (); + AddDefaultKey (); + + base.Initialize (); + } + + public override string EventLogHTML { get { return ""; } } + public override string DayEntryHTML { get { return ""; } } + public override string EventEntryHTML { get { return ""; } } + + // Creates a .desktop entry in autostart folder to + // start SparkleShare automatically at login + public override void EnableSystemAutostart () + { + } + + + // Installs a launcher so the user can launch SparkleShare + // from the Internet category if needed + public override void InstallLauncher () + { + } + + + // Adds the SparkleShare folder to the user's + // list of bookmarked places + public override void AddToBookmarks () + { + } + + + // Creates the SparkleShare folder in the user's home folder + public override bool CreateSparkleShareFolder () + { + if (!Directory.Exists (SparklePaths.SparklePath)) { + + Directory.CreateDirectory (SparklePaths.SparklePath); + SparkleHelpers.DebugInfo ("Config", "Created '" + SparklePaths.SparklePath + "'"); + + return true; + + } + + return false; + } + + public override void OpenSparkleShareFolder (string subfolder) + { + Process process = new Process(); + process.StartInfo.Arguments = ",/root," + SparkleHelpers.CombineMore(SparklePaths.SparklePath, subfolder); + process.StartInfo.FileName = "explorer"; + + process.Start(); + } + + public void AddDefaultKey () + { + /*Process process = new Process (); + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.UseShellExecute = false; + process.StartInfo.FileName = "ssh-add"; + process.StartInfo.Arguments = @"~/.ssh/id_rsa"; + process.Start (); + process.WaitForExit ();*/ + } + + private void StartSshAgent () + { + if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK"))) { + + Process process = new Process (); + process.StartInfo.FileName = "ssh-agent"; + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardOutput = true; + + process.Start (); + + string Output = process.StandardOutput.ReadToEnd (); + process.WaitForExit (); + + Match AuthSock = new Regex (@"SSH_AUTH_SOCK=([^;\n\r]*)").Match (Output); + if (AuthSock.Success) { + System.Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK", AuthSock.Groups[1].Value); + } + + Match AgentPid = new Regex (@"SSH_AGENT_PID=([^;\n\r]*)").Match (Output); + if (AgentPid.Success) { + System.Environment.SetEnvironmentVariable ("SSH_AGENT_PID", AgentPid.Groups[1].Value); + SparkleHelpers.DebugInfo ("SSH", "ssh-agent started, PID=" + AgentPid.Groups[1].Value); + } + else { + SparkleHelpers.DebugInfo ("SSH", "ssh-agent started, PID=unknown"); + } + } + } + + + } + +} \ No newline at end of file diff --git a/SparkleShare/Windows/transform_tt.cmd b/SparkleShare/Windows/transform_tt.cmd new file mode 100644 index 00000000..f5518704 --- /dev/null +++ b/SparkleShare/Windows/transform_tt.cmd @@ -0,0 +1,8 @@ +@echo off + +echo running texttransform.. +cd %~dp0 + + +cd ..\..\Sparklelib\windows +"%CommonProgramFiles%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" -out GlobalAssemblyInfo.cs GlobalAssemblyInfo.tt