From 5501a448b560111e96ab33c88b3f0299c11ae6b7 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 11 Jun 2011 21:52:41 +0200 Subject: [PATCH 001/134] 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 From b60a21731ace93a7ca1d669ae7bc496185ef69d5 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 11 Jun 2011 22:35:06 +0200 Subject: [PATCH 002/134] fix portability issue in OnFileActivity --- SparkleLib/SparkleRepoBase.cs | 2 +- SparkleShare/Windows/SparkleWinController.cs | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index bac49759..e254e0ef 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -299,7 +299,7 @@ namespace SparkleLib { // Starts a timer when something changes public void OnFileActivity (object o, FileSystemEventArgs args) { - if (args.FullPath.Contains ("/.")) + if (args.FullPath.Contains (Path.DirectorySeparatorChar + ".")) return; WatcherChangeTypes wct = args.ChangeType; diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleWinController.cs index 89ff239b..cac120ca 100644 --- a/SparkleShare/Windows/SparkleWinController.cs +++ b/SparkleShare/Windows/SparkleWinController.cs @@ -46,10 +46,11 @@ namespace SparkleShare { + System.Environment.ExpandEnvironmentVariables ("%PATH%"); System.Environment.SetEnvironmentVariable ("PATH", newPath); System.Environment.SetEnvironmentVariable ("PLINK_PROTOCOL", "ssh"); - System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); + + if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("HOME"))) + System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); StartSshAgent (); - AddDefaultKey (); base.Initialize (); } @@ -103,17 +104,6 @@ namespace SparkleShare { 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"))) { From 532085c3ab879d9011ac068d9962b7451be08396 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 12 Jun 2011 01:24:22 +0200 Subject: [PATCH 003/134] windows: improve UI --- SparkleShare/SparkleController.cs | 2 +- SparkleShare/SparkleStatusIcon.cs | 7 +- SparkleShare/SparkleUI.cs | 1 + SparkleShare/Windows/Notification.cs | 116 ++++++++++++----- SparkleShare/Windows/Notification.designer.cs | 96 ++++++++++++++ SparkleShare/Windows/Notification.resx | 120 ++++++++++++++++++ SparkleShare/Windows/SparkleBubble.cs | 6 +- SparkleShare/Windows/SparkleShare.csproj | 18 ++- 8 files changed, 332 insertions(+), 34 deletions(-) create mode 100644 SparkleShare/Windows/Notification.designer.cs create mode 100644 SparkleShare/Windows/Notification.resx diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index e6be1fc5..44bddb05 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -973,7 +973,7 @@ namespace SparkleShare { foreach (SparkleRepoBase repo in Repositories) repo.Dispose (); - Environment.Exit (0); + Gtk.Application.Quit (); } diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 5707bb7e..70939505 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -21,6 +21,7 @@ using System.Timers; using Gtk; using Mono.Unix; +using SparkleLib; namespace SparkleShare { @@ -272,7 +273,11 @@ namespace SparkleShare { // Makes the menu visible private void ShowMenu (object o, EventArgs args) { - Menu.Popup (null, null, SetPosition, 0, Global.CurrentEventTime); + if ((SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX)) + Menu.Popup (null, null, SetPosition, 0, Global.CurrentEventTime); + else + Menu.Popup (null, null, null, 0, Global.CurrentEventTime); } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 5561c94f..edaf6fef 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -169,6 +169,7 @@ namespace SparkleShare { public void Run () { Application.Run (); + StatusIcon.Dispose (); } } } diff --git a/SparkleShare/Windows/Notification.cs b/SparkleShare/Windows/Notification.cs index 1b165739..0c2733ec 100644 --- a/SparkleShare/Windows/Notification.cs +++ b/SparkleShare/Windows/Notification.cs @@ -16,40 +16,77 @@ using System; -using Gdk; +using System.Windows.Forms; +using System.Drawing; +using System.IO; + 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 partial class Notification : Form { - public Pixbuf Icon; + private Timer animationTimer; + private int startPosX; + private int startPosY; + + public new Gdk.Pixbuf Icon; public Notification () { - } + InitializeComponent (); - public Notification (string title, string subtext) - { - } + TopMost = true; + ShowInTaskbar = false; + + animationTimer = new Timer (); + animationTimer.Interval = 50; + animationTimer.Tick += timer_Tick; + } + + public Notification (string title, string subtext) + : this() + { + this.title.Text = title; + this.subtext.Text = subtext; + } + + protected override void OnLoad (EventArgs e) + { + // Move window out of screen + startPosX = Screen.PrimaryScreen.WorkingArea.Width - Width; + startPosY = Screen.PrimaryScreen.WorkingArea.Height; + SetDesktopLocation (startPosX, startPosY); + base.OnLoad (e); + // Begin animation + animationTimer.Start (); + } + + protected override void OnShown (EventArgs e) + { + base.OnShown (e); + + // hacky way to move the image from a Gdk.Pixbuf to a winforms bitmap + string Filename = Path.GetTempFileName (); + File.Delete (Filename); + + Filename = Path.ChangeExtension (Filename, "bmp"); + if (File.Exists (Filename)) + File.Delete (Filename); + this.Icon.Save (Filename, "bmp"); + using (Stream s = File.OpenRead (Filename)) + pictureBox1.Image = Bitmap.FromStream (s); + File.Delete (Filename); + } + + void timer_Tick (object sender, EventArgs e) + { + startPosY -= 5; + + if (startPosY < Screen.PrimaryScreen.WorkingArea.Height - Height) + animationTimer.Stop (); + else + SetDesktopLocation (startPosX, startPosY); + } public void AddAction (string action, string label, ActionHandler handler) { @@ -63,8 +100,29 @@ namespace Notifications { } - public void Show () - { - } } + + 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); + } diff --git a/SparkleShare/Windows/Notification.designer.cs b/SparkleShare/Windows/Notification.designer.cs new file mode 100644 index 00000000..a3d36c82 --- /dev/null +++ b/SparkleShare/Windows/Notification.designer.cs @@ -0,0 +1,96 @@ +namespace Notifications +{ + partial class Notification + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pictureBox1 = new System.Windows.Forms.PictureBox (); + this.title = new System.Windows.Forms.Label (); + this.subtext = new System.Windows.Forms.Label (); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit (); + this.SuspendLayout (); + // + // pictureBox1 + // + this.pictureBox1.Location = new System.Drawing.Point (12, 12); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size (40, 42); + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // title + // + this.title.AutoSize = true; + this.title.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.title.Location = new System.Drawing.Point (58, 9); + this.title.Name = "title"; + this.title.Size = new System.Drawing.Size (28, 13); + this.title.TabIndex = 1; + this.title.Text = "title"; + // + // subtext + // + this.subtext.AutoSize = true; + this.subtext.Location = new System.Drawing.Point (58, 22); + this.subtext.MaximumSize = new System.Drawing.Size (171, 0); + this.subtext.Name = "subtext"; + this.subtext.Size = new System.Drawing.Size (41, 13); + this.subtext.TabIndex = 2; + this.subtext.Text = "subtext"; + // + // Notification + // + this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size (241, 64); + this.ControlBox = false; + this.Controls.Add (this.subtext); + this.Controls.Add (this.title); + this.Controls.Add (this.pictureBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Notification"; + this.Opacity = 0.8; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit (); + this.ResumeLayout (false); + this.PerformLayout (); + + } + + #endregion + + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label title; + private System.Windows.Forms.Label subtext; + + } +} + diff --git a/SparkleShare/Windows/Notification.resx b/SparkleShare/Windows/Notification.resx new file mode 100644 index 00000000..19dc0dd8 --- /dev/null +++ b/SparkleShare/Windows/Notification.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleBubble.cs b/SparkleShare/Windows/SparkleBubble.cs index 4e96228e..992c6948 100644 --- a/SparkleShare/Windows/SparkleBubble.cs +++ b/SparkleShare/Windows/SparkleBubble.cs @@ -24,7 +24,11 @@ namespace SparkleShare { public SparkleBubble (string title, string subtext) : base (title, subtext) { - } + System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer (); + timer.Tick += delegate { this.Close (); }; + timer.Interval = 4500; + timer.Start (); + } // Checks whether the system allows adding buttons to a notification, // prevents error messages in Ubuntu. diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 9a706ea1..d6c11185 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -58,6 +58,8 @@ + + False @@ -72,8 +74,15 @@ GlobalAssemblyInfo.tt - - + + Form + + + Notification.cs + + + Form + @@ -140,4 +149,9 @@ $(ProjectDir)transform_tt.cmd + + + Notification.cs + + \ No newline at end of file From 9c2a4012da72fccb6ec2f0c102c8191874698009 Mon Sep 17 00:00:00 2001 From: BlackHawkDesign Date: Tue, 14 Jun 2011 09:51:29 +0200 Subject: [PATCH 004/134] Initial version of the win32 client --- SparkleShare/Win32/.gitignore | 4 + SparkleShare/Win32/Controller/Updater.cs | 16 +++ .../Win32/Gui/SystemTrayForm.Designer.cs | 33 +++++ SparkleShare/Win32/Gui/SystemTrayForm.cs | 89 +++++++++++++ SparkleShare/Win32/Program.cs | 20 +++ SparkleShare/Win32/Properties/AssemblyInfo.cs | 36 ++++++ .../Win32/Properties/Resources.Designer.cs | 62 ++++++++++ SparkleShare/Win32/Properties/Resources.resx | 117 ++++++++++++++++++ .../Win32/Properties/Settings.Designer.cs | 26 ++++ .../Win32/Properties/Settings.settings | 7 ++ SparkleShare/Win32/SparkleShare.csproj | 85 +++++++++++++ SparkleShare/Win32/SparkleShare.sln | 20 +++ SparkleShare/Win32/sparkleshare.ico | Bin 0 -> 36470 bytes 13 files changed, 515 insertions(+) create mode 100644 SparkleShare/Win32/.gitignore create mode 100644 SparkleShare/Win32/Controller/Updater.cs create mode 100644 SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs create mode 100644 SparkleShare/Win32/Gui/SystemTrayForm.cs create mode 100644 SparkleShare/Win32/Program.cs create mode 100644 SparkleShare/Win32/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Win32/Properties/Resources.Designer.cs create mode 100644 SparkleShare/Win32/Properties/Resources.resx create mode 100644 SparkleShare/Win32/Properties/Settings.Designer.cs create mode 100644 SparkleShare/Win32/Properties/Settings.settings create mode 100644 SparkleShare/Win32/SparkleShare.csproj create mode 100644 SparkleShare/Win32/SparkleShare.sln create mode 100644 SparkleShare/Win32/sparkleshare.ico diff --git a/SparkleShare/Win32/.gitignore b/SparkleShare/Win32/.gitignore new file mode 100644 index 00000000..7194bd50 --- /dev/null +++ b/SparkleShare/Win32/.gitignore @@ -0,0 +1,4 @@ + +*.suo +*.user +obj/* \ No newline at end of file diff --git a/SparkleShare/Win32/Controller/Updater.cs b/SparkleShare/Win32/Controller/Updater.cs new file mode 100644 index 00000000..6eb08527 --- /dev/null +++ b/SparkleShare/Win32/Controller/Updater.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SparkleShare { + public static class Updater { + + public static bool IsUpToDate() { + return true; + } + + public static void Update() { + throw new NotImplementedException(); + } + } +} diff --git a/SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs b/SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs new file mode 100644 index 00000000..740d6a45 --- /dev/null +++ b/SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs @@ -0,0 +1,33 @@ +namespace SparkleShare { + partial class SystemTrayForm { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Text = "SystemTrayForm"; + } + + #endregion + } +} \ No newline at end of file diff --git a/SparkleShare/Win32/Gui/SystemTrayForm.cs b/SparkleShare/Win32/Gui/SystemTrayForm.cs new file mode 100644 index 00000000..7d605792 --- /dev/null +++ b/SparkleShare/Win32/Gui/SystemTrayForm.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace SparkleShare { + public partial class SystemTrayForm : Form { + + protected override void OnLoad(EventArgs e) { + WindowState = FormWindowState.Minimized; + ShowInTaskbar = false; + + base.OnLoad(e); + + InitializeTrayIcon(); + } + + public void InitializeTrayIcon() { + NotifyIcon trayIcon = new NotifyIcon(); + trayIcon.Text = "SparkleShare"; + trayIcon.Icon = new Icon("sparkleshare.ico",40,40); + trayIcon.Visible = true; + + trayIcon.ContextMenuStrip = GetTrayIconMenu(); + } + + public ContextMenuStrip GetTrayIconMenu() { + ToolStripItem VersionStatusItem = new ToolStripLabel(); + + if (Updater.IsUpToDate()) { + VersionStatusItem.Text = "Up to date"; + VersionStatusItem.Enabled = false; + } else { + VersionStatusItem.Click += UpdateApplication; + } + + ToolStripItem AddRemoteFolderItem = new ToolStripLabel(); + AddRemoteFolderItem.Text = "Add remote folder"; + AddRemoteFolderItem.Click += AddRemoteFolder; + + ToolStripItem NotificationsItem = new ToolStripLabel(); + NotificationsItem.Text = "Turn off notifications"; + NotificationsItem.Click += ToggleNotifications; + + ToolStripItem AboutItem = new ToolStripLabel(); + AboutItem.Text = "About SparkleShare"; + AboutItem.Click += DisplayAboutDialog; + + ToolStripItem ExitItem = new ToolStripLabel(); + ExitItem.Text = "Exit"; + ExitItem.Click += ExitApplication; + + ContextMenuStrip menu = new ContextMenuStrip(); + menu.Items.Add(VersionStatusItem); + menu.Items.Add(new ToolStripSeparator()); + menu.Items.Add(AddRemoteFolderItem); + menu.Items.Add(new ToolStripSeparator()); + menu.Items.Add(NotificationsItem); + menu.Items.Add(new ToolStripSeparator()); + menu.Items.Add(AboutItem); + menu.Items.Add(ExitItem); + + return menu; + } + + public void UpdateApplication(object sender, EventArgs e) { + throw new NotImplementedException(); + } + + public void AddRemoteFolder(object sender, EventArgs e) { + throw new NotImplementedException(); + } + + public void ToggleNotifications(object sender, EventArgs e) { + throw new NotImplementedException(); + } + + public void DisplayAboutDialog(object sender, EventArgs e) { + throw new NotImplementedException(); + } + + public void ExitApplication(object sender, EventArgs e) { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/SparkleShare/Win32/Program.cs b/SparkleShare/Win32/Program.cs new file mode 100644 index 00000000..26477a42 --- /dev/null +++ b/SparkleShare/Win32/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace SparkleShare +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new SystemTrayForm()); + } + } +} \ No newline at end of file diff --git a/SparkleShare/Win32/Properties/AssemblyInfo.cs b/SparkleShare/Win32/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..2d84c602 --- /dev/null +++ b/SparkleShare/Win32/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SparkleShare")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SparkleShare")] +[assembly: AssemblyCopyright("Copyright © 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b5570a03-84a3-43c0-b9d3-3e84902323ec")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Win32/Properties/Resources.Designer.cs b/SparkleShare/Win32/Properties/Resources.Designer.cs new file mode 100644 index 00000000..f1cc34b0 --- /dev/null +++ b/SparkleShare/Win32/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.225 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SparkleShare.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SparkleShare.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/SparkleShare/Win32/Properties/Resources.resx b/SparkleShare/Win32/Properties/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/SparkleShare/Win32/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SparkleShare/Win32/Properties/Settings.Designer.cs b/SparkleShare/Win32/Properties/Settings.Designer.cs new file mode 100644 index 00000000..5e0fca00 --- /dev/null +++ b/SparkleShare/Win32/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.225 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SparkleShare.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/SparkleShare/Win32/Properties/Settings.settings b/SparkleShare/Win32/Properties/Settings.settings new file mode 100644 index 00000000..39645652 --- /dev/null +++ b/SparkleShare/Win32/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SparkleShare/Win32/SparkleShare.csproj b/SparkleShare/Win32/SparkleShare.csproj new file mode 100644 index 00000000..7f2e93aa --- /dev/null +++ b/SparkleShare/Win32/SparkleShare.csproj @@ -0,0 +1,85 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80} + WinExe + Properties + SparkleShare + SparkleShare + v2.0 + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + Form + + + SystemTrayForm.cs + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/SparkleShare/Win32/SparkleShare.sln b/SparkleShare/Win32/SparkleShare.sln new file mode 100644 index 00000000..b7dd4ff1 --- /dev/null +++ b/SparkleShare/Win32/SparkleShare.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare", "SparkleShare.csproj", "{B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Debug|x86.ActiveCfg = Debug|x86 + {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Debug|x86.Build.0 = Debug|x86 + {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Release|x86.ActiveCfg = Release|x86 + {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/SparkleShare/Win32/sparkleshare.ico b/SparkleShare/Win32/sparkleshare.ico new file mode 100644 index 0000000000000000000000000000000000000000..2e88830e6568eb7f12948d6e80fa8a2373ce6a6b GIT binary patch literal 36470 zcmeHw2S8QF*6y66QZ0bk8+Pp25E~+5OKh=VL&dJKCb3uSiVYR)4J-DBg2WhG5|fyy zi7m#03W9=g`Z=67?_0CaK7u#@&Asox_xA((_Fh#&%a{%*#u99#@31F?E?EKR=dG zld+#0$@%%QaY#F(pPV1wBi*wpa(;enr8{HGqvZS$zc6FPqmdpofkYMwAUerKc?cx^ zQM~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}^lU=PcwrXYG?PrhtRaan|um&Q?PI*(cem2tQ|HpFpqu&$z{3>)7d} z7i{$n!TS~pI+~|!anhy?JYiD?9J4Azjv5OE?aWbp3LY2w;D09Te|uc8XyUwW!l}?4 zU19&ubNc;6eL`rp@Go{gb6&F&;8(yOFz-1T{}7azoyj~$e#J^mf6hvL@q~Hy+0ztf z#?Ql<@e6QfyaP@FOMvs^^ZD_9$eB4sd&Jf*G4;N6GIxP-K0U|z z^c?5YbDU2v{L(uWC;MTXQ{UfX=4)1ZQ7)ZdY+0GoAtVT z(b+h22Y066tp7=LMweu#Og6tbFAd)pob@lxwZmEeLOx69^pQO;&idzN7ryD?gS$|w z$B6p{CgHp-A)CYf0vz`XaNIAzalZh^{Q?~K3vk>o0C_8H%JI#`{Q}%SI=e@e6*;)i z4fmRC)=Z-LpX?NIrvb;E1{`-92zeZxPlY=TaCQ=8kkVO5!nU({oT^9tjgT|Ni~AEM z;|?BLmI}|wXP;j1+LuCbS*Ys$N`&2sOeg@pvFdp|c zz_vsu0CzSBn=jni0J{^&cu4Le?9w1RbI7Bb@7DHcwg-3n;I8YMt6p}&JrOu-F_q(< z2#$LqU}ye<xMfkAWveUNA%*ZzR!|S{s}9a4Z9q= z1F3m}nFSm&vlfR Date: Sat, 18 Jun 2011 23:45:30 +0200 Subject: [PATCH 005/134] windows: locate texttransform.exe --- SparkleLib/windows/transform_tt.cmd | 11 +++++++++-- SparkleShare/Windows/transform_tt.cmd | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/SparkleLib/windows/transform_tt.cmd b/SparkleLib/windows/transform_tt.cmd index 9079fbdc..3fcb2362 100644 --- a/SparkleLib/windows/transform_tt.cmd +++ b/SparkleLib/windows/transform_tt.cmd @@ -1,7 +1,14 @@ @echo off +if "%CommonProgramFiles(x86)%"=="" (set common=%CommonProgramFiles%) else (set common=%CommonProgramFiles(x86)%) +if "%ProgramFiles(x86)%"=="" (set program=%ProgramFiles%) else (set program=%ProgramFiles(x86)%) + +set TextTransform="%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" +if not exist %TextTransform% set TextTransform="%common%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" +if not exist %TextTransform% set TextTransform="%program%\MonoDevelop\AddIns\MonoDevelop.TextTemplating\TextTransform.exe" + 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 +%TextTransform% -out Defines.cs Defines.tt +%TextTransform% -out GlobalAssemblyInfo.cs GlobalAssemblyInfo.tt diff --git a/SparkleShare/Windows/transform_tt.cmd b/SparkleShare/Windows/transform_tt.cmd index f5518704..7bec92b8 100644 --- a/SparkleShare/Windows/transform_tt.cmd +++ b/SparkleShare/Windows/transform_tt.cmd @@ -1,8 +1,15 @@ @echo off +if "%CommonProgramFiles(x86)%"=="" (set common=%CommonProgramFiles%) else (set common=%CommonProgramFiles(x86)%) +if "%ProgramFiles(x86)%"=="" (set program=%ProgramFiles%) else (set program=%ProgramFiles(x86)%) + +set TextTransform="%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" +if not exist %TextTransform% set TextTransform="%common%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" +if not exist %TextTransform% set TextTransform="%program%\MonoDevelop\AddIns\MonoDevelop.TextTemplating\TextTransform.exe" + echo running texttransform.. cd %~dp0 cd ..\..\Sparklelib\windows -"%CommonProgramFiles%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" -out GlobalAssemblyInfo.cs GlobalAssemblyInfo.tt +%TextTransform% -out GlobalAssemblyInfo.cs GlobalAssemblyInfo.tt From 2f17c4aa18db08045e97c0779cb6fd5853fbbb51 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 18 Jun 2011 23:55:20 +0200 Subject: [PATCH 006/134] no webkit-sharp on windows :( remove dependency --- SparkleShare/SparkleSpinner.cs | 3 +- SparkleShare/Windows/SparkleLog.cs | 225 +++++++++++++++++++++++ SparkleShare/Windows/SparkleShare.csproj | 6 +- 3 files changed, 228 insertions(+), 6 deletions(-) create mode 100644 SparkleShare/Windows/SparkleLog.cs diff --git a/SparkleShare/SparkleSpinner.cs b/SparkleShare/SparkleSpinner.cs index ef4c3347..69f1bc23 100644 --- a/SparkleShare/SparkleSpinner.cs +++ b/SparkleShare/SparkleSpinner.cs @@ -84,7 +84,8 @@ namespace SparkleShare { private void SetImage () { - Pixbuf = Images [CurrentStep]; + if (CurrentStep < Images.Length) + Pixbuf = Images[CurrentStep]; } diff --git a/SparkleShare/Windows/SparkleLog.cs b/SparkleShare/Windows/SparkleLog.cs new file mode 100644 index 00000000..e1974897 --- /dev/null +++ b/SparkleShare/Windows/SparkleLog.cs @@ -0,0 +1,225 @@ +// SparkleShare, a collaboration and sharing tool. +// 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 System.Collections.Generic; +using System.Diagnostics; +using System.Text.RegularExpressions; +using System.Threading; + +using Gtk; +using Mono.Unix; +using SparkleLib; + +namespace SparkleShare { + + public class SparkleLog : Window { + + public readonly string LocalPath; + + private ScrolledWindow ScrolledWindow; + private MenuBar MenuBar; + private string LinkStatus; + private SparkleSpinner Spinner; + private string HTML; + private EventBox LogContent; + + + // Short alias for the translations + public static string _ (string s) + { + return Catalog.GetString (s); + } + + + public SparkleLog (string path) : base ("") + { + LocalPath = path; + + string name = System.IO.Path.GetFileName (LocalPath); + SetSizeRequest (480, 640); + + Resizable = false; + + BorderWidth = 0; + SetPosition (WindowPosition.Center); + + // Open slightly off center for each consecutive window + if (SparkleUI.OpenLogs.Count > 0) { + + int x, y; + GetPosition (out x, out y); + Move (x + SparkleUI.OpenLogs.Count * 20, y + SparkleUI.OpenLogs.Count * 20); + + } + + // TRANSLATORS: {0} is a folder name, and {1} is a server address + Title = String.Format(_("Events in ‘{0}’"), name); + IconName = "folder-sparkleshare"; + + DeleteEvent += Close; + + CreateEventLog (); + UpdateEventLog (); + } + + + private void CreateEventLog () + { + LogContent = new EventBox (); + VBox layout_vertical = new VBox (false, 0); + + ScrolledWindow = new ScrolledWindow (); + + LogContent.Add (ScrolledWindow); + + layout_vertical.PackStart (LogContent, true, true, 0); + + HButtonBox dialog_buttons = new HButtonBox { + Layout = ButtonBoxStyle.Edge, + BorderWidth = 12 + }; + + Button open_folder_button = new Button (_("_Open Folder")) { + UseUnderline = true + }; + + open_folder_button.Clicked += delegate (object o, EventArgs args) { + SparkleShare.Controller.OpenSparkleShareFolder (LocalPath); + }; + + Button close_button = new Button (Stock.Close); + + close_button.Clicked += delegate { + HideAll (); + }; + + dialog_buttons.Add (open_folder_button); + dialog_buttons.Add (close_button); + + // We have to hide the menubar somewhere... + layout_vertical.PackStart (CreateShortcutsBar (), false, false, 0); + layout_vertical.PackStart (dialog_buttons, false, false, 0); + + Add (layout_vertical); + + ShowAll (); + } + + + public void UpdateEventLog () + { + if (HTML == null) { // TODO: there may be a race condition here + LogContent.Remove (LogContent.Child); + Spinner = new SparkleSpinner (22); + LogContent.Add (Spinner); + LogContent.ShowAll (); + } + + Thread thread = new Thread (new ThreadStart (delegate { + GenerateHTML (); + AddHTML (); + })); + + thread.Start (); + } + + + private void GenerateHTML () + { + HTML = SparkleShare.Controller.GetHTMLLog (System.IO.Path.GetFileName (LocalPath)); + + HTML = HTML.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); + HTML = HTML.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); + HTML = HTML.Replace ("", "#0085cf"); + HTML = HTML.Replace ("", "#009ff8"); + HTML = HTML.Replace ("", "\"" + Style.FontDescription.Family + "\""); + HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); + HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); + HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); + HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); + HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); + HTML = HTML.Replace ("", "file://" + + SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", + "hicolor", "32x32", "status", "avatar-default.png")); + } + + + private void AddHTML () + { + Application.Invoke (delegate { + Spinner.Stop (); + LogContent.Remove (LogContent.Child); + + LogContent.Add (ScrolledWindow); + LogContent.ShowAll (); + }); + } + + + public void Close (object o, DeleteEventArgs args) + { + HideAll (); + args.RetVal = true; + // TODO: window positions aren't saved + } + + + private MenuBar CreateShortcutsBar () + { + // Adds a hidden menubar that contains to enable keyboard + // shortcuts to close the log + MenuBar = new MenuBar (); + + MenuItem file_item = new MenuItem ("File"); + + Menu file_menu = new Menu (); + + MenuItem close_1 = new MenuItem ("Close1"); + MenuItem close_2 = new MenuItem ("Close2"); + + // adds specific Ctrl+W and Esc key accelerators to Log Window + AccelGroup accel_group = new AccelGroup (); + AddAccelGroup (accel_group); + + // Close on Esc + close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask, + AccelFlags.Visible)); + + close_1.Activated += delegate { HideAll (); }; + + // Close on Ctrl+W + close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, + AccelFlags.Visible)); + close_2.Activated += delegate { HideAll (); }; + + file_menu.Append (close_1); + file_menu.Append (close_2); + + file_item.Submenu = file_menu; + + MenuBar.Append (file_item); + + // Hacky way to hide the menubar, but the accellerators + // will simply be disabled when using Hide () + MenuBar.HeightRequest = 1; + MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); + + return MenuBar; + } + } +} diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index d6c11185..7cbbb010 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -61,10 +61,6 @@ - - False - ..\..\bin\webkit-sharp.dll - @@ -90,11 +86,11 @@ - + From b610b1b44550c5aa12980f5657082c8de7f6d292 Mon Sep 17 00:00:00 2001 From: wimh Date: Mon, 20 Jun 2011 22:04:46 +0200 Subject: [PATCH 007/134] C:\msysgit\msysgit -> C:\msysgit --- SparkleShare/Windows/SparkleWinController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleWinController.cs index cac120ca..e4771c7e 100644 --- a/SparkleShare/Windows/SparkleWinController.cs +++ b/SparkleShare/Windows/SparkleWinController.cs @@ -37,8 +37,8 @@ namespace SparkleShare { 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"; + // Asume it is installed in @"C:\msysgit\bin" for now + string MSysGit=@"C:\msysgit"; string newPath = MSysGit + @"\bin" + ";" + MSysGit + @"\mingw\bin" + ";" @@ -137,4 +137,4 @@ namespace SparkleShare { } -} \ No newline at end of file +} From d541f2179fd94371b72efc5e1158bf4f15b3ddaf Mon Sep 17 00:00:00 2001 From: wimh Date: Thu, 23 Jun 2011 22:05:09 +0200 Subject: [PATCH 008/134] fix merge issues --- SparkleLib/windows/SparkleLib.csproj | 8 + SparkleShare/SparkleUI.cs | 1 - .../{SparkleLog.cs => SparkleEventLog.cs} | 179 +++++++++++++----- SparkleShare/Windows/SparkleShare.csproj | 6 +- 4 files changed, 142 insertions(+), 52 deletions(-) rename SparkleShare/Windows/{SparkleLog.cs => SparkleEventLog.cs} (53%) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 56edeae5..783df5df 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -29,6 +29,7 @@ false false true + v3.5 true @@ -55,6 +56,9 @@ False ..\..\bin\Meebey.SmartIrc4net.dll + + 3.5 + @@ -85,6 +89,10 @@ SparkleRepoBase.cs + + SparkleWatcher.cs + Component + Defines.tt diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 575e4267..ed8a7015 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -149,7 +149,6 @@ namespace SparkleShare { public void Run () { Application.Run (); - StatusIcon.Dispose (); } } } diff --git a/SparkleShare/Windows/SparkleLog.cs b/SparkleShare/Windows/SparkleEventLog.cs similarity index 53% rename from SparkleShare/Windows/SparkleLog.cs rename to SparkleShare/Windows/SparkleEventLog.cs index e1974897..3334d4ed 100644 --- a/SparkleShare/Windows/SparkleLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -24,19 +24,27 @@ using System.Threading; using Gtk; using Mono.Unix; using SparkleLib; +#if false +using WebKit; +#endif namespace SparkleShare { - public class SparkleLog : Window { - - public readonly string LocalPath; + public class SparkleEventLog : Window { private ScrolledWindow ScrolledWindow; private MenuBar MenuBar; +#if false + private WebView WebView; +#endif private string LinkStatus; private SparkleSpinner Spinner; private string HTML; private EventBox LogContent; + private List change_sets; + private string selected_log = null; + private ComboBox combo_box; + private HBox layout_horizontal; // Short alias for the translations @@ -46,84 +54,128 @@ namespace SparkleShare { } - public SparkleLog (string path) : base ("") + public SparkleEventLog () : base ("") { - LocalPath = path; - - string name = System.IO.Path.GetFileName (LocalPath); SetSizeRequest (480, 640); - - Resizable = false; - - BorderWidth = 0; SetPosition (WindowPosition.Center); - // Open slightly off center for each consecutive window - if (SparkleUI.OpenLogs.Count > 0) { + Resizable = true; + BorderWidth = 0; - int x, y; - GetPosition (out x, out y); - Move (x + SparkleUI.OpenLogs.Count * 20, y + SparkleUI.OpenLogs.Count * 20); - - } - - // TRANSLATORS: {0} is a folder name, and {1} is a server address - Title = String.Format(_("Events in ‘{0}’"), name); + Title = _("Recent Events"); IconName = "folder-sparkleshare"; - DeleteEvent += Close; + DeleteEvent += Close; - CreateEventLog (); - UpdateEventLog (); + CreateEvents (); + UpdateEvents (false); + UpdateChooser (); } - private void CreateEventLog () + private void CreateEvents () { - LogContent = new EventBox (); VBox layout_vertical = new VBox (false, 0); + LogContent = new EventBox (); - ScrolledWindow = new ScrolledWindow (); + ScrolledWindow = new ScrolledWindow (); - LogContent.Add (ScrolledWindow); - - layout_vertical.PackStart (LogContent, true, true, 0); - - HButtonBox dialog_buttons = new HButtonBox { - Layout = ButtonBoxStyle.Edge, - BorderWidth = 12 +#if false + WebView = new WebView () { + Editable = false }; - Button open_folder_button = new Button (_("_Open Folder")) { - UseUnderline = true - }; - - open_folder_button.Clicked += delegate (object o, EventArgs args) { - SparkleShare.Controller.OpenSparkleShareFolder (LocalPath); + WebView.HoveringOverLink += delegate (object o, WebKit.HoveringOverLinkArgs args) { + LinkStatus = args.Link; }; - Button close_button = new Button (Stock.Close); + // FIXME: Use the right event, waiting for newer webkit bindings: NavigationPolicyDecisionRequested + WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { + if (args.Request.Uri == LinkStatus) { + Process process = new Process (); + process.StartInfo.FileName = "xdg-open"; + process.StartInfo.Arguments = args.Request.Uri.Replace (" ", "\\ "); // Escape space-characters + process.Start (); - close_button.Clicked += delegate { - HideAll (); + // Don't follow HREFs (as this would cause a page refresh) + args.RetVal = 1; + } }; - dialog_buttons.Add (open_folder_button); - dialog_buttons.Add (close_button); + ScrolledWindow.Add (WebView); +#endif + LogContent.Add (ScrolledWindow); + + this.layout_horizontal = new HBox (true, 0); + this.layout_horizontal.PackStart (new Label (""), true, true, 0); + this.layout_horizontal.PackStart (new Label (""), true, true, 0); + + layout_vertical.PackStart (layout_horizontal, false, false, 0); + layout_vertical.PackStart (LogContent, true, true, 0); // We have to hide the menubar somewhere... layout_vertical.PackStart (CreateShortcutsBar (), false, false, 0); - layout_vertical.PackStart (dialog_buttons, false, false, 0); Add (layout_vertical); - ShowAll (); } - public void UpdateEventLog () + public void UpdateChooser () { - if (HTML == null) { // TODO: there may be a race condition here + if (this.combo_box != null && this.combo_box.Parent != null) + this.layout_horizontal.Remove (this.combo_box); + + this.combo_box = new ComboBox (); + this.layout_horizontal.BorderWidth = 9; + + CellRendererText cell = new CellRendererText(); + this.combo_box.PackStart (cell, false); + this.combo_box.AddAttribute (cell, "text", 0); + ListStore store = new ListStore (typeof (string)); + this.combo_box.Model = store; + + store.AppendValues (_("All Folders")); + store.AppendValues ("---"); + + foreach (string folder_name in SparkleShare.Controller.Folders) + store.AppendValues (folder_name); + + this.combo_box.Active = 0; + + this.combo_box.RowSeparatorFunc = delegate (TreeModel model, TreeIter iter) { + string item = (string) this.combo_box.Model.GetValue (iter, 0); + return (item == "---"); + }; + + this.combo_box.Changed += delegate { + TreeIter iter; + this.combo_box.GetActiveIter (out iter); + + string selection = (string) this.combo_box.Model.GetValue (iter, 0); + + if (selection.Equals (_("All Folders"))) + this.selected_log = null; + else + this.selected_log = selection; + + UpdateEvents (false); + }; + + this.layout_horizontal.PackStart (this.combo_box, true, true, 0); + this.layout_horizontal.ShowAll (); + } + + + public void UpdateEvents () + { + UpdateEvents (true); + } + + + public void UpdateEvents (bool silent) + { + if (!silent) { LogContent.Remove (LogContent.Child); Spinner = new SparkleSpinner (22); LogContent.Add (Spinner); @@ -131,7 +183,17 @@ namespace SparkleShare { } Thread thread = new Thread (new ThreadStart (delegate { + Stopwatch watch = new Stopwatch (); + watch.Start (); + this.change_sets = SparkleShare.Controller.GetLog (this.selected_log); GenerateHTML (); + watch.Stop (); + + // A short delay is less annoying than + // a flashing window + if (watch.ElapsedMilliseconds < 500 && !silent) + Thread.Sleep (500 - (int) watch.ElapsedMilliseconds); + AddHTML (); })); @@ -141,7 +203,7 @@ namespace SparkleShare { private void GenerateHTML () { - HTML = SparkleShare.Controller.GetHTMLLog (System.IO.Path.GetFileName (LocalPath)); + HTML = SparkleShare.Controller.GetHTMLLog (this.change_sets); HTML = HTML.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); HTML = HTML.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); @@ -156,6 +218,18 @@ namespace SparkleShare { HTML = HTML.Replace ("", "file://" + SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", "hicolor", "32x32", "status", "avatar-default.png")); + HTML = HTML.Replace ("", "file://" + + SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", + "hicolor", "12x12", "status", "document-added.png")); + HTML = HTML.Replace ("", "file://" + + SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", + "hicolor", "12x12", "status", "document-edited.png")); + HTML = HTML.Replace ("", "file://" + + SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", + "hicolor", "12x12", "status", "document-deleted.png")); + HTML = HTML.Replace ("", "file://" + + SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", + "hicolor", "12x12", "status", "document-moved.png")); } @@ -165,6 +239,10 @@ namespace SparkleShare { Spinner.Stop (); LogContent.Remove (LogContent.Child); +#if false + WebView.LoadString (HTML, null, null, "file://"); +#endif + LogContent.Add (ScrolledWindow); LogContent.ShowAll (); }); @@ -223,3 +301,4 @@ namespace SparkleShare { } } } + diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 7cbbb010..0853160c 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -29,6 +29,7 @@ false false true + v3.5 true @@ -58,6 +59,9 @@ + + 3.5 + @@ -90,7 +94,7 @@ - + From 879abee53f89fb43dee276664b31ee4ab8cba080 Mon Sep 17 00:00:00 2001 From: wimh Date: Mon, 27 Jun 2011 18:04:28 +0200 Subject: [PATCH 009/134] C:\msysgit\msysgit -> C:\msysgit, see also 7631edc6f91cffc1743987f2e9703b26d64c2186 --- SparkleLib/windows/getversion.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleLib/windows/getversion.tt b/SparkleLib/windows/getversion.tt index ec359ecd..d558b475 100644 --- a/SparkleLib/windows/getversion.tt +++ b/SparkleLib/windows/getversion.tt @@ -5,8 +5,8 @@ <# // 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"; + // Asume it is installed in @"C:\msysgit\bin" for now + string MSysGit=@"C:\msysgit"; string newPath = MSysGit + @"\bin" + ";" + MSysGit + @"\mingw\bin" + ";" From 509f969e9ca065ca78a463a3ace9e7bf6b0bd1da Mon Sep 17 00:00:00 2001 From: wimh Date: Wed, 29 Jun 2011 16:28:00 +0200 Subject: [PATCH 010/134] fix compile problem on windows x64 --- SparkleLib/windows/transform_tt.cmd | 6 ++++-- SparkleShare/Windows/transform_tt.cmd | 11 +---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/SparkleLib/windows/transform_tt.cmd b/SparkleLib/windows/transform_tt.cmd index 3fcb2362..efcaf908 100644 --- a/SparkleLib/windows/transform_tt.cmd +++ b/SparkleLib/windows/transform_tt.cmd @@ -1,7 +1,9 @@ @echo off -if "%CommonProgramFiles(x86)%"=="" (set common=%CommonProgramFiles%) else (set common=%CommonProgramFiles(x86)%) -if "%ProgramFiles(x86)%"=="" (set program=%ProgramFiles%) else (set program=%ProgramFiles(x86)%) +set common=%CommonProgramFiles(x86)% +if "%common%"=="" set common=%CommonProgramFiles% +set program=%ProgramFiles(x86)% +if "%program%"=="" set program=%ProgramFiles% set TextTransform="%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" if not exist %TextTransform% set TextTransform="%common%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" diff --git a/SparkleShare/Windows/transform_tt.cmd b/SparkleShare/Windows/transform_tt.cmd index 7bec92b8..69c315b7 100644 --- a/SparkleShare/Windows/transform_tt.cmd +++ b/SparkleShare/Windows/transform_tt.cmd @@ -1,15 +1,6 @@ @echo off -if "%CommonProgramFiles(x86)%"=="" (set common=%CommonProgramFiles%) else (set common=%CommonProgramFiles(x86)%) -if "%ProgramFiles(x86)%"=="" (set program=%ProgramFiles%) else (set program=%ProgramFiles(x86)%) - -set TextTransform="%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -if not exist %TextTransform% set TextTransform="%common%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" -if not exist %TextTransform% set TextTransform="%program%\MonoDevelop\AddIns\MonoDevelop.TextTemplating\TextTransform.exe" - -echo running texttransform.. cd %~dp0 +call ..\..\Sparklelib\windows\transform_tt.cmd -cd ..\..\Sparklelib\windows -%TextTransform% -out GlobalAssemblyInfo.cs GlobalAssemblyInfo.tt From 84bf6e5fa9e359c68eae611b7699156a64aa944d Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 1 Jul 2011 22:02:50 +0200 Subject: [PATCH 011/134] remove references to Mono.Unix.Catalog --- SparkleShare/SparkleAbout.cs | 3 +-- SparkleShare/SparkleController.cs | 5 ++--- SparkleShare/SparkleIntro.cs | 3 +-- SparkleShare/SparkleShare.cs | 10 +++++----- SparkleShare/SparkleStatusIcon.cs | 3 +-- SparkleShare/SparkleUI.cs | 4 +--- SparkleShare/SparkleWindow.cs | 3 +-- SparkleShare/Windows/SparkleEventLog.cs | 3 +-- SparkleShare/Windows/SparkleWinController.cs | 2 -- 9 files changed, 13 insertions(+), 23 deletions(-) diff --git a/SparkleShare/SparkleAbout.cs b/SparkleShare/SparkleAbout.cs index 5e738371..7afe214a 100644 --- a/SparkleShare/SparkleAbout.cs +++ b/SparkleShare/SparkleAbout.cs @@ -21,7 +21,6 @@ using System.IO; using System.Net; using Gtk; -using Mono.Unix; namespace SparkleShare { @@ -33,7 +32,7 @@ namespace SparkleShare { // Short alias for the translations public static string _(string s) { - return Catalog.GetString (s); + return s; } diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index c0b229dd..8655e1f9 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -27,7 +27,6 @@ using System.Text.RegularExpressions; using System.Threading; using System.Xml; -using Mono.Unix; using SparkleLib; namespace SparkleShare { @@ -85,7 +84,7 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return Catalog.GetString (s); + return s; } @@ -650,7 +649,7 @@ namespace SparkleShare { change_set.MovedFrom.Count) - 1; if (changes_count > 0) { - string msg = Catalog.GetPluralString ("and {0} more", "and {0} more", changes_count); + string msg = "and {0} more"; message += " " + String.Format (msg, changes_count); } else if (changes_count < 0) { diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs index 7a0478f1..fe92455e 100644 --- a/SparkleShare/SparkleIntro.cs +++ b/SparkleShare/SparkleIntro.cs @@ -22,7 +22,6 @@ using System.Text.RegularExpressions; using System.Timers; using Gtk; -using Mono.Unix; using Notifications; namespace SparkleShare { @@ -44,7 +43,7 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return Catalog.GetString (s); + return s; } diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/SparkleShare.cs index fed350a6..ae6de9c6 100644 --- a/SparkleShare/SparkleShare.cs +++ b/SparkleShare/SparkleShare.cs @@ -22,8 +22,6 @@ using System.IO; using System.Runtime.InteropServices; using System.Text; -using Mono.Unix; -using Mono.Unix.Native; using SparkleLib; using SparkleLib.Options; @@ -39,19 +37,21 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return Catalog.GetString (s); + return s; } public static void Main (string [] args) { // Use translations - Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); + if ((SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX)) + Mono.Unix.Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); // Don't allow running as root on Linux or Mac if ((SparkleBackend.Platform == PlatformID.Unix || SparkleBackend.Platform == PlatformID.MacOSX) && - new UnixUserInfo (UnixEnvironment.UserName).UserId == 0) { + new Mono.Unix.UnixUserInfo (Mono.Unix.UnixEnvironment.UserName).UserId == 0) { Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); Console.WriteLine (_("Things would go utterly wrong.")); diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index d93246f1..060bea2c 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -23,7 +23,6 @@ using System.Timers; using AppIndicator; #endif using Gtk; -using Mono.Unix; using SparkleLib; namespace SparkleShare { @@ -47,7 +46,7 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return Catalog.GetString (s); + return s; } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index ed8a7015..e343aa21 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -24,8 +24,6 @@ using System.Text; using System.Threading; using Gtk; -using Mono.Unix; -using Mono.Unix.Native; using SparkleLib; namespace SparkleShare { @@ -40,7 +38,7 @@ namespace SparkleShare { // Short alias for the translations public static string _(string s) { - return Catalog.GetString (s); + return s; } diff --git a/SparkleShare/SparkleWindow.cs b/SparkleShare/SparkleWindow.cs index 9f510a20..c2392455 100644 --- a/SparkleShare/SparkleWindow.cs +++ b/SparkleShare/SparkleWindow.cs @@ -23,7 +23,6 @@ using System.Text.RegularExpressions; using System.Timers; using Gtk; -using Mono.Unix; using SparkleLib; namespace SparkleShare { @@ -38,7 +37,7 @@ namespace SparkleShare { public SparkleWindow () : base ("") { - Title = Catalog.GetString ("SparkleShare Setup"); + Title = "SparkleShare Setup"; BorderWidth = 0; IconName = "folder-sparkleshare"; Resizable = false; diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index 3334d4ed..d78e369e 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -22,7 +22,6 @@ using System.Text.RegularExpressions; using System.Threading; using Gtk; -using Mono.Unix; using SparkleLib; #if false using WebKit; @@ -50,7 +49,7 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return Catalog.GetString (s); + return s; } diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleWinController.cs index e4771c7e..dafe65df 100644 --- a/SparkleShare/Windows/SparkleWinController.cs +++ b/SparkleShare/Windows/SparkleWinController.cs @@ -14,8 +14,6 @@ // 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; From db2b2f2d332f1077f1ac0ff6576378be04c46bf4 Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 1 Jul 2011 23:41:41 +0200 Subject: [PATCH 012/134] generate resources for png and icon files --- .gitignore | 1 + SparkleShare/Windows/Icons.Designer.cs | 392 ++++++++++++++++++ SparkleShare/Windows/Icons.resx | 262 ++++++++++++ SparkleShare/Windows/Icons.tt | 168 ++++++++ SparkleShare/Windows/SparkleShare.csproj | 24 ++ .../Win32 => data/icons}/sparkleshare.ico | Bin 6 files changed, 847 insertions(+) create mode 100644 SparkleShare/Windows/Icons.Designer.cs create mode 100644 SparkleShare/Windows/Icons.resx create mode 100644 SparkleShare/Windows/Icons.tt rename {SparkleShare/Win32 => data/icons}/sparkleshare.ico (100%) diff --git a/.gitignore b/.gitignore index 105a8346..b64e5d69 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ po/sparkleshare.pot SparkleShare/Nautilus/sparkleshare-nautilus-extension.py gnome-doc-utils.make sparkleshare-* +desktop.ini diff --git a/SparkleShare/Windows/Icons.Designer.cs b/SparkleShare/Windows/Icons.Designer.cs new file mode 100644 index 00000000..cabe4017 --- /dev/null +++ b/SparkleShare/Windows/Icons.Designer.cs @@ -0,0 +1,392 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4211 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SparkleShare { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Icons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Icons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SparkleShare.Icons", typeof(Icons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Bitmap avatar_default { + get { + object obj = ResourceManager.GetObject("avatar_default", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap avatar_default_16 { + get { + object obj = ResourceManager.GetObject("avatar_default_16", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap avatar_default_22 { + get { + object obj = ResourceManager.GetObject("avatar_default_22", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap avatar_default_24 { + get { + object obj = ResourceManager.GetObject("avatar_default_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap avatar_default_32 { + get { + object obj = ResourceManager.GetObject("avatar_default_32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap avatar_default_48 { + get { + object obj = ResourceManager.GetObject("avatar_default_48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap dialog_error_16 { + get { + object obj = ResourceManager.GetObject("dialog_error_16", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap dialog_error_24 { + get { + object obj = ResourceManager.GetObject("dialog_error_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap document_added_12 { + get { + object obj = ResourceManager.GetObject("document_added_12", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap document_deleted_12 { + get { + object obj = ResourceManager.GetObject("document_deleted_12", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap document_edited_12 { + get { + object obj = ResourceManager.GetObject("document_edited_12", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap document_moved_12 { + get { + object obj = ResourceManager.GetObject("document_moved_12", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap error { + get { + object obj = ResourceManager.GetObject("error", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap error_active { + get { + object obj = ResourceManager.GetObject("error_active", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_16 { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_16", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_16_mist { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_16_mist", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_22 { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_22", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_22_mist { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_22_mist", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_24 { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_24_mist { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_24_mist", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_256 { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_256", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_256_mist { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_256_mist", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_32 { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_32_mist { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_32_mist", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_48 { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap folder_sparkleshare_48_mist { + get { + object obj = ResourceManager.GetObject("folder_sparkleshare_48_mist", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle0 { + get { + object obj = ResourceManager.GetObject("idle0", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle0_active { + get { + object obj = ResourceManager.GetObject("idle0_active", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle1 { + get { + object obj = ResourceManager.GetObject("idle1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle1_active { + get { + object obj = ResourceManager.GetObject("idle1_active", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle2 { + get { + object obj = ResourceManager.GetObject("idle2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle2_active { + get { + object obj = ResourceManager.GetObject("idle2_active", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle3 { + get { + object obj = ResourceManager.GetObject("idle3", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle3_active { + get { + object obj = ResourceManager.GetObject("idle3_active", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle4 { + get { + object obj = ResourceManager.GetObject("idle4", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap idle4_active { + get { + object obj = ResourceManager.GetObject("idle4_active", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_syncing_sparkleshare_24 { + get { + object obj = ResourceManager.GetObject("process_syncing_sparkleshare_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_syncing_sparkleshare_24_mist { + get { + object obj = ResourceManager.GetObject("process_syncing_sparkleshare_24_mist", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_syncing_sparkleshare_i_24 { + get { + object obj = ResourceManager.GetObject("process_syncing_sparkleshare_i_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_syncing_sparkleshare_ii_24 { + get { + object obj = ResourceManager.GetObject("process_syncing_sparkleshare_ii_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_syncing_sparkleshare_iii_24 { + get { + object obj = ResourceManager.GetObject("process_syncing_sparkleshare_iii_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_syncing_sparkleshare_iiii_24 { + get { + object obj = ResourceManager.GetObject("process_syncing_sparkleshare_iiii_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_syncing_sparkleshare_iiiii_24 { + get { + object obj = ResourceManager.GetObject("process_syncing_sparkleshare_iiiii_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap process_working_22 { + get { + object obj = ResourceManager.GetObject("process_working_22", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap side_splash { + get { + object obj = ResourceManager.GetObject("side_splash", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Icon sparkleshare { + get { + object obj = ResourceManager.GetObject("sparkleshare", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + internal static System.Drawing.Bitmap sparkleshare_syncing_error_24 { + get { + object obj = ResourceManager.GetObject("sparkleshare_syncing_error_24", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/SparkleShare/Windows/Icons.resx b/SparkleShare/Windows/Icons.resx new file mode 100644 index 00000000..111a44f9 --- /dev/null +++ b/SparkleShare/Windows/Icons.resx @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\..\data\icons\avatar-default-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-32.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-48.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\dialog-error-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\dialog-error-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-added-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-deleted-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-edited-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-moved-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\error-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\error.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-16-mist.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-22-mist.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-24-mist.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-256-mist.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-256.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-32-mist.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-32.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-48-mist.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-48.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle0-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle1-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle2-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle3-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle4-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\idle4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-24-mist.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-i-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-ii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-iii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-iiii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-iiiii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-working-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\sparkleshare-syncing-error-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\sparkleshare.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\avatar-default.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\side-splash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + diff --git a/SparkleShare/Windows/Icons.tt b/SparkleShare/Windows/Icons.tt new file mode 100644 index 00000000..ef4bcb83 --- /dev/null +++ b/SparkleShare/Windows/Icons.tt @@ -0,0 +1,168 @@ + +<#@ template language="C#v3.5" HostSpecific="true" #> +<#@ output extension="resx" #> +<#@ import namespace="System" #> +<#@ import namespace="System.IO" #> +<#@ import namespace="System.Diagnostics" #> +<#@ import namespace="System.Text.RegularExpressions" #> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + <# + string RelativeDir = @"..\..\data\icons"; + DirectoryInfo dir = new DirectoryInfo(RelativeDir); + + foreach (FileInfo f in dir.GetFiles("*.png")) + { + string DataName = Regex.Replace(Path.ChangeExtension(f.Name, null), "[^a-zA-Z0-9_]", "_"); + string FileName = Path.Combine(RelativeDir, f.Name); + #> + + <#= FileName #>;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + <# + } + + foreach (FileInfo f in dir.GetFiles("*.ico")) + { + string DataName = Regex.Replace(Path.ChangeExtension(f.Name, null), "[^a-zA-Z0-9_]", "_"); + string FileName = Path.Combine(RelativeDir, f.Name); + #> + + <#= FileName #>;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + <# + } + + RelativeDir = @"..\..\data"; + dir = new DirectoryInfo(RelativeDir); + + foreach (FileInfo f in dir.GetFiles("*.png")) + { + string DataName = Regex.Replace(Path.ChangeExtension(f.Name, null), "[^a-zA-Z0-9_]", "_"); + string FileName = Path.Combine(RelativeDir, f.Name); + #> + + <#= FileName #>;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + <# + } + + #> + diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 0853160c..17599a2d 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -74,6 +74,11 @@ GlobalAssemblyInfo.tt + + True + True + Icons.resx + Form @@ -150,8 +155,27 @@ $(ProjectDir)transform_tt.cmd + + True + True + Icons.tt + Designer + ResXFileCodeGenerator + Icons.Designer.cs + Notification.cs + Designer + + + TextTemplatingFileGenerator + Icons.resx + + + + + + \ No newline at end of file diff --git a/SparkleShare/Win32/sparkleshare.ico b/data/icons/sparkleshare.ico similarity index 100% rename from SparkleShare/Win32/sparkleshare.ico rename to data/icons/sparkleshare.ico From 0079c209d0036252308efb649dd8e4370f2c642d Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 2 Jul 2011 10:24:33 +0200 Subject: [PATCH 013/134] change platform to x86 because gtk# does not support x64 --- SparkleLib/windows/SparkleLib.csproj | 1 + SparkleShare/Windows/SparkleShare.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 783df5df..57c0577f 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -40,6 +40,7 @@ prompt 4 false + x86 none diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 17599a2d..3566a214 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -39,6 +39,7 @@ DEBUG prompt 4 + x86 none From 614629ec0d0d1d4486b119b53671d19cd5b3f0da Mon Sep 17 00:00:00 2001 From: wimh Date: Tue, 19 Jul 2011 23:54:07 +0200 Subject: [PATCH 014/134] convert to vs2010, fix about dialog background --- .gitignore | 1 + SparkleLib/windows/SparkleLib.csproj | 23 ++++++-- SparkleShare/SparkleAbout.cs | 15 +++--- SparkleShare/Windows/Icons.Designer.cs | 67 ++++++------------------ SparkleShare/Windows/Icons.resx | 6 +++ SparkleShare/Windows/SparkleShare.csproj | 23 ++++++-- SparkleShare/Windows/SparkleShare.sln | 4 +- 7 files changed, 68 insertions(+), 71 deletions(-) diff --git a/.gitignore b/.gitignore index ad095000..4de048e7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.bak *.suo *.sln.cache +*.user po/POTFILES Makefile.in Makefile diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index e1f1e575..1bc686f2 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -11,9 +11,11 @@ SparkleLib - 2.0 + 3.5 + false + v3.5 publish\ true Disk @@ -26,10 +28,8 @@ true 0 1.0.0.%2a - false false true - v3.5 true @@ -41,6 +41,7 @@ 4 false x86 + AllRules.ruleset none @@ -49,6 +50,7 @@ prompt 4 false + AllRules.ruleset @@ -117,9 +119,15 @@ + + + False + .NET Framework 3.5 SP1 Client Profile + false + False .NET Framework 2.0 %28x86%29 @@ -135,6 +143,11 @@ .NET Framework 3.5 false + + False + .NET Framework 3.5 SP1 + false + @@ -166,4 +179,4 @@ $(ProjectDir)transform_tt.cmd - + \ No newline at end of file diff --git a/SparkleShare/SparkleAbout.cs b/SparkleShare/SparkleAbout.cs index c8b9a682..5f132110 100644 --- a/SparkleShare/SparkleAbout.cs +++ b/SparkleShare/SparkleAbout.cs @@ -53,15 +53,14 @@ namespace SparkleShare { Title = _("About SparkleShare"); AppPaintable = true; - // TODO: Should be able to do without referencing SparkleLib... - //string image_path = SparkleLib.SparkleHelpers.CombineMore (SparkleLib.Defines.DATAROOTDIR, - // "sparkleshare", "pixmaps", "about.png"); - + MemoryStream MemStream = new MemoryStream(); + Icons.about.Save(MemStream, System.Drawing.Imaging.ImageFormat.Png); + MemStream.Seek(0, SeekOrigin.Begin); Realize (); - //Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path); - //Gdk.Pixmap map, map2; - //buf.RenderPixmapAndMask (out map, out map2, 255); - //GdkWindow.SetBackPixmap (map, false); + Gdk.Pixbuf buf = new Gdk.Pixbuf(MemStream); + Gdk.Pixmap map, map2; + buf.RenderPixmapAndMask (out map, out map2, 255); + GdkWindow.SetBackPixmap (map, false); CreateAbout (); diff --git a/SparkleShare/Windows/Icons.Designer.cs b/SparkleShare/Windows/Icons.Designer.cs index cabe4017..1d3290b8 100644 --- a/SparkleShare/Windows/Icons.Designer.cs +++ b/SparkleShare/Windows/Icons.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4211 +// Runtime Version:4.0.30319.225 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace SparkleShare { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Icons { @@ -60,6 +60,13 @@ namespace SparkleShare { } } + internal static System.Drawing.Bitmap about { + get { + object obj = ResourceManager.GetObject("about", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap avatar_default { get { object obj = ResourceManager.GetObject("avatar_default", resourceCulture); @@ -165,13 +172,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap folder_sparkleshare_16_mist { - get { - object obj = ResourceManager.GetObject("folder_sparkleshare_16_mist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap folder_sparkleshare_22 { get { object obj = ResourceManager.GetObject("folder_sparkleshare_22", resourceCulture); @@ -179,13 +179,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap folder_sparkleshare_22_mist { - get { - object obj = ResourceManager.GetObject("folder_sparkleshare_22_mist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap folder_sparkleshare_24 { get { object obj = ResourceManager.GetObject("folder_sparkleshare_24", resourceCulture); @@ -193,13 +186,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap folder_sparkleshare_24_mist { - get { - object obj = ResourceManager.GetObject("folder_sparkleshare_24_mist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap folder_sparkleshare_256 { get { object obj = ResourceManager.GetObject("folder_sparkleshare_256", resourceCulture); @@ -207,13 +193,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap folder_sparkleshare_256_mist { - get { - object obj = ResourceManager.GetObject("folder_sparkleshare_256_mist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap folder_sparkleshare_32 { get { object obj = ResourceManager.GetObject("folder_sparkleshare_32", resourceCulture); @@ -221,13 +200,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap folder_sparkleshare_32_mist { - get { - object obj = ResourceManager.GetObject("folder_sparkleshare_32_mist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap folder_sparkleshare_48 { get { object obj = ResourceManager.GetObject("folder_sparkleshare_48", resourceCulture); @@ -235,13 +207,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap folder_sparkleshare_48_mist { - get { - object obj = ResourceManager.GetObject("folder_sparkleshare_48_mist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap idle0 { get { object obj = ResourceManager.GetObject("idle0", resourceCulture); @@ -319,13 +284,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap process_syncing_sparkleshare_24_mist { - get { - object obj = ResourceManager.GetObject("process_syncing_sparkleshare_24_mist", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap process_syncing_sparkleshare_i_24 { get { object obj = ResourceManager.GetObject("process_syncing_sparkleshare_i_24", resourceCulture); @@ -388,5 +346,12 @@ namespace SparkleShare { return ((System.Drawing.Bitmap)(obj)); } } + + internal static System.Drawing.Bitmap sparkleshare_windows_status { + get { + object obj = ResourceManager.GetObject("sparkleshare_windows_status", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/SparkleShare/Windows/Icons.resx b/SparkleShare/Windows/Icons.resx index 76390d68..283d9193 100644 --- a/SparkleShare/Windows/Icons.resx +++ b/SparkleShare/Windows/Icons.resx @@ -228,9 +228,15 @@ ..\..\data\icons\sparkleshare-syncing-error-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\sparkleshare-windows-status.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\..\data\icons\sparkleshare.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\about.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\..\data\avatar-default.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 95fd656d..f2ef5299 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -11,9 +11,11 @@ SparkleShare - 2.0 + 3.5 + false + v3.5 publish\ true Disk @@ -26,10 +28,8 @@ true 0 1.0.0.%2a - false false true - v3.5 true @@ -40,6 +40,7 @@ prompt 4 x86 + AllRules.ruleset none @@ -47,6 +48,7 @@ ..\..\bin prompt 4 + AllRules.ruleset @@ -127,6 +129,11 @@ + + False + .NET Framework 3.5 SP1 Client Profile + false + False .NET Framework 2.0 %28x86%29 @@ -142,8 +149,14 @@ .NET Framework 3.5 false + + False + .NET Framework 3.5 SP1 + false + + @@ -180,4 +193,4 @@ - + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleShare.sln b/SparkleShare/Windows/SparkleShare.sln index 83b5e5a1..129f6e96 100644 --- a/SparkleShare/Windows/SparkleShare.sln +++ b/SparkleShare/Windows/SparkleShare.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 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}" From c0793329264f35d842f1c10e5f82587bc631b967 Mon Sep 17 00:00:00 2001 From: wimh Date: Thu, 21 Jul 2011 18:20:20 +0200 Subject: [PATCH 015/134] revert to vs2008 --- SparkleLib/windows/SparkleLib.csproj | 4 ++-- SparkleShare/Windows/SparkleShare.csproj | 4 ++-- SparkleShare/Windows/SparkleShare.sln | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 1bc686f2..0fcd1b7a 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -179,4 +179,4 @@ $(ProjectDir)transform_tt.cmd - \ No newline at end of file + diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index f2ef5299..4d7df5a5 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -193,4 +193,4 @@ - \ No newline at end of file + diff --git a/SparkleShare/Windows/SparkleShare.sln b/SparkleShare/Windows/SparkleShare.sln index 129f6e96..83b5e5a1 100644 --- a/SparkleShare/Windows/SparkleShare.sln +++ b/SparkleShare/Windows/SparkleShare.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +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}" From d08bddc6f1a16f223a168b4baf3b50912c7bd20d Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 22 Jul 2011 20:09:18 +0200 Subject: [PATCH 016/134] fix bug in CheckForChanges --- SparkleLib/SparkleRepoBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index f5373aa5..b782741a 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -283,7 +283,8 @@ namespace SparkleLib { DirectoryInfo dir_info = new DirectoryInfo (LocalPath); this.sizebuffer.Add (CalculateFolderSize (dir_info)); - if (this.sizebuffer [0].Equals (this.sizebuffer [1]) && + if (this.sizebuffer.Count >= 4 && + this.sizebuffer [0].Equals (this.sizebuffer [1]) && this.sizebuffer [1].Equals (this.sizebuffer [2]) && this.sizebuffer [2].Equals (this.sizebuffer [3])) { From 933f1c557467174456869eaa02bb51acfd91af13 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 23 Jul 2011 00:16:03 +0200 Subject: [PATCH 017/134] stop downloading further avatars w/o internet access --- SparkleShare/SparkleController.cs | 35 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 665f5e39..48ad7606 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -909,26 +909,31 @@ namespace SparkleShare { } } else { - WebClient client = new WebClient (); - string url = "http://gravatar.com/avatar/" + GetMD5 (email) + + WebClient client = new WebClient (); + string url = "http://gravatar.com/avatar/" + GetMD5 (email) + ".jpg?s=" + size + "&d=404"; - try { - // Fetch the avatar - byte [] buffer = client.DownloadData (url); + try { + // Fetch the avatar + byte [] buffer = client.DownloadData (url); - // Write the avatar data to a - // if not empty - if (buffer.Length > 255) { - avatar_fetched = true; - File.WriteAllBytes (avatar_file_path, buffer); - SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email); - } + // Write the avatar data to a + // if not empty + if (buffer.Length > 255) { + avatar_fetched = true; + File.WriteAllBytes (avatar_file_path, buffer); + SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email); + } - } catch (WebException) { + } catch (WebException ex) { SparkleHelpers.DebugInfo ("Controller", "Failed fetching gravatar for " + email); - } - } + + if (ex.Status == WebExceptionStatus.Timeout) { + // stop downloading further avatars if we have no internet access + break; + } + } + } } // Fetch new versions of the avatars that we From 5a4038df87ca93e9ae8298b1bb4c26a2aa595975 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 23 Jul 2011 20:18:58 +0200 Subject: [PATCH 018/134] convert SparkleStatusIcon to winforms --- SparkleShare/Windows/SparkleShare.csproj | 4 +- SparkleShare/Windows/SparkleStatusIcon.cs | 356 +++++++++++++++++++ SparkleShare/Windows/SparkleWinController.cs | 4 + 3 files changed, 362 insertions(+), 2 deletions(-) create mode 100644 SparkleShare/Windows/SparkleStatusIcon.cs diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 4d7df5a5..352f712a 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -96,7 +96,6 @@ - @@ -104,6 +103,7 @@ + @@ -193,4 +193,4 @@ - + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs new file mode 100644 index 00000000..3e393c28 --- /dev/null +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -0,0 +1,356 @@ +// SparkleShare, a collaboration and sharing tool. +// 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 System.IO; + +using SparkleLib; +using System.Windows.Forms; +using System.Drawing; + +namespace SparkleShare { + + // The statusicon that stays in the + // user's notification area + public class SparkleStatusIcon { + + private Timer Animation; + private Bitmap [] AnimationFrames; + private int FrameNumber; + private string StateText; + + private ToolStripItem status_menu_item; + private NotifyIcon status_icon; + + // Short alias for the translations + public static string _ (string s) + { + return s; + } + + + public SparkleStatusIcon () + { + AnimationFrames = CreateAnimationFrames (); + Animation = CreateAnimation (); + + this.status_icon = new NotifyIcon (); + status_icon.Text = "SparkleShare"; + status_icon.Icon = Icons.sparkleshare; + status_icon.Visible = true; + + CreateMenu (); + SetNormalState (); + + SparkleShare.Controller.FolderSizeChanged += delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + if (!Animation.Enabled) + SetNormalState (); + + UpdateMenu (); + }); + }; + + SparkleShare.Controller.FolderListChanged += delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + SetNormalState (); + CreateMenu (); + }); + }; + + SparkleShare.Controller.OnIdle += delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + SetNormalState (); + UpdateMenu (); + }); + }; + + SparkleShare.Controller.OnSyncing += delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + SetAnimationState (); + UpdateMenu (); + }); + }; + + SparkleShare.Controller.OnError += delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + SetNormalState (true); + UpdateMenu (); + }); + }; + } + + + // Slices up the graphic that contains the + // animation frames. + private Bitmap [] CreateAnimationFrames () + { + Bitmap [] animation_frames = new Bitmap [5]; + animation_frames [0] = Icons.process_syncing_sparkleshare_i_24; + animation_frames [1] = Icons.process_syncing_sparkleshare_ii_24; + animation_frames [2] = Icons.process_syncing_sparkleshare_iii_24; + animation_frames [3] = Icons.process_syncing_sparkleshare_iiii_24; + animation_frames [4] = Icons.process_syncing_sparkleshare_iiiii_24; + + return animation_frames; + } + + + // Creates the Animation that handles the syncing animation + private Timer CreateAnimation () + { + FrameNumber = 0; + + Timer Animation = new Timer () { + Interval = 35 + }; + + Animation.Tick += delegate { + if (FrameNumber < AnimationFrames.Length - 1) + FrameNumber++; + else + FrameNumber = 0; + + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + this.status_icon.Icon = Icon.FromHandle (AnimationFrames [FrameNumber].GetHicon ()); + }); + }; + + return Animation; + } + + + // Creates the menu that is popped up when the + // user clicks the status icon + public void CreateMenu () + { + ContextMenuStrip Menu = new ContextMenuStrip (); + + // The menu item showing the status and size of the SparkleShare folder + status_menu_item = new ToolStripLabel (StateText); + + Menu.Items.Add (status_menu_item); + Menu.Items.Add (new ToolStripSeparator ()); + + ToolStripMenuItem folder_item = new ToolStripMenuItem ("SparkleShare") { + Image = Icons.folder_sparkleshare_16 + }; + + folder_item.Click += delegate { + SparkleShare.Controller.OpenSparkleShareFolder (); + }; + + Menu.Items.Add (folder_item); + + if (SparkleShare.Controller.Folders.Count > 0) { + + // Creates a menu item for each repository with a link to their logs + foreach (string folder_name in SparkleShare.Controller.Folders) { + Bitmap folder_icon; + + if (SparkleShare.Controller.UnsyncedFolders.Contains (folder_name)) { + folder_icon = Icons.dialog_error_16; + } else { + folder_icon = Icons.sparkleshare_windows_status; + } + + ToolStripMenuItem subfolder_item = new ToolStripMenuItem (folder_name) { + Image = folder_icon + }; + + subfolder_item.Click += OpenFolderDelegate (folder_name); + Menu.Items.Add (subfolder_item); + } + + } else { + ToolStripMenuItem no_folders_item = new ToolStripMenuItem (_ ("No Remote Folders Yet")) { + Enabled = false + }; + + Menu.Items.Add (no_folders_item); + } + + Menu.Items.Add (new ToolStripSeparator ()); + + // Opens the wizard to add a new remote folder + ToolStripMenuItem sync_item = new ToolStripMenuItem (_ ("Add Remote Folder…")); + + if (SparkleShare.Controller.FirstRun) + sync_item.Enabled = false; + + sync_item.Click += delegate { + + if (SparkleUI.Setup == null) { + SparkleUI.Setup = new SparkleSetup (); + SparkleUI.Setup.Controller.ShowAddPage (); + } + + if (!SparkleUI.Setup.Visible) + SparkleUI.Setup.Controller.ShowAddPage (); + }; + + Menu.Items.Add (sync_item); + Menu.Items.Add (new ToolStripSeparator ()); + + ToolStripMenuItem recent_events_item = new ToolStripMenuItem (_ ("Show Recent Events")); + + if (SparkleShare.Controller.Folders.Count < 1) + recent_events_item.Enabled = false; + + recent_events_item.Click += delegate { + if (SparkleUI.EventLog == null) + SparkleUI.EventLog = new SparkleEventLog (); + + SparkleUI.EventLog.ShowAll (); + SparkleUI.EventLog.Present (); + }; + + Menu.Items.Add (recent_events_item); + + ToolStripMenuItem notify_item; + + if (SparkleShare.Controller.NotificationsEnabled) + notify_item = new ToolStripMenuItem (_ ("Turn Notifications Off")); + else + notify_item = new ToolStripMenuItem (_ ("Turn Notifications On")); + + notify_item.Click += delegate { + SparkleShare.Controller.ToggleNotifications (); + CreateMenu (); + }; + + Menu.Items.Add (notify_item); + Menu.Items.Add (new ToolStripSeparator ()); + + // A menu item that takes the user to http://www.sparkleshare.org/ + ToolStripMenuItem about_item = new ToolStripMenuItem (_ ("About SparkleShare")); + + about_item.Click += delegate { + if (SparkleUI.About == null) + SparkleUI.About = new SparkleAbout (); + + SparkleUI.About.Show (); + SparkleUI.About.Present (); + }; + + Menu.Items.Add (about_item); + Menu.Items.Add (new ToolStripSeparator ()); + + // A menu item that quits the application + ToolStripMenuItem quit_item = new ToolStripMenuItem (_ ("Quit")); + + quit_item.Click += delegate { + SparkleShare.Controller.Quit (); + }; + + Menu.Items.Add (quit_item); + + status_icon.ContextMenuStrip = Menu; + } + + + // A method reference that makes sure that opening the + // event log for each repository works correctly + private EventHandler OpenFolderDelegate (string name) + { + return delegate { + SparkleShare.Controller.OpenSparkleShareFolder (name); + }; + } + + + public void UpdateMenu () + { + status_menu_item.Text=StateText; + } + + + // The state when there's nothing going on + private void SetNormalState () + { + SetNormalState (false); + } + + + // The state when there's nothing going on + private void SetNormalState (bool error) + { + Animation.Stop (); + + if (SparkleShare.Controller.Folders.Count == 0) { + StateText = _("Welcome to SparkleShare!"); + + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + this.status_icon.Icon = Icon.FromHandle (AnimationFrames [0].GetHicon ()); + }); + + } else { + if (error) { + StateText = _("Not everything is synced"); + + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + this.status_icon.Icon = Icon.FromHandle (Icons.sparkleshare_syncing_error_24.GetHicon ()); + }); + } else { + StateText = _("Up to date") + " (" + SparkleShare.Controller.FolderSize + ")"; + status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + this.status_icon.Icon = Icon.FromHandle (AnimationFrames [0].GetHicon ()); + }); + } + } + } + + + // The state when animating + private void SetAnimationState () + { + StateText = _("Syncing…"); + + if (!Animation.Enabled) + Animation.Start (); + } + } + + + public static class ControlExtention { + public static void SafeInvoke (this Control uiElement, Action updater, bool forceSynchronous) + { + if (uiElement == null) { + throw new ArgumentNullException ("uiElement"); + } + + if (uiElement.InvokeRequired) { + if (forceSynchronous) { + uiElement.Invoke ((Action)delegate { SafeInvoke (uiElement, updater, forceSynchronous); }); + } else { + uiElement.BeginInvoke ((Action)delegate { SafeInvoke (uiElement, updater, forceSynchronous); }); + } + } else { + if (uiElement.IsDisposed) { + throw new ObjectDisposedException ("Control is already disposed."); + } + + updater (); + } + } + public static void SafeInvoke (this Control uiElement, Action updater) + { + uiElement.SafeInvoke (updater, false); + } + + } +} diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleWinController.cs index dafe65df..9cec97a4 100644 --- a/SparkleShare/Windows/SparkleWinController.cs +++ b/SparkleShare/Windows/SparkleWinController.cs @@ -23,6 +23,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Text.RegularExpressions; +using System.Windows.Forms; namespace SparkleShare { @@ -34,6 +35,9 @@ namespace SparkleShare { public override void Initialize () { + Application.EnableVisualStyles (); + Application.SetCompatibleTextRenderingDefault (false); + // Add msysgit to path, as we cannot asume it is added to the path // Asume it is installed in @"C:\msysgit\bin" for now string MSysGit=@"C:\msysgit"; From ea20f12a56d98bec0a011b0c0cd6f1f9e593ecd4 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 23 Jul 2011 20:24:12 +0200 Subject: [PATCH 019/134] delete Win32 folder --- SparkleShare/Win32/.gitignore | 4 - SparkleShare/Win32/Controller/Updater.cs | 16 --- .../Win32/Gui/SystemTrayForm.Designer.cs | 33 ----- SparkleShare/Win32/Gui/SystemTrayForm.cs | 89 ------------- SparkleShare/Win32/Program.cs | 20 --- SparkleShare/Win32/Properties/AssemblyInfo.cs | 36 ------ .../Win32/Properties/Resources.Designer.cs | 62 ---------- SparkleShare/Win32/Properties/Resources.resx | 117 ------------------ .../Win32/Properties/Settings.Designer.cs | 26 ---- .../Win32/Properties/Settings.settings | 7 -- SparkleShare/Win32/SparkleShare.csproj | 85 ------------- SparkleShare/Win32/SparkleShare.sln | 20 --- 12 files changed, 515 deletions(-) delete mode 100644 SparkleShare/Win32/.gitignore delete mode 100644 SparkleShare/Win32/Controller/Updater.cs delete mode 100644 SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs delete mode 100644 SparkleShare/Win32/Gui/SystemTrayForm.cs delete mode 100644 SparkleShare/Win32/Program.cs delete mode 100644 SparkleShare/Win32/Properties/AssemblyInfo.cs delete mode 100644 SparkleShare/Win32/Properties/Resources.Designer.cs delete mode 100644 SparkleShare/Win32/Properties/Resources.resx delete mode 100644 SparkleShare/Win32/Properties/Settings.Designer.cs delete mode 100644 SparkleShare/Win32/Properties/Settings.settings delete mode 100644 SparkleShare/Win32/SparkleShare.csproj delete mode 100644 SparkleShare/Win32/SparkleShare.sln diff --git a/SparkleShare/Win32/.gitignore b/SparkleShare/Win32/.gitignore deleted file mode 100644 index 7194bd50..00000000 --- a/SparkleShare/Win32/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ - -*.suo -*.user -obj/* \ No newline at end of file diff --git a/SparkleShare/Win32/Controller/Updater.cs b/SparkleShare/Win32/Controller/Updater.cs deleted file mode 100644 index 6eb08527..00000000 --- a/SparkleShare/Win32/Controller/Updater.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SparkleShare { - public static class Updater { - - public static bool IsUpToDate() { - return true; - } - - public static void Update() { - throw new NotImplementedException(); - } - } -} diff --git a/SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs b/SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs deleted file mode 100644 index 740d6a45..00000000 --- a/SparkleShare/Win32/Gui/SystemTrayForm.Designer.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace SparkleShare { - partial class SystemTrayForm { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing && (components != null)) { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Text = "SystemTrayForm"; - } - - #endregion - } -} \ No newline at end of file diff --git a/SparkleShare/Win32/Gui/SystemTrayForm.cs b/SparkleShare/Win32/Gui/SystemTrayForm.cs deleted file mode 100644 index 7d605792..00000000 --- a/SparkleShare/Win32/Gui/SystemTrayForm.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace SparkleShare { - public partial class SystemTrayForm : Form { - - protected override void OnLoad(EventArgs e) { - WindowState = FormWindowState.Minimized; - ShowInTaskbar = false; - - base.OnLoad(e); - - InitializeTrayIcon(); - } - - public void InitializeTrayIcon() { - NotifyIcon trayIcon = new NotifyIcon(); - trayIcon.Text = "SparkleShare"; - trayIcon.Icon = new Icon("sparkleshare.ico",40,40); - trayIcon.Visible = true; - - trayIcon.ContextMenuStrip = GetTrayIconMenu(); - } - - public ContextMenuStrip GetTrayIconMenu() { - ToolStripItem VersionStatusItem = new ToolStripLabel(); - - if (Updater.IsUpToDate()) { - VersionStatusItem.Text = "Up to date"; - VersionStatusItem.Enabled = false; - } else { - VersionStatusItem.Click += UpdateApplication; - } - - ToolStripItem AddRemoteFolderItem = new ToolStripLabel(); - AddRemoteFolderItem.Text = "Add remote folder"; - AddRemoteFolderItem.Click += AddRemoteFolder; - - ToolStripItem NotificationsItem = new ToolStripLabel(); - NotificationsItem.Text = "Turn off notifications"; - NotificationsItem.Click += ToggleNotifications; - - ToolStripItem AboutItem = new ToolStripLabel(); - AboutItem.Text = "About SparkleShare"; - AboutItem.Click += DisplayAboutDialog; - - ToolStripItem ExitItem = new ToolStripLabel(); - ExitItem.Text = "Exit"; - ExitItem.Click += ExitApplication; - - ContextMenuStrip menu = new ContextMenuStrip(); - menu.Items.Add(VersionStatusItem); - menu.Items.Add(new ToolStripSeparator()); - menu.Items.Add(AddRemoteFolderItem); - menu.Items.Add(new ToolStripSeparator()); - menu.Items.Add(NotificationsItem); - menu.Items.Add(new ToolStripSeparator()); - menu.Items.Add(AboutItem); - menu.Items.Add(ExitItem); - - return menu; - } - - public void UpdateApplication(object sender, EventArgs e) { - throw new NotImplementedException(); - } - - public void AddRemoteFolder(object sender, EventArgs e) { - throw new NotImplementedException(); - } - - public void ToggleNotifications(object sender, EventArgs e) { - throw new NotImplementedException(); - } - - public void DisplayAboutDialog(object sender, EventArgs e) { - throw new NotImplementedException(); - } - - public void ExitApplication(object sender, EventArgs e) { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/SparkleShare/Win32/Program.cs b/SparkleShare/Win32/Program.cs deleted file mode 100644 index 26477a42..00000000 --- a/SparkleShare/Win32/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace SparkleShare -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new SystemTrayForm()); - } - } -} \ No newline at end of file diff --git a/SparkleShare/Win32/Properties/AssemblyInfo.cs b/SparkleShare/Win32/Properties/AssemblyInfo.cs deleted file mode 100644 index 2d84c602..00000000 --- a/SparkleShare/Win32/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SparkleShare")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SparkleShare")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b5570a03-84a3-43c0-b9d3-3e84902323ec")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Win32/Properties/Resources.Designer.cs b/SparkleShare/Win32/Properties/Resources.Designer.cs deleted file mode 100644 index f1cc34b0..00000000 --- a/SparkleShare/Win32/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.225 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SparkleShare.Properties { - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if ((resourceMan == null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SparkleShare.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/SparkleShare/Win32/Properties/Resources.resx b/SparkleShare/Win32/Properties/Resources.resx deleted file mode 100644 index af7dbebb..00000000 --- a/SparkleShare/Win32/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/SparkleShare/Win32/Properties/Settings.Designer.cs b/SparkleShare/Win32/Properties/Settings.Designer.cs deleted file mode 100644 index 5e0fca00..00000000 --- a/SparkleShare/Win32/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.225 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SparkleShare.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/SparkleShare/Win32/Properties/Settings.settings b/SparkleShare/Win32/Properties/Settings.settings deleted file mode 100644 index 39645652..00000000 --- a/SparkleShare/Win32/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/SparkleShare/Win32/SparkleShare.csproj b/SparkleShare/Win32/SparkleShare.csproj deleted file mode 100644 index 7f2e93aa..00000000 --- a/SparkleShare/Win32/SparkleShare.csproj +++ /dev/null @@ -1,85 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80} - WinExe - Properties - SparkleShare - SparkleShare - v2.0 - 512 - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - Form - - - SystemTrayForm.cs - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - PreserveNewest - - - - - \ No newline at end of file diff --git a/SparkleShare/Win32/SparkleShare.sln b/SparkleShare/Win32/SparkleShare.sln deleted file mode 100644 index b7dd4ff1..00000000 --- a/SparkleShare/Win32/SparkleShare.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare", "SparkleShare.csproj", "{B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Debug|x86.ActiveCfg = Debug|x86 - {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Debug|x86.Build.0 = Debug|x86 - {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Release|x86.ActiveCfg = Release|x86 - {B436FB0A-C8CE-4EA3-8A18-9FB1A9C4EC80}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal From bdf226ead2872ba951e4b063c582a234a131c9f3 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 23 Jul 2011 22:37:09 +0200 Subject: [PATCH 020/134] convert SparkleAbout to winforms --- SparkleShare/Windows/Icons.Designer.cs | 4 +- .../Windows/Properties/Resources.Designer.cs | 63 +++++++++ .../Windows/Properties/Resources.resx | 120 +++++++++++++++++ SparkleShare/Windows/SparkleAbout.Designer.cs | 105 +++++++++++++++ SparkleShare/Windows/SparkleAbout.cs | 78 +++++++++++ SparkleShare/Windows/SparkleAbout.resx | 125 ++++++++++++++++++ SparkleShare/Windows/SparkleShare.csproj | 24 +++- SparkleShare/Windows/SparkleStatusIcon.cs | 2 +- 8 files changed, 513 insertions(+), 8 deletions(-) create mode 100644 SparkleShare/Windows/Properties/Resources.Designer.cs create mode 100644 SparkleShare/Windows/Properties/Resources.resx create mode 100644 SparkleShare/Windows/SparkleAbout.Designer.cs create mode 100644 SparkleShare/Windows/SparkleAbout.cs create mode 100644 SparkleShare/Windows/SparkleAbout.resx diff --git a/SparkleShare/Windows/Icons.Designer.cs b/SparkleShare/Windows/Icons.Designer.cs index 1d3290b8..66e3856d 100644 --- a/SparkleShare/Windows/Icons.Designer.cs +++ b/SparkleShare/Windows/Icons.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.225 +// Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace SparkleShare { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Icons { diff --git a/SparkleShare/Windows/Properties/Resources.Designer.cs b/SparkleShare/Windows/Properties/Resources.Designer.cs new file mode 100644 index 00000000..5a3e45fa --- /dev/null +++ b/SparkleShare/Windows/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3053 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SparkleShare.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SparkleShare.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/SparkleShare/Windows/Properties/Resources.resx b/SparkleShare/Windows/Properties/Resources.resx new file mode 100644 index 00000000..7080a7d1 --- /dev/null +++ b/SparkleShare/Windows/Properties/Resources.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleAbout.Designer.cs b/SparkleShare/Windows/SparkleAbout.Designer.cs new file mode 100644 index 00000000..a65acdd6 --- /dev/null +++ b/SparkleShare/Windows/SparkleAbout.Designer.cs @@ -0,0 +1,105 @@ +namespace SparkleShare { + partial class SparkleAbout { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleAbout)); + this.version = new System.Windows.Forms.Label (); + this.copyright = new System.Windows.Forms.Label (); + this.emptyLabel = new System.Windows.Forms.Label (); + this.SparkleShareVersion = new System.Windows.Forms.Label (); + this.SuspendLayout (); + // + // version + // + this.version.AutoSize = true; + this.version.BackColor = System.Drawing.Color.Transparent; + this.version.ForeColor = System.Drawing.Color.LightGray; + this.version.Location = new System.Drawing.Point (302, 102); + this.version.Name = "version"; + this.version.Size = new System.Drawing.Size (34, 13); + this.version.TabIndex = 1; + this.version.Text = "........."; + // + // copyright + // + this.copyright.BackColor = System.Drawing.Color.Transparent; + this.copyright.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.copyright.ForeColor = System.Drawing.Color.White; + this.copyright.Location = new System.Drawing.Point (302, 135); + this.copyright.Name = "copyright"; + this.copyright.Size = new System.Drawing.Size (298, 84); + this.copyright.TabIndex = 2; + this.copyright.Text = resources.GetString ("copyright.Text"); + // + // emptyLabel + // + this.emptyLabel.AutoSize = true; + this.emptyLabel.Location = new System.Drawing.Point (16, 89); + this.emptyLabel.Name = "emptyLabel"; + this.emptyLabel.Size = new System.Drawing.Size (0, 13); + this.emptyLabel.TabIndex = 6; + // + // SparkleShareVersion + // + this.SparkleShareVersion.AutoSize = true; + this.SparkleShareVersion.BackColor = System.Drawing.Color.Transparent; + this.SparkleShareVersion.ForeColor = System.Drawing.Color.White; + this.SparkleShareVersion.Location = new System.Drawing.Point (302, 89); + this.SparkleShareVersion.Name = "SparkleShareVersion"; + this.SparkleShareVersion.Size = new System.Drawing.Size (106, 13); + this.SparkleShareVersion.TabIndex = 1; + this.SparkleShareVersion.Text = "SparkleShareVersion"; + // + // SparkleAbout + // + this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size (640, 260); + this.Controls.Add (this.SparkleShareVersion); + this.Controls.Add (this.emptyLabel); + this.Controls.Add (this.copyright); + this.Controls.Add (this.version); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SparkleAbout"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "About SparkleShare"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleAbout_FormClosing); + this.ResumeLayout (false); + this.PerformLayout (); + + } + + #endregion + + private System.Windows.Forms.Label version; + private System.Windows.Forms.Label copyright; + private System.Windows.Forms.Label emptyLabel; + private System.Windows.Forms.Label SparkleShareVersion; + + + } +} diff --git a/SparkleShare/Windows/SparkleAbout.cs b/SparkleShare/Windows/SparkleAbout.cs new file mode 100644 index 00000000..7f7825ba --- /dev/null +++ b/SparkleShare/Windows/SparkleAbout.cs @@ -0,0 +1,78 @@ +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons (hylkebons@gmail.com) +// +// 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 (http://www.gnu.org/licenses/). + + +using System; +using System.Diagnostics; +using System.IO; +using System.Net; + +using System.Windows.Forms; +using System.Drawing; + +namespace SparkleShare { + + public partial class SparkleAbout : Form { + + public SparkleAboutController Controller = new SparkleAboutController (); + + // Short alias for the translations + public static string _(string s) + { + return s; + } + + + public SparkleAbout () + { + InitializeComponent (); + + this.BackgroundImage=Icons.about; + this.ClientSize = this.BackgroundImage.Size; + this.Icon = Icons.sparkleshare; + + this.SparkleShareVersion.Text = SparkleLib.Defines.VERSION; + this.MaximumSize = this.Size; + this.MinimumSize = this.Size; + this.version.Text = ""; + + Controller.NewVersionEvent += delegate (string new_version) { + this.version.Invoke((Action)delegate { + this.version.Text = new_version; + }); + }; + + Controller.VersionUpToDateEvent += delegate { + this.version.Invoke((Action)delegate { + this.version.Text = "You are running the latest version."; + }); + }; + + Controller.CheckingForNewVersionEvent += delegate { + this.version.Invoke((Action)delegate { + this.version.Text = "Checking for updates..."; + }); + }; + + } + + private void SparkleAbout_FormClosing (object sender, FormClosingEventArgs e) + { + e.Cancel = true; + this.Hide (); + } + } +} diff --git a/SparkleShare/Windows/SparkleAbout.resx b/SparkleShare/Windows/SparkleAbout.resx new file mode 100644 index 00000000..53b79502 --- /dev/null +++ b/SparkleShare/Windows/SparkleAbout.resx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Copyright © 2010-2011 Hylke Bons and others + +SparkleShare is Free and Open Source Software. You are free to use, modify, and redistribute it under the terms of the GNU General Public License version 3 or later. + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 352f712a..d6f71088 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -88,6 +88,17 @@ Notification.cs + + True + True + Resources.resx + + + Form + + + SparkleAbout.cs + Form @@ -100,7 +111,6 @@ - @@ -182,15 +192,19 @@ Notification.cs Designer + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + SparkleAbout.cs + TextTemplatingFileGenerator Icons.resx - - - - \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 3e393c28..62b4e697 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -244,7 +244,7 @@ namespace SparkleShare { SparkleUI.About = new SparkleAbout (); SparkleUI.About.Show (); - SparkleUI.About.Present (); + SparkleUI.About.BringToFront (); }; Menu.Items.Add (about_item); From 8eaa91532d79f8ab5b13cd0f1f2c2686b3a8c4c6 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 31 Jul 2011 02:44:05 +0200 Subject: [PATCH 021/134] convert SparkleEventLog to winforms --- SparkleShare/SparkleController.cs | 2 +- SparkleShare/SparkleShare.cs | 2 +- .../Windows/ApplicationSchemeHandler.cs | 62 ++++ SparkleShare/Windows/FileSchemeHandler.cs | 27 ++ .../Windows/Properties/Resources.Designer.cs | 87 ++++++ .../Windows/Properties/Resources.resx | 13 + .../Windows/SparkleEventLog.Designer.cs | 89 ++++++ SparkleShare/Windows/SparkleEventLog.cs | 273 +++++------------- SparkleShare/Windows/SparkleEventLog.resx | 120 ++++++++ SparkleShare/Windows/SparkleShare.csproj | 29 +- SparkleShare/Windows/SparkleStatusIcon.cs | 4 +- SparkleShare/Windows/SparkleUIHelpers.cs | 73 +++++ SparkleShare/Windows/SparkleWinController.cs | 56 +++- 13 files changed, 625 insertions(+), 212 deletions(-) create mode 100644 SparkleShare/Windows/ApplicationSchemeHandler.cs create mode 100644 SparkleShare/Windows/FileSchemeHandler.cs create mode 100644 SparkleShare/Windows/SparkleEventLog.Designer.cs create mode 100644 SparkleShare/Windows/SparkleEventLog.resx create mode 100644 SparkleShare/Windows/SparkleUIHelpers.cs diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 48ad7606..469e2aeb 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -946,7 +946,7 @@ namespace SparkleShare { } - public string GetAvatar (string email, int size) + public virtual string GetAvatar (string email, int size) { string avatar_file_path = SparkleHelpers.CombineMore ( SparklePaths.SparkleLocalIconPath, size + "x" + size, "status", "avatar-" + email); diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/SparkleShare.cs index 5352e974..fc2d8eab 100644 --- a/SparkleShare/SparkleShare.cs +++ b/SparkleShare/SparkleShare.cs @@ -40,7 +40,7 @@ namespace SparkleShare { return s; } - + [STAThread] public static void Main (string [] args) { // Don't allow running as root on Linux or Mac diff --git a/SparkleShare/Windows/ApplicationSchemeHandler.cs b/SparkleShare/Windows/ApplicationSchemeHandler.cs new file mode 100644 index 00000000..bb7d8237 --- /dev/null +++ b/SparkleShare/Windows/ApplicationSchemeHandler.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using CefSharp; +using System.IO; + +namespace SparkleShare { + + class ApplicationSchemeHandler : ISchemeHandler { + #region ISchemeHandler Members + + public bool ProcessRequest (IRequest request, ref string mimeType, ref Stream stream) + { + if (request.Url.EndsWith (".png")) { + System.Drawing.Bitmap Image=null; + + if (request.Url.EndsWith ("avatar-default-32.png")) + Image = Icons.avatar_default_32; + else if (request.Url.EndsWith ("document-added-12.png")) + Image = Icons.document_added_12; + else if (request.Url.EndsWith ("document-edited-12.png")) + Image = Icons.document_edited_12; + else if (request.Url.EndsWith ("document-deleted-12.png")) + Image = Icons.document_deleted_12; + else if (request.Url.EndsWith ("document-moved-12.png")) + Image = Icons.document_moved_12; + + if (Image != null) { + stream = new MemoryStream (); + Image.Save (stream, System.Drawing.Imaging.ImageFormat.Png); + stream.Seek (0, SeekOrigin.Begin); + mimeType = "image/png"; + return true; + } + } else if (request.Url.EndsWith (".js")) { + string Text = null; + + if (request.Url.EndsWith ("jquery.js")) + Text = Properties.Resources.jquery_js; + + if (Text != null) { + stream = new MemoryStream (Encoding.UTF8.GetPreamble ().Concat (Encoding.UTF8.GetBytes (Text)).ToArray ()); + mimeType = "application/javascript"; + return true; + } + } + + return false; + } + + #endregion + } + + public class ApplicationSchemeHandlerFactory : ISchemeHandlerFactory { + public ISchemeHandler Create () + { + return new ApplicationSchemeHandler (); + } + } + +} diff --git a/SparkleShare/Windows/FileSchemeHandler.cs b/SparkleShare/Windows/FileSchemeHandler.cs new file mode 100644 index 00000000..0984447f --- /dev/null +++ b/SparkleShare/Windows/FileSchemeHandler.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using CefSharp; +using System.IO; + +namespace SparkleShare { + + class FileSchemeHandler : ISchemeHandler { + #region ISchemeHandler Members + + public bool ProcessRequest (IRequest request, ref string mimeType, ref Stream stream) + { + return false; + } + + #endregion + } + + public class FileSchemeHandlerFactory : ISchemeHandlerFactory { + public ISchemeHandler Create () + { + return new FileSchemeHandler (); + } + } +} diff --git a/SparkleShare/Windows/Properties/Resources.Designer.cs b/SparkleShare/Windows/Properties/Resources.Designer.cs index 5a3e45fa..844f818e 100644 --- a/SparkleShare/Windows/Properties/Resources.Designer.cs +++ b/SparkleShare/Windows/Properties/Resources.Designer.cs @@ -59,5 +59,92 @@ namespace SparkleShare.Properties { resourceCulture = value; } } + + /// + /// Looks up a localized string similar to <div class='day-entry'> + /// <div class='day-entry-header'> + /// <!-- $day-entry-header --> + /// </div> + /// <div class='day-entry-content'> + /// <!-- $day-entry-content --> + /// </div> + ///</div> + ///. + /// + internal static string day_entry_html { + get { + return ResourceManager.GetString("day_entry_html", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <div class='event-entry' style='background-image: url("<!-- $event-avatar-url -->");'> + /// <div class='event-user-name'><!-- $event-user-name --></div> + /// <div class='event-folder'><!-- $event-folder --></div> + /// + /// <!-- $event-entry-content --> + /// + /// <div class="clearer"></div> + /// <div class="event-timestamp"><!-- $event-time --></div> + /// <div class="action note">Add note</div> + /// <div class="action show">Show all</div> + /// + /// <div class="clearer"></div> + /// + /// <div class="comments-section"> + /// [rest of string was truncated]";. + /// + internal static string event_entry_html { + get { + return ResourceManager.GetString("event_entry_html", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <!doctype html> + ///<html> + /// <head> + /// <title>SparkleShare Event Log</title> + /// <script type="text/javascript" src="<!-- $jquery-url -->"></script> + /// <script type="text/javascript"> + /// $(document).ready(function () { + /// $('.comments-section').each (function () { + /// if ($(this).find ('.comments').children ().size () < 1) { + /// $(this).hide (); + /// } + /// }); + /// + /// $('.buddy-icon').each (function () { + /// [rest of string was truncated]";. + /// + internal static string event_log_html { + get { + return ResourceManager.GetString("event_log_html", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /*! + /// * jQuery JavaScript Library v1.6.1 + /// * http://jquery.com/ + /// * + /// * Copyright 2011, John Resig + /// * Dual licensed under the MIT or GPL Version 2 licenses. + /// * http://jquery.org/license + /// * + /// * Includes Sizzle.js + /// * http://sizzlejs.com/ + /// * Copyright 2011, The Dojo Foundation + /// * Released under the MIT, BSD, and GPL Licenses. + /// * + /// * Date: Thu May 12 15:04:36 2011 -0400 + /// */ + ///(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var [rest of string was truncated]";. + /// + internal static string jquery_js { + get { + return ResourceManager.GetString("jquery_js", resourceCulture); + } + } } } diff --git a/SparkleShare/Windows/Properties/Resources.resx b/SparkleShare/Windows/Properties/Resources.resx index 7080a7d1..ff560fa0 100644 --- a/SparkleShare/Windows/Properties/Resources.resx +++ b/SparkleShare/Windows/Properties/Resources.resx @@ -117,4 +117,17 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\..\..\data\html\day-entry.html;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\..\..\data\html\event-entry.html;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\..\..\data\html\event-log.html;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\..\..\data\html\jquery.js;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleEventLog.Designer.cs b/SparkleShare/Windows/SparkleEventLog.Designer.cs new file mode 100644 index 00000000..aedf4e7b --- /dev/null +++ b/SparkleShare/Windows/SparkleEventLog.Designer.cs @@ -0,0 +1,89 @@ +namespace SparkleShare { + partial class SparkleEventLog { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.WebViewPanel = new System.Windows.Forms.Panel (); + this.panel2 = new System.Windows.Forms.Panel (); + this.combo_box = new System.Windows.Forms.ComboBox (); + this.panel2.SuspendLayout (); + this.SuspendLayout (); + // + // WebViewPanel + // + this.WebViewPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.WebViewPanel.Location = new System.Drawing.Point (0, 44); + this.WebViewPanel.Name = "WebViewPanel"; + this.WebViewPanel.Size = new System.Drawing.Size (472, 569); + this.WebViewPanel.TabIndex = 1; + // + // panel2 + // + this.panel2.Controls.Add (this.combo_box); + this.panel2.Dock = System.Windows.Forms.DockStyle.Top; + this.panel2.Location = new System.Drawing.Point (0, 0); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size (472, 44); + this.panel2.TabIndex = 0; + // + // combo_box + // + this.combo_box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.combo_box.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.combo_box.FormattingEnabled = true; + this.combo_box.Location = new System.Drawing.Point (339, 12); + this.combo_box.Name = "combo_box"; + this.combo_box.Size = new System.Drawing.Size (121, 21); + this.combo_box.TabIndex = 0; + this.combo_box.SelectedIndexChanged += new System.EventHandler (this.combo_box_SelectedIndexChanged); + // + // SparkleEventLog + // + this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size (472, 613); + this.Controls.Add (this.WebViewPanel); + this.Controls.Add (this.panel2); + this.Name = "SparkleEventLog"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Recent Events"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleEventLog_FormClosing); + this.panel2.ResumeLayout (false); + this.ResumeLayout (false); + + } + + #endregion + + private System.Windows.Forms.Panel WebViewPanel; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.ComboBox combo_box; + + + + + + + } +} diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index d78e369e..dcaaee43 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -16,35 +16,30 @@ using System; +using System.Linq; using System.Collections.Generic; using System.Diagnostics; using System.Text.RegularExpressions; using System.Threading; -using Gtk; +using System.Windows.Forms; +using System.Drawing; +using System.Runtime.InteropServices; +using System.ComponentModel; + using SparkleLib; -#if false -using WebKit; -#endif +using CefSharp; +using System.IO; +using System.Text; namespace SparkleShare { - public class SparkleEventLog : Window { + public partial class SparkleEventLog : Form, IBeforeResourceLoad { + private readonly CefWebBrowser _browserControl; - private ScrolledWindow ScrolledWindow; - private MenuBar MenuBar; -#if false - private WebView WebView; -#endif - private string LinkStatus; - private SparkleSpinner Spinner; private string HTML; - private EventBox LogContent; private List change_sets; private string selected_log = null; - private ComboBox combo_box; - private HBox layout_horizontal; - // Short alias for the translations public static string _ (string s) @@ -52,117 +47,34 @@ namespace SparkleShare { return s; } - - public SparkleEventLog () : base ("") + public SparkleEventLog () { - SetSizeRequest (480, 640); - SetPosition (WindowPosition.Center); + InitializeComponent (); - Resizable = true; - BorderWidth = 0; + this.Icon = Icons.sparkleshare; - Title = _("Recent Events"); - IconName = "folder-sparkleshare"; + this.change_sets = SparkleShare.Controller.GetLog (null); + GenerateHTML (); - DeleteEvent += Close; - - CreateEvents (); - UpdateEvents (false); + _browserControl = new CefWebBrowser ("application://sparkleshare/eventlog"); + _browserControl.Dock = DockStyle.Fill; + //_browserControl.PropertyChanged += HandleBrowserPropertyChanged; + //_browserControl.ConsoleMessage += HandleConsoleMessage; + _browserControl.BeforeResourceLoadHandler = this; + WebViewPanel.Controls.Add (_browserControl); + UpdateChooser (); } - - private void CreateEvents () - { - VBox layout_vertical = new VBox (false, 0); - LogContent = new EventBox (); - - ScrolledWindow = new ScrolledWindow (); - -#if false - WebView = new WebView () { - Editable = false - }; - - WebView.HoveringOverLink += delegate (object o, WebKit.HoveringOverLinkArgs args) { - LinkStatus = args.Link; - }; - - // FIXME: Use the right event, waiting for newer webkit bindings: NavigationPolicyDecisionRequested - WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { - if (args.Request.Uri == LinkStatus) { - Process process = new Process (); - process.StartInfo.FileName = "xdg-open"; - process.StartInfo.Arguments = args.Request.Uri.Replace (" ", "\\ "); // Escape space-characters - process.Start (); - - // Don't follow HREFs (as this would cause a page refresh) - args.RetVal = 1; - } - }; - - ScrolledWindow.Add (WebView); -#endif - LogContent.Add (ScrolledWindow); - - this.layout_horizontal = new HBox (true, 0); - this.layout_horizontal.PackStart (new Label (""), true, true, 0); - this.layout_horizontal.PackStart (new Label (""), true, true, 0); - - layout_vertical.PackStart (layout_horizontal, false, false, 0); - layout_vertical.PackStart (LogContent, true, true, 0); - - // We have to hide the menubar somewhere... - layout_vertical.PackStart (CreateShortcutsBar (), false, false, 0); - - Add (layout_vertical); - ShowAll (); - } - - public void UpdateChooser () { - if (this.combo_box != null && this.combo_box.Parent != null) - this.layout_horizontal.Remove (this.combo_box); - - this.combo_box = new ComboBox (); - this.layout_horizontal.BorderWidth = 9; - - CellRendererText cell = new CellRendererText(); - this.combo_box.PackStart (cell, false); - this.combo_box.AddAttribute (cell, "text", 0); - ListStore store = new ListStore (typeof (string)); - this.combo_box.Model = store; - - store.AppendValues (_("All Folders")); - store.AppendValues ("---"); + this.combo_box.Items.Add (_ ("All Folders")); + this.combo_box.Items.Add (""); foreach (string folder_name in SparkleShare.Controller.Folders) - store.AppendValues (folder_name); + this.combo_box.Items.Add (folder_name); - this.combo_box.Active = 0; - - this.combo_box.RowSeparatorFunc = delegate (TreeModel model, TreeIter iter) { - string item = (string) this.combo_box.Model.GetValue (iter, 0); - return (item == "---"); - }; - - this.combo_box.Changed += delegate { - TreeIter iter; - this.combo_box.GetActiveIter (out iter); - - string selection = (string) this.combo_box.Model.GetValue (iter, 0); - - if (selection.Equals (_("All Folders"))) - this.selected_log = null; - else - this.selected_log = selection; - - UpdateEvents (false); - }; - - this.layout_horizontal.PackStart (this.combo_box, true, true, 0); - this.layout_horizontal.ShowAll (); + this.combo_box.SelectedItem = this.combo_box.Items[0]; } @@ -174,13 +86,6 @@ namespace SparkleShare { public void UpdateEvents (bool silent) { - if (!silent) { - LogContent.Remove (LogContent.Child); - Spinner = new SparkleSpinner (22); - LogContent.Add (Spinner); - LogContent.ShowAll (); - } - Thread thread = new Thread (new ThreadStart (delegate { Stopwatch watch = new Stopwatch (); watch.Start (); @@ -204,99 +109,81 @@ namespace SparkleShare { { HTML = SparkleShare.Controller.GetHTMLLog (this.change_sets); - HTML = HTML.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); - HTML = HTML.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); + HTML = HTML.Replace ("", this.Font.Size + "px"); + HTML = HTML.Replace ("", this.Font.Size + "px"); HTML = HTML.Replace ("", "#0085cf"); HTML = HTML.Replace ("", "#009ff8"); - HTML = HTML.Replace ("", "\"" + Style.FontDescription.Family + "\""); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "32x32", "status", "avatar-default.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-added.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-edited.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-deleted.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-moved.png")); + HTML = HTML.Replace ("", "\"" + this.Font.FontFamily + "\""); + HTML = HTML.Replace ("", this.ForeColor.ToHex()); + HTML = HTML.Replace ("", this.BackColor.ToHex()); + HTML = HTML.Replace ("", this.BackColor.ToHex()); + HTML = HTML.Replace ("", this.ForeColor.ToHex()); + HTML = HTML.Replace ("", this.ForeColor.ToHex()); + HTML = HTML.Replace ("", + "application://sparkleshare/avatar-default-32.png"); + HTML = HTML.Replace ("", + "application://sparkleshare/document-added-12.png"); + HTML = HTML.Replace ("", + "application://sparkleshare/document-edited-12.png"); + HTML = HTML.Replace ("", + "application://sparkleshare/document-deleted-12.png"); + HTML = HTML.Replace ("", + "application://sparkleshare/document-moved-12.png"); + + HTML = HTML.Replace ("href='" + SparklePaths.SparklePath, "href='application://file/" + SparklePaths.SparklePath); + HTML = HTML.Replace ("file://application://sparkleshare/", "application://sparkleshare/"); + HTML = HTML.Replace ("file://", "application://file/"); } private void AddHTML () { - Application.Invoke (delegate { - Spinner.Stop (); - LogContent.Remove (LogContent.Child); - -#if false - WebView.LoadString (HTML, null, null, "file://"); -#endif - - LogContent.Add (ScrolledWindow); - LogContent.ShowAll (); + Invoke ((Action)delegate { + _browserControl.Reload (); }); } - - public void Close (object o, DeleteEventArgs args) + private void SparkleEventLog_FormClosing (object sender, FormClosingEventArgs e) { - HideAll (); - args.RetVal = true; - // TODO: window positions aren't saved + e.Cancel = true; + this.Hide (); } + + #region IBeforeResourceLoad Members - private MenuBar CreateShortcutsBar () + public void HandleBeforeResourceLoad (CefWebBrowser browserControl, IRequestResponse requestResponse) { - // Adds a hidden menubar that contains to enable keyboard - // shortcuts to close the log - MenuBar = new MenuBar (); + IRequest request = requestResponse.Request; + Console.WriteLine ("{0} {1}", request.Method, request.Url); - MenuItem file_item = new MenuItem ("File"); + if (request.Url.StartsWith ("application://sparkleshare/eventlog")) { + Stream resourceStream = new MemoryStream (Encoding.UTF8.GetPreamble ().Concat (Encoding.UTF8.GetBytes (HTML)).ToArray ()); - Menu file_menu = new Menu (); + //Stream resourceStream = new MemoryStream (Encoding.UTF8.GetBytes (HTML)); + requestResponse.RespondWith (resourceStream, "text/html"); + } else if (request.Url.StartsWith ("application://file/")) { + string Filename = request.Url.Substring ("application://file/".Length); + Filename = Uri.UnescapeDataString (Filename); + Filename = Filename.Replace ("/", "\\"); - MenuItem close_1 = new MenuItem ("Close1"); - MenuItem close_2 = new MenuItem ("Close2"); - - // adds specific Ctrl+W and Esc key accelerators to Log Window - AccelGroup accel_group = new AccelGroup (); - AddAccelGroup (accel_group); + if (Filename.StartsWith (SparklePaths.SparklePath)) + System.Diagnostics.Process.Start (Filename); + } + } - // Close on Esc - close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask, - AccelFlags.Visible)); + #endregion - close_1.Activated += delegate { HideAll (); }; + private void combo_box_SelectedIndexChanged (object sender, EventArgs e) + { + String SelectedText = this.combo_box.SelectedItem as string; - // Close on Ctrl+W - close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, - AccelFlags.Visible)); - close_2.Activated += delegate { HideAll (); }; + if (string.IsNullOrEmpty (SelectedText) || SelectedText.Equals (_ ("All Folders"))) + this.selected_log = null; + else + this.selected_log = SelectedText; - file_menu.Append (close_1); - file_menu.Append (close_2); - - file_item.Submenu = file_menu; - - MenuBar.Append (file_item); - - // Hacky way to hide the menubar, but the accellerators - // will simply be disabled when using Hide () - MenuBar.HeightRequest = 1; - MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); - - return MenuBar; + UpdateEvents (false); } } } diff --git a/SparkleShare/Windows/SparkleEventLog.resx b/SparkleShare/Windows/SparkleEventLog.resx new file mode 100644 index 00000000..19dc0dd8 --- /dev/null +++ b/SparkleShare/Windows/SparkleEventLog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index d6f71088..81e18b1c 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -41,6 +41,7 @@ 4 x86 AllRules.ruleset + false none @@ -53,6 +54,7 @@ + @@ -65,6 +67,7 @@ 3.5 + @@ -76,7 +79,9 @@ True GlobalAssemblyInfo.tt + + True True @@ -109,11 +114,16 @@ - - + + Form + + + SparkleEventLog.cs + + @@ -139,11 +149,6 @@ - - False - .NET Framework 3.5 SP1 Client Profile - false - False .NET Framework 2.0 %28x86%29 @@ -159,11 +164,6 @@ .NET Framework 3.5 false - - False - .NET Framework 3.5 SP1 - false - @@ -199,6 +199,11 @@ SparkleAbout.cs + Designer + + + SparkleEventLog.cs + Designer diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 62b4e697..1e545758 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -215,8 +215,8 @@ namespace SparkleShare { if (SparkleUI.EventLog == null) SparkleUI.EventLog = new SparkleEventLog (); - SparkleUI.EventLog.ShowAll (); - SparkleUI.EventLog.Present (); + SparkleUI.EventLog.Show (); + SparkleUI.EventLog.BringToFront (); }; Menu.Items.Add (recent_events_item); diff --git a/SparkleShare/Windows/SparkleUIHelpers.cs b/SparkleShare/Windows/SparkleUIHelpers.cs new file mode 100644 index 00000000..52705c15 --- /dev/null +++ b/SparkleShare/Windows/SparkleUIHelpers.cs @@ -0,0 +1,73 @@ +// SparkleShare, a collaboration and sharing tool. +// 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 Gtk; +using SparkleLib; +using System; +using System.IO; +using System.Net; +using System.Security.Cryptography; +using System.Text; + +namespace SparkleShare { + + public static class SparkleUIHelpers { + + // Creates an MD5 hash of input + public static string GetMD5 (string s) + { + MD5 md5 = new MD5CryptoServiceProvider (); + Byte[] bytes = ASCIIEncoding.Default.GetBytes (s); + Byte[] encodedBytes = md5.ComputeHash (bytes); + return BitConverter.ToString (encodedBytes).ToLower ().Replace ("-", ""); + } + + + // Looks up an icon from the system's theme + public static Gdk.Pixbuf GetIcon (string name, int size) + { + IconTheme icon_theme = new IconTheme (); + icon_theme.AppendSearchPath (SparklePaths.SparkleIconPath); + icon_theme.AppendSearchPath (SparklePaths.SparkleLocalIconPath); + + try { + return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); + } catch { + try { + return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); + } catch { + return null; + } + } + } + + + // Converts a Gdk RGB color to a hex value. + // Example: from "rgb:0,0,0" to "#000000" + public static string GdkColorToHex (Gdk.Color color) + { + return String.Format ("#{0:X2}{1:X2}{2:X2}", + (int) Math.Truncate (color.Red / 256.00), + (int) Math.Truncate (color.Green / 256.00), + (int) Math.Truncate (color.Blue / 256.00)); + } + + public static string ToHex (this System.Drawing.Color color) + { + return String.Format ("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B); + } + } +} diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleWinController.cs index 9cec97a4..202cc4e9 100644 --- a/SparkleShare/Windows/SparkleWinController.cs +++ b/SparkleShare/Windows/SparkleWinController.cs @@ -24,6 +24,7 @@ using System.Text; using System.Threading; using System.Text.RegularExpressions; using System.Windows.Forms; +using CefSharp; namespace SparkleShare { @@ -35,6 +36,17 @@ namespace SparkleShare { public override void Initialize () { + Settings settings = new Settings (); + BrowserSettings browserSettings = new BrowserSettings (); + + if (!CEF.Initialize (settings, browserSettings)) { + Console.WriteLine ("Couldn't initialise CEF"); + return; + } + + CEF.RegisterScheme ("application", "sparkleshare", new ApplicationSchemeHandlerFactory ()); + CEF.RegisterScheme ("application", "file", new FileSchemeHandlerFactory ()); + Application.EnableVisualStyles (); Application.SetCompatibleTextRenderingDefault (false); @@ -57,9 +69,47 @@ namespace SparkleShare { base.Initialize (); } - public override string EventLogHTML { get { return ""; } } - public override string DayEntryHTML { get { return ""; } } - public override string EventEntryHTML { get { return ""; } } + public override string EventLogHTML + { + get + { + string html = Properties.Resources.event_log_html; + + html = html.Replace ("", "application://sparkleshare/jquery.js"); + + return html; + } + } + + + public override string DayEntryHTML + { + get + { + return Properties.Resources.day_entry_html; + } + } + + + public override string EventEntryHTML + { + get + { + return Properties.Resources.event_entry_html; + } + } + + public override string GetAvatar (string email, int size) + { + if (string.IsNullOrEmpty (email)) { + return "application://sparkleshare/avatar-default-32.png"; + } + string avatar_file_path = SparkleHelpers.CombineMore ( + SparklePaths.SparkleLocalIconPath, size + "x" + size, "status", "avatar-" + email); + + return avatar_file_path; + } + // Creates a .desktop entry in autostart folder to // start SparkleShare automatically at login From 408c2852436712f9c7413c1a60e992a3ad44f8d2 Mon Sep 17 00:00:00 2001 From: wimh Date: Thu, 4 Aug 2011 22:33:02 +0200 Subject: [PATCH 022/134] fix handling of paths to be able to clone a github repo (#7) --- SparkleShare/SparkleController.cs | 5 +++-- SparkleShare/SparkleSetupController.cs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 48ad7606..3b2e2063 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -964,7 +964,8 @@ namespace SparkleShare { Directory.CreateDirectory (SparklePaths.SparkleTmpPath); // Strip the '.git' from the name - string canonical_name = Path.GetFileNameWithoutExtension (remote_folder); + string canonical_name = Regex.Replace (remote_folder, @"\..*$", ""); + canonical_name = Regex.Replace (remote_folder, @"^.*/", ""); string tmp_folder = Path.Combine (SparklePaths.SparkleTmpPath, canonical_name); SparkleFetcherBase fetcher = null; @@ -1009,7 +1010,7 @@ namespace SparkleShare { try { Directory.Move (tmp_folder, target_folder_path); } catch (Exception e) { - SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message); + SparkleHelpers.DebugInfo ("Controller", String.Format ("Error moving folder from {0} to {1}: {2}", tmp_folder, target_folder_path, e.Message)); } SparkleConfig.DefaultConfig.AddFolder (target_folder_name, fetcher.RemoteUrl, backend); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 02cd880e..3b74be7e 100644 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -17,6 +17,7 @@ using System; using System.IO; +using System.Text.RegularExpressions; namespace SparkleShare { @@ -100,7 +101,7 @@ namespace SparkleShare { public void AddPageCompleted (string server, string folder_name) { - this.syncing_folder = Path.GetFileNameWithoutExtension (folder_name); + this.syncing_folder = Regex.Replace (folder_name, @"\..*$", ""); this.previous_server = server; this.previous_folder = folder_name; From a99e5b02886699c11b49e0435f0c8c215d5f18b0 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 6 Aug 2011 23:44:37 +0200 Subject: [PATCH 023/134] convert SparkleSetup to winforms fixed some exceptions during debugging renamed class SparkleShare to Program because of namespace problems (see http://blogs.msdn.com/b/ericlippert/archive/2010/03/09/do-not-name-a-class-the-same-as-its-namespace-part-one.aspx) --- SparkleLib/Git/SparkleRepoGit.cs | 3 + SparkleShare/SparkleController.cs | 21 +- SparkleShare/SparkleSetupController.cs | 22 +- SparkleShare/SparkleUI.cs | 4 +- SparkleShare/Windows/Program.cs | 155 ++++++ SparkleShare/Windows/SparkleEventLog.cs | 18 +- SparkleShare/Windows/SparkleSetup.Designer.cs | 522 ++++++++++++++++++ SparkleShare/Windows/SparkleSetup.cs | 184 ++++++ SparkleShare/Windows/SparkleSetup.resx | 126 +++++ SparkleShare/Windows/SparkleShare.csproj | 19 +- SparkleShare/Windows/SparkleStatusIcon.cs | 34 +- .../Windows/controls/ExampleTextBox.cs | 96 ++++ .../Windows/controls/TablessControl.cs | 21 + 13 files changed, 1180 insertions(+), 45 deletions(-) create mode 100644 SparkleShare/Windows/Program.cs create mode 100644 SparkleShare/Windows/SparkleSetup.Designer.cs create mode 100644 SparkleShare/Windows/SparkleSetup.cs create mode 100644 SparkleShare/Windows/SparkleSetup.resx create mode 100644 SparkleShare/Windows/controls/ExampleTextBox.cs create mode 100644 SparkleShare/Windows/controls/TablessControl.cs diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 64bf45bb..94dd567e 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -45,6 +45,9 @@ namespace SparkleLib { string output = git.StandardOutput.ReadToEnd (); git.WaitForExit (); + if (output.Length < 40) + return null; + return output.Substring (0, 40); } } diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 469e2aeb..00de52bb 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -41,7 +41,7 @@ namespace SparkleShare { public delegate void OnQuitWhileSyncingEventHandler (); public event FolderFetchedEventHandler FolderFetched; - public delegate void FolderFetchedEventHandler (); + public delegate void FolderFetchedEventHandler (string target_folder_name); public event FolderFetchErrorEventHandler FolderFetchError; public delegate void FolderFetchErrorEventHandler (); @@ -873,8 +873,10 @@ namespace SparkleShare { // Create an easily accessible copy of the public // key in the user's SparkleShare folder - File.Copy (key_file_path + ".pub", - Path.Combine (SparklePath, UserName + "'s key.txt")); + string PublicKeyCopy = Path.Combine (SparklePath, UserName + "'s key.txt"); + if (File.Exists (PublicKeyCopy)) + File.Delete (PublicKeyCopy); + File.Copy (key_file_path + ".pub", PublicKeyCopy); }; process.Start (); @@ -882,10 +884,14 @@ namespace SparkleShare { } } - + private bool FetchingAvatars = false; // Gets the avatar for a specific email address and size public void FetchAvatars (List emails, int size) { + if (FetchingAvatars) + return; + FetchingAvatars = true; + List old_avatars = new List (); bool avatar_fetched = false; string avatar_path = SparkleHelpers.CombineMore ( @@ -935,6 +941,7 @@ namespace SparkleShare { } } } + FetchingAvatars = false; // Fetch new versions of the avatars that we // deleted because they were too old @@ -964,7 +971,9 @@ namespace SparkleShare { Directory.CreateDirectory (SparklePaths.SparkleTmpPath); // Strip the '.git' from the name - string canonical_name = Path.GetFileNameWithoutExtension (remote_folder); + string canonical_name = Regex.Replace (remote_folder, @"\..*$", ""); + canonical_name = Regex.Replace (remote_folder, @"^.*/", ""); + string tmp_folder = Path.Combine (SparklePaths.SparkleTmpPath, canonical_name); SparkleFetcherBase fetcher = null; @@ -1016,7 +1025,7 @@ namespace SparkleShare { AddRepository (target_folder_path); if (FolderFetched != null) - FolderFetched (); + FolderFetched (target_folder_name); FolderSize = GetFolderSize (); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 02cd880e..1ca4f9cc 100644 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -87,11 +87,11 @@ namespace SparkleShare { public void SetupPageCompleted (string full_name, string email) { - SparkleShare.Controller.UserName = full_name; - SparkleShare.Controller.UserEmail = email; + Program.Controller.UserName = full_name; + Program.Controller.UserEmail = email; - SparkleShare.Controller.GenerateKeyPair (); - SparkleShare.Controller.UpdateState (); + Program.Controller.GenerateKeyPair (); + Program.Controller.UpdateState (); if (ChangePageEvent != null) ChangePageEvent (PageType.Add); @@ -100,28 +100,28 @@ namespace SparkleShare { public void AddPageCompleted (string server, string folder_name) { - this.syncing_folder = Path.GetFileNameWithoutExtension (folder_name); + this.syncing_folder = folder_name; this.previous_server = server; this.previous_folder = folder_name; if (ChangePageEvent != null) ChangePageEvent (PageType.Syncing); - SparkleShare.Controller.FolderFetched += delegate { + Program.Controller.FolderFetched += (target_folder_name) => { + this.syncing_folder = target_folder_name; + if (ChangePageEvent != null) ChangePageEvent (PageType.Finished); - - this.syncing_folder = ""; }; - SparkleShare.Controller.FolderFetchError += delegate { + Program.Controller.FolderFetchError += delegate { if (ChangePageEvent != null) ChangePageEvent (PageType.Error); this.syncing_folder = ""; }; - SparkleShare.Controller.FetchFolder (server, this.syncing_folder); + Program.Controller.FetchFolder (server, this.syncing_folder); } @@ -136,7 +136,7 @@ namespace SparkleShare { { this.previous_server = ""; this.previous_folder = ""; - SparkleShare.Controller.UpdateState (); + Program.Controller.UpdateState (); } } } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 501dfb56..be71eb2e 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -72,12 +72,12 @@ namespace SparkleShare { // Create the statusicon StatusIcon = new SparkleStatusIcon (); - if (SparkleShare.Controller.FirstRun) { + if (Program.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } - SparkleShare.Controller.OnQuitWhileSyncing += delegate { + Program.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; } diff --git a/SparkleShare/Windows/Program.cs b/SparkleShare/Windows/Program.cs new file mode 100644 index 00000000..4cfc6896 --- /dev/null +++ b/SparkleShare/Windows/Program.cs @@ -0,0 +1,155 @@ +// SparkleShare, a collaboration and sharing tool. +// 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 System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +using SparkleLib; +using SparkleLib.Options; + +namespace SparkleShare { + + // This is SparkleShare! + // http://blogs.msdn.com/b/ericlippert/archive/2010/03/09/do-not-name-a-class-the-same-as-its-namespace-part-one.aspx + public class Program { + + public static SparkleController Controller; + public static SparkleUI UI; + + + // Short alias for the translations + public static string _ (string s) + { + return s; + } + + [STAThread] + public static void Main (string [] args) + { + // Don't allow running as root on Linux or Mac + if ((SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX) && + new Mono.Unix.UnixUserInfo (Mono.Unix.UnixEnvironment.UserName).UserId == 0) { + + Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); + Console.WriteLine (_("Things would go utterly wrong.")); + Environment.Exit (-1); + } + + // Parse the command line options + bool show_help = false; + OptionSet option_set = new OptionSet () { + { "v|version", _("Print version information"), v => { PrintVersion (); } }, + { "h|help", _("Show this help text"), v => show_help = v != null } + }; + + try { + option_set.Parse (args); + + } catch (OptionException e) { + Console.Write ("SparkleShare: "); + Console.WriteLine (e.Message); + Console.WriteLine ("Try `sparkleshare --help' for more information."); + } + + if (show_help) + ShowHelp (option_set); + + // Load the right controller for the OS + string controller_name = "Lin"; + switch (SparkleBackend.Platform) { + case PlatformID.Unix: + SetProcessName ("sparkleshare"); + break; + case PlatformID.MacOSX: + controller_name = "Mac"; + break; + case PlatformID.Win32NT: + controller_name = "Win"; + break; + } + + // Initialize the controller this way so that + // there aren't any exceptions in the OS specific UI's + Controller = (SparkleController) Activator.CreateInstance ( + Type.GetType ("SparkleShare.Sparkle" + controller_name + "Controller")); + + Controller.Initialize (); + + if (Controller != null) { + UI = new SparkleUI (); + UI.Run (); + } + } + + + // Prints the help output + public static void ShowHelp (OptionSet option_set) + { + Console.WriteLine (" "); + Console.WriteLine (_("SparkleShare, a collaboration and sharing tool.")); + Console.WriteLine (_("Copyright (C) 2010 Hylke Bons")); + Console.WriteLine (" "); + Console.WriteLine (_("This program comes with ABSOLUTELY NO WARRANTY.")); + Console.WriteLine (" "); + Console.WriteLine (_("This is free software, and you are welcome to redistribute it ")); + Console.WriteLine (_("under certain conditions. Please read the GNU GPLv3 for details.")); + Console.WriteLine (" "); + Console.WriteLine (_("SparkleShare automatically syncs Git repositories in ")); + Console.WriteLine (_("the ~/SparkleShare folder with their remote origins.")); + Console.WriteLine (" "); + Console.WriteLine (_("Usage: sparkleshare [start|stop|restart] [OPTION]...")); + Console.WriteLine (_("Sync SparkleShare folder with remote repositories.")); + Console.WriteLine (" "); + Console.WriteLine (_("Arguments:")); + + option_set.WriteOptionDescriptions (Console.Out); + Environment.Exit (0); + } + + + // Prints the version information + public static void PrintVersion () + { + Console.WriteLine (_("SparkleShare " + Defines.VERSION)); + Environment.Exit (0); + } + + + // Strange magic needed by SetProcessName () + [DllImport ("libc")] + private static extern int prctl (int option, byte [] arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5); + + + // Sets the Unix process name to 'sparkleshare' instead of 'mono' + private static void SetProcessName (string name) + { + try { + if (prctl (15, Encoding.ASCII.GetBytes (name + "\0"), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) != 0) + throw new ApplicationException ("Error setting process name: " + + Mono.Unix.Native.Stdlib.GetLastError ()); + + } catch (EntryPointNotFoundException) { + Console.WriteLine ("SetProcessName: Entry point not found"); + } + } + } +} diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index dcaaee43..653edad5 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -53,7 +53,7 @@ namespace SparkleShare { this.Icon = Icons.sparkleshare; - this.change_sets = SparkleShare.Controller.GetLog (null); + this.change_sets = Program.Controller.GetLog (null); GenerateHTML (); _browserControl = new CefWebBrowser ("application://sparkleshare/eventlog"); @@ -71,7 +71,7 @@ namespace SparkleShare { this.combo_box.Items.Add (_ ("All Folders")); this.combo_box.Items.Add (""); - foreach (string folder_name in SparkleShare.Controller.Folders) + foreach (string folder_name in Program.Controller.Folders) this.combo_box.Items.Add (folder_name); this.combo_box.SelectedItem = this.combo_box.Items[0]; @@ -89,7 +89,7 @@ namespace SparkleShare { Thread thread = new Thread (new ThreadStart (delegate { Stopwatch watch = new Stopwatch (); watch.Start (); - this.change_sets = SparkleShare.Controller.GetLog (this.selected_log); + this.change_sets = Program.Controller.GetLog (this.selected_log); GenerateHTML (); watch.Stop (); @@ -107,7 +107,10 @@ namespace SparkleShare { private void GenerateHTML () { - HTML = SparkleShare.Controller.GetHTMLLog (this.change_sets); + HTML = Program.Controller.GetHTMLLog (this.change_sets); + + if (HTML == null) + return; HTML = HTML.Replace ("", this.Font.Size + "px"); HTML = HTML.Replace ("", this.Font.Size + "px"); @@ -158,9 +161,12 @@ namespace SparkleShare { Console.WriteLine ("{0} {1}", request.Method, request.Url); if (request.Url.StartsWith ("application://sparkleshare/eventlog")) { - Stream resourceStream = new MemoryStream (Encoding.UTF8.GetPreamble ().Concat (Encoding.UTF8.GetBytes (HTML)).ToArray ()); + Stream resourceStream; + if (HTML != null) + resourceStream = new MemoryStream (Encoding.UTF8.GetPreamble ().Concat (Encoding.UTF8.GetBytes (HTML)).ToArray ()); + else + resourceStream = new MemoryStream (); - //Stream resourceStream = new MemoryStream (Encoding.UTF8.GetBytes (HTML)); requestResponse.RespondWith (resourceStream, "text/html"); } else if (request.Url.StartsWith ("application://file/")) { string Filename = request.Url.Substring ("application://file/".Length); diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs new file mode 100644 index 00000000..e2cd5005 --- /dev/null +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -0,0 +1,522 @@ +namespace SparkleShare { + partial class SparkleSetup { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleSetup)); + this.pictureBox = new System.Windows.Forms.PictureBox (); + this.tabControl = new SparkleShare.controls.TablessControl (); + this.setupPage = new System.Windows.Forms.TabPage (); + this.EmailEntry = new System.Windows.Forms.TextBox (); + this.NameEntry = new System.Windows.Forms.TextBox (); + this.label13 = new System.Windows.Forms.Label (); + this.label12 = new System.Windows.Forms.Label (); + this.label11 = new System.Windows.Forms.Label (); + this.label10 = new System.Windows.Forms.Label (); + this.buttonNext = new System.Windows.Forms.Button (); + this.addPage = new System.Windows.Forms.TabPage (); + this.buttonSync = new System.Windows.Forms.Button (); + this.buttonCancel = new System.Windows.Forms.Button (); + this.label5 = new System.Windows.Forms.Label (); + this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); + this.ServerEntry = new SparkleShare.controls.ExampleTextBox (); + this.radio_button_gnome = new System.Windows.Forms.RadioButton (); + this.radio_button_gitorious = new System.Windows.Forms.RadioButton (); + this.radio_button_github = new System.Windows.Forms.RadioButton (); + this.radio_button_own_server = new System.Windows.Forms.RadioButton (); + this.label4 = new System.Windows.Forms.Label (); + this.syncingPage = new System.Windows.Forms.TabPage (); + this.syncingProgressBar = new System.Windows.Forms.ProgressBar (); + this.buttonFinish = new System.Windows.Forms.Button (); + this.label7 = new System.Windows.Forms.Label (); + this.label6 = new System.Windows.Forms.Label (); + this.errorPage = new System.Windows.Forms.TabPage (); + this.buttonTryAgain = new System.Windows.Forms.Button (); + this.label3 = new System.Windows.Forms.Label (); + this.label2 = new System.Windows.Forms.Label (); + this.label1 = new System.Windows.Forms.Label (); + this.finishedPage = new System.Windows.Forms.TabPage (); + this.label9 = new System.Windows.Forms.Label (); + this.label8 = new System.Windows.Forms.Label (); + this.buttonFinished = new System.Windows.Forms.Button (); + this.buttonOpenFolder = new System.Windows.Forms.Button (); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); + this.tabControl.SuspendLayout (); + this.setupPage.SuspendLayout (); + this.addPage.SuspendLayout (); + this.syncingPage.SuspendLayout (); + this.errorPage.SuspendLayout (); + this.finishedPage.SuspendLayout (); + this.SuspendLayout (); + // + // pictureBox + // + this.pictureBox.Dock = System.Windows.Forms.DockStyle.Left; + this.pictureBox.Location = new System.Drawing.Point (0, 0); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size (150, 407); + this.pictureBox.TabIndex = 1; + this.pictureBox.TabStop = false; + // + // tabControl + // + this.tabControl.Controls.Add (this.setupPage); + this.tabControl.Controls.Add (this.addPage); + this.tabControl.Controls.Add (this.syncingPage); + this.tabControl.Controls.Add (this.errorPage); + this.tabControl.Controls.Add (this.finishedPage); + this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl.Location = new System.Drawing.Point (150, 0); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.Size = new System.Drawing.Size (522, 407); + this.tabControl.TabIndex = 0; + this.tabControl.TabStop = false; + // + // setupPage + // + this.setupPage.Controls.Add (this.EmailEntry); + this.setupPage.Controls.Add (this.NameEntry); + this.setupPage.Controls.Add (this.label13); + this.setupPage.Controls.Add (this.label12); + this.setupPage.Controls.Add (this.label11); + this.setupPage.Controls.Add (this.label10); + this.setupPage.Controls.Add (this.buttonNext); + this.setupPage.Location = new System.Drawing.Point (4, 22); + this.setupPage.Name = "setupPage"; + this.setupPage.Padding = new System.Windows.Forms.Padding (3); + this.setupPage.Size = new System.Drawing.Size (514, 381); + this.setupPage.TabIndex = 0; + this.setupPage.Text = "Setup"; + this.setupPage.UseVisualStyleBackColor = true; + // + // EmailEntry + // + this.EmailEntry.Location = new System.Drawing.Point (157, 135); + this.EmailEntry.Name = "EmailEntry"; + this.EmailEntry.Size = new System.Drawing.Size (275, 20); + this.EmailEntry.TabIndex = 6; + this.EmailEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); + // + // NameEntry + // + this.NameEntry.Location = new System.Drawing.Point (157, 109); + this.NameEntry.Name = "NameEntry"; + this.NameEntry.Size = new System.Drawing.Size (275, 20); + this.NameEntry.TabIndex = 5; + this.NameEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.Location = new System.Drawing.Point (11, 138); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size (41, 13); + this.label13.TabIndex = 4; + this.label13.Text = "Email:"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.Location = new System.Drawing.Point (11, 112); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size (65, 13); + this.label12.TabIndex = 3; + this.label12.Text = "Full name:"; + // + // label11 + // + this.label11.Location = new System.Drawing.Point (11, 44); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size (307, 62); + this.label11.TabIndex = 2; + this.label11.Text = "Before we can create a SparkleShare folder on this computer, we need a few bits o" + + "f information from you.\r\n"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label10.Location = new System.Drawing.Point (8, 18); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size (222, 20); + this.label10.TabIndex = 1; + this.label10.Text = "Welcome to SparkleShare!"; + // + // buttonNext + // + this.buttonNext.Enabled = false; + this.buttonNext.Location = new System.Drawing.Point (431, 350); + this.buttonNext.Name = "buttonNext"; + this.buttonNext.Size = new System.Drawing.Size (75, 23); + this.buttonNext.TabIndex = 0; + this.buttonNext.Text = "Next"; + this.buttonNext.UseVisualStyleBackColor = true; + this.buttonNext.Click += new System.EventHandler (this.buttonNext_Click); + // + // addPage + // + this.addPage.Controls.Add (this.buttonSync); + this.addPage.Controls.Add (this.buttonCancel); + this.addPage.Controls.Add (this.label5); + this.addPage.Controls.Add (this.FolderEntry); + this.addPage.Controls.Add (this.ServerEntry); + this.addPage.Controls.Add (this.radio_button_gnome); + this.addPage.Controls.Add (this.radio_button_gitorious); + this.addPage.Controls.Add (this.radio_button_github); + this.addPage.Controls.Add (this.radio_button_own_server); + this.addPage.Controls.Add (this.label4); + this.addPage.Location = new System.Drawing.Point (4, 22); + this.addPage.Name = "addPage"; + this.addPage.Padding = new System.Windows.Forms.Padding (3); + this.addPage.Size = new System.Drawing.Size (514, 381); + this.addPage.TabIndex = 1; + this.addPage.Text = "Add"; + this.addPage.UseVisualStyleBackColor = true; + // + // buttonSync + // + this.buttonSync.Location = new System.Drawing.Point (431, 355); + this.buttonSync.Name = "buttonSync"; + this.buttonSync.Size = new System.Drawing.Size (75, 23); + this.buttonSync.TabIndex = 9; + this.buttonSync.Text = "Sync"; + this.buttonSync.UseVisualStyleBackColor = true; + this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point (350, 355); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size (75, 23); + this.buttonCancel.TabIndex = 8; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler (this.buttonCancel_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point (96, 254); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size (121, 13); + this.label5.TabIndex = 7; + this.label5.Text = "Folder name (on server):"; + // + // FolderEntry + // + this.FolderEntry.ExampleText = "Folder"; + this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.FolderEntry.Location = new System.Drawing.Point (223, 251); + this.FolderEntry.Name = "FolderEntry"; + this.FolderEntry.Size = new System.Drawing.Size (283, 20); + this.FolderEntry.TabIndex = 6; + this.FolderEntry.TextChanged += new System.EventHandler (this.CheckAddPage); + // + // ServerEntry + // + this.ServerEntry.ExampleText = "address-to-server.com"; + this.ServerEntry.ForeColor = System.Drawing.SystemColors.WindowText; + this.ServerEntry.Location = new System.Drawing.Point (223, 64); + this.ServerEntry.Name = "ServerEntry"; + this.ServerEntry.Size = new System.Drawing.Size (283, 20); + this.ServerEntry.TabIndex = 5; + this.ServerEntry.TextChanged += new System.EventHandler (this.CheckAddPage); + // + // radio_button_gnome + // + this.radio_button_gnome.AutoSize = true; + this.radio_button_gnome.Location = new System.Drawing.Point (12, 213); + this.radio_button_gnome.Name = "radio_button_gnome"; + this.radio_button_gnome.Size = new System.Drawing.Size (123, 17); + this.radio_button_gnome.TabIndex = 4; + this.radio_button_gnome.Text = "The GNOME Project"; + this.radio_button_gnome.UseVisualStyleBackColor = true; + this.radio_button_gnome.CheckedChanged += new System.EventHandler (this.CheckAddPage); + // + // radio_button_gitorious + // + this.radio_button_gitorious.AutoSize = true; + this.radio_button_gitorious.Location = new System.Drawing.Point (12, 161); + this.radio_button_gitorious.Name = "radio_button_gitorious"; + this.radio_button_gitorious.Size = new System.Drawing.Size (66, 17); + this.radio_button_gitorious.TabIndex = 3; + this.radio_button_gitorious.Text = "Gitorious"; + this.radio_button_gitorious.UseVisualStyleBackColor = true; + this.radio_button_gitorious.CheckedChanged += new System.EventHandler (this.CheckAddPage); + // + // radio_button_github + // + this.radio_button_github.AutoSize = true; + this.radio_button_github.Location = new System.Drawing.Point (12, 107); + this.radio_button_github.Name = "radio_button_github"; + this.radio_button_github.Size = new System.Drawing.Size (56, 17); + this.radio_button_github.TabIndex = 2; + this.radio_button_github.Text = "Github"; + this.radio_button_github.UseVisualStyleBackColor = true; + this.radio_button_github.CheckedChanged += new System.EventHandler (this.CheckAddPage); + // + // radio_button_own_server + // + this.radio_button_own_server.AutoSize = true; + this.radio_button_own_server.Checked = true; + this.radio_button_own_server.Location = new System.Drawing.Point (12, 65); + this.radio_button_own_server.Name = "radio_button_own_server"; + this.radio_button_own_server.Size = new System.Drawing.Size (115, 17); + this.radio_button_own_server.TabIndex = 1; + this.radio_button_own_server.TabStop = true; + this.radio_button_own_server.Text = "On my own Server:"; + this.radio_button_own_server.UseVisualStyleBackColor = true; + this.radio_button_own_server.CheckedChanged += new System.EventHandler (this.radio_button_own_server_CheckedChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Location = new System.Drawing.Point (8, 18); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size (240, 20); + this.label4.TabIndex = 0; + this.label4.Text = "Where is your remote folder?"; + // + // syncingPage + // + this.syncingPage.Controls.Add (this.syncingProgressBar); + this.syncingPage.Controls.Add (this.buttonFinish); + this.syncingPage.Controls.Add (this.label7); + this.syncingPage.Controls.Add (this.label6); + this.syncingPage.Location = new System.Drawing.Point (4, 22); + this.syncingPage.Name = "syncingPage"; + this.syncingPage.Size = new System.Drawing.Size (514, 381); + this.syncingPage.TabIndex = 2; + this.syncingPage.Text = "Syncing"; + this.syncingPage.UseVisualStyleBackColor = true; + // + // syncingProgressBar + // + this.syncingProgressBar.Location = new System.Drawing.Point (14, 109); + this.syncingProgressBar.Name = "syncingProgressBar"; + this.syncingProgressBar.Size = new System.Drawing.Size (492, 23); + this.syncingProgressBar.TabIndex = 3; + // + // buttonFinish + // + this.buttonFinish.Enabled = false; + this.buttonFinish.Location = new System.Drawing.Point (431, 350); + this.buttonFinish.Name = "buttonFinish"; + this.buttonFinish.Size = new System.Drawing.Size (75, 23); + this.buttonFinish.TabIndex = 2; + this.buttonFinish.Text = "Finish"; + this.buttonFinish.UseVisualStyleBackColor = true; + this.buttonFinish.Click += new System.EventHandler (this.buttonFinish_Click); + // + // label7 + // + this.label7.Location = new System.Drawing.Point (11, 44); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size (307, 62); + this.label7.TabIndex = 1; + this.label7.Text = "This may take a while.\r\nAre you sure its not coffee o\'clock?\r\n"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label6.Location = new System.Drawing.Point (8, 18); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size (123, 20); + this.label6.TabIndex = 0; + this.label6.Text = "Syncing folder"; + // + // errorPage + // + this.errorPage.Controls.Add (this.buttonTryAgain); + this.errorPage.Controls.Add (this.label3); + this.errorPage.Controls.Add (this.label2); + this.errorPage.Controls.Add (this.label1); + this.errorPage.Location = new System.Drawing.Point (4, 22); + this.errorPage.Name = "errorPage"; + this.errorPage.Size = new System.Drawing.Size (514, 381); + this.errorPage.TabIndex = 3; + this.errorPage.Text = "Error"; + this.errorPage.UseVisualStyleBackColor = true; + // + // buttonTryAgain + // + this.buttonTryAgain.Location = new System.Drawing.Point (431, 350); + this.buttonTryAgain.Name = "buttonTryAgain"; + this.buttonTryAgain.Size = new System.Drawing.Size (75, 23); + this.buttonTryAgain.TabIndex = 3; + this.buttonTryAgain.Text = "Try Again"; + this.buttonTryAgain.UseVisualStyleBackColor = true; + this.buttonTryAgain.Click += new System.EventHandler (this.buttonTryAgain_Click); + // + // label3 + // + this.label3.Location = new System.Drawing.Point (11, 106); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size (307, 129); + this.label3.TabIndex = 2; + this.label3.Text = resources.GetString ("label3.Text"); + // + // label2 + // + this.label2.Location = new System.Drawing.Point (11, 44); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size (307, 62); + this.label2.TabIndex = 1; + this.label2.Text = "We don\'t know exactly what the problem is, but we can try to help you pinpoint it" + + "."; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label1.Location = new System.Drawing.Point (8, 18); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size (191, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Something went wrong"; + // + // finishedPage + // + this.finishedPage.Controls.Add (this.label9); + this.finishedPage.Controls.Add (this.label8); + this.finishedPage.Controls.Add (this.buttonFinished); + this.finishedPage.Controls.Add (this.buttonOpenFolder); + this.finishedPage.Location = new System.Drawing.Point (4, 22); + this.finishedPage.Name = "finishedPage"; + this.finishedPage.Size = new System.Drawing.Size (514, 381); + this.finishedPage.TabIndex = 4; + this.finishedPage.Text = "Finished"; + this.finishedPage.UseVisualStyleBackColor = true; + // + // label9 + // + this.label9.Location = new System.Drawing.Point (11, 44); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size (307, 62); + this.label9.TabIndex = 3; + this.label9.Text = "Access the synced files from your SparkleShare folder."; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label8.Location = new System.Drawing.Point (8, 18); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size (228, 20); + this.label8.TabIndex = 2; + this.label8.Text = "Folder synced successfully!"; + // + // buttonFinished + // + this.buttonFinished.Location = new System.Drawing.Point (431, 350); + this.buttonFinished.Name = "buttonFinished"; + this.buttonFinished.Size = new System.Drawing.Size (75, 23); + this.buttonFinished.TabIndex = 1; + this.buttonFinished.Text = "Finish"; + this.buttonFinished.UseVisualStyleBackColor = true; + this.buttonFinished.Click += new System.EventHandler (this.buttonFinished_Click); + // + // buttonOpenFolder + // + this.buttonOpenFolder.Location = new System.Drawing.Point (350, 350); + this.buttonOpenFolder.Name = "buttonOpenFolder"; + this.buttonOpenFolder.Size = new System.Drawing.Size (75, 23); + this.buttonOpenFolder.TabIndex = 0; + this.buttonOpenFolder.Text = "Open Folder"; + this.buttonOpenFolder.UseVisualStyleBackColor = true; + this.buttonOpenFolder.Click += new System.EventHandler (this.buttonOpenFolder_Click); + // + // SparkleSetup + // + this.ClientSize = new System.Drawing.Size (672, 407); + this.Controls.Add (this.tabControl); + this.Controls.Add (this.pictureBox); + this.Name = "SparkleSetup"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SparkleShare Setup"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleSetup_FormClosing); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit (); + this.tabControl.ResumeLayout (false); + this.setupPage.ResumeLayout (false); + this.setupPage.PerformLayout (); + this.addPage.ResumeLayout (false); + this.addPage.PerformLayout (); + this.syncingPage.ResumeLayout (false); + this.syncingPage.PerformLayout (); + this.errorPage.ResumeLayout (false); + this.errorPage.PerformLayout (); + this.finishedPage.ResumeLayout (false); + this.finishedPage.PerformLayout (); + this.ResumeLayout (false); + + } + + #endregion + + private SparkleShare.controls.TablessControl tabControl; + private System.Windows.Forms.TabPage setupPage; + private System.Windows.Forms.TabPage addPage; + private System.Windows.Forms.TabPage syncingPage; + private System.Windows.Forms.TabPage errorPage; + private System.Windows.Forms.TabPage finishedPage; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.RadioButton radio_button_gnome; + private System.Windows.Forms.RadioButton radio_button_gitorious; + private System.Windows.Forms.RadioButton radio_button_github; + private System.Windows.Forms.RadioButton radio_button_own_server; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button buttonSync; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Label label5; + private SparkleShare.controls.ExampleTextBox FolderEntry; + private SparkleShare.controls.ExampleTextBox ServerEntry; + private System.Windows.Forms.PictureBox pictureBox; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Button buttonFinish; + private System.Windows.Forms.ProgressBar syncingProgressBar; + private System.Windows.Forms.Button buttonTryAgain; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button buttonFinished; + private System.Windows.Forms.Button buttonOpenFolder; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Button buttonNext; + private System.Windows.Forms.TextBox EmailEntry; + private System.Windows.Forms.TextBox NameEntry; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label12; + + + + + } +} diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs new file mode 100644 index 00000000..84656d57 --- /dev/null +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -0,0 +1,184 @@ +// SparkleShare, a collaboration and sharing tool. +// 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 private 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 private License for more details. +// +// You should have received a copy of the GNU General private License +// along with this program. If not, see . + + +using System; +using System.Diagnostics; +using System.IO; +using System.Text.RegularExpressions; +using System.Timers; +using System.Collections.Generic; + +using System.Windows.Forms; +using System.Drawing; + + +namespace SparkleShare { + + public partial class SparkleSetup : Form { + + public SparkleSetupController Controller = new SparkleSetupController (); + + // Short alias for the translations + public static string _ (string s) + { + return s; + } + + + public SparkleSetup () + { + InitializeComponent (); + + pictureBox.Image = Icons.side_splash; + this.ClientSize = new Size (this.ClientSize.Width, Icons.side_splash.Size.Height); + this.Icon = Icons.sparkleshare; + + Controller.ChangePageEvent += delegate (PageType type) { + tabControl.SafeInvoke ((Action)delegate { + switch (type) { + case PageType.Add: + tabControl.SelectedIndex = 1; + if (!string.IsNullOrEmpty (Controller.PreviousServer)) + ServerEntry.Text = Controller.PreviousServer; + else + ServerEntry.Text = ""; + FolderEntry.Text = ""; + radio_button_own_server.Checked = true; + //CheckAddPage (null, null); + Show (); + break; + case PageType.Error: + tabControl.SelectedIndex = 3; + Show (); + break; + case PageType.Finished: + tabControl.SelectedIndex = 4; + Show (); + break; + case PageType.Setup: + tabControl.SelectedIndex = 0; + NameEntry.Text = Program.Controller.UserName; + Show (); + break; + case PageType.Syncing: + tabControl.SelectedIndex = 2; + Show (); + break; + } + }); + }; + } + + private void SparkleSetup_FormClosing (object sender, FormClosingEventArgs e) + { + e.Cancel = true; + this.Hide (); + } + + private void buttonCancel_Click (object sender, EventArgs e) + { + this.Hide (); + } + + private void buttonSync_Click (object sender, EventArgs e) + { + string server = ServerEntry.Text; + string folder_name = FolderEntry.Text; + + if (radio_button_gitorious.Checked) + server = "gitorious.org"; + + if (radio_button_github.Checked) + server = "github.com"; + + if (radio_button_gnome.Checked) + server = "gnome.org"; + + Controller.AddPageCompleted (server, folder_name); + } + + private void CheckAddPage (object sender, EventArgs e) + { + buttonSync.Enabled = false; + + if (radio_button_own_server.Checked) + FolderEntry.ExampleText = _ ("Folder"); + else if (radio_button_github.Checked) + FolderEntry.ExampleText = _ ("Username/Folder"); + else if (radio_button_gitorious.Checked) + FolderEntry.ExampleText = _ ("Project/Folder"); + else if(radio_button_gnome.Checked) + FolderEntry.ExampleText = _ ("Project"); + + // Enables or disables the 'Next' button depending on the + // entries filled in by the user + buttonSync.Enabled = false; + if (!String.IsNullOrEmpty (FolderEntry.Text)) { + if (!radio_button_own_server.Checked || !String.IsNullOrEmpty (ServerEntry.Text)) + buttonSync.Enabled = true; + } + } + + private void radio_button_own_server_CheckedChanged (object sender, EventArgs e) + { + ServerEntry.Enabled = radio_button_own_server.Checked; + CheckAddPage (sender,e); + } + + private void buttonFinish_Click (object sender, EventArgs e) + { + this.Hide (); + } + + private void buttonTryAgain_Click (object sender, EventArgs e) + { + Controller.ErrorPageCompleted (); + } + + private void buttonFinished_Click (object sender, EventArgs e) + { + this.Hide (); + } + + private void buttonOpenFolder_Click (object sender, EventArgs e) + { + Program.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); + } + + private void buttonNext_Click (object sender, EventArgs e) + { + string full_name = NameEntry.Text; + string email = EmailEntry.Text; + + Controller.SetupPageCompleted (full_name, email); + } + + private void CheckSetupPage (object sender, EventArgs e) + { + // Enables or disables the 'Next' button depending on the + // entries filled in by the user + if (!String.IsNullOrEmpty(NameEntry.Text) && + Program.Controller.IsValidEmail (EmailEntry.Text)) { + + buttonNext.Enabled = true; + } else { + buttonNext.Enabled = false; + } + } + + } +} diff --git a/SparkleShare/Windows/SparkleSetup.resx b/SparkleShare/Windows/SparkleSetup.resx new file mode 100644 index 00000000..a82557eb --- /dev/null +++ b/SparkleShare/Windows/SparkleSetup.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + First, have you tried turning it off and on again? is the address we've compiled {Controller.SyncingFolder} from the information you entered. Does this look correct? + +The host needs to know who you are. Have you uploaded the key that sits in your SparkleShare folder? + + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 81e18b1c..d1b6761d 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -81,6 +81,9 @@ + + Component + True @@ -107,10 +110,7 @@ Form - - - @@ -122,9 +122,19 @@ SparkleEventLog.cs + + Form + + + SparkleSetup.cs + + + + Component + @@ -205,6 +215,9 @@ SparkleEventLog.cs Designer + + SparkleSetup.cs + diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 1e545758..ee408a82 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -56,7 +56,7 @@ namespace SparkleShare { CreateMenu (); SetNormalState (); - SparkleShare.Controller.FolderSizeChanged += delegate { + Program.Controller.FolderSizeChanged += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { if (!Animation.Enabled) SetNormalState (); @@ -65,28 +65,28 @@ namespace SparkleShare { }); }; - SparkleShare.Controller.FolderListChanged += delegate { + Program.Controller.FolderListChanged += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { SetNormalState (); CreateMenu (); }); }; - SparkleShare.Controller.OnIdle += delegate { + Program.Controller.OnIdle += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { SetNormalState (); UpdateMenu (); }); }; - SparkleShare.Controller.OnSyncing += delegate { + Program.Controller.OnSyncing += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { SetAnimationState (); UpdateMenu (); }); }; - SparkleShare.Controller.OnError += delegate { + Program.Controller.OnError += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { SetNormalState (true); UpdateMenu (); @@ -151,18 +151,18 @@ namespace SparkleShare { }; folder_item.Click += delegate { - SparkleShare.Controller.OpenSparkleShareFolder (); + Program.Controller.OpenSparkleShareFolder (); }; Menu.Items.Add (folder_item); - if (SparkleShare.Controller.Folders.Count > 0) { + if (Program.Controller.Folders.Count > 0) { // Creates a menu item for each repository with a link to their logs - foreach (string folder_name in SparkleShare.Controller.Folders) { + foreach (string folder_name in Program.Controller.Folders) { Bitmap folder_icon; - if (SparkleShare.Controller.UnsyncedFolders.Contains (folder_name)) { + if (Program.Controller.UnsyncedFolders.Contains (folder_name)) { folder_icon = Icons.dialog_error_16; } else { folder_icon = Icons.sparkleshare_windows_status; @@ -189,7 +189,7 @@ namespace SparkleShare { // Opens the wizard to add a new remote folder ToolStripMenuItem sync_item = new ToolStripMenuItem (_ ("Add Remote Folder…")); - if (SparkleShare.Controller.FirstRun) + if (Program.Controller.FirstRun) sync_item.Enabled = false; sync_item.Click += delegate { @@ -208,7 +208,7 @@ namespace SparkleShare { ToolStripMenuItem recent_events_item = new ToolStripMenuItem (_ ("Show Recent Events")); - if (SparkleShare.Controller.Folders.Count < 1) + if (Program.Controller.Folders.Count < 1) recent_events_item.Enabled = false; recent_events_item.Click += delegate { @@ -223,13 +223,13 @@ namespace SparkleShare { ToolStripMenuItem notify_item; - if (SparkleShare.Controller.NotificationsEnabled) + if (Program.Controller.NotificationsEnabled) notify_item = new ToolStripMenuItem (_ ("Turn Notifications Off")); else notify_item = new ToolStripMenuItem (_ ("Turn Notifications On")); notify_item.Click += delegate { - SparkleShare.Controller.ToggleNotifications (); + Program.Controller.ToggleNotifications (); CreateMenu (); }; @@ -254,7 +254,7 @@ namespace SparkleShare { ToolStripMenuItem quit_item = new ToolStripMenuItem (_ ("Quit")); quit_item.Click += delegate { - SparkleShare.Controller.Quit (); + Program.Controller.Quit (); }; Menu.Items.Add (quit_item); @@ -268,7 +268,7 @@ namespace SparkleShare { private EventHandler OpenFolderDelegate (string name) { return delegate { - SparkleShare.Controller.OpenSparkleShareFolder (name); + Program.Controller.OpenSparkleShareFolder (name); }; } @@ -291,7 +291,7 @@ namespace SparkleShare { { Animation.Stop (); - if (SparkleShare.Controller.Folders.Count == 0) { + if (Program.Controller.Folders.Count == 0) { StateText = _("Welcome to SparkleShare!"); status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { @@ -306,7 +306,7 @@ namespace SparkleShare { this.status_icon.Icon = Icon.FromHandle (Icons.sparkleshare_syncing_error_24.GetHicon ()); }); } else { - StateText = _("Up to date") + " (" + SparkleShare.Controller.FolderSize + ")"; + StateText = _("Up to date") + " (" + Program.Controller.FolderSize + ")"; status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { this.status_icon.Icon = Icon.FromHandle (AnimationFrames [0].GetHicon ()); }); diff --git a/SparkleShare/Windows/controls/ExampleTextBox.cs b/SparkleShare/Windows/controls/ExampleTextBox.cs new file mode 100644 index 00000000..c054afaf --- /dev/null +++ b/SparkleShare/Windows/controls/ExampleTextBox.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace SparkleShare.controls { + public class ExampleTextBox : TextBox { + + private bool ExampleTextActive = true; + private bool OnTextChangedActive = true; + private bool _focused = false; + + private string _ExampleText = ""; + public string ExampleText + { + get { return _ExampleText; } + set + { + _ExampleText = value; + if (ExampleTextActive) + ActivateExampleText (); + } + } + + public override string Text + { + get + { + if (ExampleTextActive) + return ""; + return base.Text; + } + set + { + if (String.IsNullOrEmpty (value)) { + ActivateExampleText (); + } else { + ExampleTextActive = false; + ForeColor = System.Drawing.SystemColors.WindowText; + base.Text = value; + } + } + } + + private void ActivateExampleText () + { + OnTextChangedActive = false; + base.Text = ExampleText; + OnTextChangedActive = true; + ExampleTextActive = true; + ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + } + + protected override void OnTextChanged (EventArgs e) + { + if (!OnTextChangedActive) + return; + + bool Empty = String.IsNullOrEmpty (base.Text); + if (Empty) { + ActivateExampleText (); + SelectAll (); + } else if (ExampleTextActive) { + ExampleTextActive = false; + ForeColor = System.Drawing.SystemColors.WindowText; + } + base.OnTextChanged (e); + } + + protected override void OnEnter (EventArgs e) + { + base.OnEnter (e); + if (ExampleTextActive && MouseButtons == MouseButtons.None) { + SelectAll (); + _focused = true; + } + } + + protected override void OnLeave (EventArgs e) + { + base.OnLeave (e); + _focused = false; + } + + protected override void OnMouseUp (MouseEventArgs mevent) + { + base.OnMouseUp (mevent); + if (!_focused) { + if (ExampleTextActive && SelectionLength == 0) + SelectAll (); + _focused = true; + } + } + } +} diff --git a/SparkleShare/Windows/controls/TablessControl.cs b/SparkleShare/Windows/controls/TablessControl.cs new file mode 100644 index 00000000..0618f531 --- /dev/null +++ b/SparkleShare/Windows/controls/TablessControl.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace SparkleShare.controls { + public class TablessControl : TabControl { + protected override void WndProc (ref Message m) + { + if (m.Msg == 0x1328 && !DesignMode) + m.Result = (IntPtr)1; + else + base.WndProc (ref m); + } + + } +} From 580ec563b9c15c71215d1a09bd0de5013e145527 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 7 Aug 2011 00:26:23 +0200 Subject: [PATCH 024/134] remove references to gtksharp and mono when compiled under .net --- SparkleLib/SparkleConfig.cs | 14 +++++------ SparkleLib/SparkleFetcherBase.cs | 14 +++++------ SparkleLib/windows/SparkleLib.csproj | 3 +-- SparkleShare/SparkleController.cs | 6 ++++- SparkleShare/SparkleUI.cs | 7 +++++- SparkleShare/Windows/Notification.cs | 4 +-- SparkleShare/Windows/Program.cs | 30 ++++++++++++----------- SparkleShare/Windows/SparkleShare.csproj | 11 --------- SparkleShare/Windows/SparkleUIHelpers.cs | 31 ------------------------ 9 files changed, 43 insertions(+), 77 deletions(-) diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index cb69040a..d6eea46b 100644 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -20,8 +20,9 @@ using System.IO; using System.Collections.Generic; using System.Xml; +#if __MonoCS__ using Mono.Unix; - +#endif namespace SparkleLib { public class SparkleConfig : XmlDocument { @@ -58,18 +59,15 @@ namespace SparkleLib { { string user_name = "Unknown"; - if (SparkleBackend.Platform == PlatformID.Unix || - SparkleBackend.Platform == PlatformID.MacOSX) { - +#if __MonoCS__ user_name = new UnixUserInfo (UnixEnvironment.UserName).RealName; if (string.IsNullOrEmpty (user_name)) user_name = UnixEnvironment.UserName; else user_name = user_name.TrimEnd (",".ToCharArray()); - - } else { - user_name = Environment.UserName; - } +#else + user_name = Environment.UserName; +#endif if (string.IsNullOrEmpty (user_name)) user_name = "Unknown"; diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index 73422d54..6a767add 100644 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -21,7 +21,9 @@ using System.Diagnostics; using System.Text.RegularExpressions; using System.Threading; +#if __MonoCS__ using Mono.Unix; +#endif namespace SparkleLib { @@ -140,12 +142,11 @@ namespace SparkleLib { writer.Close (); } - if ((SparkleBackend.Platform == PlatformID.Unix || - SparkleBackend.Platform == PlatformID.MacOSX)) { - UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); +#if __MonoCS__ + UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | FileAccessPermissions.UserWrite); - } +#endif SparkleHelpers.DebugInfo ("Fetcher", "Disabled host key checking"); } @@ -181,13 +182,12 @@ 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)) { +#if __MonoCS__ UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | FileAccessPermissions.UserWrite); - } +#endif } } diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 0fcd1b7a..0f691e04 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -54,7 +54,6 @@ - False ..\..\bin\Meebey.SmartIrc4net.dll @@ -179,4 +178,4 @@ $(ProjectDir)transform_tt.cmd - + \ No newline at end of file diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 00de52bb..424599cc 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -1092,7 +1092,11 @@ namespace SparkleShare { foreach (SparkleRepoBase repo in Repositories) repo.Dispose (); - Gtk.Application.Quit (); +#if __MonoCS__ + Gtk.Application.Quit (); +#else + System.Windows.Forms.Application.Exit (); +#endif } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index be71eb2e..fa72545e 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -23,7 +23,11 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading; +#if __MonoCS__ using Gtk; +#else +using System.Windows.Forms; +#endif using SparkleLib; namespace SparkleShare { @@ -46,6 +50,7 @@ namespace SparkleShare { public SparkleUI () { // Initialize the application +#if __MonoCS__ Application.Init (); GLib.ExceptionManager.UnhandledException += delegate (GLib.UnhandledExceptionArgs exArgs) { @@ -68,7 +73,7 @@ namespace SparkleShare { ExceptionDialog.Destroy (); }; - +#endif // Create the statusicon StatusIcon = new SparkleStatusIcon (); diff --git a/SparkleShare/Windows/Notification.cs b/SparkleShare/Windows/Notification.cs index 0c2733ec..e7f7bc3e 100644 --- a/SparkleShare/Windows/Notification.cs +++ b/SparkleShare/Windows/Notification.cs @@ -29,7 +29,7 @@ namespace Notifications private int startPosX; private int startPosY; - public new Gdk.Pixbuf Icon; + //public new Gdk.Pixbuf Icon; public Notification () { @@ -72,7 +72,7 @@ namespace Notifications Filename = Path.ChangeExtension (Filename, "bmp"); if (File.Exists (Filename)) File.Delete (Filename); - this.Icon.Save (Filename, "bmp"); + //this.Icon.Save (Filename, "bmp"); using (Stream s = File.OpenRead (Filename)) pictureBox1.Image = Bitmap.FromStream (s); File.Delete (Filename); diff --git a/SparkleShare/Windows/Program.cs b/SparkleShare/Windows/Program.cs index 4cfc6896..6f915a3b 100644 --- a/SparkleShare/Windows/Program.cs +++ b/SparkleShare/Windows/Program.cs @@ -45,14 +45,14 @@ namespace SparkleShare { public static void Main (string [] args) { // Don't allow running as root on Linux or Mac - if ((SparkleBackend.Platform == PlatformID.Unix || - SparkleBackend.Platform == PlatformID.MacOSX) && - new Mono.Unix.UnixUserInfo (Mono.Unix.UnixEnvironment.UserName).UserId == 0) { +#if __MonoCS__ + if (new Mono.Unix.UnixUserInfo (Mono.Unix.UnixEnvironment.UserName).UserId == 0) { Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); Console.WriteLine (_("Things would go utterly wrong.")); Environment.Exit (-1); } +#endif // Parse the command line options bool show_help = false; @@ -76,15 +76,15 @@ namespace SparkleShare { // Load the right controller for the OS string controller_name = "Lin"; switch (SparkleBackend.Platform) { - case PlatformID.Unix: - SetProcessName ("sparkleshare"); - break; - case PlatformID.MacOSX: - controller_name = "Mac"; - break; - case PlatformID.Win32NT: - controller_name = "Win"; - break; + case PlatformID.Unix: + SetProcessName ("sparkleshare"); + break; + case PlatformID.MacOSX: + controller_name = "Mac"; + break; + case PlatformID.Win32NT: + controller_name = "Win"; + break; } // Initialize the controller this way so that @@ -133,15 +133,16 @@ namespace SparkleShare { Environment.Exit (0); } - +#if __MonoCS__ // Strange magic needed by SetProcessName () [DllImport ("libc")] private static extern int prctl (int option, byte [] arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5); - +#endif // Sets the Unix process name to 'sparkleshare' instead of 'mono' private static void SetProcessName (string name) { +#if __MonoCS__ try { if (prctl (15, Encoding.ASCII.GetBytes (name + "\0"), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) != 0) throw new ApplicationException ("Error setting process name: " + @@ -150,6 +151,7 @@ namespace SparkleShare { } catch (EntryPointNotFoundException) { Console.WriteLine ("SetProcessName: Entry point not found"); } +#endif } } } diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index d1b6761d..ad8f1282 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -53,17 +53,8 @@ - - - - - - - - - 3.5 @@ -111,9 +102,7 @@ Form - - diff --git a/SparkleShare/Windows/SparkleUIHelpers.cs b/SparkleShare/Windows/SparkleUIHelpers.cs index 52705c15..c9252e3f 100644 --- a/SparkleShare/Windows/SparkleUIHelpers.cs +++ b/SparkleShare/Windows/SparkleUIHelpers.cs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -using Gtk; using SparkleLib; using System; using System.IO; @@ -35,36 +34,6 @@ namespace SparkleShare { return BitConverter.ToString (encodedBytes).ToLower ().Replace ("-", ""); } - - // Looks up an icon from the system's theme - public static Gdk.Pixbuf GetIcon (string name, int size) - { - IconTheme icon_theme = new IconTheme (); - icon_theme.AppendSearchPath (SparklePaths.SparkleIconPath); - icon_theme.AppendSearchPath (SparklePaths.SparkleLocalIconPath); - - try { - return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); - } catch { - try { - return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); - } catch { - return null; - } - } - } - - - // Converts a Gdk RGB color to a hex value. - // Example: from "rgb:0,0,0" to "#000000" - public static string GdkColorToHex (Gdk.Color color) - { - return String.Format ("#{0:X2}{1:X2}{2:X2}", - (int) Math.Truncate (color.Red / 256.00), - (int) Math.Truncate (color.Green / 256.00), - (int) Math.Truncate (color.Blue / 256.00)); - } - public static string ToHex (this System.Drawing.Color color) { return String.Format ("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B); From 239d41f12157fd66c74ae11daeaee17ef6244bf3 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 7 Aug 2011 01:06:09 +0200 Subject: [PATCH 025/134] fix some issues on close + cleanup --- SparkleShare/SparkleAboutController.cs | 32 +++++++++++------------ SparkleShare/SparkleController.cs | 3 ++- SparkleShare/SparkleUI.cs | 1 + SparkleShare/Windows/SparkleAbout.cs | 8 ++++-- SparkleShare/Windows/SparkleEventLog.cs | 8 ++++-- SparkleShare/Windows/SparkleSetup.cs | 8 ++++-- SparkleShare/Windows/SparkleStatusIcon.cs | 11 +++++++- 7 files changed, 47 insertions(+), 24 deletions(-) diff --git a/SparkleShare/SparkleAboutController.cs b/SparkleShare/SparkleAboutController.cs index 5495dfc9..d35f78eb 100644 --- a/SparkleShare/SparkleAboutController.cs +++ b/SparkleShare/SparkleAboutController.cs @@ -68,24 +68,24 @@ namespace SparkleShare { Uri uri = new Uri ("http://www.sparkleshare.org/version"); web_client.DownloadStringCompleted += delegate (object o, DownloadStringCompletedEventArgs args) { - if (args.Error != null) - return; - - string new_version = args.Result.Trim (); - - // Add a little delay, making it seems we're - // actually doing hard work - Thread.Sleep (2 * 1000); - - if (RunningVersion.Equals (new_version)) { - if (VersionUpToDateEvent != null) - VersionUpToDateEvent (); - + if (args.Error != null) { + Console.WriteLine ("Error during version check: {0}", args.Error.Message); } else { - if (NewVersionEvent != null) - NewVersionEvent (new_version); - } + string new_version = args.Result.Trim (); + // Add a little delay, making it seems we're + // actually doing hard work + Thread.Sleep (2 * 1000); + + if (RunningVersion.Equals (new_version)) { + if (VersionUpToDateEvent != null) + VersionUpToDateEvent (); + + } else { + if (NewVersionEvent != null) + NewVersionEvent (new_version); + } + } this.version_checker.Start (); }; diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 424599cc..112081b6 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -145,7 +145,7 @@ namespace SparkleShare { } }; - new Thread (new ThreadStart (PopulateRepositories)).Start (); + PopulateRepositories(); } @@ -1091,6 +1091,7 @@ namespace SparkleShare { { foreach (SparkleRepoBase repo in Repositories) repo.Dispose (); + Repositories = null; #if __MonoCS__ Gtk.Application.Quit (); diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index fa72545e..f552a530 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -91,6 +91,7 @@ namespace SparkleShare { public void Run () { Application.Run (); + StatusIcon.Dispose (); } } } diff --git a/SparkleShare/Windows/SparkleAbout.cs b/SparkleShare/Windows/SparkleAbout.cs index 7f7825ba..e1c27088 100644 --- a/SparkleShare/Windows/SparkleAbout.cs +++ b/SparkleShare/Windows/SparkleAbout.cs @@ -71,8 +71,12 @@ namespace SparkleShare { private void SparkleAbout_FormClosing (object sender, FormClosingEventArgs e) { - e.Cancel = true; - this.Hide (); + if (e.CloseReason != CloseReason.ApplicationExitCall + && e.CloseReason != CloseReason.TaskManagerClosing + && e.CloseReason != CloseReason.WindowsShutDown) { + e.Cancel = true; + this.Hide (); + } } } } diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index 653edad5..765671d6 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -148,8 +148,12 @@ namespace SparkleShare { private void SparkleEventLog_FormClosing (object sender, FormClosingEventArgs e) { - e.Cancel = true; - this.Hide (); + if (e.CloseReason != CloseReason.ApplicationExitCall + && e.CloseReason != CloseReason.TaskManagerClosing + && e.CloseReason != CloseReason.WindowsShutDown) { + e.Cancel = true; + this.Hide (); + } } diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 84656d57..24e12bb9 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -85,8 +85,12 @@ namespace SparkleShare { private void SparkleSetup_FormClosing (object sender, FormClosingEventArgs e) { - e.Cancel = true; - this.Hide (); + if (e.CloseReason != CloseReason.ApplicationExitCall + && e.CloseReason != CloseReason.TaskManagerClosing + && e.CloseReason != CloseReason.WindowsShutDown) { + e.Cancel = true; + this.Hide (); + } } private void buttonCancel_Click (object sender, EventArgs e) diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index ee408a82..e7be9945 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -26,7 +26,7 @@ namespace SparkleShare { // The statusicon that stays in the // user's notification area - public class SparkleStatusIcon { + public class SparkleStatusIcon : IDisposable { private Timer Animation; private Bitmap [] AnimationFrames; @@ -323,6 +323,15 @@ namespace SparkleShare { if (!Animation.Enabled) Animation.Start (); } + + #region IDisposable Members + + public void Dispose () + { + status_icon.Dispose (); + } + + #endregion } From 9ef53d34de62f829dc2cc59308b5e1f8a05d21e7 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 7 Aug 2011 01:17:33 +0200 Subject: [PATCH 026/134] fix crash at shutdown See https://github.com/chillitom/CefSharp/issues/27 --- SparkleShare/Windows/Program.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SparkleShare/Windows/Program.cs b/SparkleShare/Windows/Program.cs index 6f915a3b..54a104d0 100644 --- a/SparkleShare/Windows/Program.cs +++ b/SparkleShare/Windows/Program.cs @@ -98,6 +98,14 @@ namespace SparkleShare { UI = new SparkleUI (); UI.Run (); } + +#if !__MonoCS__ + // For now we must do GC.Collect to free some internal handles, otherwise + // in debug mode you can got assertion message. + GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced); + GC.WaitForPendingFinalizers (); + CefSharp.CEF.Shutdown (); // Shutdown CEF. +#endif } From 9ebf8c8f988ff6f1dc34782a6ec88e1685d8853c Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 13 Aug 2011 01:33:15 +0200 Subject: [PATCH 027/134] add and integrate submodule TextTemplating (TextTransform.exe) in build --- .gitmodules | 3 +++ SparkleLib/windows/transform_tt.cmd | 13 ++++--------- SparkleShare/Windows/build.cmd | 6 ++++++ tools/TextTemplating | 1 + 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 SparkleShare/Windows/build.cmd create mode 160000 tools/TextTemplating diff --git a/.gitmodules b/.gitmodules index 2d9ee5ea..ad6b3978 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "SmartIrc4net"] path = SmartIrc4net url = git://git.qnetp.net/smartirc4net.git +[submodule "tools/TextTemplating"] + path = tools/TextTemplating + url = git@github.com:wimh/TextTemplating.git diff --git a/SparkleLib/windows/transform_tt.cmd b/SparkleLib/windows/transform_tt.cmd index efcaf908..5b60f53e 100644 --- a/SparkleLib/windows/transform_tt.cmd +++ b/SparkleLib/windows/transform_tt.cmd @@ -1,16 +1,11 @@ @echo off +cd %~dp0 -set common=%CommonProgramFiles(x86)% -if "%common%"=="" set common=%CommonProgramFiles% -set program=%ProgramFiles(x86)% -if "%program%"=="" set program=%ProgramFiles% - -set TextTransform="%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -if not exist %TextTransform% set TextTransform="%common%\Microsoft Shared\TextTemplating\1.2\texttransform.exe" -if not exist %TextTransform% set TextTransform="%program%\MonoDevelop\AddIns\MonoDevelop.TextTemplating\TextTransform.exe" +set TextTransform=..\..\tools\TextTemplating\bin\TextTransform.exe +if not exist %TextTransform% call ..\..\tools\TextTemplating\build.cmd echo running texttransform.. -cd %~dp0 %TextTransform% -out Defines.cs Defines.tt %TextTransform% -out GlobalAssemblyInfo.cs GlobalAssemblyInfo.tt + diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd new file mode 100644 index 00000000..f38f4de7 --- /dev/null +++ b/SparkleShare/Windows/build.cmd @@ -0,0 +1,6 @@ +@echo off +set WinDirNet=%WinDir%\Microsoft.NET\Framework +set msbuild="%WinDirNet%\v3.5\msbuild.exe" +if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" + +%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln diff --git a/tools/TextTemplating b/tools/TextTemplating new file mode 160000 index 00000000..0ca5059e --- /dev/null +++ b/tools/TextTemplating @@ -0,0 +1 @@ +Subproject commit 0ca5059ef76813fe8d380563c5a08fba933e3800 From 2a1368c5f66507f7fa6a81470f03a3f07c2ddad6 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 13 Aug 2011 01:46:47 +0200 Subject: [PATCH 028/134] fix git path --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index ad6b3978..ccaf797a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = git://git.qnetp.net/smartirc4net.git [submodule "tools/TextTemplating"] path = tools/TextTemplating - url = git@github.com:wimh/TextTemplating.git + url = git://github.com/wimh/TextTemplating.git From deafe9c5c429ab66a140f34d4aef1efdc93c6081 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 13 Aug 2011 22:33:48 +0200 Subject: [PATCH 029/134] set PlatformTarget from x86 to AnyCPU --- SparkleLib/windows/SparkleLib.csproj | 2 +- SparkleShare/Windows/SparkleShare.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 0f691e04..206f1a4c 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -40,7 +40,7 @@ prompt 4 false - x86 + AnyCPU AllRules.ruleset diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index ad8f1282..150efd86 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -39,7 +39,7 @@ DEBUG prompt 4 - x86 + AnyCPU AllRules.ruleset false From b55309da0c587f34493e8a608eee4ae18dc203c7 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 13 Aug 2011 23:16:43 +0200 Subject: [PATCH 030/134] Revert "fix handling of paths to be able to clone a github repo (#7)" This reverts commit 590b8e3a38320cb2626494ae2f781e5a99d9abc8. This is fixed slightly different in the winforms branch, so want to revert it for a clean merge. --- SparkleShare/SparkleController.cs | 5 ++--- SparkleShare/SparkleSetupController.cs | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 3b2e2063..48ad7606 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -964,8 +964,7 @@ namespace SparkleShare { Directory.CreateDirectory (SparklePaths.SparkleTmpPath); // Strip the '.git' from the name - string canonical_name = Regex.Replace (remote_folder, @"\..*$", ""); - canonical_name = Regex.Replace (remote_folder, @"^.*/", ""); + string canonical_name = Path.GetFileNameWithoutExtension (remote_folder); string tmp_folder = Path.Combine (SparklePaths.SparkleTmpPath, canonical_name); SparkleFetcherBase fetcher = null; @@ -1010,7 +1009,7 @@ namespace SparkleShare { try { Directory.Move (tmp_folder, target_folder_path); } catch (Exception e) { - SparkleHelpers.DebugInfo ("Controller", String.Format ("Error moving folder from {0} to {1}: {2}", tmp_folder, target_folder_path, e.Message)); + SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message); } SparkleConfig.DefaultConfig.AddFolder (target_folder_name, fetcher.RemoteUrl, backend); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 3b74be7e..02cd880e 100644 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -17,7 +17,6 @@ using System; using System.IO; -using System.Text.RegularExpressions; namespace SparkleShare { @@ -101,7 +100,7 @@ namespace SparkleShare { public void AddPageCompleted (string server, string folder_name) { - this.syncing_folder = Regex.Replace (folder_name, @"\..*$", ""); + this.syncing_folder = Path.GetFileNameWithoutExtension (folder_name); this.previous_server = server; this.previous_folder = folder_name; From 51cb04d363bbb3b590aa4df3cfb9bf01df669b15 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 28 Aug 2011 21:49:04 +0200 Subject: [PATCH 031/134] set PlatformTarget from AnyCPU to x86 CefSharp is win32 only: https://github.com/chillitom/CefSharp/blob/master/CefSharp/CefSharp.vcproj#L11 --- SparkleLib/windows/SparkleLib.csproj | 3 ++- SparkleShare/Windows/SparkleShare.csproj | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 206f1a4c..76e3de80 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -40,7 +40,7 @@ prompt 4 false - AnyCPU + x86 AllRules.ruleset @@ -51,6 +51,7 @@ 4 false AllRules.ruleset + x86 diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 150efd86..e23c68c6 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -39,7 +39,7 @@ DEBUG prompt 4 - AnyCPU + x86 AllRules.ruleset false @@ -50,6 +50,7 @@ prompt 4 AllRules.ruleset + x86 From 77caf67a8d19d88ab3d27cc9d0aa37ca454cb3f7 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 27 Aug 2011 02:42:09 +0200 Subject: [PATCH 032/134] Use 'h' as hour-minute separator, as Windows doesn't allow ':' in file names --- SparkleLib/Git/SparkleRepoGit.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 94dd567e..650e1753 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -321,8 +321,10 @@ namespace SparkleLib { git_theirs.Start (); git_theirs.WaitForExit (); - // Append a timestamp to local version - string timestamp = DateTime.Now.ToString ("HH:mm MMM d"); + // Append a timestamp to local version. + // Windows doesn't allow colons in the file name, so + // we use "h" between the hours and minutes instead. + string timestamp = DateTime.Now.ToString ("HH\\hmm MMM d"); string their_path = conflicting_path + " (" + SparkleConfig.DefaultConfig.UserName + ", " + timestamp + ")"; string abs_conflicting_path = Path.Combine (LocalPath, conflicting_path); string abs_their_path = Path.Combine (LocalPath, their_path); From 0a9aaff4b8ca9a8b0c3f3267ac4fa5055907d471 Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 26 Aug 2011 22:00:33 +0200 Subject: [PATCH 033/134] fix crash if file was renamed remote see #8 (https://github.com/wimh/SparkleShare/issues/8) --- SparkleLib/Git/SparkleRepoGit.cs | 3 ++- SparkleLib/SparkleRepoBase.cs | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 650e1753..57243311 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -494,7 +494,8 @@ namespace SparkleLib { if ((change_set.Added.Count + change_set.Edited.Count + - change_set.Deleted.Count) > 0) { + change_set.Deleted.Count + + change_set.MovedFrom.Count) > 0) { change_set.Notes.AddRange (GetNotes (change_set.Revision)); change_sets.Add (change_set); diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index b782741a..f781d57c 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -442,8 +442,13 @@ namespace SparkleLib { if (SyncStatusChanged != null) SyncStatusChanged (SyncStatus.Idle); - if (NewChangeSet != null) - NewChangeSet (GetChangeSets (1) [0], LocalPath); + List change_sets = GetChangeSets (1); + if (change_sets != null && change_sets.Count > 0) { + SparkleChangeSet change_set = change_sets [0]; + + if (NewChangeSet != null) + NewChangeSet (change_set, LocalPath); + } // There could be changes from a // resolved conflict. Tries only once, From 04b3b43f88f4d6e8bb595b188c17f4e5417a82f0 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 3 Sep 2011 23:38:53 +0200 Subject: [PATCH 034/134] Add ~* to ignored files Fix crash when a conflict has been resolved already --- SparkleLib/Git/SparkleFetcherGit.cs | 1 + SparkleLib/Git/SparkleRepoGit.cs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index 390053c1..b8e6a75e 100644 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -168,6 +168,7 @@ namespace SparkleLib { // Windows writer.WriteLine ("Thumbs.db"); writer.WriteLine ("Desktop.ini"); + writer.WriteLine ("~*"); // CVS writer.WriteLine ("*/CVS/*"); diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 57243311..0b0f631f 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -303,6 +303,11 @@ namespace SparkleLib { string output = git_status.StandardOutput.ReadToEnd ().TrimEnd (); git_status.WaitForExit (); + if (String.IsNullOrEmpty (output)) { + // no conflict any more. + return; + } + string [] lines = output.Split ("\n".ToCharArray ()); foreach (string line in lines) { From c767dbc30277d0c3cf4475d729b8465f9d85b8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Mon, 5 Sep 2011 03:02:15 +0200 Subject: [PATCH 035/134] Added a new helper function for getting a relative-to-repostory path --- SparkleLib/SparkleHelpers.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SparkleLib/SparkleHelpers.cs b/SparkleLib/SparkleHelpers.cs index 741648d7..9a00fef3 100644 --- a/SparkleLib/SparkleHelpers.cs +++ b/SparkleLib/SparkleHelpers.cs @@ -17,6 +17,7 @@ using System; using System.IO; +using System.Text.RegularExpressions; namespace SparkleLib { @@ -76,5 +77,10 @@ namespace SparkleLib { DateTime unix_epoch = new DateTime (1970, 1, 1, 0, 0, 0, 0); return unix_epoch.AddSeconds (timestamp); } + + // Gets the relative path of two hirarchical absolute paths + public static string DiffPaths(string target, string source) { + return target.Replace(source + Path.DirectorySeparatorChar, ""); + } } } From 85abd6bbb76beb9ac2a1b2c22db6d03f01dfbffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Mon, 5 Sep 2011 03:10:50 +0200 Subject: [PATCH 036/134] Skipping files which are unreadable by sparkleshare and added some methods for git's exclude file manipulation, see #10 --- SparkleLib/SparkleRepoBase.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 70cb9808..6af276d9 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -64,6 +64,10 @@ namespace SparkleLib { public abstract bool SyncDown (); public abstract bool HasUnsyncedChanges { get; set; } + public abstract bool AddExclusionRule (FileSystemEventArgs args); + public abstract bool RemoveExclusionRule (FileSystemEventArgs args); + public abstract bool CheckExclusionRules (); + public delegate void SyncStatusChangedEventHandler (SyncStatus new_status); public event SyncStatusChangedEventHandler SyncStatusChanged; @@ -316,6 +320,20 @@ namespace SparkleLib { !args.FullPath.Contains (Path.DirectorySeparatorChar + ".notes")) return; + /* + * Check whether the file which triggered the action + * is readable so that git can actually commit it + */ + + try { + FileStream file = File.OpenRead(args.FullPath); + file.Close(); + } catch { + SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list."); + AddExclusionRule(args); + return; + } + WatcherChangeTypes wct = args.ChangeType; if (AnyDifferences) { From 73f58892e8446d752cffa25726267917417f712e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Mon, 5 Sep 2011 17:34:07 +0200 Subject: [PATCH 037/134] Check readabilty only for existing files; Remove Exclusions when file is readable again --- SparkleLib/SparkleRepoBase.cs | 36 ++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 6af276d9..813891e0 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -66,7 +66,7 @@ namespace SparkleLib { public abstract bool AddExclusionRule (FileSystemEventArgs args); public abstract bool RemoveExclusionRule (FileSystemEventArgs args); - public abstract bool CheckExclusionRules (); + public abstract bool ExclusionRuleExists (FileSystemEventArgs args); public delegate void SyncStatusChangedEventHandler (SyncStatus new_status); public event SyncStatusChangedEventHandler SyncStatusChanged; @@ -321,18 +321,36 @@ namespace SparkleLib { return; /* - * Check whether the file which triggered the action - * is readable so that git can actually commit it - */ - + * Check whether the file which triggered the action + * is readable so that git can actually commit it + */ try { - FileStream file = File.OpenRead(args.FullPath); - file.Close(); + if(File.Exists(args.FullPath)) { + FileStream file = File.OpenRead(args.FullPath); + file.Close(); + } } catch { - SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list."); - AddExclusionRule(args); + if(!ExclusionRuleExists(args)) { + SparkleHelpers.DebugInfo("Warning", "File " + args.FullPath + " is not readable. Adding to ignore list."); + AddExclusionRule(args); + } + return; } + + /* + * Remove rule if file is readable but there is still + * an exclusion rule set + */ + if(ExclusionRuleExists(args)) { + SparkleHelpers.DebugInfo("Info", "Removing exclusion rule for " + args.Name); + RemoveExclusionRule(args); + + // If a file was former unreadable but has now been (re)moved, skip the process. + if(!File.Exists(args.FullPath)) { + return; + } + } WatcherChangeTypes wct = args.ChangeType; From 0298e8c79585f4e5066392ad2f30baa1ba7c8acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Mon, 5 Sep 2011 17:36:03 +0200 Subject: [PATCH 038/134] Implemented Exclusion Rule methods for handling non-readable files. See issue #10 --- SparkleLib/Git/SparkleRepoGit.cs | 170 ++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 1 deletion(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index a81fad71..3c8c1ea1 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -26,8 +26,15 @@ namespace SparkleLib { public class SparkleRepoGit : SparkleRepoBase { + private string exlude_rules_file_path; + private string ExclusionBlock = "#Temporary Exclusions"; + public SparkleRepoGit (string path, SparkleBackend backend) : - base (path, backend) { } + base (path, backend) { + // Set exclude file path + exlude_rules_file_path = SparkleHelpers.CombineMore ( + LocalPath, ".git", "info", "exclude"); + } public override string Identifier { @@ -214,6 +221,167 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes staged"); } + // Add a new file to be ignored + public override bool AddExclusionRule (FileSystemEventArgs args) { + + string RelativePath = SparkleHelpers.DiffPaths(args.FullPath, LocalPath); + + List exclusions; + try { + exclusions = ReadExclusionRules(); + } + catch { + return false; + } + + // Look for the local exclusions section + bool added = false; + for(int i = 0; i < exclusions.Count; i++) { + string entry = exclusions[i]; + if(entry.Equals(ExclusionBlock)) { + // add a new exclusion rule containing a file path + exclusions.Insert(i + 1, RelativePath); + added = true; + break; + } + } + + /* + * For compability to existing repos: + * Add a "#Temporary Exclusions"-Block to the + * ignore file in order to recognize this + * exclude rules later on + */ + if(!added) { + exclusions.Add(ExclusionBlock); + exclusions.Add(RelativePath); + } + + // Write exceptions list back to file + return WriteExclusionRules(exclusions); + } + + // Check whether a specific rule exists in the exclusion file + public override bool ExclusionRuleExists(FileSystemEventArgs args) { + string RelativePath = SparkleHelpers.DiffPaths(args.FullPath, LocalPath); + + List exclusions; + try { + // Read rules from temporary block only + exclusions = ReadExclusionRules(true); + + foreach(string entry in exclusions) { + if(entry.Equals(RelativePath)) { + return true; + } + } + } catch { + SparkleHelpers.DebugInfo("Error", "Cannot determine whether an exclusion rule for " + + args.FullPath + " already exists or not."); + return false; + } + + return false; + } + + // Remove file from exclusion list when they are readable again + public override bool RemoveExclusionRule(FileSystemEventArgs args) { + string RelativePath = SparkleHelpers.DiffPaths(args.FullPath, LocalPath); + + List exclusions; + try { + exclusions = ReadExclusionRules(); + + /* + * Removing a rule should only apply to rules in the "Temporary Exclusion"-block. + * Therefore we first read until reaching the block and then remove the rule. + * + * We cannot use ReadExclusionRules(true) here since we write all lines back + * to the file. This would result in a crippled exclusion file. + */ + bool BlockReached = false; + foreach(string entry in exclusions) { + if(entry.Equals(ExclusionBlock)) { + BlockReached = true; + } + + // Remove this rule + if(BlockReached && entry.Equals(RelativePath)) { + exclusions.Remove(entry); + break; + } + } + + return WriteExclusionRules(exclusions); + } catch { + SparkleHelpers.DebugInfo("Error", "Unable to remove exclusion rule for entry " + RelativePath); + return false; + } + } + + // Reads the exclusion rules file into a string list + private List ReadExclusionRules() { + + List exclusions = new List(); + TextReader reader = new StreamReader (exlude_rules_file_path);; + + try { + while(reader.Peek() > -1) { + exclusions.Add(reader.ReadLine().TrimEnd()); + } + } + catch (IOException e) { + SparkleHelpers.DebugInfo("Error", "Reading from exclusion file failed: " + e.Message); + return new List(); + } + finally { + if(reader != null) { + reader.Close(); + } + } + + return exclusions; + } + + // Reads rules only from temporary exclusion block + private List ReadExclusionRules(bool TempOnly) { + if(TempOnly) { + bool ForceRead = false; + List exclusions = new List(); + foreach(string entry in ReadExclusionRules()) { + if(ForceRead || entry.Equals(ExclusionBlock)) { + exclusions.Add(entry); + ForceRead = true; + } + } + + return exclusions; + } + + return ReadExclusionRules(); + } + + // Writes the exclusion rules file with a given string list + private bool WriteExclusionRules(List lines) { + + TextWriter writer = new StreamWriter (exlude_rules_file_path); + + try { + foreach(string line in lines) { + writer.WriteLine(line.TrimEnd()); + } + } catch(IOException e) { + SparkleHelpers.DebugInfo("Error", "Writing into exclusion file failed: " + e.Message); + return false; + } + finally { + if(writer != null) { + writer.Close(); + } + } + + return true; + } // Removes unneeded objects private void CollectGarbage () From c1481d51a0d1dcc2ff260a97106495e72c2e5552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Mon, 5 Sep 2011 17:39:20 +0200 Subject: [PATCH 039/134] Fixed code intendation --- SparkleLib/SparkleHelpers.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SparkleLib/SparkleHelpers.cs b/SparkleLib/SparkleHelpers.cs index 9a00fef3..dfaaadaf 100644 --- a/SparkleLib/SparkleHelpers.cs +++ b/SparkleLib/SparkleHelpers.cs @@ -77,10 +77,10 @@ namespace SparkleLib { DateTime unix_epoch = new DateTime (1970, 1, 1, 0, 0, 0, 0); return unix_epoch.AddSeconds (timestamp); } - - // Gets the relative path of two hirarchical absolute paths - public static string DiffPaths(string target, string source) { - return target.Replace(source + Path.DirectorySeparatorChar, ""); - } + + // Gets the relative path of two hirarchical absolute paths + public static string DiffPaths(string target, string source) { + return target.Replace(source + Path.DirectorySeparatorChar, ""); + } } } From 48e3beb9c26525010f22e9107ec150041508e19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Mon, 5 Sep 2011 17:40:53 +0200 Subject: [PATCH 040/134] RegEx not needed anymore --- SparkleLib/SparkleHelpers.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SparkleLib/SparkleHelpers.cs b/SparkleLib/SparkleHelpers.cs index dfaaadaf..820f55eb 100644 --- a/SparkleLib/SparkleHelpers.cs +++ b/SparkleLib/SparkleHelpers.cs @@ -17,7 +17,6 @@ using System; using System.IO; -using System.Text.RegularExpressions; namespace SparkleLib { @@ -77,7 +76,7 @@ namespace SparkleLib { DateTime unix_epoch = new DateTime (1970, 1, 1, 0, 0, 0, 0); return unix_epoch.AddSeconds (timestamp); } - + // Gets the relative path of two hirarchical absolute paths public static string DiffPaths(string target, string source) { return target.Replace(source + Path.DirectorySeparatorChar, ""); From 839c3ed8353bd089886131dbdd935a16bb7cbb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Thu, 8 Sep 2011 15:52:56 +0200 Subject: [PATCH 041/134] Added support for Hg Backend --- SparkleLib/Hg/SparkleRepoHg.cs | 170 ++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 1 deletion(-) diff --git a/SparkleLib/Hg/SparkleRepoHg.cs b/SparkleLib/Hg/SparkleRepoHg.cs index bb8788b8..af57301a 100644 --- a/SparkleLib/Hg/SparkleRepoHg.cs +++ b/SparkleLib/Hg/SparkleRepoHg.cs @@ -24,9 +24,16 @@ using System.Text.RegularExpressions; namespace SparkleLib { public class SparkleRepoHg : SparkleRepoBase { + + private string exlude_rules_file_path; + private string ExclusionBlock = "#Temporary Exclusions"; public SparkleRepoHg (string path, SparkleBackend backend) : - base (path, backend) { } + base (path, backend) { + // Set exclude file path + exlude_rules_file_path = SparkleHelpers.CombineMore ( + LocalPath, ".hg", "hgignore"); + } public override string Identifier { @@ -148,6 +155,167 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Hg", "[" + Name + "] Changes staged"); } + // Add a new file to be ignored + public override bool AddExclusionRule (FileSystemEventArgs args) { + + string RelativePath = SparkleHelpers.DiffPaths(args.FullPath, LocalPath); + + List exclusions; + try { + exclusions = ReadExclusionRules(); + } + catch { + return false; + } + + // Look for the local exclusions section + bool added = false; + for(int i = 0; i < exclusions.Count; i++) { + string entry = exclusions[i]; + if(entry.Equals(ExclusionBlock)) { + // add a new exclusion rule containing a file path + exclusions.Insert(i + 1, RelativePath); + added = true; + break; + } + } + + /* + * For compability to existing repos: + * Add a "#Temporary Exclusions"-Block to the + * ignore file in order to recognize this + * exclude rules later on + */ + if(!added) { + exclusions.Add(ExclusionBlock); + exclusions.Add(RelativePath); + } + + // Write exceptions list back to file + return WriteExclusionRules(exclusions); + } + + // Check whether a specific rule exists in the exclusion file + public override bool ExclusionRuleExists(FileSystemEventArgs args) { + string RelativePath = SparkleHelpers.DiffPaths(args.FullPath, LocalPath); + + List exclusions; + try { + // Read rules from temporary block only + exclusions = ReadExclusionRules(true); + + foreach(string entry in exclusions) { + if(entry.Equals(RelativePath)) { + return true; + } + } + } catch { + SparkleHelpers.DebugInfo("Error", "Cannot determine whether an exclusion rule for " + + args.FullPath + " already exists or not."); + return false; + } + + return false; + } + + // Remove file from exclusion list when they are readable again + public override bool RemoveExclusionRule(FileSystemEventArgs args) { + string RelativePath = SparkleHelpers.DiffPaths(args.FullPath, LocalPath); + + List exclusions; + try { + exclusions = ReadExclusionRules(); + + /* + * Removing a rule should only apply to rules in the "Temporary Exclusion"-block. + * Therefore we first read until reaching the block and then remove the rule. + * + * We cannot use ReadExclusionRules(true) here since we write all lines back + * to the file. This would result in a crippled exclusion file. + */ + bool BlockReached = false; + foreach(string entry in exclusions) { + if(entry.Equals(ExclusionBlock)) { + BlockReached = true; + } + + // Remove this rule + if(BlockReached && entry.Equals(RelativePath)) { + exclusions.Remove(entry); + break; + } + } + + return WriteExclusionRules(exclusions); + } catch { + SparkleHelpers.DebugInfo("Error", "Unable to remove exclusion rule for entry " + RelativePath); + return false; + } + } + + // Reads the exclusion rules file into a string list + private List ReadExclusionRules() { + + List exclusions = new List(); + TextReader reader = new StreamReader (exlude_rules_file_path);; + + try { + while(reader.Peek() > -1) { + exclusions.Add(reader.ReadLine().TrimEnd()); + } + } + catch (IOException e) { + SparkleHelpers.DebugInfo("Error", "Reading from exclusion file failed: " + e.Message); + return new List(); + } + finally { + if(reader != null) { + reader.Close(); + } + } + + return exclusions; + } + + // Reads rules only from temporary exclusion block + private List ReadExclusionRules(bool TempOnly) { + if(TempOnly) { + bool ForceRead = false; + List exclusions = new List(); + foreach(string entry in ReadExclusionRules()) { + if(ForceRead || entry.Equals(ExclusionBlock)) { + exclusions.Add(entry); + ForceRead = true; + } + } + + return exclusions; + } + + return ReadExclusionRules(); + } + + // Writes the exclusion rules file with a given string list + private bool WriteExclusionRules(List lines) { + + TextWriter writer = new StreamWriter (exlude_rules_file_path); + + try { + foreach(string line in lines) { + writer.WriteLine(line.TrimEnd()); + } + } catch(IOException e) { + SparkleHelpers.DebugInfo("Error", "Writing into exclusion file failed: " + e.Message); + return false; + } + finally { + if(writer != null) { + writer.Close(); + } + } + + return true; + } // Commits the made changes private void Commit (string message) From 9ee12f31ad50b06bad2d38a1f43e599006e63fe0 Mon Sep 17 00:00:00 2001 From: Beau Gunderson Date: Wed, 14 Sep 2011 12:19:53 -0700 Subject: [PATCH 042/134] Added the GIT_SSH environment variable and set it to "ssh" so that git will use ssh-agent; fixed a bug where SparkleShare creates an exclude file within the "info" directory without checking if the "info" directory exists. --- SparkleLib/Git/SparkleFetcherGit.cs | 16 ++++++++++++++-- SparkleShare/Windows/SparkleWinController.cs | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index b8e6a75e..e4e0232a 100644 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -138,10 +138,22 @@ namespace SparkleLib { // Add a .gitignore file to the repo private void InstallExcludeRules () { - string exlude_rules_file_path = SparkleHelpers.CombineMore ( + string exclude_rules_file_path = SparkleHelpers.CombineMore ( this.target_folder, ".git", "info", "exclude"); - TextWriter writer = new StreamWriter (exlude_rules_file_path); + string directory = Path.GetDirectoryName(exclude_rules_file_path); + + if (directory == null) + { + return; + } + + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + TextWriter writer = new StreamWriter (exclude_rules_file_path); // gedit and emacs writer.WriteLine ("*~"); diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleWinController.cs index 202cc4e9..93b95533 100644 --- a/SparkleShare/Windows/SparkleWinController.cs +++ b/SparkleShare/Windows/SparkleWinController.cs @@ -58,8 +58,10 @@ namespace SparkleShare { + MSysGit + @"\mingw\bin" + ";" + MSysGit + @"\cmd" + ";" + System.Environment.ExpandEnvironmentVariables ("%PATH%"); + System.Environment.SetEnvironmentVariable ("PATH", newPath); System.Environment.SetEnvironmentVariable ("PLINK_PROTOCOL", "ssh"); + System.Environment.SetEnvironmentVariable ("GIT_SSH", "ssh"); if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("HOME"))) System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); From de52b741a11b854465a81c03c0efa903a0bc703b Mon Sep 17 00:00:00 2001 From: Niklas Angebrand Date: Mon, 19 Sep 2011 21:42:00 +0200 Subject: [PATCH 043/134] Adding installer with License agreement dialogue and target folder selection dialogue. MsysGit is not bundled with this installer. --- LICENSE.rtf | 115 ++++++++++++++++++++++++++ SparkleShare/Windows/SparkleShare.wxs | 47 +++++++++++ 2 files changed, 162 insertions(+) create mode 100644 LICENSE.rtf create mode 100644 SparkleShare/Windows/SparkleShare.wxs diff --git a/LICENSE.rtf b/LICENSE.rtf new file mode 100644 index 00000000..f679cc67 --- /dev/null +++ b/LICENSE.rtf @@ -0,0 +1,115 @@ +{\rtf1\ansi\ansicpg1252\deff0\deflang2077{\fonttbl{\f0\froman\fcharset0 Times New Roman;}{\f1\fnil\fcharset0 Calibri;}{\f2\fnil\fcharset2 Symbol;}} +{\colortbl ;\red0\green0\blue255;} +{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\keepn\sb100\sa100\lang1053\b\f0\fs28 GNU GENERAL PUBLIC LICENSE\par +\pard\sb100\sa100\b0\fs24 Version 3, 29 June 2007\par +Copyright \'a9 2007 Free Software Foundation, Inc. <{\field{\*\fldinst{HYPERLINK "http://fsf.org/"}}{\fldrslt{\ul\cf1 http://fsf.org/}}}\f0\fs24 >\par +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\par +\pard\keepn\sb100\sa100\b\fs28 Preamble\par +\pard\sb100\sa100\b0\fs24 The GNU General Public License is a free, copyleft license for software and other kinds of works.\par +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.\par +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.\par +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.\par +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\par +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.\par +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.\par +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.\par +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.\par +The precise terms and conditions for copying, distribution and modification follow.\par +\pard\keepn\sb100\sa100\b\fs28 TERMS AND CONDITIONS\par +\fs24 0. Definitions.\par +\pard\sb100\sa100\b0\ldblquote This License\rdblquote refers to version 3 of the GNU General Public License.\par +\ldblquote Copyright\rdblquote also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.\par +\ldblquote The Program\rdblquote refers to any copyrightable work licensed under this License. Each licensee is addressed as \ldblquote you\rdblquote . \ldblquote Licensees\rdblquote and \ldblquote recipients\rdblquote may be individuals or organizations.\par +To \ldblquote modify\rdblquote a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a \ldblquote modified version\rdblquote of the earlier work or a work \ldblquote based on\rdblquote the earlier work.\par +A \ldblquote covered work\rdblquote means either the unmodified Program or a work based on the Program.\par +To \ldblquote propagate\rdblquote a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.\par +To \ldblquote convey\rdblquote a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.\par +An interactive user interface displays \ldblquote Appropriate Legal Notices\rdblquote to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.\par +\pard\keepn\sb100\sa100\b 1. Source Code.\par +\pard\sb100\sa100\b0 The \ldblquote source code\rdblquote for a work means the preferred form of the work for making modifications to it. \ldblquote Object code\rdblquote means any non-source form of a work.\par +A \ldblquote Standard Interface\rdblquote means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.\par +The \ldblquote System Libraries\rdblquote of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A \ldblquote Major Component\rdblquote , in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.\par +The \ldblquote Corresponding Source\rdblquote for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.\par +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.\par +The Corresponding Source for a work in source code form is that same work.\par +\pard\keepn\sb100\sa100\b 2. Basic Permissions.\par +\pard\sb100\sa100\b0 All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.\par +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.\par +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.\par +\pard\keepn\sb100\sa100\b 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\par +\pard\sb100\sa100\b0 No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.\par +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.\par +\pard\keepn\sb100\sa100\b 4. Conveying Verbatim Copies.\par +\pard\sb100\sa100\b0 You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.\par +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.\par +\pard\keepn\sb100\sa100\b 5. Conveying Modified Source Versions.\par +\pard\sb100\sa100\b0 You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:\par +\pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent360{\pntxtb\'B7}}\fi-360\li720\sb100\sa100 a) The work must carry prominent notices stating that you modified it, and giving a relevant date. \par +{\pntext\f2\'B7\tab}b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to \ldblquote keep intact all notices\rdblquote . \par +{\pntext\f2\'B7\tab}c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. \par +{\pntext\f2\'B7\tab}d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. \par +\pard\sb100\sa100 A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an \ldblquote aggregate\rdblquote if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.\par +\pard\keepn\sb100\sa100\b 6. Conveying Non-Source Forms.\par +\pard\sb100\sa100\b0 You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:\par +\pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent360{\pntxtb\'B7}}\fi-360\li720\sb100\sa100 a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. \par +{\pntext\f2\'B7\tab}b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. \par +{\pntext\f2\'B7\tab}c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. \par +{\pntext\f2\'B7\tab}d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. \par +{\pntext\f2\'B7\tab}e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. \par +\pard\sb100\sa100 A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.\par +A \ldblquote User Product\rdblquote is either (1) a \ldblquote consumer product\rdblquote , which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, \ldblquote normally used\rdblquote refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.\par +\ldblquote Installation Information\rdblquote for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.\par +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).\par +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.\par +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.\par +\pard\keepn\sb100\sa100\b 7. Additional Terms.\par +\pard\sb100\sa100\b0\ldblquote Additional permissions\rdblquote are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.\par +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.\par +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:\par +\pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent360{\pntxtb\'B7}}\fi-360\li720\sb100\sa100 a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or \par +{\pntext\f2\'B7\tab}b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or \par +{\pntext\f2\'B7\tab}c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or \par +{\pntext\f2\'B7\tab}d) Limiting the use for publicity purposes of names of licensors or authors of the material; or \par +{\pntext\f2\'B7\tab}e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or \par +{\pntext\f2\'B7\tab}f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. \par +\pard\sb100\sa100 All other non-permissive additional terms are considered \ldblquote further restrictions\rdblquote within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.\par +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.\par +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.\par +\pard\keepn\sb100\sa100\b 8. Termination.\par +\pard\sb100\sa100\b0 You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).\par +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.\par +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.\par +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.\par +\pard\keepn\sb100\sa100\b 9. Acceptance Not Required for Having Copies.\par +\pard\sb100\sa100\b0 You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.\par +\pard\keepn\sb100\sa100\b 10. Automatic Licensing of Downstream Recipients.\par +\pard\sb100\sa100\b0 Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.\par +An \ldblquote entity transaction\rdblquote is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.\par +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.\par +\pard\keepn\sb100\sa100\b 11. Patents.\par +\pard\sb100\sa100\b0 A \ldblquote contributor\rdblquote is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's \ldblquote contributor version\rdblquote .\par +A contributor's \ldblquote essential patent claims\rdblquote are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, \ldblquote control\rdblquote includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.\par +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.\par +In the following three paragraphs, a \ldblquote patent license\rdblquote is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To \ldblquote grant\rdblquote such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.\par +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. \ldblquote Knowingly relying\rdblquote means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.\par +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.\par +A patent license is \ldblquote discriminatory\rdblquote if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.\par +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.\par +\pard\keepn\sb100\sa100\b 12. No Surrender of Others' Freedom.\par +\pard\sb100\sa100\b0 If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.\par +\pard\keepn\sb100\sa100\b 13. Use with the GNU Affero General Public License.\par +\pard\sb100\sa100\b0 Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.\par +\pard\keepn\sb100\sa100\b 14. Revised Versions of this License.\par +\pard\sb100\sa100\b0 The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\par +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License \ldblquote or any later version\rdblquote applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.\par +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.\par +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.\par +\pard\keepn\sb100\sa100\b 15. Disclaimer of Warranty.\par +\pard\sb100\sa100\b0 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \ldblquote AS IS\rdblquote WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\par +\pard\keepn\sb100\sa100\b 16. Limitation of Liability.\par +\pard\sb100\sa100\b0 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\par +\pard\keepn\sb100\sa100\b 17. Interpretation of Sections 15 and 16.\par +\pard\sb100\sa100\b0 If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.\par +END OF TERMS AND CONDITIONS\lang29\f1\fs22\par +} + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs new file mode 100644 index 00000000..ddc6e0a0 --- /dev/null +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 7be94511a4d1d8729d422098d503965fea803cb2 Mon Sep 17 00:00:00 2001 From: Niklas Angebrand Date: Mon, 19 Sep 2011 21:45:00 +0200 Subject: [PATCH 044/134] Wix installer can now be built from Windows/build.cmd using extra argument "installer". I.e. "Windows/build.cmd installer" will build MSI file. --- SparkleShare/Windows/build.cmd | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index f38f4de7..8fb8a7a6 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -2,5 +2,19 @@ set WinDirNet=%WinDir%\Microsoft.NET\Framework set msbuild="%WinDirNet%\v3.5\msbuild.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" +set wixBinDir=%WIX%\bin %msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln + +if "%1"=="installer" ( + if exist "%wixBinDir%" ( + "%wixBinDir%\candle" "%~dp0\SparkleShare.wxs" + "%wixBinDir%\light" -ext WixUIExtension Sparkleshare.wixobj + echo SparkleShare.msi created. + + ) else ( + echo Not building installer ^(could not find wix, Windows Installer XML toolset^) + echo wix is available at http://wix.sourceforge.net/ + ) + +) else echo Not building installer, as it was not requested. ^(Issue "build.cmd installer" to build installer ^) From e5a4863f3093a45ac074bdc04907fd1c2807636c Mon Sep 17 00:00:00 2001 From: Niklas Angebrand Date: Tue, 20 Sep 2011 17:17:51 +0200 Subject: [PATCH 045/134] Now also bundling msysgit, albeit in an ugly way. --- addmedia.xlst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 addmedia.xlst diff --git a/addmedia.xlst b/addmedia.xlst new file mode 100644 index 00000000..66b70765 --- /dev/null +++ b/addmedia.xlst @@ -0,0 +1,23 @@ + + + + + + + + + + + + + 2 + + + + + \ No newline at end of file From 3d9364209bab16a89f48690dd4f4394a52c23b4e Mon Sep 17 00:00:00 2001 From: Niklas Angebrand Date: Tue, 20 Sep 2011 21:22:23 +0200 Subject: [PATCH 046/134] Added MsysGit bundle to WiX installation --- SparkleShare/Windows/SparkleShare.wxs | 25 +++++++++++++++++++++---- SparkleShare/Windows/build.cmd | 6 ++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs index ddc6e0a0..d9f5719a 100644 --- a/SparkleShare/Windows/SparkleShare.wxs +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -1,6 +1,6 @@ - + @@ -8,9 +8,16 @@ Comments='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.' Manufacturer='sparkleshare.org' InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' /> - + + + + + + + + @@ -29,17 +36,27 @@ + + - + + + + + + + + MSYSGIT_CAB_EXISTS + - + diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index 8fb8a7a6..5738b519 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -4,12 +4,14 @@ set msbuild="%WinDirNet%\v3.5\msbuild.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" set wixBinDir=%WIX%\bin -%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln +rem %msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln if "%1"=="installer" ( if exist "%wixBinDir%" ( + "%wixBinDir%\heat.exe" dir "%git_install_root%." -cg msysGitComponentGroup -gg -scom -sreg -sfrag -srd -dr MSYSGIT_DIR -t addmedia.xlst -var wix.msysgitpath -o msysgit.wxs "%wixBinDir%\candle" "%~dp0\SparkleShare.wxs" - "%wixBinDir%\light" -ext WixUIExtension Sparkleshare.wixobj + "%wixBinDir%\candle" "msysgit.wxs + "%wixBinDir%\light" -ext WixUIExtension Sparkleshare.wixobj msysgit.wixobj -dmsysgitpath=%git_install_root% -o SparkleShare.msi echo SparkleShare.msi created. ) else ( From b76b0fa0e59087ec4ed1f38038b9ff64f06ea28e Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Wed, 28 Sep 2011 00:37:22 +0200 Subject: [PATCH 047/134] Added groupboxes and information for each selection when a user should add a server --- SparkleShare/Windows/SparkleSetup.Designer.cs | 286 +++++++++++------- SparkleShare/Windows/SparkleSetup.cs | 38 +++ 2 files changed, 222 insertions(+), 102 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index e2cd5005..505dc731 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -25,6 +25,9 @@ namespace SparkleShare { private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleSetup)); this.pictureBox = new System.Windows.Forms.PictureBox (); + this.panel_info = new System.Windows.Forms.Panel (); + this.groupBox3 = new System.Windows.Forms.GroupBox (); + this.label_info = new System.Windows.Forms.Label (); this.tabControl = new SparkleShare.controls.TablessControl (); this.setupPage = new System.Windows.Forms.TabPage (); this.EmailEntry = new System.Windows.Forms.TextBox (); @@ -35,15 +38,18 @@ namespace SparkleShare { this.label10 = new System.Windows.Forms.Label (); this.buttonNext = new System.Windows.Forms.Button (); this.addPage = new System.Windows.Forms.TabPage (); - this.buttonSync = new System.Windows.Forms.Button (); - this.buttonCancel = new System.Windows.Forms.Button (); - this.label5 = new System.Windows.Forms.Label (); - this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); + this.panel_server_selection = new System.Windows.Forms.Panel (); + this.groupbox_server_selection = new System.Windows.Forms.GroupBox (); this.ServerEntry = new SparkleShare.controls.ExampleTextBox (); this.radio_button_gnome = new System.Windows.Forms.RadioButton (); this.radio_button_gitorious = new System.Windows.Forms.RadioButton (); this.radio_button_github = new System.Windows.Forms.RadioButton (); this.radio_button_own_server = new System.Windows.Forms.RadioButton (); + this.groupbox_folder_selection = new System.Windows.Forms.GroupBox (); + this.label5 = new System.Windows.Forms.Label (); + this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); + this.buttonSync = new System.Windows.Forms.Button (); + this.buttonCancel = new System.Windows.Forms.Button (); this.label4 = new System.Windows.Forms.Label (); this.syncingPage = new System.Windows.Forms.TabPage (); this.syncingProgressBar = new System.Windows.Forms.ProgressBar (); @@ -61,9 +67,14 @@ namespace SparkleShare { this.buttonFinished = new System.Windows.Forms.Button (); this.buttonOpenFolder = new System.Windows.Forms.Button (); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); + this.panel_info.SuspendLayout (); + this.groupBox3.SuspendLayout (); this.tabControl.SuspendLayout (); this.setupPage.SuspendLayout (); this.addPage.SuspendLayout (); + this.panel_server_selection.SuspendLayout (); + this.groupbox_server_selection.SuspendLayout (); + this.groupbox_folder_selection.SuspendLayout (); this.syncingPage.SuspendLayout (); this.errorPage.SuspendLayout (); this.finishedPage.SuspendLayout (); @@ -74,10 +85,38 @@ namespace SparkleShare { this.pictureBox.Dock = System.Windows.Forms.DockStyle.Left; this.pictureBox.Location = new System.Drawing.Point (0, 0); this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size (150, 407); + this.pictureBox.Size = new System.Drawing.Size (150, 396); this.pictureBox.TabIndex = 1; this.pictureBox.TabStop = false; // + // panel_info + // + this.panel_info.BackColor = System.Drawing.Color.White; + this.panel_info.Controls.Add (this.groupBox3); + this.panel_info.Location = new System.Drawing.Point (0, 0); + this.panel_info.Name = "panel_info"; + this.panel_info.Size = new System.Drawing.Size (150, 396); + this.panel_info.TabIndex = 7; + this.panel_info.Visible = false; + // + // groupBox3 + // + this.groupBox3.Controls.Add (this.label_info); + this.groupBox3.Location = new System.Drawing.Point (15, 56); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size (129, 270); + this.groupBox3.TabIndex = 0; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Information"; + // + // label_info + // + this.label_info.Location = new System.Drawing.Point (11, 28); + this.label_info.Name = "label_info"; + this.label_info.Size = new System.Drawing.Size (112, 229); + this.label_info.TabIndex = 0; + this.label_info.Text = "Informative text"; + // // tabControl // this.tabControl.Controls.Add (this.setupPage); @@ -85,11 +124,11 @@ namespace SparkleShare { this.tabControl.Controls.Add (this.syncingPage); this.tabControl.Controls.Add (this.errorPage); this.tabControl.Controls.Add (this.finishedPage); - this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl.Dock = System.Windows.Forms.DockStyle.Right; this.tabControl.Location = new System.Drawing.Point (150, 0); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size (522, 407); + this.tabControl.Size = new System.Drawing.Size (514, 396); this.tabControl.TabIndex = 0; this.tabControl.TabStop = false; // @@ -105,7 +144,7 @@ namespace SparkleShare { this.setupPage.Location = new System.Drawing.Point (4, 22); this.setupPage.Name = "setupPage"; this.setupPage.Padding = new System.Windows.Forms.Padding (3); - this.setupPage.Size = new System.Drawing.Size (514, 381); + this.setupPage.Size = new System.Drawing.Size (506, 370); this.setupPage.TabIndex = 0; this.setupPage.Text = "Setup"; this.setupPage.UseVisualStyleBackColor = true; @@ -178,24 +217,128 @@ namespace SparkleShare { // // addPage // + this.addPage.Controls.Add (this.panel_server_selection); + this.addPage.Controls.Add (this.groupbox_folder_selection); this.addPage.Controls.Add (this.buttonSync); this.addPage.Controls.Add (this.buttonCancel); - this.addPage.Controls.Add (this.label5); - this.addPage.Controls.Add (this.FolderEntry); - this.addPage.Controls.Add (this.ServerEntry); - this.addPage.Controls.Add (this.radio_button_gnome); - this.addPage.Controls.Add (this.radio_button_gitorious); - this.addPage.Controls.Add (this.radio_button_github); - this.addPage.Controls.Add (this.radio_button_own_server); this.addPage.Controls.Add (this.label4); this.addPage.Location = new System.Drawing.Point (4, 22); this.addPage.Name = "addPage"; this.addPage.Padding = new System.Windows.Forms.Padding (3); - this.addPage.Size = new System.Drawing.Size (514, 381); + this.addPage.Size = new System.Drawing.Size (506, 370); this.addPage.TabIndex = 1; this.addPage.Text = "Add"; this.addPage.UseVisualStyleBackColor = true; // + // panel_server_selection + // + this.panel_server_selection.Controls.Add (this.groupbox_server_selection); + this.panel_server_selection.Location = new System.Drawing.Point (0, 53); + this.panel_server_selection.Name = "panel_server_selection"; + this.panel_server_selection.Size = new System.Drawing.Size (512, 154); + this.panel_server_selection.TabIndex = 12; + this.panel_server_selection.MouseLeave += new System.EventHandler (this.panel_server_selection_MouseLeave); + // + // groupbox_server_selection + // + this.groupbox_server_selection.Controls.Add (this.ServerEntry); + this.groupbox_server_selection.Controls.Add (this.radio_button_gnome); + this.groupbox_server_selection.Controls.Add (this.radio_button_gitorious); + this.groupbox_server_selection.Controls.Add (this.radio_button_github); + this.groupbox_server_selection.Controls.Add (this.radio_button_own_server); + this.groupbox_server_selection.Location = new System.Drawing.Point (15, 9); + this.groupbox_server_selection.Name = "groupbox_server_selection"; + this.groupbox_server_selection.Size = new System.Drawing.Size (470, 123); + this.groupbox_server_selection.TabIndex = 11; + this.groupbox_server_selection.TabStop = false; + this.groupbox_server_selection.Text = "Server selection"; + // + // ServerEntry + // + this.ServerEntry.ExampleText = "address-to-server/ip-to-server"; + this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.ServerEntry.Location = new System.Drawing.Point (139, 21); + this.ServerEntry.Name = "ServerEntry"; + this.ServerEntry.Size = new System.Drawing.Size (312, 20); + this.ServerEntry.TabIndex = 10; + // + // radio_button_gnome + // + this.radio_button_gnome.AutoSize = true; + this.radio_button_gnome.Location = new System.Drawing.Point (6, 91); + this.radio_button_gnome.Name = "radio_button_gnome"; + this.radio_button_gnome.Size = new System.Drawing.Size (165, 17); + this.radio_button_gnome.TabIndex = 9; + this.radio_button_gnome.Text = "The GNOME Project account"; + this.radio_button_gnome.UseVisualStyleBackColor = true; + this.radio_button_gnome.MouseEnter += new System.EventHandler (this.radio_button_gnome_MouseEnter); + // + // radio_button_gitorious + // + this.radio_button_gitorious.AutoSize = true; + this.radio_button_gitorious.Location = new System.Drawing.Point (6, 68); + this.radio_button_gitorious.Name = "radio_button_gitorious"; + this.radio_button_gitorious.Size = new System.Drawing.Size (108, 17); + this.radio_button_gitorious.TabIndex = 8; + this.radio_button_gitorious.Text = "Gitorious account"; + this.radio_button_gitorious.UseVisualStyleBackColor = true; + this.radio_button_gitorious.MouseEnter += new System.EventHandler (this.radio_button_gitorious_MouseEnter); + // + // radio_button_github + // + this.radio_button_github.AutoSize = true; + this.radio_button_github.Location = new System.Drawing.Point (6, 45); + this.radio_button_github.Name = "radio_button_github"; + this.radio_button_github.Size = new System.Drawing.Size (98, 17); + this.radio_button_github.TabIndex = 7; + this.radio_button_github.Text = "Github account"; + this.radio_button_github.UseVisualStyleBackColor = true; + this.radio_button_github.MouseEnter += new System.EventHandler (this.radio_button_github_MouseEnter); + // + // radio_button_own_server + // + this.radio_button_own_server.AutoSize = true; + this.radio_button_own_server.Checked = true; + this.radio_button_own_server.Location = new System.Drawing.Point (6, 22); + this.radio_button_own_server.Name = "radio_button_own_server"; + this.radio_button_own_server.Size = new System.Drawing.Size (115, 17); + this.radio_button_own_server.TabIndex = 6; + this.radio_button_own_server.TabStop = true; + this.radio_button_own_server.Text = "On my own Server:"; + this.radio_button_own_server.UseVisualStyleBackColor = true; + this.radio_button_own_server.MouseEnter += new System.EventHandler (this.radio_button_own_server_MouseEnter); + // + // groupbox_folder_selection + // + this.groupbox_folder_selection.Controls.Add (this.label5); + this.groupbox_folder_selection.Controls.Add (this.FolderEntry); + this.groupbox_folder_selection.Location = new System.Drawing.Point (21, 213); + this.groupbox_folder_selection.Name = "groupbox_folder_selection"; + this.groupbox_folder_selection.Size = new System.Drawing.Size (470, 123); + this.groupbox_folder_selection.TabIndex = 11; + this.groupbox_folder_selection.TabStop = false; + this.groupbox_folder_selection.Text = "Folder selection"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point (6, 55); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size (121, 13); + this.label5.TabIndex = 9; + this.label5.Text = "Folder name (on server):"; + // + // FolderEntry + // + this.FolderEntry.ExampleText = "/path/to/folder"; + this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.FolderEntry.Location = new System.Drawing.Point (133, 52); + this.FolderEntry.Name = "FolderEntry"; + this.FolderEntry.Size = new System.Drawing.Size (318, 20); + this.FolderEntry.TabIndex = 8; + this.FolderEntry.MouseEnter += new System.EventHandler (this.FolderEntry_MouseEnter); + this.FolderEntry.MouseLeave += new System.EventHandler (this.FolderEntry_MouseLeave); + // // buttonSync // this.buttonSync.Location = new System.Drawing.Point (431, 355); @@ -216,81 +359,6 @@ namespace SparkleShare { this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler (this.buttonCancel_Click); // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (96, 254); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (121, 13); - this.label5.TabIndex = 7; - this.label5.Text = "Folder name (on server):"; - // - // FolderEntry - // - this.FolderEntry.ExampleText = "Folder"; - this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.FolderEntry.Location = new System.Drawing.Point (223, 251); - this.FolderEntry.Name = "FolderEntry"; - this.FolderEntry.Size = new System.Drawing.Size (283, 20); - this.FolderEntry.TabIndex = 6; - this.FolderEntry.TextChanged += new System.EventHandler (this.CheckAddPage); - // - // ServerEntry - // - this.ServerEntry.ExampleText = "address-to-server.com"; - this.ServerEntry.ForeColor = System.Drawing.SystemColors.WindowText; - this.ServerEntry.Location = new System.Drawing.Point (223, 64); - this.ServerEntry.Name = "ServerEntry"; - this.ServerEntry.Size = new System.Drawing.Size (283, 20); - this.ServerEntry.TabIndex = 5; - this.ServerEntry.TextChanged += new System.EventHandler (this.CheckAddPage); - // - // radio_button_gnome - // - this.radio_button_gnome.AutoSize = true; - this.radio_button_gnome.Location = new System.Drawing.Point (12, 213); - this.radio_button_gnome.Name = "radio_button_gnome"; - this.radio_button_gnome.Size = new System.Drawing.Size (123, 17); - this.radio_button_gnome.TabIndex = 4; - this.radio_button_gnome.Text = "The GNOME Project"; - this.radio_button_gnome.UseVisualStyleBackColor = true; - this.radio_button_gnome.CheckedChanged += new System.EventHandler (this.CheckAddPage); - // - // radio_button_gitorious - // - this.radio_button_gitorious.AutoSize = true; - this.radio_button_gitorious.Location = new System.Drawing.Point (12, 161); - this.radio_button_gitorious.Name = "radio_button_gitorious"; - this.radio_button_gitorious.Size = new System.Drawing.Size (66, 17); - this.radio_button_gitorious.TabIndex = 3; - this.radio_button_gitorious.Text = "Gitorious"; - this.radio_button_gitorious.UseVisualStyleBackColor = true; - this.radio_button_gitorious.CheckedChanged += new System.EventHandler (this.CheckAddPage); - // - // radio_button_github - // - this.radio_button_github.AutoSize = true; - this.radio_button_github.Location = new System.Drawing.Point (12, 107); - this.radio_button_github.Name = "radio_button_github"; - this.radio_button_github.Size = new System.Drawing.Size (56, 17); - this.radio_button_github.TabIndex = 2; - this.radio_button_github.Text = "Github"; - this.radio_button_github.UseVisualStyleBackColor = true; - this.radio_button_github.CheckedChanged += new System.EventHandler (this.CheckAddPage); - // - // radio_button_own_server - // - this.radio_button_own_server.AutoSize = true; - this.radio_button_own_server.Checked = true; - this.radio_button_own_server.Location = new System.Drawing.Point (12, 65); - this.radio_button_own_server.Name = "radio_button_own_server"; - this.radio_button_own_server.Size = new System.Drawing.Size (115, 17); - this.radio_button_own_server.TabIndex = 1; - this.radio_button_own_server.TabStop = true; - this.radio_button_own_server.Text = "On my own Server:"; - this.radio_button_own_server.UseVisualStyleBackColor = true; - this.radio_button_own_server.CheckedChanged += new System.EventHandler (this.radio_button_own_server_CheckedChanged); - // // label4 // this.label4.AutoSize = true; @@ -309,7 +377,7 @@ namespace SparkleShare { this.syncingPage.Controls.Add (this.label6); this.syncingPage.Location = new System.Drawing.Point (4, 22); this.syncingPage.Name = "syncingPage"; - this.syncingPage.Size = new System.Drawing.Size (514, 381); + this.syncingPage.Size = new System.Drawing.Size (506, 370); this.syncingPage.TabIndex = 2; this.syncingPage.Text = "Syncing"; this.syncingPage.UseVisualStyleBackColor = true; @@ -358,7 +426,7 @@ namespace SparkleShare { this.errorPage.Controls.Add (this.label1); this.errorPage.Location = new System.Drawing.Point (4, 22); this.errorPage.Name = "errorPage"; - this.errorPage.Size = new System.Drawing.Size (514, 381); + this.errorPage.Size = new System.Drawing.Size (506, 370); this.errorPage.TabIndex = 3; this.errorPage.Text = "Error"; this.errorPage.UseVisualStyleBackColor = true; @@ -408,7 +476,7 @@ namespace SparkleShare { this.finishedPage.Controls.Add (this.buttonOpenFolder); this.finishedPage.Location = new System.Drawing.Point (4, 22); this.finishedPage.Name = "finishedPage"; - this.finishedPage.Size = new System.Drawing.Size (514, 381); + this.finishedPage.Size = new System.Drawing.Size (506, 370); this.finishedPage.TabIndex = 4; this.finishedPage.Text = "Finished"; this.finishedPage.UseVisualStyleBackColor = true; @@ -453,7 +521,8 @@ namespace SparkleShare { // // SparkleSetup // - this.ClientSize = new System.Drawing.Size (672, 407); + this.ClientSize = new System.Drawing.Size (664, 396); + this.Controls.Add (this.panel_info); this.Controls.Add (this.tabControl); this.Controls.Add (this.pictureBox); this.Name = "SparkleSetup"; @@ -461,11 +530,18 @@ namespace SparkleShare { this.Text = "SparkleShare Setup"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleSetup_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit (); + this.panel_info.ResumeLayout (false); + this.groupBox3.ResumeLayout (false); this.tabControl.ResumeLayout (false); this.setupPage.ResumeLayout (false); this.setupPage.PerformLayout (); this.addPage.ResumeLayout (false); this.addPage.PerformLayout (); + this.panel_server_selection.ResumeLayout (false); + this.groupbox_server_selection.ResumeLayout (false); + this.groupbox_server_selection.PerformLayout (); + this.groupbox_folder_selection.ResumeLayout (false); + this.groupbox_folder_selection.PerformLayout (); this.syncingPage.ResumeLayout (false); this.syncingPage.PerformLayout (); this.errorPage.ResumeLayout (false); @@ -487,16 +563,9 @@ namespace SparkleShare { private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label3; - private System.Windows.Forms.RadioButton radio_button_gnome; - private System.Windows.Forms.RadioButton radio_button_gitorious; - private System.Windows.Forms.RadioButton radio_button_github; - private System.Windows.Forms.RadioButton radio_button_own_server; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button buttonSync; private System.Windows.Forms.Button buttonCancel; - private System.Windows.Forms.Label label5; - private SparkleShare.controls.ExampleTextBox FolderEntry; - private SparkleShare.controls.ExampleTextBox ServerEntry; private System.Windows.Forms.PictureBox pictureBox; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label6; @@ -514,6 +583,19 @@ namespace SparkleShare { private System.Windows.Forms.TextBox NameEntry; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label12; + private System.Windows.Forms.GroupBox groupbox_folder_selection; + private System.Windows.Forms.Label label5; + private controls.ExampleTextBox FolderEntry; + private System.Windows.Forms.Panel panel_info; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label label_info; + private System.Windows.Forms.Panel panel_server_selection; + private System.Windows.Forms.GroupBox groupbox_server_selection; + private controls.ExampleTextBox ServerEntry; + private System.Windows.Forms.RadioButton radio_button_gnome; + private System.Windows.Forms.RadioButton radio_button_gitorious; + private System.Windows.Forms.RadioButton radio_button_github; + private System.Windows.Forms.RadioButton radio_button_own_server; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 24e12bb9..e3e063fa 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -184,5 +184,43 @@ namespace SparkleShare { } } + private void showInfo (string text) { + pictureBox.Visible = false; + panel_info.Visible = true; + label_info.Text = text; + } + + private void hideInfo () { + pictureBox.Visible = true; + panel_info.Visible = false; + } + + private void radio_button_own_server_MouseEnter (object sender, EventArgs e) { + showInfo ("To use your own server you need to blabla"); + } + + private void radio_button_github_MouseEnter (object sender, EventArgs e) { + showInfo ("To use your own server you need to blabla"); + } + + private void radio_button_gitorious_MouseEnter (object sender, EventArgs e) { + showInfo ("awdaw"); + } + + private void radio_button_gnome_MouseEnter (object sender, EventArgs e) { + showInfo ("Gnome"); + } + + private void panel_server_selection_MouseLeave (object sender, EventArgs e) { + hideInfo (); + } + + private void FolderEntry_MouseEnter (object sender, EventArgs e) { + showInfo ("Type in the folder"); + } + + private void FolderEntry_MouseLeave (object sender, EventArgs e) { + hideInfo (); + } } } From 55e7bd8daf4eebb61c981a52a44e2bda0ada054c Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Wed, 28 Sep 2011 12:23:45 +0200 Subject: [PATCH 048/134] Changed the information text to something more appropriate --- SparkleShare/Windows/SparkleSetup.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index e3e063fa..5441c9fe 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -196,19 +196,19 @@ namespace SparkleShare { } private void radio_button_own_server_MouseEnter (object sender, EventArgs e) { - showInfo ("To use your own server you need to blabla"); + showInfo ("To use your own server you need to ..."); } private void radio_button_github_MouseEnter (object sender, EventArgs e) { - showInfo ("To use your own server you need to blabla"); + showInfo ("To use github to store your files you need to ..."); } private void radio_button_gitorious_MouseEnter (object sender, EventArgs e) { - showInfo ("awdaw"); + showInfo ("To use gitorious to store your files you need to ..."); } private void radio_button_gnome_MouseEnter (object sender, EventArgs e) { - showInfo ("Gnome"); + showInfo ("To use gnome project to store your files you need to ..."); } private void panel_server_selection_MouseLeave (object sender, EventArgs e) { @@ -216,7 +216,7 @@ namespace SparkleShare { } private void FolderEntry_MouseEnter (object sender, EventArgs e) { - showInfo ("Type in the folder"); + showInfo ("This is the path to your git project ..."); } private void FolderEntry_MouseLeave (object sender, EventArgs e) { From 951fbf65792f96b9e715c830f888e878f4287af2 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Wed, 28 Sep 2011 17:28:41 +0200 Subject: [PATCH 049/134] Added informatio popup for the own server address field. Also changed the information display, not in a groupbox anymore. --- SparkleShare/Windows/SparkleSetup.Designer.cs | 161 ++++++++++-------- SparkleShare/Windows/SparkleSetup.cs | 3 +- 2 files changed, 88 insertions(+), 76 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 505dc731..0e1c8a84 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -26,10 +26,10 @@ namespace SparkleShare { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleSetup)); this.pictureBox = new System.Windows.Forms.PictureBox (); this.panel_info = new System.Windows.Forms.Panel (); - this.groupBox3 = new System.Windows.Forms.GroupBox (); this.label_info = new System.Windows.Forms.Label (); this.tabControl = new SparkleShare.controls.TablessControl (); this.setupPage = new System.Windows.Forms.TabPage (); + this.groupBox1 = new System.Windows.Forms.GroupBox (); this.EmailEntry = new System.Windows.Forms.TextBox (); this.NameEntry = new System.Windows.Forms.TextBox (); this.label13 = new System.Windows.Forms.Label (); @@ -38,6 +38,10 @@ namespace SparkleShare { this.label10 = new System.Windows.Forms.Label (); this.buttonNext = new System.Windows.Forms.Button (); this.addPage = new System.Windows.Forms.TabPage (); + this.panel_folder_selection = new System.Windows.Forms.Panel (); + this.groupbox_folder_selection = new System.Windows.Forms.GroupBox (); + this.label5 = new System.Windows.Forms.Label (); + this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); this.panel_server_selection = new System.Windows.Forms.Panel (); this.groupbox_server_selection = new System.Windows.Forms.GroupBox (); this.ServerEntry = new SparkleShare.controls.ExampleTextBox (); @@ -45,9 +49,6 @@ namespace SparkleShare { this.radio_button_gitorious = new System.Windows.Forms.RadioButton (); this.radio_button_github = new System.Windows.Forms.RadioButton (); this.radio_button_own_server = new System.Windows.Forms.RadioButton (); - this.groupbox_folder_selection = new System.Windows.Forms.GroupBox (); - this.label5 = new System.Windows.Forms.Label (); - this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); this.buttonSync = new System.Windows.Forms.Button (); this.buttonCancel = new System.Windows.Forms.Button (); this.label4 = new System.Windows.Forms.Label (); @@ -68,13 +69,14 @@ namespace SparkleShare { this.buttonOpenFolder = new System.Windows.Forms.Button (); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); this.panel_info.SuspendLayout (); - this.groupBox3.SuspendLayout (); this.tabControl.SuspendLayout (); this.setupPage.SuspendLayout (); + this.groupBox1.SuspendLayout (); this.addPage.SuspendLayout (); + this.panel_folder_selection.SuspendLayout (); + this.groupbox_folder_selection.SuspendLayout (); this.panel_server_selection.SuspendLayout (); this.groupbox_server_selection.SuspendLayout (); - this.groupbox_folder_selection.SuspendLayout (); this.syncingPage.SuspendLayout (); this.errorPage.SuspendLayout (); this.finishedPage.SuspendLayout (); @@ -92,29 +94,19 @@ namespace SparkleShare { // panel_info // this.panel_info.BackColor = System.Drawing.Color.White; - this.panel_info.Controls.Add (this.groupBox3); + this.panel_info.Controls.Add (this.label_info); this.panel_info.Location = new System.Drawing.Point (0, 0); this.panel_info.Name = "panel_info"; this.panel_info.Size = new System.Drawing.Size (150, 396); this.panel_info.TabIndex = 7; this.panel_info.Visible = false; // - // groupBox3 - // - this.groupBox3.Controls.Add (this.label_info); - this.groupBox3.Location = new System.Drawing.Point (15, 56); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size (129, 270); - this.groupBox3.TabIndex = 0; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "Information"; - // // label_info // - this.label_info.Location = new System.Drawing.Point (11, 28); + this.label_info.Location = new System.Drawing.Point (12, 105); this.label_info.Name = "label_info"; - this.label_info.Size = new System.Drawing.Size (112, 229); - this.label_info.TabIndex = 0; + this.label_info.Size = new System.Drawing.Size (112, 253); + this.label_info.TabIndex = 1; this.label_info.Text = "Informative text"; // // tabControl @@ -134,10 +126,7 @@ namespace SparkleShare { // // setupPage // - this.setupPage.Controls.Add (this.EmailEntry); - this.setupPage.Controls.Add (this.NameEntry); - this.setupPage.Controls.Add (this.label13); - this.setupPage.Controls.Add (this.label12); + this.setupPage.Controls.Add (this.groupBox1); this.setupPage.Controls.Add (this.label11); this.setupPage.Controls.Add (this.label10); this.setupPage.Controls.Add (this.buttonNext); @@ -149,40 +138,51 @@ namespace SparkleShare { this.setupPage.Text = "Setup"; this.setupPage.UseVisualStyleBackColor = true; // + // groupBox1 + // + this.groupBox1.Controls.Add (this.EmailEntry); + this.groupBox1.Controls.Add (this.NameEntry); + this.groupBox1.Controls.Add (this.label13); + this.groupBox1.Controls.Add (this.label12); + this.groupBox1.Location = new System.Drawing.Point (14, 119); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size (429, 102); + this.groupBox1.TabIndex = 7; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Information about you"; + // // EmailEntry // - this.EmailEntry.Location = new System.Drawing.Point (157, 135); + this.EmailEntry.Location = new System.Drawing.Point (150, 54); this.EmailEntry.Name = "EmailEntry"; this.EmailEntry.Size = new System.Drawing.Size (275, 20); - this.EmailEntry.TabIndex = 6; - this.EmailEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); + this.EmailEntry.TabIndex = 10; // // NameEntry // - this.NameEntry.Location = new System.Drawing.Point (157, 109); + this.NameEntry.Location = new System.Drawing.Point (150, 28); this.NameEntry.Name = "NameEntry"; this.NameEntry.Size = new System.Drawing.Size (275, 20); - this.NameEntry.TabIndex = 5; - this.NameEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); + this.NameEntry.TabIndex = 9; // // label13 // this.label13.AutoSize = true; this.label13.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label13.Location = new System.Drawing.Point (11, 138); + this.label13.Location = new System.Drawing.Point (15, 57); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size (41, 13); - this.label13.TabIndex = 4; + this.label13.TabIndex = 8; this.label13.Text = "Email:"; // // label12 // this.label12.AutoSize = true; this.label12.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label12.Location = new System.Drawing.Point (11, 112); + this.label12.Location = new System.Drawing.Point (15, 31); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size (65, 13); - this.label12.TabIndex = 3; + this.label12.TabIndex = 7; this.label12.Text = "Full name:"; // // label11 @@ -217,8 +217,8 @@ namespace SparkleShare { // // addPage // + this.addPage.Controls.Add (this.panel_folder_selection); this.addPage.Controls.Add (this.panel_server_selection); - this.addPage.Controls.Add (this.groupbox_folder_selection); this.addPage.Controls.Add (this.buttonSync); this.addPage.Controls.Add (this.buttonCancel); this.addPage.Controls.Add (this.label4); @@ -230,6 +230,45 @@ namespace SparkleShare { this.addPage.Text = "Add"; this.addPage.UseVisualStyleBackColor = true; // + // panel_folder_selection + // + this.panel_folder_selection.Controls.Add (this.groupbox_folder_selection); + this.panel_folder_selection.Location = new System.Drawing.Point (2, 213); + this.panel_folder_selection.Name = "panel_folder_selection"; + this.panel_folder_selection.Size = new System.Drawing.Size (512, 123); + this.panel_folder_selection.TabIndex = 13; + this.panel_folder_selection.MouseLeave += new System.EventHandler (this.panel_folder_selection_MouseLeave); + // + // groupbox_folder_selection + // + this.groupbox_folder_selection.Controls.Add (this.label5); + this.groupbox_folder_selection.Controls.Add (this.FolderEntry); + this.groupbox_folder_selection.Location = new System.Drawing.Point (10, 20); + this.groupbox_folder_selection.Name = "groupbox_folder_selection"; + this.groupbox_folder_selection.Size = new System.Drawing.Size (470, 88); + this.groupbox_folder_selection.TabIndex = 11; + this.groupbox_folder_selection.TabStop = false; + this.groupbox_folder_selection.Text = "Folder selection"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point (6, 43); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size (121, 13); + this.label5.TabIndex = 9; + this.label5.Text = "Folder name (on server):"; + // + // FolderEntry + // + this.FolderEntry.ExampleText = "/path/to/folder"; + this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.FolderEntry.Location = new System.Drawing.Point (133, 40); + this.FolderEntry.Name = "FolderEntry"; + this.FolderEntry.Size = new System.Drawing.Size (318, 20); + this.FolderEntry.TabIndex = 8; + this.FolderEntry.MouseEnter += new System.EventHandler (this.FolderEntry_MouseEnter); + // // panel_server_selection // this.panel_server_selection.Controls.Add (this.groupbox_server_selection); @@ -308,37 +347,6 @@ namespace SparkleShare { this.radio_button_own_server.UseVisualStyleBackColor = true; this.radio_button_own_server.MouseEnter += new System.EventHandler (this.radio_button_own_server_MouseEnter); // - // groupbox_folder_selection - // - this.groupbox_folder_selection.Controls.Add (this.label5); - this.groupbox_folder_selection.Controls.Add (this.FolderEntry); - this.groupbox_folder_selection.Location = new System.Drawing.Point (21, 213); - this.groupbox_folder_selection.Name = "groupbox_folder_selection"; - this.groupbox_folder_selection.Size = new System.Drawing.Size (470, 123); - this.groupbox_folder_selection.TabIndex = 11; - this.groupbox_folder_selection.TabStop = false; - this.groupbox_folder_selection.Text = "Folder selection"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (6, 55); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (121, 13); - this.label5.TabIndex = 9; - this.label5.Text = "Folder name (on server):"; - // - // FolderEntry - // - this.FolderEntry.ExampleText = "/path/to/folder"; - this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.FolderEntry.Location = new System.Drawing.Point (133, 52); - this.FolderEntry.Name = "FolderEntry"; - this.FolderEntry.Size = new System.Drawing.Size (318, 20); - this.FolderEntry.TabIndex = 8; - this.FolderEntry.MouseEnter += new System.EventHandler (this.FolderEntry_MouseEnter); - this.FolderEntry.MouseLeave += new System.EventHandler (this.FolderEntry_MouseLeave); - // // buttonSync // this.buttonSync.Location = new System.Drawing.Point (431, 355); @@ -531,17 +539,19 @@ namespace SparkleShare { this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleSetup_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit (); this.panel_info.ResumeLayout (false); - this.groupBox3.ResumeLayout (false); this.tabControl.ResumeLayout (false); this.setupPage.ResumeLayout (false); this.setupPage.PerformLayout (); + this.groupBox1.ResumeLayout (false); + this.groupBox1.PerformLayout (); this.addPage.ResumeLayout (false); this.addPage.PerformLayout (); + this.panel_folder_selection.ResumeLayout (false); + this.groupbox_folder_selection.ResumeLayout (false); + this.groupbox_folder_selection.PerformLayout (); this.panel_server_selection.ResumeLayout (false); this.groupbox_server_selection.ResumeLayout (false); this.groupbox_server_selection.PerformLayout (); - this.groupbox_folder_selection.ResumeLayout (false); - this.groupbox_folder_selection.PerformLayout (); this.syncingPage.ResumeLayout (false); this.syncingPage.PerformLayout (); this.errorPage.ResumeLayout (false); @@ -579,16 +589,10 @@ namespace SparkleShare { private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label10; private System.Windows.Forms.Button buttonNext; - private System.Windows.Forms.TextBox EmailEntry; - private System.Windows.Forms.TextBox NameEntry; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.Label label12; private System.Windows.Forms.GroupBox groupbox_folder_selection; private System.Windows.Forms.Label label5; private controls.ExampleTextBox FolderEntry; private System.Windows.Forms.Panel panel_info; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.Label label_info; private System.Windows.Forms.Panel panel_server_selection; private System.Windows.Forms.GroupBox groupbox_server_selection; private controls.ExampleTextBox ServerEntry; @@ -596,6 +600,13 @@ namespace SparkleShare { private System.Windows.Forms.RadioButton radio_button_gitorious; private System.Windows.Forms.RadioButton radio_button_github; private System.Windows.Forms.RadioButton radio_button_own_server; + private System.Windows.Forms.Label label_info; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox EmailEntry; + private System.Windows.Forms.TextBox NameEntry; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Panel panel_folder_selection; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index b1d3dabe..34f6c33c 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -21,6 +21,7 @@ using System.IO; using System.Text.RegularExpressions; using System.Timers; using System.Collections.Generic; +using System.Threading; using System.Windows.Forms; using System.Drawing; @@ -222,7 +223,7 @@ namespace SparkleShare { showInfo ("This is the path to your git project ..."); } - private void FolderEntry_MouseLeave (object sender, EventArgs e) { + private void panel_folder_selection_MouseLeave (object sender, EventArgs e) { hideInfo (); } } From 9f729e5e3e3ab857deb9d808cb4ef18a2911ab00 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 2 Oct 2011 00:52:21 +0200 Subject: [PATCH 050/134] Merge with upstream (11a932b73ee7b94b33f0bb2a7fb9468aa52de81c) --- .gitignore | 1 + SparkleLib/Git/SparkleFetcherGit.cs | 94 +- SparkleLib/Git/SparkleRepoGit.cs | 35 +- SparkleLib/Hg/SparkleRepoHg.cs | 10 +- SparkleLib/Makefile.am | 5 - SparkleLib/Scp/SparkleFetcherScp.cs | 139 -- SparkleLib/Scp/SparkleRepoScp.cs | 115 -- SparkleLib/SparkleBackend.cs | 2 +- SparkleLib/SparkleChangeSet.cs | 44 +- SparkleLib/SparkleConfig.cs | 227 +-- SparkleLib/SparkleFetcherBase.cs | 29 +- SparkleLib/SparkleListenerBase.cs | 55 +- SparkleLib/SparkleListenerIrc.cs | 18 +- SparkleLib/SparkleListenerTcp.cs | 15 +- SparkleLib/SparkleRepoBase.cs | 39 +- SparkleLib/windows/SparkleLib.csproj | 11 +- SparkleShare/Makefile.am | 7 +- SparkleShare/Program.cs | 131 ++ SparkleShare/SparkleAbout.cs | 21 +- SparkleShare/SparkleAboutController.cs | 32 +- SparkleShare/SparkleBubbles.cs | 33 +- SparkleShare/SparkleBubblesController.cs | 23 +- SparkleShare/SparkleController.cs | 1236 ++--------------- SparkleShare/SparkleControllerBase.cs | 1183 ++++++++++++++++ SparkleShare/SparkleEventLog.cs | 256 ++-- SparkleShare/SparkleEventLogController.cs | 16 +- SparkleShare/SparkleExtensions.cs | 35 + SparkleShare/SparkleLinController.cs | 46 +- SparkleShare/SparkleSetup.cs | 274 +++- SparkleShare/SparkleSetupController.cs | 92 +- SparkleShare/SparkleSetupWindow.cs | 21 +- SparkleShare/SparkleShare.csproj | 16 +- SparkleShare/SparkleShare.sln | 12 +- SparkleShare/SparkleStatusIcon.cs | 175 +-- SparkleShare/SparkleStatusIconController.cs | 16 +- SparkleShare/SparkleUIHelpers.cs | 19 +- SparkleShare/Windows/Program.cs | 38 +- ...eWinController.cs => SparkleController.cs} | 4 +- SparkleShare/Windows/SparkleShare.csproj | 9 +- SparkleShare/sparkleshare.in | 5 + 40 files changed, 2546 insertions(+), 1993 deletions(-) delete mode 100644 SparkleLib/Scp/SparkleFetcherScp.cs delete mode 100644 SparkleLib/Scp/SparkleRepoScp.cs create mode 100644 SparkleShare/Program.cs create mode 100644 SparkleShare/SparkleControllerBase.cs create mode 100644 SparkleShare/SparkleExtensions.cs rename SparkleShare/Windows/{SparkleWinController.cs => SparkleController.cs} (98%) diff --git a/.gitignore b/.gitignore index 4de048e7..16c48d78 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ SparkleShare/Nautilus/sparkleshare-nautilus-extension.py gnome-doc-utils.make /sparkleshare-* desktop.ini +_ReSharper.* diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index b8e6a75e..11a39046 100644 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -18,6 +18,7 @@ using System; using System.IO; using System.Diagnostics; +using System.Text.RegularExpressions; using System.Xml; namespace SparkleLib { @@ -25,12 +26,15 @@ namespace SparkleLib { // Sets up a fetcher that can get remote folders public class SparkleFetcherGit : SparkleFetcherBase { + private SparkleGit git; + + public SparkleFetcherGit (string server, string remote_folder, string target_folder) : base (server, remote_folder, target_folder) { remote_folder = remote_folder.Trim ("/".ToCharArray ()); - if (server.StartsWith("http")) { + if (server.StartsWith ("http")) { base.target_folder = target_folder; base.remote_url = server; return; @@ -57,13 +61,20 @@ namespace SparkleLib { } else { server = server.TrimEnd ("/".ToCharArray ()); + string protocol = "ssh://"; + if (server.StartsWith ("ssh://")) + server = server.Substring (6); + + if (server.StartsWith ("git://")) { server = server.Substring (6); + protocol = "git://"; + } if (!server.Contains ("@")) server = "git@" + server; - server = "ssh://" + server; + server = protocol + server; } base.target_folder = target_folder; @@ -73,15 +84,51 @@ namespace SparkleLib { public override bool Fetch () { - SparkleGit git = new SparkleGit (SparklePaths.SparkleTmpPath, - "clone \"" + base.remote_url + "\" " + "\"" + base.target_folder + "\""); + this.git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath, + "clone " + + "--progress " + // Redirects progress stats to standarderror + "\"" + base.remote_url + "\" " + "\"" + base.target_folder + "\""); + + this.git.StartInfo.RedirectStandardError = true; + this.git.Start (); + + double percentage = 1.0; + Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled); + + while (!this.git.StandardError.EndOfStream) { + string line = this.git.StandardError.ReadLine (); + Match match = progress_regex.Match (line); + + double number = 0.0; + if (match.Success) { + number = double.Parse (match.Groups [1].Value); + + // The cloning progress consists of two stages: the "Compressing + // objects" stage which we count as 20% of the total progress, and + // the "Receiving objects" stage which we count as the last 80% + if (line.Contains ("|")) + // "Receiving objects" stage + number = (number / 100 * 75 + 20); + else + // "Compressing objects" stage + number = (number / 100 * 20); + } + + if (number >= percentage) { + percentage = number; + + // FIXME: for some reason it doesn't go above 95% + base.OnProgressChanged (percentage); + } + + System.Threading.Thread.Sleep (100); + } + + this.git.WaitForExit (); - git.Start (); - git.WaitForExit (); + SparkleHelpers.DebugInfo ("Git", "Exit code " + this.git.ExitCode.ToString ()); - SparkleHelpers.DebugInfo ("Git", "Exit code " + git.ExitCode.ToString ()); - - if (git.ExitCode != 0) { + if (this.git.ExitCode != 0) { return false; } else { InstallConfiguration (); @@ -91,11 +138,22 @@ namespace SparkleLib { } + public override void Stop () + { + if (this.git != null) { + this.git.Kill (); + this.git.Dispose (); + } + + base.Stop (); + } + + // Install the user's name and email and some config into // the newly cloned repository private void InstallConfiguration () { - string global_config_file_path = Path.Combine (SparklePaths.SparkleConfigPath, "config.xml"); + string global_config_file_path = Path.Combine (SparkleConfig.DefaultConfig.TmpPath, "config.xml"); if (!File.Exists (global_config_file_path)) return; @@ -103,17 +161,20 @@ namespace SparkleLib { string repo_config_file_path = SparkleHelpers.CombineMore (base.target_folder, ".git", "config"); string config = String.Join (Environment.NewLine, File.ReadAllLines (repo_config_file_path)); + string n = Environment.NewLine; + + // Show special characters in the logs + config = config.Replace ("[core]" + n, + "[core]" + n + "quotepath = false" + n); + // Be case sensitive explicitly to work on Mac config = config.Replace ("ignorecase = true", "ignorecase = false"); // Ignore permission changes config = config.Replace ("filemode = true", "filemode = false"); - config = config.Replace ("fetch = +refs/heads/*:refs/remotes/origin/*", - "fetch = +refs/heads/*:refs/remotes/origin/*" + Environment.NewLine + - "\tfetch = +refs/notes/*:refs/notes/*"); + // Add user info - string n = Environment.NewLine; XmlDocument xml = new XmlDocument(); xml.Load (global_config_file_path); @@ -146,6 +207,10 @@ namespace SparkleLib { // gedit and emacs writer.WriteLine ("*~"); + // Firefox and Chromium temporary download files + writer.WriteLine ("*.part"); + writer.WriteLine ("*.crdownload"); + // vi(m) writer.WriteLine (".*.sw[a-z]"); writer.WriteLine ("*.un~"); @@ -168,7 +233,6 @@ namespace SparkleLib { // Windows writer.WriteLine ("Thumbs.db"); writer.WriteLine ("Desktop.ini"); - writer.WriteLine ("~*"); // CVS writer.WriteLine ("*/CVS/*"); diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 0b0f631f..43b11ed4 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -131,7 +131,9 @@ namespace SparkleLib { public override bool SyncUp () { Add (); - Commit ("Changes made by SparkleShare"); + + string message = FormatCommitMessage (); + Commit (message); SparkleGit git = new SparkleGit (LocalPath, "push origin master"); git.Start (); @@ -163,6 +165,8 @@ namespace SparkleLib { public override bool AnyDifferences { get { + FillEmptyDirectories (LocalPath); + SparkleGit git = new SparkleGit (LocalPath, "status --porcelain"); git.Start (); @@ -197,7 +201,7 @@ namespace SparkleLib { if (value) { if (!File.Exists (unsynced_file_path)) - File.Create (unsynced_file_path); + File.Create (unsynced_file_path).Close (); } else { File.Delete (unsynced_file_path); } @@ -330,7 +334,7 @@ namespace SparkleLib { // Windows doesn't allow colons in the file name, so // we use "h" between the hours and minutes instead. string timestamp = DateTime.Now.ToString ("HH\\hmm MMM d"); - string their_path = conflicting_path + " (" + SparkleConfig.DefaultConfig.UserName + ", " + timestamp + ")"; + string their_path = conflicting_path + " (" + SparkleConfig.DefaultConfig.User.Name + ", " + timestamp + ")"; string abs_conflicting_path = Path.Combine (LocalPath, conflicting_path); string abs_their_path = Path.Combine (LocalPath, their_path); @@ -452,9 +456,9 @@ namespace SparkleLib { change_set.Folder = Name; change_set.Revision = match.Groups [1].Value; - change_set.UserName = match.Groups [2].Value; - change_set.UserEmail = match.Groups [3].Value; - change_set.IsMerge = is_merge_commit; + change_set.User.Name = match.Groups [2].Value; + change_set.User.Email = match.Groups [3].Value; + change_set.IsMagical = is_merge_commit; change_set.Timestamp = new DateTime (int.Parse (match.Groups [4].Value), int.Parse (match.Groups [5].Value), int.Parse (match.Groups [6].Value), @@ -477,6 +481,9 @@ namespace SparkleLib { string file_path = entry_line.Substring (39); string to_file_path; + if (file_path.EndsWith (".empty")) + file_path = file_path.Substring (0, file_path.Length - ".empty".Length); + if (change_type.Equals ("A") && !file_path.Contains (".notes")) { change_set.Added.Add (file_path); @@ -512,6 +519,22 @@ namespace SparkleLib { } + // Git doesn't track empty directories, so this method + // fills them all with a hidden empty file + private void FillEmptyDirectories (string path) + { + foreach (string child_path in Directory.GetDirectories (path)) { + if (child_path.EndsWith (".git") || child_path.EndsWith (".notes")) + continue; + + FillEmptyDirectories (child_path); + } + + if (Directory.GetFiles (path).Length == 0) + File.Create (Path.Combine (path, ".empty")).Close (); + } + + // Creates a pretty commit message based on what has changed private string FormatCommitMessage () { diff --git a/SparkleLib/Hg/SparkleRepoHg.cs b/SparkleLib/Hg/SparkleRepoHg.cs index d59c3915..1d0cdb8b 100644 --- a/SparkleLib/Hg/SparkleRepoHg.cs +++ b/SparkleLib/Hg/SparkleRepoHg.cs @@ -130,7 +130,7 @@ namespace SparkleLib { if (value) { if (!File.Exists (unsynced_file_path)) - File.Create (unsynced_file_path); + File.Create (unsynced_file_path).Close (); } else { File.Delete (unsynced_file_path); } @@ -234,11 +234,13 @@ namespace SparkleLib { SparkleChangeSet change_set = new SparkleChangeSet () { Revision = match.Groups [9].Value, - UserName = match.Groups [7].Value.Trim (), - UserEmail = match.Groups [8].Value, - IsMerge = is_merge_commit + IsMagical = is_merge_commit }; + change_set.User.Name = match.Groups [7].Value.Trim (); + change_set.User.Email = match.Groups [8].Value; + + change_set.Timestamp = new DateTime (int.Parse (match.Groups [1].Value), int.Parse (match.Groups [2].Value), int.Parse (match.Groups [3].Value), int.Parse (match.Groups [4].Value), int.Parse (match.Groups [5].Value), 0); diff --git a/SparkleLib/Makefile.am b/SparkleLib/Makefile.am index e5fdcd51..6356372a 100644 --- a/SparkleLib/Makefile.am +++ b/SparkleLib/Makefile.am @@ -11,10 +11,6 @@ SOURCES = \ Defines.cs \ Git/SparkleFetcherGit.cs \ Git/SparkleRepoGit.cs \ - Hg/SparkleFetcherHg.cs \ - Hg/SparkleRepoHg.cs \ - Scp/SparkleFetcherScp.cs \ - Scp/SparkleRepoScp.cs \ SparkleBackend.cs \ SparkleChangeSet.cs \ SparkleConfig.cs \ @@ -24,7 +20,6 @@ SOURCES = \ SparkleListenerIrc.cs \ SparkleListenerTcp.cs \ SparkleOptions.cs \ - SparklePaths.cs \ SparkleRepoBase.cs \ SparkleWatcher.cs diff --git a/SparkleLib/Scp/SparkleFetcherScp.cs b/SparkleLib/Scp/SparkleFetcherScp.cs deleted file mode 100644 index d20e22a7..00000000 --- a/SparkleLib/Scp/SparkleFetcherScp.cs +++ /dev/null @@ -1,139 +0,0 @@ -// SparkleShare, a collaboration and sharing tool. -// 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 System.IO; -using System.Diagnostics; -using System.Xml; - -namespace SparkleLib { - - // Sets up a fetcher that can get remote folders - public class SparkleFetcherScp : SparkleFetcherBase { - - public SparkleFetcherScp (string server, string remote_folder, string target_folder) : - base (server, remote_folder, target_folder) { } - - - public override bool Fetch () - { - SparkleScp scp = new SparkleScp (SparklePaths.SparkleTmpPath, - "-r \"" + base.remote_url + "\" " + "\"" + base.target_folder + "\""); - - scp.Start (); - scp.WaitForExit (); - - SparkleHelpers.DebugInfo ("Scp", "Exit code " + scp.ExitCode.ToString ()); - - if (scp.ExitCode != 0) { - return false; - } else { - InstallConfiguration (); - InstallExcludeRules (); - return true; - } - } - - - // Install the user's name and email and some config into - // the newly cloned repository - private void InstallConfiguration () - { - string log_file_path = SparkleHelpers.CombineMore (base.target_folder, ".sparkleshare", "log"); - File.Create (log_file_path); - - string config_file_path = SparkleHelpers.CombineMore (base.target_folder, ".sparkleshare", "config"); - File.Create (config_file_path); - - string config = ""; - - // Write the config to the file - TextWriter writer = new StreamWriter (config_file_path); - writer.WriteLine (config); - writer.Close (); - - SparkleHelpers.DebugInfo ("Config", "Added configuration to '" + config_file_path + "'"); - } - - - // Add a .gitignore file to the repo - private void InstallExcludeRules () - { - string exlude_rules_file_path = SparkleHelpers.CombineMore (base.target_folder, ".sparkleshare", "exclude"); - File.Create (exlude_rules_file_path); - - TextWriter writer = new StreamWriter (exlude_rules_file_path); - - // gedit and emacs - writer.WriteLine ("*~"); - - // vi(m) - writer.WriteLine (".*.sw[a-z]"); - writer.WriteLine ("*.un~"); - writer.WriteLine ("*.swp"); - writer.WriteLine ("*.swo"); - - // KDE - writer.WriteLine (".directory"); - - // Mac OSX - writer.WriteLine (".DS_Store"); - writer.WriteLine ("Icon?"); - writer.WriteLine ("._*"); - writer.WriteLine (".Spotlight-V100"); - writer.WriteLine (".Trashes"); - - // Mac OSX - writer.WriteLine ("*(Autosaved).graffle"); - - // Windows - writer.WriteLine ("Thumbs.db"); - writer.WriteLine ("Desktop.ini"); - - // CVS - writer.WriteLine ("*/CVS/*"); - writer.WriteLine (".cvsignore"); - writer.WriteLine ("*/.cvsignore"); - - // Subversion - writer.WriteLine ("/.svn/*"); - writer.WriteLine ("*/.svn/*"); - - writer.Close (); - } - } - - public class SparkleScp : Process { - - public SparkleScp (string path, string args) : base () - { - EnableRaisingEvents = true; - StartInfo.FileName = SparkleBackend.DefaultBackend.Path; - StartInfo.Arguments = args; - StartInfo.RedirectStandardOutput = true; - StartInfo.UseShellExecute = false; - StartInfo.WorkingDirectory = path; - } - - - new public void Start () - { - SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments); - base.Start (); - } - } -} diff --git a/SparkleLib/Scp/SparkleRepoScp.cs b/SparkleLib/Scp/SparkleRepoScp.cs deleted file mode 100644 index a3030557..00000000 --- a/SparkleLib/Scp/SparkleRepoScp.cs +++ /dev/null @@ -1,115 +0,0 @@ -// SparkleShare, a collaboration and sharing tool. -// 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 System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Text.RegularExpressions; - -namespace SparkleLib { - - public class SparkleRepoScp : SparkleRepoBase { - - public SparkleRepoScp (string path, SparkleBackend backend) : - base (path, backend) { } - - - public override string Identifier { - get { - return "sparkles"; - } - } - - - public override string CurrentRevision { - get { - return ""; - } - } - - - public override bool CheckForRemoteChanges () - { - return true; - } - - - public override bool SyncUp () - { - return true; - } - - - public override bool SyncDown () - { - return true; - } - - - public override bool AnyDifferences { - get { - return false; - } - } - - - public override bool HasUnsyncedChanges { - get { - string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath, - ".sparkleshare", "has_unsynced_changes"); - - return File.Exists (unsynced_file_path); - } - - set { - string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath, - ".sparkleshare", "has_unsynced_changes"); - - if (value) { - if (!File.Exists (unsynced_file_path)) - File.Create (unsynced_file_path); - } else { - File.Delete (unsynced_file_path); - } - } - } - - - public override List GetChangeSets (int count) - { - var l = new List (); - l.Add (new SparkleChangeSet () { UserName = "test", UserEmail = "test", Revision = "test", Timestamp = DateTime.Now }); - return l; - } - - - public override void CreateInitialChangeSet () - { - base.CreateInitialChangeSet (); - } - - - public override bool UsesNotificationCenter - { - get { - string file_path = SparkleHelpers.CombineMore (LocalPath, ".sparkleshare", "disable_notification_center"); - return !File.Exists (file_path); - } - } - } -} diff --git a/SparkleLib/SparkleBackend.cs b/SparkleLib/SparkleBackend.cs index ee9d1208..c916fa83 100644 --- a/SparkleLib/SparkleBackend.cs +++ b/SparkleLib/SparkleBackend.cs @@ -32,7 +32,7 @@ namespace SparkleLib { public SparkleBackend (string name, string [] paths) { Name = name; - Path = "git"; // default + Path = "git"; foreach (string path in paths) { if (File.Exists (path)) { diff --git a/SparkleLib/SparkleChangeSet.cs b/SparkleLib/SparkleChangeSet.cs index 3961c39c..5496e44e 100644 --- a/SparkleLib/SparkleChangeSet.cs +++ b/SparkleLib/SparkleChangeSet.cs @@ -16,20 +16,20 @@ using System; +using System.IO; using System.Collections.Generic; namespace SparkleLib { public class SparkleChangeSet { - public string UserName; - public string UserEmail; + public SparkleUser User = new SparkleUser ("Unknown", "Unknown"); public string Folder; public string Revision; public DateTime Timestamp; public DateTime FirstTimestamp; - public bool IsMerge = false; + public bool IsMagical = false; public List Added = new List (); public List Deleted = new List (); @@ -76,10 +76,44 @@ namespace SparkleLib { public class SparkleNote { - public string UserName; - public string UserEmail; + public SparkleUser User; public DateTime Timestamp; public string Body; } + + + public class SparkleUser { + + public string Name; + public string Email; + + public string PublicKey; + + + public SparkleUser (string name, string email) + { + Name = name; + Email = email; + } + } + + + public class SparkleFolder { + + public string Name; + // TODO: Uri + + public string FullPath { + get { + return Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, Name); + } + } + + + public SparkleFolder (string name) + { + Name = name; + } + } } diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index d6eea46b..17282bb0 100644 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -23,19 +23,37 @@ using System.Xml; #if __MonoCS__ using Mono.Unix; #endif + namespace SparkleLib { public class SparkleConfig : XmlDocument { - public static SparkleConfig DefaultConfig = new SparkleConfig ( - SparklePaths.SparkleConfigPath, "config.xml"); + public static string ConfigPath = Path.Combine ( + Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), + "sparkleshare"); - public string Path; + public static SparkleConfig DefaultConfig = new SparkleConfig (ConfigPath, "config.xml"); + + + public string FullPath; + + public string HomePath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); + public string TmpPath; + + public string FoldersPath { + get { + if (GetConfigOption ("folders_path") != null) + return GetConfigOption ("folders_path"); + else + return Path.Combine (HomePath, "SparkleShare"); + } + } public SparkleConfig (string config_path, string config_file_name) { - Path = System.IO.Path.Combine (config_path, config_file_name); + FullPath = System.IO.Path.Combine (config_path, config_file_name); + TmpPath = Path.Combine (FoldersPath, ".tmp"); if (!Directory.Exists (config_path)) { Directory.CreateDirectory (config_path); @@ -48,10 +66,30 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Config", "Created \"" + icons_path + "\""); } - if (!File.Exists (Path)) + try { + Load (FullPath); + + } catch (TypeInitializationException) { CreateInitialConfig (); - Load (Path); + } catch (IOException) { + CreateInitialConfig (); + + } catch (XmlException) { + + FileInfo file = new FileInfo (FullPath); + + if (file.Length == 0) { + File.Delete (FullPath); + CreateInitialConfig (); + + } else { + throw new XmlException (FullPath + " does not contain a valid config XML structure."); + } + + } finally { + Load (FullPath); + } } @@ -59,20 +97,23 @@ namespace SparkleLib { { string user_name = "Unknown"; + if (SparkleBackend.Platform == PlatformID.Unix || + SparkleBackend.Platform == PlatformID.MacOSX) { #if __MonoCS__ user_name = new UnixUserInfo (UnixEnvironment.UserName).RealName; if (string.IsNullOrEmpty (user_name)) user_name = UnixEnvironment.UserName; else user_name = user_name.TrimEnd (",".ToCharArray()); -#else - user_name = Environment.UserName; #endif + } else { + user_name = Environment.UserName; + } if (string.IsNullOrEmpty (user_name)) user_name = "Unknown"; - TextWriter writer = new StreamWriter (Path); + TextWriter writer = new StreamWriter (FullPath); string n = Environment.NewLine; writer.Write ("" + n + @@ -84,36 +125,31 @@ namespace SparkleLib { ""); writer.Close (); - SparkleHelpers.DebugInfo ("Config", "Created \"" + Path + "\""); + SparkleHelpers.DebugInfo ("Config", "Created \"" + FullPath + "\""); } - public string UserName { + public SparkleUser User { get { - XmlNode node = SelectSingleNode ("/sparkleshare/user/name/text()"); - return node.Value; + XmlNode name_node = SelectSingleNode ("/sparkleshare/user/name/text()"); + string name = name_node.Value; + + XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()"); + string email = email_node.Value; + + return new SparkleUser (name, email); } set { - XmlNode node = SelectSingleNode ("/sparkleshare/user/name/text()"); - node.InnerText = value; + SparkleUser user = (SparkleUser) value; - Save (); - } - } + XmlNode name_node = SelectSingleNode ("/sparkleshare/user/name/text()"); + name_node.InnerText = user.Name; + XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()"); + email_node.InnerText = user.Email; - public string UserEmail { - get { - XmlNode node = SelectSingleNode ("/sparkleshare/user/email/text()"); - return node.Value; - } - - set { - XmlNode node = SelectSingleNode ("/sparkleshare/user/email/text()"); - node.InnerText = value; - - Save (); + this.Save (); } } @@ -149,22 +185,7 @@ namespace SparkleLib { XmlNode node_root = SelectSingleNode ("/sparkleshare"); node_root.AppendChild (node_folder); - Save (); - } - - public bool SetFolderOptionalAttribute (string name, string key, string value) - { - XmlNode folder = this.GetFolder(name); - if (folder == null) return false; - - if (folder[key] != null) { - folder[key].InnerText = value; - } else { - XmlNode new_node = CreateElement(key); - new_node.InnerText = value; - folder.AppendChild(new_node); - } - return true; + this.Save (); } @@ -175,28 +196,64 @@ namespace SparkleLib { SelectSingleNode ("/sparkleshare").RemoveChild (node_folder); } - Save (); + this.Save (); } public bool FolderExists (string name) { - XmlNode folder = this.GetFolder(name); - return folder != null; + XmlNode folder = this.GetFolder (name); + return (folder != null); } public string GetBackendForFolder (string name) { - return this.GetFolderValue(name, "backend"); + return this.GetFolderValue (name, "backend"); } public string GetUrlForFolder (string name) { - return this.GetFolderValue(name, "url"); + return this.GetFolderValue (name, "url"); } - + + + public bool SetFolderOptionalAttribute (string folder_name, string key, string value) + { + XmlNode folder = this.GetFolder (folder_name); + + if (folder == null) + return false; + + if (folder [key] != null) { + folder [key].InnerText = value; + + } else { + XmlNode new_node = CreateElement (key); + new_node.InnerText = value; + folder.AppendChild (new_node); + } + + return true; + } + + + public string GetFolderOptionalAttribute (string folder_name, string key) + { + XmlNode folder = this.GetFolder (folder_name); + + if (folder != null) { + if (folder [key] != null) + return folder [key].InnerText; + else + return null; + + } else { + return null; + } + } + public List Hosts { get { @@ -204,6 +261,7 @@ namespace SparkleLib { foreach (XmlNode node_folder in SelectNodes ("/sparkleshare/folder")) { Uri uri = new Uri (node_folder ["url"].InnerText); + if (!hosts.Contains (uri.Host)) hosts.Add (uri.Host); } @@ -213,21 +271,40 @@ namespace SparkleLib { } - public string GetAnnouncementsForFolder (string name) - { - return this.GetFolderValue(name, "announcements"); + public List HostsWithUsername { + get { + List hosts = new List (); + + foreach (XmlNode node_folder in SelectNodes ("/sparkleshare/folder")) { + Uri uri = new Uri (node_folder ["url"].InnerText); + + if ("git" != uri.UserInfo && !hosts.Contains (uri.UserInfo + "@" + uri.Host)) + hosts.Add (uri.UserInfo + "@" + uri.Host); + } + + return hosts; + } } - public string GetAnnouncementUrlForFolder (string name) + private XmlNode GetFolder (string name) { - // examples? - // tcp://localhost:9999/ - // xmpp:someuser@somexmppserver?canhavefunnybits - // irc://hbons/#somechatroom - return this.GetFolderValue(name, "announcements_url"); + return SelectSingleNode (String.Format("/sparkleshare/folder[name='{0}']", name)); } + + private string GetFolderValue (string name, string key) + { + XmlNode folder = this.GetFolder(name); + + if ((folder != null) && (folder [key] != null)) { + return folder [key].InnerText; + } + + return null; + } + + public string GetConfigOption (string name) { XmlNode node = SelectSingleNode ("/sparkleshare/" + name); @@ -255,34 +332,17 @@ namespace SparkleLib { } SparkleHelpers.DebugInfo ("Config", "Updated " + name + ":" + content); - Save (); + this.Save (); } - public void Save () + private void Save () { - if (!File.Exists (Path)) - throw new ConfigFileNotFoundException (Path + " does not exist"); + if (!File.Exists (FullPath)) + throw new ConfigFileNotFoundException (FullPath + " does not exist"); - Save (Path); - SparkleHelpers.DebugInfo ("Config", "Updated \"" + Path + "\""); - } - - - private XmlNode GetFolder (string name) - { - return SelectSingleNode(String.Format("/sparkleshare/folder[name='{0}']", name)); - } - - - private string GetFolderValue (string name, string key) - { - XmlNode folder = this.GetFolder(name); - - if ((folder != null) && (folder[key] != null)) { - return folder[key].InnerText; - } - return null; + this.Save (FullPath); + SparkleHelpers.DebugInfo ("Config", "Updated \"" + FullPath + "\""); } } @@ -293,3 +353,4 @@ namespace SparkleLib { base (message) { } } } + diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index 6a767add..1650b1aa 100644 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -33,18 +33,19 @@ namespace SparkleLib { public delegate void StartedEventHandler (); public delegate void FinishedEventHandler (); public delegate void FailedEventHandler (); + public delegate void ProgressChangedEventHandler (double percentage); public event StartedEventHandler Started; public event FinishedEventHandler Finished; public event FailedEventHandler Failed; + public event ProgressChangedEventHandler ProgressChanged; protected string target_folder; protected string remote_url; + private Thread thread; - public abstract bool Fetch (); - - + public SparkleFetcherBase (string server, string remote_folder, string target_folder) { this.target_folder = target_folder; @@ -52,6 +53,9 @@ namespace SparkleLib { } + public abstract bool Fetch (); + + // Clones the remote repository public void Start () { @@ -97,6 +101,13 @@ namespace SparkleLib { } + public virtual void Stop () + { + this.thread.Abort (); + this.thread.Join (); + } + + public string RemoteUrl { get { return this.remote_url; @@ -112,10 +123,16 @@ namespace SparkleLib { } } - + + protected void OnProgressChanged (double percentage) { + if (ProgressChanged != null) + ProgressChanged (percentage); + } + + private void DisableHostKeyCheckingForHost (string host) { - string path = SparklePaths.HomePath; + string path = SparkleConfig.DefaultConfig.HomePath; if (!(SparkleBackend.Platform == PlatformID.Unix || SparkleBackend.Platform == PlatformID.MacOSX)) { @@ -154,7 +171,7 @@ namespace SparkleLib { private void EnableHostKeyCheckingForHost (string host) { - string path = SparklePaths.HomePath; + string path = SparkleConfig.DefaultConfig.HomePath; if (!(SparkleBackend.Platform == PlatformID.Unix || SparkleBackend.Platform == PlatformID.MacOSX)) { diff --git a/SparkleLib/SparkleListenerBase.cs b/SparkleLib/SparkleListenerBase.cs index e35e036f..e7ae5c4f 100644 --- a/SparkleLib/SparkleListenerBase.cs +++ b/SparkleLib/SparkleListenerBase.cs @@ -41,35 +41,44 @@ namespace SparkleLib { public static SparkleListenerBase CreateListener (string folder_name, string folder_identifier) { - string announce_uri = SparkleConfig.DefaultConfig.GetAnnouncementUrlForFolder (folder_name); + string uri = SparkleConfig.DefaultConfig.GetFolderOptionalAttribute ( + folder_name, "announcements_url"); - if (announce_uri == null) { + if (uri == null) { // This is SparkleShare's centralized notification service. // Don't worry, we only use this server as a backup if you // don't have your own. All data needed to connect is hashed and // we don't store any personal information ever - - announce_uri = "irc://204.62.14.135/"; + + uri = "tcp://204.62.14.135:1986"; // TODO: announcements.sparkleshare.org } + Uri announce_uri = new Uri (uri); + + // We use only one listener per server to keep + // the number of connections as low as possible foreach (SparkleListenerBase listener in listeners) { if (listener.Server.Equals (announce_uri)) { - SparkleHelpers.DebugInfo ("ListenerFactory", "Refered to existing listener for " + announce_uri); + SparkleHelpers.DebugInfo ("ListenerFactory", + "Refered to existing listener for " + announce_uri); + listener.AlsoListenTo (folder_identifier); return (SparkleListenerBase) listener; } } - Uri listen_on = new Uri (announce_uri); - - switch (listen_on.Scheme) { - case "tcp": - listeners.Add (new SparkleListenerTcp (listen_on, folder_identifier)); - break; - case "irc": - default: - listeners.Add (new SparkleListenerIrc (listen_on, folder_identifier)); - break; + // Create a new listener with the appropriate + // type if one doesn't exist yet for that server + switch (announce_uri.Scheme) { + case "tcp": + listeners.Add (new SparkleListenerTcp (announce_uri, folder_identifier)); + break; + case "irc": + listeners.Add (new SparkleListenerIrc (announce_uri, folder_identifier)); + break; + default: + listeners.Add (new SparkleListenerTcp (announce_uri, folder_identifier)); + break; } SparkleHelpers.DebugInfo ("ListenerFactory", "Issued new listener for " + announce_uri); @@ -109,20 +118,25 @@ namespace SparkleLib { protected Uri server; protected Timer reconnect_timer = new Timer { Interval = 60 * 1000, Enabled = true }; - public SparkleListenerBase (Uri server, string folder_identifier) { + public SparkleListenerBase (Uri server, string folder_identifier) + { + this.server = server; + this.reconnect_timer.Elapsed += delegate { if (!IsConnected && !this.is_connecting) Reconnect (); }; - this.server = server; this.reconnect_timer.Start (); } - public void AnnounceBase (SparkleAnnouncement announcement) { + public void AnnounceBase (SparkleAnnouncement announcement) + { if (IsConnected) { - SparkleHelpers.DebugInfo ("Listener", "Announcing to " + announcement.FolderIdentifier + " on " + this.server); + SparkleHelpers.DebugInfo ("Listener", + "Announcing to " + announcement.FolderIdentifier + " on " + this.server); + Announce (announcement); } else { @@ -161,6 +175,7 @@ namespace SparkleLib { if (this.queue_up.Count > 0) { SparkleHelpers.DebugInfo ("Listener", "Delivering queued messages..."); + foreach (SparkleAnnouncement announcement in this.queue_up) { AnnounceBase (announcement); this.queue_up.Remove (announcement); @@ -171,7 +186,7 @@ namespace SparkleLib { public void OnDisconnected () { - SparkleHelpers.DebugInfo ("Listener", "Disonnected"); + SparkleHelpers.DebugInfo ("Listener", "Disonnected from " + Server); if (Disconnected != null) Disconnected (); diff --git a/SparkleLib/SparkleListenerIrc.cs b/SparkleLib/SparkleListenerIrc.cs index 1932ef3e..2bedae0f 100644 --- a/SparkleLib/SparkleListenerIrc.cs +++ b/SparkleLib/SparkleListenerIrc.cs @@ -48,6 +48,20 @@ namespace SparkleLib { PingInterval = 60 }; + string proxy = Environment.GetEnvironmentVariable ("http_proxy"); + Uri proxy_uri = null; + if (!String.IsNullOrEmpty (proxy) && + Uri.TryCreate (proxy, UriKind.Absolute, out proxy_uri)) { + +#if __MonoCS__ + if (proxy_uri.Scheme == "http") { + this.client.ProxyType = ProxyType.Http; + this.client.ProxyHost = proxy_uri.Host; + this.client.ProxyPort = proxy_uri.Port; + } +#endif + } + this.client.OnConnected += delegate { base.is_connecting = false; OnConnected (); @@ -92,11 +106,12 @@ namespace SparkleLib { int port = base.server.Port; if (port < 0) port = 6667; this.client.Connect (base.server.Host, port); - this.client.Login (this.nick, this.nick); + this.client.Login (this.nick, this.nick, 8, this.nick); foreach (string channel in base.channels) { SparkleHelpers.DebugInfo ("ListenerIrc", "Joining channel " + channel); this.client.RfcJoin (channel); + this.client.RfcMode (channel, "+s"); } // List to the channel, this blocks the thread @@ -124,6 +139,7 @@ namespace SparkleLib { if (IsConnected) { SparkleHelpers.DebugInfo ("ListenerIrc", "Joining channel " + channel); this.client.RfcJoin (channel); + this.client.RfcMode (channel, "+s"); } } } diff --git a/SparkleLib/SparkleListenerTcp.cs b/SparkleLib/SparkleListenerTcp.cs index ad7e71ae..ee82127a 100644 --- a/SparkleLib/SparkleListenerTcp.cs +++ b/SparkleLib/SparkleListenerTcp.cs @@ -46,11 +46,12 @@ namespace SparkleLib { public override bool IsConnected { get { - //return this.client.IsConnected; bool result = false; + lock (this.mutex) { result = this.connected; } + return result; } } @@ -70,40 +71,46 @@ namespace SparkleLib { int port = Server.Port; if (port < 0) port = 9999; this.socket.Connect (Server.Host, port); + lock (this.mutex) { base.is_connecting = false; this.connected = true; + OnConnected (); + foreach (string channel in base.channels) { SparkleHelpers.DebugInfo ("ListenerTcp", "Subscribing to channel " + channel); this.socket.Send (Encoding.UTF8.GetBytes ("subscribe " + channel + "\n")); } } - byte [] bytes = new byte [4096]; // List to the channels, this blocks the thread while (this.socket.Connected) { int bytes_read = this.socket.Receive (bytes); + if (bytes_read > 0) { string received = Encoding.UTF8.GetString (bytes); string folder_identifier = received.Substring (0, received.IndexOf ("!")); string message = received.Substring (received.IndexOf ("!") + 1); OnAnnouncement (new SparkleAnnouncement (folder_identifier, message)); + } else { SparkleHelpers.DebugInfo ("ListenerTcp", "Error on socket"); + lock (this.mutex) { - this.socket.Close(); + this.socket.Close (); this.connected = false; + + OnDisconnected (); } } } SparkleHelpers.DebugInfo ("ListenerTcp", "Disconnected from " + Server.Host); - // TODO: attempt to reconnect..? } catch (SocketException e) { SparkleHelpers.DebugInfo ("ListenerTcp", "Could not connect to " + Server + ": " + e.Message); } diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index f781d57c..9be8e97a 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -67,9 +67,12 @@ namespace SparkleLib { public delegate void SyncStatusChangedEventHandler (SyncStatus new_status); public event SyncStatusChangedEventHandler SyncStatusChanged; - public delegate void NewChangeSetEventHandler (SparkleChangeSet change_set, string source_path); + public delegate void NewChangeSetEventHandler (SparkleChangeSet change_set); public event NewChangeSetEventHandler NewChangeSet; + public delegate void NewNoteEventHandler (string user_name, string user_email); + public event NewNoteEventHandler NewNote; + public delegate void ConflictResolvedEventHandler (); public event ConflictResolvedEventHandler ConflictResolved; @@ -253,6 +256,8 @@ namespace SparkleLib { this.listener.Announcement += delegate (SparkleAnnouncement announcement) { string identifier = Identifier; + Console.WriteLine (announcement.Message + " ! " + CurrentRevision); + if (announcement.FolderIdentifier == identifier && !announcement.Message.Equals (CurrentRevision)) { if ((Status != SyncStatus.SyncUp) && @@ -276,7 +281,6 @@ namespace SparkleLib { { lock (this.change_lock) { if (this.has_changed) { - Console.WriteLine ("checking..."); if (this.sizebuffer.Count >= 4) this.sizebuffer.RemoveAt (0); @@ -363,8 +367,8 @@ namespace SparkleLib { if (match_notes.Success) { SparkleNote note = new SparkleNote () { - UserName = match_notes.Groups [1].Value, - UserEmail = match_notes.Groups [2].Value, + User = new SparkleUser (match_notes.Groups [1].Value, + match_notes.Groups [2].Value), Timestamp = new DateTime (1970, 1, 1).AddSeconds (int.Parse (match_notes.Groups [3].Value)), Body = match_notes.Groups [4].Value }; @@ -446,13 +450,26 @@ namespace SparkleLib { if (change_sets != null && change_sets.Count > 0) { SparkleChangeSet change_set = change_sets [0]; - if (NewChangeSet != null) - NewChangeSet (change_set, LocalPath); + bool note_added = false; + foreach (string added in change_set.Added) { + if (added.Contains (".notes")) { + if (NewNote != null) + NewNote (change_set.User.Name, change_set.User.Email); + + note_added = true; + break; + } + } + + if (!note_added) { + if (NewChangeSet != null) + NewChangeSet (change_set); + } } - // There could be changes from a - // resolved conflict. Tries only once, - //then let the timer try again periodicallly + // There could be changes from a resolved + // conflict. Tries only once, then lets + // the timer try again periodically if (HasUnsyncedChanges) SyncUp (); @@ -510,8 +527,8 @@ namespace SparkleLib { string n = Environment.NewLine; note = "" + n + " " + n + - " " + SparkleConfig.DefaultConfig.UserName + "" + n + - " " + SparkleConfig.DefaultConfig.UserEmail + "" + n + + " " + SparkleConfig.DefaultConfig.User.Name + "" + n + + " " + SparkleConfig.DefaultConfig.User.Email + "" + n + " " + n + " " + timestamp + "" + n + " " + note + "" + n + diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 76e3de80..3bb20808 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -79,16 +79,12 @@ SparkleRepoHg.cs - - SparkleFetcherScp.cs - Component - - - SparkleRepoScp.cs - SparkleConfig.cs + + SparklePaths.cs + SparkleRepoBase.cs @@ -105,7 +101,6 @@ - diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am index 15dee260..802cbdbd 100644 --- a/SparkleShare/Makefile.am +++ b/SparkleShare/Makefile.am @@ -12,19 +12,20 @@ BUILD_DEFINES="-define:HAVE_APP_INDICATOR" endif SOURCES = \ + Program.cs \ SparkleAbout.cs \ SparkleAboutController.cs \ SparkleBubbles.cs \ SparkleBubblesController.cs \ SparkleController.cs \ + SparkleControllerBase.cs \ SparkleEntry.cs \ SparkleEventLog.cs \ SparkleEventLogController.cs \ - SparkleLinController.cs \ + SparkleExtensions.cs \ SparkleSetup.cs \ SparkleSetupController.cs \ SparkleSetupWindow.cs \ - SparkleShare.cs \ SparkleSpinner.cs \ SparkleStatusIcon.cs \ SparkleStatusIconController.cs \ @@ -40,7 +41,7 @@ SOURCES = \ SparkleSetup.cs \ SparkleSetupController.cs \ SparkleSetupWindow.cs \ - SparkleShare.cs \ + Program.cs \ SparkleSpinner.cs \ SparkleStatusIcon.cs \ SparkleStatusIconController.cs \ diff --git a/SparkleShare/Program.cs b/SparkleShare/Program.cs new file mode 100644 index 00000000..8d5f7697 --- /dev/null +++ b/SparkleShare/Program.cs @@ -0,0 +1,131 @@ +// SparkleShare, a collaboration and sharing tool. +// 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 System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +using Mono.Unix; +//using Mono.Unix.Native; +using SparkleLib; +using SparkleLib.Options; + +namespace SparkleShare { + + // This is SparkleShare! + public class Program { + + public static SparkleController Controller; + public static SparkleUI UI; + + + // Short alias for the translations + public static string _ (string s) + { + return Catalog.GetString (s); + } + + + public static void Main (string [] args) + { + // Parse the command line options + bool show_help = false; + OptionSet option_set = new OptionSet () { + { "v|version", _("Print version information"), v => { PrintVersion (); } }, + { "h|help", _("Show this help text"), v => show_help = v != null } + }; + + try { + option_set.Parse (args); + + } catch (OptionException e) { + Console.Write ("SparkleShare: "); + Console.WriteLine (e.Message); + Console.WriteLine ("Try `sparkleshare --help' for more information."); + } + + if (show_help) + ShowHelp (option_set); + + + // Initialize the controller this way so that + // there aren't any exceptions in the OS specific UI's + Controller = new SparkleController (); + Controller.Initialize (); + + if (Controller != null) { + UI = new SparkleUI (); + UI.Run (); + } + } + + + // Prints the help output + public static void ShowHelp (OptionSet option_set) + { + Console.WriteLine (" "); + Console.WriteLine (_("SparkleShare, a collaboration and sharing tool.")); + Console.WriteLine (_("Copyright (C) 2010 Hylke Bons")); + Console.WriteLine (" "); + Console.WriteLine (_("This program comes with ABSOLUTELY NO WARRANTY.")); + Console.WriteLine (" "); + Console.WriteLine (_("This is free software, and you are welcome to redistribute it ")); + Console.WriteLine (_("under certain conditions. Please read the GNU GPLv3 for details.")); + Console.WriteLine (" "); + Console.WriteLine (_("SparkleShare automatically syncs Git repositories in ")); + Console.WriteLine (_("the ~/SparkleShare folder with their remote origins.")); + Console.WriteLine (" "); + Console.WriteLine (_("Usage: sparkleshare [start|stop|restart] [OPTION]...")); + Console.WriteLine (_("Sync SparkleShare folder with remote repositories.")); + Console.WriteLine (" "); + Console.WriteLine (_("Arguments:")); + + option_set.WriteOptionDescriptions (Console.Out); + Environment.Exit (0); + } + + + // Prints the version information + public static void PrintVersion () + { + Console.WriteLine (_("SparkleShare " + Defines.VERSION)); + Environment.Exit (0); + } + + + // Strange magic needed by SetProcessName () + [DllImport ("libc")] + private static extern int prctl (int option, byte [] arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5); + + + // Sets the Unix process name to 'sparkleshare' instead of 'mono' + private static void SetProcessName (string name) + { + try { + if (prctl (15, Encoding.ASCII.GetBytes (name + "\0"), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) != 0) + throw new ApplicationException ("Error setting process name: " + + Mono.Unix.Native.Stdlib.GetLastError ()); + + } catch (EntryPointNotFoundException) { + Console.WriteLine ("SetProcessName: Entry point not found"); + } + } + } +} diff --git a/SparkleShare/SparkleAbout.cs b/SparkleShare/SparkleAbout.cs index 5f132110..7bb6e2ad 100644 --- a/SparkleShare/SparkleAbout.cs +++ b/SparkleShare/SparkleAbout.cs @@ -21,20 +21,20 @@ using System.IO; using System.Net; using Gtk; +using Mono.Unix; namespace SparkleShare { public class SparkleAbout : Window { - public SparkleAboutController Controller = new SparkleAboutController (); - + public SparkleAboutController Controller; private Label updates; // Short alias for the translations public static string _(string s) { - return s; + return Catalog.GetString (s); } @@ -53,21 +53,22 @@ namespace SparkleShare { Title = _("About SparkleShare"); AppPaintable = true; - MemoryStream MemStream = new MemoryStream(); - Icons.about.Save(MemStream, System.Drawing.Imaging.ImageFormat.Png); - MemStream.Seek(0, SeekOrigin.Begin); + string image_path = new string [] {SparkleUI.AssetsPath, + "pixmaps", "about.png"}.Combine (); + Realize (); - Gdk.Pixbuf buf = new Gdk.Pixbuf(MemStream); + Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path); Gdk.Pixmap map, map2; buf.RenderPixmapAndMask (out map, out map2, 255); GdkWindow.SetBackPixmap (map, false); - CreateAbout (); + Controller = new SparkleAboutController (); Controller.NewVersionEvent += delegate (string new_version) { Application.Invoke (delegate { this.updates.Markup = String.Format ("{0}", String.Format (_("A newer version ({0}) is available!"), new_version)); + this.updates.ShowAll (); }); }; @@ -76,6 +77,7 @@ namespace SparkleShare { Application.Invoke (delegate { this.updates.Markup = String.Format ("{0}", _("You are running the latest version.")); + this.updates.ShowAll (); }); }; @@ -84,9 +86,12 @@ namespace SparkleShare { Application.Invoke (delegate { this.updates.Markup = String.Format ("{0}", _("Checking for updates...")); + this.updates.ShowAll (); }); }; + + this.CreateAbout (); } diff --git a/SparkleShare/SparkleAboutController.cs b/SparkleShare/SparkleAboutController.cs index d35f78eb..5495dfc9 100644 --- a/SparkleShare/SparkleAboutController.cs +++ b/SparkleShare/SparkleAboutController.cs @@ -68,24 +68,24 @@ namespace SparkleShare { Uri uri = new Uri ("http://www.sparkleshare.org/version"); web_client.DownloadStringCompleted += delegate (object o, DownloadStringCompletedEventArgs args) { - if (args.Error != null) { - Console.WriteLine ("Error during version check: {0}", args.Error.Message); + if (args.Error != null) + return; + + string new_version = args.Result.Trim (); + + // Add a little delay, making it seems we're + // actually doing hard work + Thread.Sleep (2 * 1000); + + if (RunningVersion.Equals (new_version)) { + if (VersionUpToDateEvent != null) + VersionUpToDateEvent (); + } else { - string new_version = args.Result.Trim (); - - // Add a little delay, making it seems we're - // actually doing hard work - Thread.Sleep (2 * 1000); - - if (RunningVersion.Equals (new_version)) { - if (VersionUpToDateEvent != null) - VersionUpToDateEvent (); - - } else { - if (NewVersionEvent != null) - NewVersionEvent (new_version); - } + if (NewVersionEvent != null) + NewVersionEvent (new_version); } + this.version_checker.Start (); }; diff --git a/SparkleShare/SparkleBubbles.cs b/SparkleShare/SparkleBubbles.cs index 7f0f2cf3..8b29622b 100644 --- a/SparkleShare/SparkleBubbles.cs +++ b/SparkleShare/SparkleBubbles.cs @@ -30,27 +30,24 @@ namespace SparkleShare { public SparkleBubbles () { Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) { - Notification notification = new Notification () { - Timeout = 5 * 1000, - Urgency = Urgency.Low - }; + try { + Notification notification = new Notification () { + Timeout = 5 * 1000, + Urgency = Urgency.Low + }; + + if (image_path != null) + notification.Icon = new Gdk.Pixbuf (image_path); + else + notification.IconName = "folder-sparkleshare"; - if (image_path != null) - notification.Icon = new Gdk.Pixbuf (image_path); - else - notification.IconName = "folder-sparkleshare"; + notification.Show (); - notification.Show (); + } catch (Exception) { + // Ignore exceptions thrown by libnotify, + // they're not important enough to crash + } }; } - - - // 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) -// { -// if (Array.IndexOf (Notifications.Global.Capabilities, "actions") > -1) -// base.AddAction (action, label, handler); -// } } } diff --git a/SparkleShare/SparkleBubblesController.cs b/SparkleShare/SparkleBubblesController.cs index 56ffd3a9..e6983625 100644 --- a/SparkleShare/SparkleBubblesController.cs +++ b/SparkleShare/SparkleBubblesController.cs @@ -27,19 +27,24 @@ namespace SparkleShare { public SparkleBubblesController () { - SparkleShare.Controller.ConflictNotificationRaised += delegate { - if (ShowBubbleEvent != null && SparkleShare.Controller.NotificationsEnabled) - ShowBubbleEvent ("Ouch! Mid-air collision!", - "Don't worry, SparkleShare made a copy of each conflicting file.", null); + Program.Controller.ConflictNotificationRaised += delegate { + ShowBubble ("Ouch! Mid-air collision!", + "Don't worry, SparkleShare made a copy of each conflicting file.", + null); }; - SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email, + Program.Controller.NotificationRaised += delegate (string user_name, string user_email, string message, string folder_path) { - - if (ShowBubbleEvent != null && SparkleShare.Controller.NotificationsEnabled) - ShowBubbleEvent (user_name, message, - SparkleShare.Controller.GetAvatar (user_email, 36)); + ShowBubble (user_name, message, + Program.Controller.GetAvatar (user_email, 36)); }; } + + + public void ShowBubble (string title, string subtext, string image_path) + { + if (ShowBubbleEvent != null && Program.Controller.NotificationsEnabled) + ShowBubbleEvent (title, subtext, image_path); + } } } diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 112081b6..d4ceda9e 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -19,1139 +19,195 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; -using System.Net; -using System.Security.Cryptography; +using System.Runtime.InteropServices; using System.Text; -using System.Text.RegularExpressions; using System.Threading; -using System.Xml; +using Mono.Unix; using SparkleLib; namespace SparkleShare { - public abstract class SparkleController { + public class SparkleController : SparkleControllerBase { - public List Repositories; - public string FolderSize; - public readonly string SparklePath = SparklePaths.SparklePath; - - public event OnQuitWhileSyncingEventHandler OnQuitWhileSyncing; - public delegate void OnQuitWhileSyncingEventHandler (); - - public event FolderFetchedEventHandler FolderFetched; - public delegate void FolderFetchedEventHandler (string target_folder_name); - - public event FolderFetchErrorEventHandler FolderFetchError; - public delegate void FolderFetchErrorEventHandler (); - - public event FolderListChangedEventHandler FolderListChanged; - public delegate void FolderListChangedEventHandler (); - - public event FolderSizeChangedEventHandler FolderSizeChanged; - public delegate void FolderSizeChangedEventHandler (string folder_size); - - public event AvatarFetchedEventHandler AvatarFetched; - public delegate void AvatarFetchedEventHandler (); - - public event OnIdleEventHandler OnIdle; - public delegate void OnIdleEventHandler (); - - public event OnSyncingEventHandler OnSyncing; - public delegate void OnSyncingEventHandler (); - - public event OnErrorEventHandler OnError; - public delegate void OnErrorEventHandler (); - - public event OnInvitationEventHandler OnInvitation; - public delegate void OnInvitationEventHandler (string server, string folder, string token); - - public event ConflictNotificationRaisedEventHandler ConflictNotificationRaised; - public delegate void ConflictNotificationRaisedEventHandler (); - - public event NotificationRaisedEventHandler NotificationRaised; - public delegate void NotificationRaisedEventHandler (string user_name, string user_email, - string message, string repository_path); - - - // Short alias for the translations - public static string _ (string s) + public SparkleController () : base () { - return s; - } - - - public SparkleController () { } - - public virtual void Initialize () - { - InstallLauncher (); - EnableSystemAutostart (); - - // Create the SparkleShare folder and add it to the bookmarks - if (CreateSparkleShareFolder ()) - AddToBookmarks (); - - FolderSize = GetFolderSize (); - - // TODO: Legacy. Remove at some later point - string old_global_config_file_path = Path.Combine (SparklePaths.SparkleConfigPath, "config"); - if (File.Exists (old_global_config_file_path)) - MigrateConfig (); - - if (FirstRun) - SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); - else - AddKey (); - - // Watch the SparkleShare folder - FileSystemWatcher watcher = new FileSystemWatcher (SparklePaths.SparklePath) { - IncludeSubdirectories = false, - EnableRaisingEvents = true, - Filter = "*" - }; - - // Remove the repository when a delete event occurs - watcher.Deleted += delegate (object o, FileSystemEventArgs args) { - RemoveRepository (args.FullPath); - SparkleConfig.DefaultConfig.RemoveFolder (Path.GetFileName (args.Name)); - - if (FolderListChanged != null) - FolderListChanged (); - - FolderSize = GetFolderSize (); - - if (FolderSizeChanged != null) - FolderSizeChanged (FolderSize); - }; - - - watcher.Created += delegate (object o, FileSystemEventArgs args) { - - // Handle invitations when the user saves an - // invitation into the SparkleShare folder - if (args.Name.EndsWith (".sparkle") && !FirstRun) { - XmlDocument xml_doc = new XmlDocument (); - xml_doc.Load (args.Name); - - string server = xml_doc.GetElementsByTagName ("server") [0].InnerText; - string folder = xml_doc.GetElementsByTagName ("folder") [0].InnerText; - string token = xml_doc.GetElementsByTagName ("token") [0].InnerText; - - // FIXME: this is broken :\ - if (OnInvitation != null) - OnInvitation (server, folder, token); - } - }; - - PopulateRepositories(); - } - - - public bool FirstRun { - get { - return SparkleConfig.DefaultConfig.UserEmail.Equals ("Unknown"); - } - } - - - private void MigrateConfig () - { - string old_global_config_file_path = Path.Combine (SparklePaths.SparkleConfigPath, "config"); - - StreamReader reader = new StreamReader (old_global_config_file_path); - string global_config_file = reader.ReadToEnd (); - reader.Close (); - - Regex regex = new Regex (@"name.+= (.+)"); - Match match = regex.Match (global_config_file); - - string user_name = match.Groups [1].Value; - - regex = new Regex (@"email.+= (.+)"); - match = regex.Match (global_config_file); - - string user_email = match.Groups [1].Value; - - SparkleConfig.DefaultConfig.UserName = user_name; - SparkleConfig.DefaultConfig.UserEmail = user_email; - - File.Delete (old_global_config_file_path); - } - - - // Uploads the user's public key to the server - public bool AcceptInvitation (string server, string folder, string token) - { - // The location of the user's public key for SparkleShare - string public_key_file_path = SparkleHelpers.CombineMore (SparklePaths.HomePath, ".ssh", - "sparkleshare." + UserEmail + ".key.pub"); - - if (!File.Exists (public_key_file_path)) - return false; - - StreamReader reader = new StreamReader (public_key_file_path); - string public_key = reader.ReadToEnd (); - reader.Close (); - - string url = "https://" + server + "/?folder=" + folder + - "&token=" + token + "&pubkey=" + public_key; - - SparkleHelpers.DebugInfo ("WebRequest", url); - - HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url); - HttpWebResponse response = (HttpWebResponse) request.GetResponse(); - - if (response.StatusCode == HttpStatusCode.OK) { - response.Close (); - return true; - - } else { - response.Close (); - return false; - } - } - - - public List Folders { - get { - List folders = SparkleConfig.DefaultConfig.Folders; - folders.Sort (); - return folders; - } - } - - - public List UnsyncedFolders { - get { - List unsynced_folders = new List (); - - foreach (SparkleRepoBase repo in Repositories) { - if (repo.HasUnsyncedChanges) - unsynced_folders.Add (repo.Name); - } - - return unsynced_folders; - } - } - - - public List GetLog () - { - List list = new List (); - - foreach (SparkleRepoBase repo in Repositories) - list.AddRange (repo.GetChangeSets (50)); - - list.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); - list.Reverse (); - - if (list.Count > 100) - return list.GetRange (0, 100); - else - return list.GetRange (0, list.Count); - } - - - public List GetLog (string name) - { - if (name == null) - return GetLog (); - - string path = Path.Combine (SparklePaths.SparklePath, name); - int log_size = 50; - - foreach (SparkleRepoBase repo in Repositories) { - if (repo.LocalPath.Equals (path)) - return repo.GetChangeSets (log_size); - } - - return null; - } - - - public abstract string EventLogHTML { get; } - public abstract string DayEntryHTML { get; } - public abstract string EventEntryHTML { get; } - - - public string GetHTMLLog (List change_sets) - { - List activity_days = new List (); - List emails = new List (); - - change_sets.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); - change_sets.Reverse (); - - if (change_sets.Count == 0) - return null; - - foreach (SparkleChangeSet change_set in change_sets) { - if (!emails.Contains (change_set.UserEmail)) - emails.Add (change_set.UserEmail); - - bool change_set_inserted = false; - foreach (ActivityDay stored_activity_day in activity_days) { - if (stored_activity_day.DateTime.Year == change_set.Timestamp.Year && - stored_activity_day.DateTime.Month == change_set.Timestamp.Month && - stored_activity_day.DateTime.Day == change_set.Timestamp.Day) { - - bool squash = false; - foreach (SparkleChangeSet existing_set in stored_activity_day) { - if (change_set.UserName.Equals (existing_set.UserName) && - change_set.UserEmail.Equals (existing_set.UserEmail) && - change_set.Folder.Equals (existing_set.Folder)) { - - existing_set.Added.AddRange (change_set.Added); - existing_set.Edited.AddRange (change_set.Edited); - existing_set.Deleted.AddRange (change_set.Deleted); - existing_set.MovedFrom.AddRange (change_set.MovedFrom); - existing_set.MovedTo.AddRange (change_set.MovedTo); - existing_set.Notes.AddRange (change_set.Notes); - - existing_set.Added = existing_set.Added.Distinct ().ToList (); - existing_set.Edited = existing_set.Edited.Distinct ().ToList (); - existing_set.Deleted = existing_set.Deleted.Distinct ().ToList (); - - if (DateTime.Compare (existing_set.Timestamp, change_set.Timestamp) < 1) { - existing_set.FirstTimestamp = existing_set.Timestamp; - existing_set.Timestamp = change_set.Timestamp; - existing_set.Revision = change_set.Revision; - - } else { - existing_set.FirstTimestamp = change_set.Timestamp; - } - - squash = true; - } - } - - if (!squash) - stored_activity_day.Add (change_set); - - change_set_inserted = true; - break; - } - } - - if (!change_set_inserted) { - ActivityDay activity_day = new ActivityDay (change_set.Timestamp); - activity_day.Add (change_set); - activity_days.Add (activity_day); - } - } - - new Thread (new ThreadStart (delegate { - FetchAvatars (emails, 48); - })).Start (); - - string event_log_html = EventLogHTML; - string day_entry_html = DayEntryHTML; - string event_entry_html = EventEntryHTML; - string event_log = ""; - - foreach (ActivityDay activity_day in activity_days) { - string event_entries = ""; - - foreach (SparkleChangeSet change_set in activity_day) { - string event_entry = "
"; - - if (change_set.IsMerge) { - event_entry += "
Did something magical
"; - - } else { - if (change_set.Edited.Count > 0) { - foreach (string file_path in change_set.Edited) { - string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, - change_set.Folder, file_path); - - if (File.Exists (absolute_file_path)) - event_entry += "
" + file_path + "
"; - else - event_entry += "
" + file_path + "
"; - } - } - - if (change_set.Added.Count > 0) { - foreach (string file_path in change_set.Added) { - string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, - change_set.Folder, file_path); - - if (File.Exists (absolute_file_path)) - event_entry += "
" + file_path + "
"; - else - event_entry += "
" + file_path + "
"; - } - } - - if (change_set.Deleted.Count > 0) { - foreach (string file_path in change_set.Deleted) { - string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, - change_set.Folder, file_path); - - if (File.Exists (absolute_file_path)) - event_entry += "
" + file_path + "
"; - else - event_entry += "
" + file_path + "
"; - } - } - - if (change_set.MovedFrom.Count > 0) { - int i = 0; - foreach (string file_path in change_set.MovedFrom) { - string to_file_path = change_set.MovedTo [i]; - string absolute_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, - change_set.Folder, file_path); - string absolute_to_file_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, - change_set.Folder, to_file_path); - - if (File.Exists (absolute_file_path)) - event_entry += "
" + file_path + "
"; - else - event_entry += "
" + file_path + "
"; - - if (File.Exists (absolute_to_file_path)) - event_entry += "" + to_file_path + "
"; - else - event_entry += to_file_path + ""; - - i++; - } - } - } - - string comments = ""; - comments = "
"; - - if (change_set.Notes != null) { - change_set.Notes.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); - - foreach (SparkleNote note in change_set.Notes) { - comments += "
" + - "

" + - note.UserName + "

" + - note.Body + - "
"; - } - } - - comments += "
"; - - string avatar_email = ""; - if (File.Exists (GetAvatar (change_set.UserEmail, 48))) - avatar_email = change_set.UserEmail; - - event_entry += "
"; - - string timestamp = change_set.Timestamp.ToString ("H:mm"); - - if (!change_set.FirstTimestamp.Equals (new DateTime ())) - timestamp = change_set.FirstTimestamp.ToString ("H:mm") + - " – " + timestamp; - - event_entries += event_entry_html.Replace ("", event_entry) - .Replace ("", change_set.UserName) - .Replace ("", "file://" + GetAvatar (avatar_email, 48)) - .Replace ("", timestamp) - .Replace ("", change_set.Folder) - .Replace ("", change_set.Revision) - .Replace ("", AssignColor (change_set.Folder)) - .Replace ("", comments); - } - - string day_entry = ""; - DateTime today = DateTime.Now; - DateTime yesterday = DateTime.Now.AddDays (-1); - - if (today.Day == activity_day.DateTime.Day && - today.Month == activity_day.DateTime.Month && - today.Year == activity_day.DateTime.Year) { - - day_entry = day_entry_html.Replace ("", "Today"); - - } else if (yesterday.Day == activity_day.DateTime.Day && - yesterday.Month == activity_day.DateTime.Month && - yesterday.Year == activity_day.DateTime.Year) { - - day_entry = day_entry_html.Replace ("", "Yesterday"); - - } else { - if (activity_day.DateTime.Year != DateTime.Now.Year) { - // TRANSLATORS: This is the date in the event logs - day_entry = day_entry_html.Replace ("", - activity_day.DateTime.ToString (_("dddd, MMMM d, yyyy"))); - - } else { - // TRANSLATORS: This is the date in the event logs, without the year - day_entry = day_entry_html.Replace ("", - activity_day.DateTime.ToString (_("dddd, MMMM d"))); - } - } - - event_log += day_entry.Replace ("", event_entries); - } - - string html = event_log_html.Replace ("", event_log) - .Replace ("", UserName) - .Replace ("", "file://" + GetAvatar (UserEmail, 48)); - - return html; } // Creates a .desktop entry in autostart folder to // start SparkleShare automatically at login - public abstract void EnableSystemAutostart (); + public override void EnableSystemAutostart () + { + string autostart_path = Path.Combine (Environment.GetFolderPath ( + Environment.SpecialFolder.ApplicationData), "autostart"); + + string desktopfile_path = Path.Combine (autostart_path, "sparkleshare.desktop"); + + if (!Directory.Exists (autostart_path)) + Directory.CreateDirectory (autostart_path); + + if (!File.Exists (desktopfile_path)) { + TextWriter writer = new StreamWriter (desktopfile_path); + writer.WriteLine ("[Desktop Entry]\n" + + "Type=Application\n" + + "Name=SparkleShare\n" + + "Exec=sparkleshare start\n" + + "Icon=folder-sparkleshare\n" + + "Terminal=false\n" + + "X-GNOME-Autostart-enabled=true\n" + + "Categories=Network"); + writer.Close (); + + // Give the launcher the right permissions so it can be launched by the user + UnixFileInfo file_info = new UnixFileInfo (desktopfile_path); + file_info.Create (FileAccessPermissions.UserReadWriteExecute); + + SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login"); + } + } + // Installs a launcher so the user can launch SparkleShare // from the Internet category if needed - public abstract void InstallLauncher (); + public override void InstallLauncher () + { + string apps_path = + new string [] {SparkleConfig.DefaultConfig.HomePath, + ".local", "share", "applications"}.Combine (); + + string desktopfile_path = Path.Combine (apps_path, "sparkleshare.desktop"); + + if (!File.Exists (desktopfile_path)) { + if (!Directory.Exists (apps_path)) + Directory.CreateDirectory (apps_path); + + TextWriter writer = new StreamWriter (desktopfile_path); + writer.WriteLine ("[Desktop Entry]\n" + + "Type=Application\n" + + "Name=SparkleShare\n" + + "Comment=Share documents\n" + + "Exec=sparkleshare start\n" + + "Icon=folder-sparkleshare\n" + + "Terminal=false\n" + + "Categories=Network;"); + writer.Close (); + + // Give the launcher the right permissions so it can be launched by the user + UnixFileInfo file_info = new UnixFileInfo (desktopfile_path); + file_info.FileAccessPermissions = FileAccessPermissions.UserReadWriteExecute; + + SparkleHelpers.DebugInfo ("Controller", "Created '" + desktopfile_path + "'"); + } + } + // Adds the SparkleShare folder to the user's // list of bookmarked places - public abstract void AddToBookmarks (); + public override void AddToBookmarks () + { + string bookmarks_file_path = Path.Combine (SparkleConfig.DefaultConfig.HomePath, ".gtk-bookmarks"); + string sparkleshare_bookmark = "file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"; + + if (File.Exists (bookmarks_file_path)) { + StreamReader reader = new StreamReader (bookmarks_file_path); + string bookmarks = reader.ReadToEnd (); + reader.Close (); + + if (!bookmarks.Contains (sparkleshare_bookmark)) { + TextWriter writer = File.AppendText (bookmarks_file_path); + writer.WriteLine ("file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"); + writer.Close (); + } + } else { + StreamWriter writer = new StreamWriter (bookmarks_file_path); + writer.WriteLine ("file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"); + writer.Close (); + } + } + // Creates the SparkleShare folder in the user's home folder - public abstract bool CreateSparkleShareFolder (); - - // Opens the SparkleShare folder or an (optional) subfolder - public abstract void OpenSparkleShareFolder (string subfolder); - - - // Fires events for the current syncing state - public void UpdateState () + public override bool CreateSparkleShareFolder () { - foreach (SparkleRepoBase repo in Repositories) { - if (repo.Status == SyncStatus.SyncDown || - repo.Status == SyncStatus.SyncUp || - repo.IsBuffering) { + if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) { + + Directory.CreateDirectory (SparkleConfig.DefaultConfig.FoldersPath); + SparkleHelpers.DebugInfo ("Controller", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'"); - if (OnSyncing != null) - OnSyncing (); + string gvfs_command_path = + new string [] {Path.VolumeSeparatorChar.ToString (), + "usr", "bin", "gvfs-set-attribute"}.Combine (); - return; + // Add a special icon to the SparkleShare folder + if (File.Exists (gvfs_command_path)) { + Process process = new Process (); - } else if (repo.HasUnsyncedChanges) { - if (OnError != null) - OnError (); + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.UseShellExecute = false; + process.StartInfo.FileName = "gvfs-set-attribute"; - return; + // Clear the custom (legacy) icon path + process.StartInfo.Arguments = "-t unset " + SparkleConfig.DefaultConfig.FoldersPath + " metadata::custom-icon"; + process.Start (); + process.WaitForExit (); + + // Give the SparkleShare folder an icon name, so that it scales + process.StartInfo.Arguments = SparkleConfig.DefaultConfig.FoldersPath + " metadata::custom-icon-name 'folder-sparkleshare'"; + process.Start (); + process.WaitForExit (); } + + return true; } - if (OnIdle != null) - OnIdle (); - - FolderSize = GetFolderSize (); - - if (FolderSizeChanged != null) - FolderSizeChanged (FolderSize); + return false; } + - - // Adds a repository to the list of repositories - private void AddRepository (string folder_path) - { - if (folder_path.Equals (SparklePaths.SparkleTmpPath)) - return; - - string folder_name = Path.GetFileName (folder_path); - string backend = SparkleConfig.DefaultConfig.GetBackendForFolder (folder_name); - - if (backend == null) - return; - - SparkleRepoBase repo = null; - - if (backend.Equals ("Hg")) - repo = new SparkleRepoHg (folder_path, new SparkleBackendHg ()); - - else if (backend.Equals ("Scp")) - repo = new SparkleRepoScp (folder_path, new SparkleBackendScp ()); - - else - repo = new SparkleRepoGit (folder_path, SparkleBackend.DefaultBackend); - - repo.NewChangeSet += delegate (SparkleChangeSet change_set, string repository_path) { - string message = FormatMessage (change_set); - - if (NotificationRaised != null) - NotificationRaised (change_set.UserName, change_set.UserEmail, message, repository_path); - }; - - repo.ConflictResolved += delegate { - if (ConflictNotificationRaised != null) - ConflictNotificationRaised (); - }; - - repo.SyncStatusChanged += delegate (SyncStatus status) { -/* if (status == SyncStatus.SyncUp) { - foreach (string path in repo.UnsyncedFilePaths) - Console.WriteLine (path); - } -*/ - if (status == SyncStatus.Idle || - status == SyncStatus.SyncUp || - status == SyncStatus.SyncDown || - status == SyncStatus.Error) { - - UpdateState (); - } - }; - - repo.ChangesDetected += delegate { - UpdateState (); - }; - - Repositories.Add (repo); - } - - - // Removes a repository from the list of repositories and - // updates the statusicon menu - private void RemoveRepository (string folder_path) - { - string folder_name = Path.GetFileName (folder_path); - - for (int i = 0; i < Repositories.Count; i++) { - SparkleRepoBase repo = Repositories [i]; - - if (repo.Name.Equals (folder_name)) { - repo.Dispose (); - Repositories.Remove (repo); - repo = null; - break; - } - } - } - - - // Updates the list of repositories with all the - // folders in the SparkleShare folder - private void PopulateRepositories () - { - Repositories = new List (); - - foreach (string folder_name in SparkleConfig.DefaultConfig.Folders) { - string folder_path = Path.Combine (SparklePaths.SparklePath, folder_name); - - if (Directory.Exists (folder_path)) - AddRepository (folder_path); - else - SparkleConfig.DefaultConfig.RemoveFolder (folder_name); - } - - if (FolderListChanged != null) - FolderListChanged (); - - FolderSize = GetFolderSize (); - - if (FolderSizeChanged != null) - FolderSizeChanged (FolderSize); - } - - - public bool NotificationsEnabled { + public override string EventLogHTML { get { - string notifications_enabled = - SparkleConfig.DefaultConfig.GetConfigOption ("notifications"); + string path = new string [] {Defines.PREFIX, + "share", "sparkleshare", "html", "event-log.html"}.Combine (); - if (String.IsNullOrEmpty (notifications_enabled)) { - SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); - return true; + string html = String.Join (Environment.NewLine, File.ReadAllLines (path)); - } else { - return notifications_enabled.Equals (bool.TrueString); - } + html = html.Replace ("", "file://" + + new string [] {Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js"}.Combine ()); + + return html; } - } - - - public void ToggleNotifications () { - bool notifications_enabled = - SparkleConfig.DefaultConfig.GetConfigOption ("notifications") - .Equals (bool.TrueString); - - if (notifications_enabled) - SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.FalseString); - else - SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); - } - - - private string GetFolderSize () - { - double folder_size = CalculateFolderSize (new DirectoryInfo (SparklePaths.SparklePath)); - return FormatFolderSize (folder_size); - } - - - private string FormatMessage (SparkleChangeSet change_set) - { - string file_name = ""; - string message = ""; - - if (change_set.Added.Count > 0) { - file_name = change_set.Added [0]; - message = String.Format (_("added ‘{0}’"), file_name); - } - - if (change_set.MovedFrom.Count > 0) { - file_name = change_set.MovedFrom [0]; - message = String.Format (_("moved ‘{0}’"), file_name); - } - - if (change_set.Edited.Count > 0) { - file_name = change_set.Edited [0]; - message = String.Format (_("edited ‘{0}’"), file_name); - } - - if (change_set.Deleted.Count > 0) { - file_name = change_set.Deleted [0]; - message = String.Format (_("deleted ‘{0}’"), file_name); - } - - int changes_count = (change_set.Added.Count + - change_set.Edited.Count + - change_set.Deleted.Count + - change_set.MovedFrom.Count) - 1; - - if (changes_count > 0) { - string msg = "and {0} more"; - message += " " + String.Format (msg, changes_count); - - } else if (changes_count < 0) { - message += _("did something magical"); - } - - return message; - } // TODO: move to bubbles controller - - - // Recursively gets a folder's size in bytes - private double CalculateFolderSize (DirectoryInfo parent) - { - if (!Directory.Exists (parent.ToString ())) - return 0; - - double size = 0; - - // Ignore the temporary 'rebase-apply' and '.tmp' directories. This prevents potential - // crashes when files are being queried whilst the files have already been deleted. - if (parent.Name.Equals ("rebase-apply") || - parent.Name.Equals (".tmp")) - return 0; - - try { - foreach (FileInfo file in parent.GetFiles()) { - if (!file.Exists) - return 0; - - size += file.Length; - } - - foreach (DirectoryInfo directory in parent.GetDirectories()) - size += CalculateFolderSize (directory); - - } catch (Exception) { - return 0; - } - - return size; - } - - - // Format a file size nicely with small caps. - // Example: 1048576 becomes "1 ᴍʙ" - private string FormatFolderSize (double byte_count) - { - if (byte_count >= 1099511627776) - return String.Format ("{0:##.##} ᴛʙ", Math.Round (byte_count / 1099511627776, 1)); - else if (byte_count >= 1073741824) - return String.Format ("{0:##.##} ɢʙ", Math.Round (byte_count / 1073741824, 1)); - else if (byte_count >= 1048576) - return String.Format ("{0:##.##} ᴍʙ", Math.Round (byte_count / 1048576, 1)); - else if (byte_count >= 1024) - return String.Format ("{0:##.##} ᴋʙ", Math.Round (byte_count / 1024, 1)); - else - return byte_count.ToString () + " bytes"; - } - - - public void OpenSparkleShareFolder () - { - OpenSparkleShareFolder (""); } - // Adds the user's SparkleShare key to the ssh-agent, - // so all activity is done with this key - public void AddKey () + public override string DayEntryHTML { + get { + string path = new string [] {Defines.PREFIX, + "share", "sparkleshare", "html", "day-entry.html"}.Combine (); + + return String.Join (Environment.NewLine, File.ReadAllLines (path)); + } + } + + + public override string EventEntryHTML { + get { + string path = new string [] {Defines.PREFIX, + "share", "sparkleshare", "html", "event-entry.html"}.Combine (); + + return String.Join (Environment.NewLine, File.ReadAllLines (path)); + } + } + + + public override void OpenSparkleShareFolder (string subfolder) { - string keys_path = SparklePaths.SparkleConfigPath; - string key_file_name = "sparkleshare." + UserEmail + ".key"; + string folder = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder); Process process = new Process (); - process.StartInfo.RedirectStandardOutput = true; - process.StartInfo.UseShellExecute = false; - process.StartInfo.FileName = "ssh-add"; - process.StartInfo.Arguments = "\"" + Path.Combine (keys_path, key_file_name) + "\""; + process.StartInfo.FileName = "xdg-open"; + process.StartInfo.Arguments = "\"" + folder + "\""; process.Start (); - process.WaitForExit (); - } - - - public bool BackendIsPresent { - get { - return SparkleBackend.DefaultBackend.IsPresent; - } - } - - - // Looks up the user's name from the global configuration - public string UserName - { - get { - return SparkleConfig.DefaultConfig.UserName; - } - - set { - SparkleConfig.DefaultConfig.UserName = value; - } - } - - - // Looks up the user's email from the global configuration - public string UserEmail - { - get { - return SparkleConfig.DefaultConfig.UserEmail; - } - - set { - SparkleConfig.DefaultConfig.UserEmail = value; - } - } - - - // Generates and installs an RSA keypair to identify this system - public void GenerateKeyPair () - { - string keys_path = SparklePaths.SparkleConfigPath; - string key_file_name = "sparkleshare." + UserEmail + ".key"; - string key_file_path = Path.Combine (keys_path, key_file_name); - - if (File.Exists (key_file_path)) { - SparkleHelpers.DebugInfo ("Config", "Key already exists ('" + key_file_name + "'), " + - "leaving it untouched"); - return; - } - - if (!Directory.Exists (keys_path)) - Directory.CreateDirectory (keys_path); - - if (!File.Exists (key_file_name)) { - Process process = new Process () { - EnableRaisingEvents = true - }; - - process.StartInfo.WorkingDirectory = keys_path; - process.StartInfo.UseShellExecute = false; - process.StartInfo.RedirectStandardOutput = true; - process.StartInfo.FileName = "ssh-keygen"; - - // -t is the crypto type - // -P is the password (none) - // -f is the file name to store the private key in - process.StartInfo.Arguments = "-t rsa -P \"\" -f " + key_file_name; - - process.Exited += delegate { - SparkleHelpers.DebugInfo ("Config", "Created private key '" + key_file_name + "'"); - SparkleHelpers.DebugInfo ("Config", "Created public key '" + key_file_name + ".pub'"); - - // Create an easily accessible copy of the public - // key in the user's SparkleShare folder - string PublicKeyCopy = Path.Combine (SparklePath, UserName + "'s key.txt"); - if (File.Exists (PublicKeyCopy)) - File.Delete (PublicKeyCopy); - File.Copy (key_file_path + ".pub", PublicKeyCopy); - }; - - process.Start (); - process.WaitForExit (); - } - } - - private bool FetchingAvatars = false; - // Gets the avatar for a specific email address and size - public void FetchAvatars (List emails, int size) - { - if (FetchingAvatars) - return; - FetchingAvatars = true; - - List old_avatars = new List (); - bool avatar_fetched = false; - string avatar_path = SparkleHelpers.CombineMore ( - SparklePaths.SparkleLocalIconPath, size + "x" + size, "status"); - - if (!Directory.Exists (avatar_path)) { - Directory.CreateDirectory (avatar_path); - SparkleHelpers.DebugInfo ("Config", "Created '" + avatar_path + "'"); - } - - foreach (string email in emails) { - string avatar_file_path = Path.Combine (avatar_path, "avatar-" + email); - - if (File.Exists (avatar_file_path)) { - FileInfo avatar_info = new FileInfo (avatar_file_path); - - // Delete avatars older than a month - if (avatar_info.CreationTime < DateTime.Now.AddMonths (-1)) { - avatar_info.Delete (); - old_avatars.Add (email); - } - - } else { - WebClient client = new WebClient (); - string url = "http://gravatar.com/avatar/" + GetMD5 (email) + - ".jpg?s=" + size + "&d=404"; - - try { - // Fetch the avatar - byte [] buffer = client.DownloadData (url); - - // Write the avatar data to a - // if not empty - if (buffer.Length > 255) { - avatar_fetched = true; - File.WriteAllBytes (avatar_file_path, buffer); - SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email); - } - - } catch (WebException ex) { - SparkleHelpers.DebugInfo ("Controller", "Failed fetching gravatar for " + email); - - if (ex.Status == WebExceptionStatus.Timeout) { - // stop downloading further avatars if we have no internet access - break; - } - } - } - } - FetchingAvatars = false; - - // Fetch new versions of the avatars that we - // deleted because they were too old - if (old_avatars.Count > 0) - FetchAvatars (old_avatars, size); - - if (AvatarFetched != null && avatar_fetched) - AvatarFetched (); - } - - - public virtual string GetAvatar (string email, int size) - { - string avatar_file_path = SparkleHelpers.CombineMore ( - SparklePaths.SparkleLocalIconPath, size + "x" + size, "status", "avatar-" + email); - - return avatar_file_path; - } - - - public void FetchFolder (string server, string remote_folder) - { - server = server.Trim (); - remote_folder = remote_folder.Trim (); - - if (!Directory.Exists (SparklePaths.SparkleTmpPath)) - Directory.CreateDirectory (SparklePaths.SparkleTmpPath); - - // Strip the '.git' from the name - string canonical_name = Regex.Replace (remote_folder, @"\..*$", ""); - canonical_name = Regex.Replace (remote_folder, @"^.*/", ""); - - string tmp_folder = Path.Combine (SparklePaths.SparkleTmpPath, canonical_name); - - SparkleFetcherBase fetcher = null; - string backend = null; - - if (remote_folder.EndsWith (".hg")) { - remote_folder = remote_folder.Substring (0, (remote_folder.Length - 3)); - fetcher = new SparkleFetcherHg (server, remote_folder, tmp_folder); - backend = "Hg"; - - } else if (remote_folder.EndsWith (".scp")) { - remote_folder = remote_folder.Substring (0, (remote_folder.Length - 4)); - fetcher = new SparkleFetcherScp (server, remote_folder, tmp_folder); - backend = "Scp"; - - } else { - fetcher = new SparkleFetcherGit (server, remote_folder, tmp_folder); - backend = "Git"; - } - - bool target_folder_exists = Directory.Exists (Path.Combine (SparklePaths.SparklePath, canonical_name)); - - // Add a numbered suffix to the nameif a folder with the same name - // already exists. Example: "Folder (2)" - int i = 1; - while (target_folder_exists) { - i++; - target_folder_exists = Directory.Exists ( - Path.Combine (SparklePaths.SparklePath, canonical_name + " (" + i + ")")); - } - - string target_folder_name = canonical_name; - if (i > 1) - target_folder_name += " (" + i + ")"; - - fetcher.Finished += delegate { - - // Needed to do the moving - SparkleHelpers.ClearAttributes (tmp_folder); - string target_folder_path = Path.Combine (SparklePaths.SparklePath, target_folder_name); - - try { - Directory.Move (tmp_folder, target_folder_path); - } catch (Exception e) { - SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message); - } - - SparkleConfig.DefaultConfig.AddFolder (target_folder_name, fetcher.RemoteUrl, backend); - AddRepository (target_folder_path); - - if (FolderFetched != null) - FolderFetched (target_folder_name); - - FolderSize = GetFolderSize (); - - if (FolderSizeChanged != null) - FolderSizeChanged (FolderSize); - - if (FolderListChanged != null) - FolderListChanged (); - - fetcher.Dispose (); - - if (Directory.Exists (SparklePaths.SparkleTmpPath)) - Directory.Delete (SparklePaths.SparkleTmpPath, true); - }; - - - fetcher.Failed += delegate { - if (FolderFetchError != null) - FolderFetchError (); - - fetcher.Dispose (); - - if (Directory.Exists (SparklePaths.SparkleTmpPath)) - Directory.Delete (SparklePaths.SparkleTmpPath, true); - }; - - - fetcher.Start (); - } - - - // Creates an MD5 hash of input - private string GetMD5 (string s) - { - MD5 md5 = new MD5CryptoServiceProvider (); - Byte[] bytes = ASCIIEncoding.Default.GetBytes (s); - Byte[] encoded_bytes = md5.ComputeHash (bytes); - return BitConverter.ToString (encoded_bytes).ToLower ().Replace ("-", ""); - } - - - // Checks whether there are any folders syncing and - // quits if safe - public void TryQuit () - { - foreach (SparkleRepoBase repo in Repositories) { - if (repo.Status == SyncStatus.SyncUp || - repo.Status == SyncStatus.SyncDown || - repo.IsBuffering) { - - if (OnQuitWhileSyncing != null) - OnQuitWhileSyncing (); - - return; - } - } - - Quit (); - } - - - public void Quit () - { - foreach (SparkleRepoBase repo in Repositories) - repo.Dispose (); - Repositories = null; - -#if __MonoCS__ - Gtk.Application.Quit (); -#else - System.Windows.Forms.Application.Exit (); -#endif - } - - - // Checks to see if an email address is valid - public bool IsValidEmail (string email) - { - Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); - return regex.IsMatch (email); - } - - - - - public void AddNoteToFolder (string folder_name, string revision, string note) - { - folder_name = folder_name.Replace ("%20", " "); - note = note.Replace ("%20", " "); - - foreach (SparkleRepoBase repo in Repositories) { - if (repo.Name.Equals (folder_name)) - repo.AddNote (revision, note); - } - } - - - - - private string [] tango_palette = new string [] {"#eaab00", "#e37222", - "#3892ab", "#33c2cb", "#19b271", "#9eab05", "#8599a8", "#9ca696", - "#b88454", "#cc0033", "#8f6678", "#8c6cd0", "#796cbf", "#4060af", - "#aa9c8f", "#818a8f"}; - - private string AssignColor (string s) - { - string hash = GetMD5 (s).Substring (0, 8); - string numbers = Regex.Replace (hash, "[a-z]", ""); - int number = 3 + int.Parse (numbers); - return this.tango_palette [number % this.tango_palette.Length]; - } - } - - - public class ChangeSet : SparkleChangeSet { } - - - // All change sets that happened on a day - public class ActivityDay : List - { - public DateTime DateTime; - - public ActivityDay (DateTime date_time) - { - DateTime = date_time; - DateTime = new DateTime (DateTime.Year, DateTime.Month, DateTime.Day); } } } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs new file mode 100644 index 00000000..f2276553 --- /dev/null +++ b/SparkleShare/SparkleControllerBase.cs @@ -0,0 +1,1183 @@ +// SparkleShare, a collaboration and sharing tool. +// 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 System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Xml; + +#if __MonoCS__ +using Mono.Unix; +#endif +using SparkleLib; + +namespace SparkleShare { + + public abstract class SparkleControllerBase { + + public List Repositories; + public string FolderSize; + public readonly string SparklePath = SparkleConfig.DefaultConfig.FoldersPath; + + public event OnQuitWhileSyncingEventHandler OnQuitWhileSyncing; + public delegate void OnQuitWhileSyncingEventHandler (); + + public event FolderFetchedEventHandler FolderFetched; + public delegate void FolderFetchedEventHandler (); + + public event FolderFetchErrorEventHandler FolderFetchError; + public delegate void FolderFetchErrorEventHandler (string remote_url); + + public event FolderFetchingEventHandler FolderFetching; + public delegate void FolderFetchingEventHandler (double percentage); + + public event FolderListChangedEventHandler FolderListChanged; + public delegate void FolderListChangedEventHandler (); + + public event FolderSizeChangedEventHandler FolderSizeChanged; + public delegate void FolderSizeChangedEventHandler (string folder_size); + + public event AvatarFetchedEventHandler AvatarFetched; + public delegate void AvatarFetchedEventHandler (); + + public event OnIdleEventHandler OnIdle; + public delegate void OnIdleEventHandler (); + + public event OnSyncingEventHandler OnSyncing; + public delegate void OnSyncingEventHandler (); + + public event OnErrorEventHandler OnError; + public delegate void OnErrorEventHandler (); + + public event OnInvitationEventHandler OnInvitation; + public delegate void OnInvitationEventHandler (string server, string folder, string token); + + public event ConflictNotificationRaisedEventHandler ConflictNotificationRaised; + public delegate void ConflictNotificationRaisedEventHandler (); + + public event NotificationRaisedEventHandler NotificationRaised; + public delegate void NotificationRaisedEventHandler (string user_name, string user_email, + string message, string repository_path); + + private SparkleFetcherBase fetcher; + + + // Short alias for the translations + public static string _ (string s) + { +#if __MonoCS__ + return Catalog.GetString (s); +#else + return s; +#endif + } + + + public SparkleControllerBase () + { + } + + + public virtual void Initialize () + { + InstallLauncher (); + EnableSystemAutostart (); + + // Create the SparkleShare folder and add it to the bookmarks + if (CreateSparkleShareFolder ()) + AddToBookmarks (); + + FolderSize = GetFolderSize (); + + if (FirstRun) + SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); + else + AddKey (); + + // Watch the SparkleShare folder + FileSystemWatcher watcher = new FileSystemWatcher (SparkleConfig.DefaultConfig.FoldersPath) { + IncludeSubdirectories = false, + EnableRaisingEvents = true, + Filter = "*" + }; + + // Remove the repository when a delete event occurs + watcher.Deleted += delegate (object o, FileSystemEventArgs args) { + RemoveRepository (args.FullPath); + SparkleConfig.DefaultConfig.RemoveFolder (Path.GetFileName (args.Name)); + + if (FolderListChanged != null) + FolderListChanged (); + + FolderSize = GetFolderSize (); + + if (FolderSizeChanged != null) + FolderSizeChanged (FolderSize); + }; + + + watcher.Created += delegate (object o, FileSystemEventArgs args) { + + // Handle invitations when the user saves an + // invitation into the SparkleShare folder + if (args.Name.EndsWith (".sparkle") && !FirstRun) { + XmlDocument xml_doc = new XmlDocument (); + xml_doc.Load (args.Name); + + string server = xml_doc.GetElementsByTagName ("server") [0].InnerText; + string folder = xml_doc.GetElementsByTagName ("folder") [0].InnerText; + string token = xml_doc.GetElementsByTagName ("token") [0].InnerText; + + // FIXME: this is broken :\ + if (OnInvitation != null) + OnInvitation (server, folder, token); + } + }; + + new Thread (new ThreadStart (PopulateRepositories)).Start (); + } + + + public bool FirstRun { + get { + return SparkleConfig.DefaultConfig.User.Email.Equals ("Unknown"); + } + } + + + // Uploads the user's public key to the server + public bool AcceptInvitation (string server, string folder, string token) + { + // The location of the user's public key for SparkleShare + string public_key_file_path = SparkleHelpers.CombineMore (SparkleConfig.DefaultConfig.HomePath, ".ssh", + "sparkleshare." + UserEmail + ".key.pub"); + + if (!File.Exists (public_key_file_path)) + return false; + + StreamReader reader = new StreamReader (public_key_file_path); + string public_key = reader.ReadToEnd (); + reader.Close (); + + string url = "https://" + server + "/?folder=" + folder + + "&token=" + token + "&pubkey=" + public_key; + + SparkleHelpers.DebugInfo ("WebRequest", url); + + HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url); + HttpWebResponse response = (HttpWebResponse) request.GetResponse(); + + if (response.StatusCode == HttpStatusCode.OK) { + response.Close (); + return true; + + } else { + response.Close (); + return false; + } + } + + + public List Folders { + get { + List folders = SparkleConfig.DefaultConfig.Folders; + folders.Sort (); + return folders; + } + } + + + public List PreviousHosts { + get { + List hosts = SparkleConfig.DefaultConfig.HostsWithUsername; + hosts.AddRange(SparkleConfig.DefaultConfig.Hosts); + hosts.Sort (); + return hosts; + } + } + + + public List UnsyncedFolders { + get { + List unsynced_folders = new List (); + + foreach (SparkleRepoBase repo in Repositories) { + if (repo.HasUnsyncedChanges) + unsynced_folders.Add (repo.Name); + } + + return unsynced_folders; + } + } + + + public List GetLog () + { + List list = new List (); + + foreach (SparkleRepoBase repo in Repositories) { + List change_sets = repo.GetChangeSets (50); + + if (change_sets != null) + list.AddRange (change_sets); + else + SparkleHelpers.DebugInfo ("Log", "Could not create log for " + repo.Name); + } + + list.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); + list.Reverse (); + + if (list.Count > 100) + return list.GetRange (0, 100); + else + return list.GetRange (0, list.Count); + } + + + public List GetLog (string name) + { + if (name == null) + return GetLog (); + + string path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, name}.Combine (); + int log_size = 50; + + foreach (SparkleRepoBase repo in Repositories) { + if (repo.LocalPath.Equals (path)) + return repo.GetChangeSets (log_size); + } + + return null; + } + + + public abstract string EventLogHTML { get; } + public abstract string DayEntryHTML { get; } + public abstract string EventEntryHTML { get; } + + + public string GetHTMLLog (List change_sets) + { + List activity_days = new List (); + List emails = new List (); + + change_sets.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); + change_sets.Reverse (); + + if (change_sets.Count == 0) + return null; + + foreach (SparkleChangeSet change_set in change_sets) { + if (!emails.Contains (change_set.User.Email)) + emails.Add (change_set.User.Email); + + bool change_set_inserted = false; + foreach (ActivityDay stored_activity_day in activity_days) { + if (stored_activity_day.DateTime.Year == change_set.Timestamp.Year && + stored_activity_day.DateTime.Month == change_set.Timestamp.Month && + stored_activity_day.DateTime.Day == change_set.Timestamp.Day) { + + bool squash = false; + foreach (SparkleChangeSet existing_set in stored_activity_day) { + if (change_set.User.Name.Equals (existing_set.User.Name) && + change_set.User.Email.Equals (existing_set.User.Email) && + change_set.Folder.Equals (existing_set.Folder)) { + + existing_set.Added.AddRange (change_set.Added); + existing_set.Edited.AddRange (change_set.Edited); + existing_set.Deleted.AddRange (change_set.Deleted); + existing_set.MovedFrom.AddRange (change_set.MovedFrom); + existing_set.MovedTo.AddRange (change_set.MovedTo); + existing_set.Notes.AddRange (change_set.Notes); + + existing_set.Added = existing_set.Added.Distinct ().ToList (); + existing_set.Edited = existing_set.Edited.Distinct ().ToList (); + existing_set.Deleted = existing_set.Deleted.Distinct ().ToList (); + + if (DateTime.Compare (existing_set.Timestamp, change_set.Timestamp) < 1) { + existing_set.FirstTimestamp = existing_set.Timestamp; + existing_set.Timestamp = change_set.Timestamp; + existing_set.Revision = change_set.Revision; + + } else { + existing_set.FirstTimestamp = change_set.Timestamp; + } + + squash = true; + } + } + + if (!squash) + stored_activity_day.Add (change_set); + + change_set_inserted = true; + break; + } + } + + if (!change_set_inserted) { + ActivityDay activity_day = new ActivityDay (change_set.Timestamp); + activity_day.Add (change_set); + activity_days.Add (activity_day); + } + } + + new Thread (new ThreadStart (delegate { + FetchAvatars (emails, 48); + })).Start (); + + string event_log_html = EventLogHTML; + string day_entry_html = DayEntryHTML; + string event_entry_html = EventEntryHTML; + string event_log = ""; + + foreach (ActivityDay activity_day in activity_days) { + string event_entries = ""; + + foreach (SparkleChangeSet change_set in activity_day) { + string event_entry = "
"; + + if (change_set.IsMagical) { + event_entry += "
Did something magical
"; + + } else { + if (change_set.Edited.Count > 0) { + foreach (string file_path in change_set.Edited) { + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); + + if (File.Exists (absolute_file_path)) + event_entry += "
" + file_path + "
"; + else + event_entry += "
" + file_path + "
"; + } + } + + if (change_set.Added.Count > 0) { + foreach (string file_path in change_set.Added) { + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); + + if (File.Exists (absolute_file_path)) + event_entry += "
" + file_path + "
"; + else + event_entry += "
" + file_path + "
"; + } + } + + if (change_set.Deleted.Count > 0) { + foreach (string file_path in change_set.Deleted) { + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); + + if (File.Exists (absolute_file_path)) + event_entry += "
" + file_path + "
"; + else + event_entry += "
" + file_path + "
"; + } + } + + if (change_set.MovedFrom.Count > 0) { + int i = 0; + foreach (string file_path in change_set.MovedFrom) { + string to_file_path = change_set.MovedTo [i]; + + string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, file_path}.Combine (); + + string absolute_to_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, + change_set.Folder, to_file_path}.Combine (); + + if (File.Exists (absolute_file_path)) + event_entry += "
" + file_path + "
"; + else + event_entry += "
" + file_path + "
"; + + if (File.Exists (absolute_to_file_path)) + event_entry += "" + to_file_path + "
"; + else + event_entry += to_file_path + ""; + + i++; + } + } + } + + string comments = ""; + comments = "
"; + + if (change_set.Notes != null) { + change_set.Notes.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); + + foreach (SparkleNote note in change_set.Notes) { + + string note_avatar = GetAvatar (note.User.Email, 48); + if (File.Exists (note_avatar)) + note_avatar = "file://" + note_avatar; + else + note_avatar = ""; + + comments += "
" + + "

" + + note.User.Name + "

" + + note.Body + + "
"; + } + } + + comments += "
"; + + string change_set_avatar = GetAvatar (change_set.User.Email, 48); + if (File.Exists (change_set_avatar)) + change_set_avatar = "file://" + change_set_avatar; + else + change_set_avatar = ""; + + event_entry += "
"; + + string timestamp = change_set.Timestamp.ToString ("H:mm"); + + if (!change_set.FirstTimestamp.Equals (new DateTime ())) + timestamp = change_set.FirstTimestamp.ToString ("H:mm") + + " – " + timestamp; + + event_entries += event_entry_html.Replace ("", event_entry) + .Replace ("", change_set.User.Name) + .Replace ("", change_set_avatar) + .Replace ("", timestamp) + .Replace ("", change_set.Folder) + .Replace ("", change_set.Revision) + .Replace ("", AssignColor (change_set.Folder)) + .Replace ("", comments); + } + + string day_entry = ""; + DateTime today = DateTime.Now; + DateTime yesterday = DateTime.Now.AddDays (-1); + + if (today.Day == activity_day.DateTime.Day && + today.Month == activity_day.DateTime.Month && + today.Year == activity_day.DateTime.Year) { + + day_entry = day_entry_html.Replace ("", "Today"); + + } else if (yesterday.Day == activity_day.DateTime.Day && + yesterday.Month == activity_day.DateTime.Month && + yesterday.Year == activity_day.DateTime.Year) { + + day_entry = day_entry_html.Replace ("", "Yesterday"); + + } else { + if (activity_day.DateTime.Year != DateTime.Now.Year) { + + // TRANSLATORS: This is the date in the event logs + day_entry = day_entry_html.Replace ("", + activity_day.DateTime.ToString (_("dddd, MMMM d, yyyy"))); + + } else { + + // TRANSLATORS: This is the date in the event logs, without the year + day_entry = day_entry_html.Replace ("", + activity_day.DateTime.ToString (_("dddd, MMMM d"))); + } + } + + event_log += day_entry.Replace ("", event_entries); + } + + string html = event_log_html.Replace ("", event_log) + .Replace ("", UserName) + .Replace ("", "file://" + GetAvatar (UserEmail, 48)); + + return html; + } + + + // Creates a .desktop entry in autostart folder to + // start SparkleShare automatically at login + public abstract void EnableSystemAutostart (); + + // Installs a launcher so the user can launch SparkleShare + // from the Internet category if needed + public abstract void InstallLauncher (); + + // Adds the SparkleShare folder to the user's + // list of bookmarked places + public abstract void AddToBookmarks (); + + // Creates the SparkleShare folder in the user's home folder + public abstract bool CreateSparkleShareFolder (); + + // Opens the SparkleShare folder or an (optional) subfolder + public abstract void OpenSparkleShareFolder (string subfolder); + + + // Fires events for the current syncing state + public void UpdateState () + { + foreach (SparkleRepoBase repo in Repositories) { + if (repo.Status == SyncStatus.SyncDown || + repo.Status == SyncStatus.SyncUp || + repo.IsBuffering) { + + if (OnSyncing != null) + OnSyncing (); + + return; + + } else if (repo.HasUnsyncedChanges) { + if (OnError != null) + OnError (); + + return; + } + } + + if (OnIdle != null) + OnIdle (); + + FolderSize = GetFolderSize (); + + if (FolderSizeChanged != null) + FolderSizeChanged (FolderSize); + } + + + // Adds a repository to the list of repositories + private void AddRepository (string folder_path) + { + if (folder_path.Equals (SparkleConfig.DefaultConfig.TmpPath)) + return; + + string folder_name = Path.GetFileName (folder_path); + string backend = SparkleConfig.DefaultConfig.GetBackendForFolder (folder_name); + + if (backend == null) + return; + + SparkleRepoBase repo = new SparkleRepoGit (folder_path, SparkleBackend.DefaultBackend); + + repo.NewChangeSet += delegate (SparkleChangeSet change_set) { + string message = FormatMessage (change_set); + + if (NotificationRaised != null) + NotificationRaised (change_set.User.Name, change_set.User.Email, message, repo.LocalPath); + }; + + repo.NewNote += delegate (string user_name, string user_email) { + if (NotificationRaised != null) + NotificationRaised (user_name, user_email, + "added a note to " + Path.GetFileName (repo.LocalPath), repo.LocalPath); + }; + + repo.ConflictResolved += delegate { + if (ConflictNotificationRaised != null) + ConflictNotificationRaised (); + }; + + repo.SyncStatusChanged += delegate (SyncStatus status) { +/* if (status == SyncStatus.SyncUp) { + foreach (string path in repo.UnsyncedFilePaths) + Console.WriteLine (path); + } +*/ + if (status == SyncStatus.Idle || + status == SyncStatus.SyncUp || + status == SyncStatus.SyncDown || + status == SyncStatus.Error) { + + UpdateState (); + } + }; + + repo.ChangesDetected += delegate { + UpdateState (); + }; + + Repositories.Add (repo); + } + + + // Removes a repository from the list of repositories and + // updates the statusicon menu + private void RemoveRepository (string folder_path) + { + string folder_name = Path.GetFileName (folder_path); + + for (int i = 0; i < Repositories.Count; i++) { + SparkleRepoBase repo = Repositories [i]; + + if (repo.Name.Equals (folder_name)) { + repo.Dispose (); + Repositories.Remove (repo); + repo = null; + break; + } + } + } + + + // Updates the list of repositories with all the + // folders in the SparkleShare folder + private void PopulateRepositories () + { + Repositories = new List (); + + foreach (string folder_name in SparkleConfig.DefaultConfig.Folders) { + string folder_path = new SparkleFolder (folder_name).FullPath; + + if (Directory.Exists (folder_path)) + AddRepository (folder_path); + else + SparkleConfig.DefaultConfig.RemoveFolder (folder_name); + } + + if (FolderListChanged != null) + FolderListChanged (); + + FolderSize = GetFolderSize (); + + if (FolderSizeChanged != null) + FolderSizeChanged (FolderSize); + } + + + public bool NotificationsEnabled { + get { + string notifications_enabled = + SparkleConfig.DefaultConfig.GetConfigOption ("notifications"); + + if (String.IsNullOrEmpty (notifications_enabled)) { + SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); + return true; + + } else { + return notifications_enabled.Equals (bool.TrueString); + } + } + } + + + public void ToggleNotifications () { + bool notifications_enabled = + SparkleConfig.DefaultConfig.GetConfigOption ("notifications") + .Equals (bool.TrueString); + + if (notifications_enabled) + SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.FalseString); + else + SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); + } + + + private string GetFolderSize () + { + double folder_size = CalculateFolderSize ( + new DirectoryInfo (SparkleConfig.DefaultConfig.FoldersPath)); + + return FormatFolderSize (folder_size); + } + + + private string FormatMessage (SparkleChangeSet change_set) + { + string file_name = ""; + string message = ""; + + if (change_set.Added.Count > 0) { + file_name = change_set.Added [0]; + message = String.Format (_("added ‘{0}’"), file_name); + } + + if (change_set.MovedFrom.Count > 0) { + file_name = change_set.MovedFrom [0]; + message = String.Format (_("moved ‘{0}’"), file_name); + } + + if (change_set.Edited.Count > 0) { + file_name = change_set.Edited [0]; + message = String.Format (_("edited ‘{0}’"), file_name); + } + + if (change_set.Deleted.Count > 0) { + file_name = change_set.Deleted [0]; + message = String.Format (_("deleted ‘{0}’"), file_name); + } + + int changes_count = (change_set.Added.Count + + change_set.Edited.Count + + change_set.Deleted.Count + + change_set.MovedFrom.Count) - 1; + + if (changes_count > 0) { +#if __MonoCS__ + string msg = Catalog.GetPluralString ("and {0} more", "and {0} more", changes_count); + message += " " + String.Format (msg, changes_count); +#else + message += " " + String.Format ("and {0} more", changes_count); +#endif + + } else if (changes_count < 0) { + message += _("did something magical"); + } + + return message; + } // TODO: move to bubbles controller + + + // Recursively gets a folder's size in bytes + private double CalculateFolderSize (DirectoryInfo parent) + { + if (!Directory.Exists (parent.ToString ())) + return 0; + + double size = 0; + + // Ignore the temporary 'rebase-apply' and '.tmp' directories. This prevents potential + // crashes when files are being queried whilst the files have already been deleted. + if (parent.Name.Equals ("rebase-apply") || + parent.Name.Equals (".tmp")) + return 0; + + try { + foreach (FileInfo file in parent.GetFiles()) { + if (!file.Exists) + return 0; + + size += file.Length; + } + + foreach (DirectoryInfo directory in parent.GetDirectories()) + size += CalculateFolderSize (directory); + + } catch (Exception) { + return 0; + } + + return size; + } + + + // Format a file size nicely with small caps. + // Example: 1048576 becomes "1 ᴍʙ" + private string FormatFolderSize (double byte_count) + { + if (byte_count >= 1099511627776) + return String.Format ("{0:##.##} ᴛʙ", Math.Round (byte_count / 1099511627776, 1)); + else if (byte_count >= 1073741824) + return String.Format ("{0:##.##} ɢʙ", Math.Round (byte_count / 1073741824, 1)); + else if (byte_count >= 1048576) + return String.Format ("{0:##.##} ᴍʙ", Math.Round (byte_count / 1048576, 1)); + else if (byte_count >= 1024) + return String.Format ("{0:##.##} ᴋʙ", Math.Round (byte_count / 1024, 1)); + else + return byte_count.ToString () + " bytes"; + } + + + public void OpenSparkleShareFolder () + { + OpenSparkleShareFolder (""); + } + + + // Adds the user's SparkleShare key to the ssh-agent, + // so all activity is done with this key + public void AddKey () + { + string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath); + string key_file_name = "sparkleshare." + UserEmail + ".key"; + + Process process = new Process (); + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.UseShellExecute = false; + process.StartInfo.FileName = "ssh-add"; + process.StartInfo.Arguments = "\"" + Path.Combine (keys_path, key_file_name) + "\""; + process.Start (); + process.WaitForExit (); + } + + + public bool BackendIsPresent { + get { + return SparkleBackend.DefaultBackend.IsPresent; + } + } + + + // Looks up the user's name from the global configuration + public string UserName + { + get { + return SparkleConfig.DefaultConfig.User.Name; + } + + set { + SparkleConfig.DefaultConfig.User = new SparkleUser (value, UserEmail); + } + } + + + // Looks up the user's email from the global configuration + public string UserEmail + { + get { + return SparkleConfig.DefaultConfig.User.Email; + } + + set { + SparkleConfig.DefaultConfig.User = new SparkleUser (UserName, value); + } + } + + + // Generates and installs an RSA keypair to identify this system + public void GenerateKeyPair () + { + string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath); + string key_file_name = "sparkleshare." + UserEmail + ".key"; + string key_file_path = Path.Combine (keys_path, key_file_name); + + if (File.Exists (key_file_path)) { + SparkleHelpers.DebugInfo ("Config", "Key already exists ('" + key_file_name + "'), " + + "leaving it untouched"); + return; + } + + if (!Directory.Exists (keys_path)) + Directory.CreateDirectory (keys_path); + + if (!File.Exists (key_file_name)) { + Process process = new Process () { + EnableRaisingEvents = true + }; + + process.StartInfo.WorkingDirectory = keys_path; + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.FileName = "ssh-keygen"; + + // -t is the crypto type + // -P is the password (none) + // -f is the file name to store the private key in + process.StartInfo.Arguments = "-t rsa -P \"\" -f " + key_file_name; + + process.Exited += delegate { + SparkleHelpers.DebugInfo ("Config", "Created private key '" + key_file_name + "'"); + SparkleHelpers.DebugInfo ("Config", "Created public key '" + key_file_name + ".pub'"); + + // Create an easily accessible copy of the public + // key in the user's SparkleShare folder + File.Copy (key_file_path + ".pub", + Path.Combine (SparklePath, UserName + "'s key.txt")); + }; + + process.Start (); + process.WaitForExit (); + } + } + + + // Gets the avatar for a specific email address and size + public void FetchAvatars (List emails, int size) + { + List old_avatars = new List (); + bool avatar_fetched = false; + string avatar_path = new string [] { + Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath), + "icons", size + "x" + size, "status"}.Combine (); + + if (!Directory.Exists (avatar_path)) { + Directory.CreateDirectory (avatar_path); + SparkleHelpers.DebugInfo ("Config", "Created '" + avatar_path + "'"); + } + + foreach (string raw_email in emails) { + + // Gravatar wants lowercase emails + string email = raw_email.ToLower (); + string avatar_file_path = Path.Combine (avatar_path, "avatar-" + email); + + if (File.Exists (avatar_file_path)) { + FileInfo avatar_info = new FileInfo (avatar_file_path); + + // Delete avatars older than a month + if (avatar_info.CreationTime < DateTime.Now.AddMonths (-1)) { + avatar_info.Delete (); + old_avatars.Add (email); + } + + } else { + WebClient client = new WebClient (); + string url = "http://gravatar.com/avatar/" + GetMD5 (email) + + ".jpg?s=" + size + "&d=404"; + + try { + // Fetch the avatar + byte [] buffer = client.DownloadData (url); + + // Write the avatar data to a + // if not empty + if (buffer.Length > 255) { + avatar_fetched = true; + File.WriteAllBytes (avatar_file_path, buffer); + SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email); + } + + } catch (WebException e) { + SparkleHelpers.DebugInfo ("Controller", "Failed fetching gravatar for " + email); + + // Stop downloading further avatars if we have no internet access + if (e.Status == WebExceptionStatus.Timeout) + break; + } + } + } + + // Fetch new versions of the avatars that we + // deleted because they were too old + if (old_avatars.Count > 0) + FetchAvatars (old_avatars, size); + + if (AvatarFetched != null && avatar_fetched) + AvatarFetched (); + } + + + public virtual string GetAvatar (string email, int size) + { + string avatar_file_path = SparkleHelpers.CombineMore ( + Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath), "icons", + size + "x" + size, "status", "avatar-" + email); + + return avatar_file_path; + } + + + public void FetchFolder (string server, string remote_folder) + { + server = server.Trim (); + remote_folder = remote_folder.Trim (); + + string tmp_path = SparkleConfig.DefaultConfig.TmpPath; + if (!Directory.Exists (tmp_path)) + Directory.CreateDirectory (tmp_path); + + // Strip the '.git' from the name + string canonical_name = Path.GetFileNameWithoutExtension (remote_folder); + string tmp_folder = Path.Combine (tmp_path, canonical_name); + + string backend = null; + +/* if (remote_folder.EndsWith (".hg")) { + remote_folder = remote_folder.Substring (0, (remote_folder.Length - 3)); + fetcher = new SparkleFetcherHg (server, remote_folder, tmp_folder); + backend = "Hg"; + + } else if (remote_folder.EndsWith (".scp")) { + remote_folder = remote_folder.Substring (0, (remote_folder.Length - 4)); + fetcher = new SparkleFetcherScp (server, remote_folder, tmp_folder); + backend = "Scp"; + + } else {*/ + this.fetcher = new SparkleFetcherGit (server, remote_folder, tmp_folder); + backend = "Git"; + //} + + bool target_folder_exists = Directory.Exists ( + Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, canonical_name)); + + // Add a numbered suffix to the nameif a folder with the same name + // already exists. Example: "Folder (2)" + int i = 1; + while (target_folder_exists) { + i++; + target_folder_exists = Directory.Exists ( + Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, canonical_name + " (" + i + ")")); + } + + string target_folder_name = canonical_name; + if (i > 1) + target_folder_name += " (" + i + ")"; + + this.fetcher.Finished += delegate { + + // Needed to do the moving + SparkleHelpers.ClearAttributes (tmp_folder); + string target_folder_path = Path.Combine ( + SparkleConfig.DefaultConfig.FoldersPath, target_folder_name); + + try { + Directory.Move (tmp_folder, target_folder_path); + } catch (Exception e) { + SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message); + } + + SparkleConfig.DefaultConfig.AddFolder (target_folder_name, this.fetcher.RemoteUrl, backend); + AddRepository (target_folder_path); + + if (FolderFetched != null) + FolderFetched (); + + FolderSize = GetFolderSize (); + + if (FolderSizeChanged != null) + FolderSizeChanged (FolderSize); + + if (FolderListChanged != null) + FolderListChanged (); + + this.fetcher.Dispose (); + + if (Directory.Exists (tmp_path)) + Directory.Delete (tmp_path, true); + }; + + + this.fetcher.Failed += delegate { + if (FolderFetchError != null) + FolderFetchError (this.fetcher.RemoteUrl); + + this.fetcher.Dispose (); + + if (Directory.Exists (tmp_path)) + Directory.Delete (tmp_path, true); + }; + + + this.fetcher.ProgressChanged += delegate (double percentage) { + if (FolderFetching != null) + FolderFetching (percentage); + }; + + + this.fetcher.Start (); + } + + + public void StopFetcher () + { + if (fetcher != null) + fetcher.Stop (); + } + + + // Creates an MD5 hash of input + private string GetMD5 (string s) + { + MD5 md5 = new MD5CryptoServiceProvider (); + Byte[] bytes = ASCIIEncoding.Default.GetBytes (s); + Byte[] encoded_bytes = md5.ComputeHash (bytes); + return BitConverter.ToString (encoded_bytes).ToLower ().Replace ("-", ""); + } + + + // Checks whether there are any folders syncing and + // quits if safe + public void TryQuit () + { + foreach (SparkleRepoBase repo in Repositories) { + if (repo.Status == SyncStatus.SyncUp || + repo.Status == SyncStatus.SyncDown || + repo.IsBuffering) { + + if (OnQuitWhileSyncing != null) + OnQuitWhileSyncing (); + + return; + } + } + + Quit (); + } + + + public void Quit () + { + foreach (SparkleRepoBase repo in Repositories) + repo.Dispose (); + +#if __MonoCS__ + Environment.Exit (0); +#else + System.Windows.Forms.Application.Exit (); +#endif + } + + + // Checks to see if an email address is valid + public bool IsValidEmail (string email) + { + Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); + return regex.IsMatch (email); + } + + + + + public void AddNoteToFolder (string folder_name, string revision, string note) + { + folder_name = folder_name.Replace ("%20", " "); + note = note.Replace ("%20", " "); + + foreach (SparkleRepoBase repo in Repositories) { + if (repo.Name.Equals (folder_name)) + repo.AddNote (revision, note); + } + } + + + + + private string [] tango_palette = new string [] {"#eaab00", "#e37222", + "#3892ab", "#33c2cb", "#19b271", "#9eab05", "#8599a8", "#9ca696", + "#b88454", "#cc0033", "#8f6678", "#8c6cd0", "#796cbf", "#4060af", + "#aa9c8f", "#818a8f"}; + + private string AssignColor (string s) + { + string hash = GetMD5 (s).Substring (0, 8); + string numbers = Regex.Replace (hash, "[a-z]", ""); + int number = 3 + int.Parse (numbers); + return this.tango_palette [number % this.tango_palette.Length]; + } + } + + + public class ChangeSet : SparkleChangeSet { } + + + // All change sets that happened on a day + public class ActivityDay : List + { + public DateTime DateTime; + + public ActivityDay (DateTime date_time) + { + DateTime = date_time; + DateTime = new DateTime (DateTime.Year, DateTime.Month, DateTime.Day); + } + } +} diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 4379e9a8..5ab9e152 100644 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -23,24 +23,21 @@ using System.Threading; using Gtk; using Mono.Unix; -using SparkleLib; using WebKit; namespace SparkleShare { public class SparkleEventLog : Window { - private ScrolledWindow ScrolledWindow; - private MenuBar MenuBar; - private WebView WebView; - private string LinkStatus; - private SparkleSpinner Spinner; - private string HTML; - private EventBox LogContent; - private List change_sets; - private string selected_log = null; - private ComboBox combo_box; + public SparkleEventLogController Controller = new SparkleEventLogController (); + private HBox layout_horizontal; + private ComboBox combo_box; + private EventBox content_wrapper; + private ScrolledWindow scrolled_window; + private WebView web_view; + private SparkleSpinner spinner; + private string link_status; // Short alias for the translations @@ -63,49 +60,43 @@ namespace SparkleShare { DeleteEvent += Close; - CreateEvents (); - UpdateEvents (false); - UpdateChooser (); - } - - - private void CreateEvents () - { VBox layout_vertical = new VBox (false, 0); - LogContent = new EventBox (); + this.spinner = new SparkleSpinner (22); + this.content_wrapper = new EventBox (); + this.scrolled_window = new ScrolledWindow (); - ScrolledWindow = new ScrolledWindow (); - - WebView = new WebView () { + this.web_view = new WebView () { Editable = false }; - WebView.HoveringOverLink += delegate (object o, WebKit.HoveringOverLinkArgs args) { - LinkStatus = args.Link; + this.web_view.HoveringOverLink += delegate (object o, WebKit.HoveringOverLinkArgs args) { + this.link_status = args.Link; }; - WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { - if (args.Request.Uri == LinkStatus) { + this.web_view.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { + if (args.Request.Uri == this.link_status) { + // TODO: controller Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = args.Request.Uri.Replace (" ", "\\ "); // Escape space-characters process.Start (); } else { - Regex regex = new Regex (@"(.+)~(.+)~(.+)"); - Match match = regex.Match (args.Request.Uri); + //TODO: controller + Regex regex = new Regex (@"(.+)~(.+)~(.+)"); + Match match = regex.Match (args.Request.Uri); - if (match.Success) { - string folder_name = match.Groups [1].Value; - string revision = match.Groups [2].Value; - string note = match.Groups [3].Value.Replace ("%20", " "); + if (match.Success) { + string folder_name = match.Groups [1].Value; + string revision = match.Groups [2].Value; + string note = match.Groups [3].Value; - Thread thread = new Thread (new ThreadStart (delegate { - SparkleShare.Controller.AddNoteToFolder (folder_name, revision, note); - })); + Thread thread = new Thread (new ThreadStart (delegate { + Program.Controller.AddNoteToFolder (folder_name, revision, note); + })); - thread.Start (); - } + thread.Start (); + } } // Don't follow HREFs (as this would cause a page refresh) @@ -113,44 +104,75 @@ namespace SparkleShare { args.RetVal = 1; }; - ScrolledWindow.Add (WebView); - LogContent.Add (ScrolledWindow); + this.scrolled_window.Add (this.web_view); + this.content_wrapper.Add (this.spinner); + + this.spinner.Start (); this.layout_horizontal = new HBox (true, 0); this.layout_horizontal.PackStart (new Label (""), true, true, 0); this.layout_horizontal.PackStart (new Label (""), true, true, 0); - layout_vertical.PackStart (layout_horizontal, false, false, 0); - layout_vertical.PackStart (LogContent, true, true, 0); - - // We have to hide the menubar somewhere... + layout_vertical.PackStart (this.layout_horizontal, false, false, 0); layout_vertical.PackStart (CreateShortcutsBar (), false, false, 0); + layout_vertical.PackStart (this.content_wrapper, true, true, 0); Add (layout_vertical); ShowAll (); + + UpdateChooser (null); + UpdateContent (null); + + + // Hook up the controller events + Controller.UpdateChooserEvent += delegate (string [] folders) { + Application.Invoke (delegate { + UpdateChooser (folders); + }); + }; + + Controller.UpdateContentEvent += delegate (string html) { + Application.Invoke (delegate { + UpdateContent (html); + }); + }; + + Controller.ContentLoadingEvent += delegate { + Application.Invoke (delegate { + if (this.content_wrapper.Child != null) + this.content_wrapper.Remove (this.content_wrapper.Child); + + this.content_wrapper.Add (this.spinner); + this.spinner.Start (); + this.content_wrapper.ShowAll (); + }); + }; } - public void UpdateChooser () + public void UpdateChooser (string [] folders) { + if (folders == null) + folders = Controller.Folders; + if (this.combo_box != null && this.combo_box.Parent != null) this.layout_horizontal.Remove (this.combo_box); this.combo_box = new ComboBox (); - this.layout_horizontal.BorderWidth = 9; CellRendererText cell = new CellRendererText(); this.combo_box.PackStart (cell, false); this.combo_box.AddAttribute (cell, "text", 0); + ListStore store = new ListStore (typeof (string)); - this.combo_box.Model = store; - + store.AppendValues (_("All Folders")); store.AppendValues ("---"); - foreach (string folder_name in SparkleShare.Controller.Folders) - store.AppendValues (folder_name); + foreach (string folder in folders) + store.AppendValues (folder); + this.combo_box.Model = store; this.combo_box.Active = 0; this.combo_box.RowSeparatorFunc = delegate (TreeModel model, TreeIter iter) { @@ -158,116 +180,75 @@ namespace SparkleShare { return (item == "---"); }; - if (this.selected_log != null && - !SparkleShare.Controller.Folders.Contains (this.selected_log)) { - - this.selected_log = null; - } - this.combo_box.Changed += delegate { TreeIter iter; this.combo_box.GetActiveIter (out iter); - string selection = (string) this.combo_box.Model.GetValue (iter, 0); if (selection.Equals (_("All Folders"))) - this.selected_log = null; + Controller.SelectedFolder = null; else - this.selected_log = selection; - - UpdateEvents (false); + Controller.SelectedFolder = selection; }; + this.layout_horizontal.BorderWidth = 9; this.layout_horizontal.PackStart (this.combo_box, true, true, 0); this.layout_horizontal.ShowAll (); } - public void UpdateEvents () + public void UpdateContent (string html) { - UpdateEvents (true); - } - - - public void UpdateEvents (bool silent) - { - if (!silent) { - LogContent.Remove (LogContent.Child); - Spinner = new SparkleSpinner (22); - LogContent.Add (Spinner); - LogContent.ShowAll (); - } - Thread thread = new Thread (new ThreadStart (delegate { - Stopwatch watch = new Stopwatch (); - watch.Start (); - this.change_sets = SparkleShare.Controller.GetLog (this.selected_log); - GenerateHTML (); - watch.Stop (); + if (html == null) + html = Controller.HTML; - // A short delay is less annoying than - // a flashing window - if (watch.ElapsedMilliseconds < 500 && !silent) - Thread.Sleep (500 - (int) watch.ElapsedMilliseconds); + if (html == null) + return; - AddHTML (); + html = html.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); + html = html.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); + html = html.Replace ("", "#0085cf"); + html = html.Replace ("", "#009ff8"); + html = html.Replace ("", "\"" + Style.FontDescription.Family + "\""); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); + html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); + html = html.Replace ("", "file://" + + new string [] {SparkleUI.AssetsPath, "icons", + "hicolor", "32x32", "status", "avatar-default.png"}.Combine ()); + html = html.Replace ("", "file://" + + new string [] {SparkleUI.AssetsPath, "icons", + "hicolor", "12x12", "status", "document-added.png"}.Combine ()); + html = html.Replace ("", "file://" + + new string [] {SparkleUI.AssetsPath, "icons", + "hicolor", "12x12", "status", "document-edited.png"}.Combine ()); + html = html.Replace ("", "file://" + + new string [] {SparkleUI.AssetsPath, "icons", + "hicolor", "12x12", "status", "document-deleted.png"}.Combine ()); + html = html.Replace ("", "file://" + + new string [] {SparkleUI.AssetsPath, "icons", + "hicolor", "12x12", "status", "document-moved.png"}.Combine ()); + + Application.Invoke (delegate { + this.spinner.Stop (); + this.web_view.LoadString (html, null, null, "file://"); + this.content_wrapper.Remove (this.content_wrapper.Child); + this.content_wrapper.Add (this.scrolled_window); + this.content_wrapper.ShowAll (); + }); })); thread.Start (); } - private void GenerateHTML () - { - HTML = SparkleShare.Controller.GetHTMLLog (this.change_sets); - - HTML = HTML.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); - HTML = HTML.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); - HTML = HTML.Replace ("", "#0085cf"); - HTML = HTML.Replace ("", "#009ff8"); - HTML = HTML.Replace ("", "\"" + Style.FontDescription.Family + "\""); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - HTML = HTML.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "32x32", "status", "avatar-default.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-added.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-edited.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-deleted.png")); - HTML = HTML.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons", - "hicolor", "12x12", "status", "document-moved.png")); - } - - - private void AddHTML () - { - Application.Invoke (delegate { - Spinner.Stop (); - LogContent.Remove (LogContent.Child); - - WebView.LoadString (HTML, null, null, "file://"); - - LogContent.Add (ScrolledWindow); - LogContent.ShowAll (); - }); - } - - public void Close (object o, DeleteEventArgs args) { HideAll (); args.RetVal = true; - // TODO: window positions aren't saved } @@ -275,7 +256,7 @@ namespace SparkleShare { { // Adds a hidden menubar that contains to enable keyboard // shortcuts to close the log - MenuBar = new MenuBar (); + MenuBar menu_bar = new MenuBar (); MenuItem file_item = new MenuItem ("File"); @@ -304,15 +285,14 @@ namespace SparkleShare { file_item.Submenu = file_menu; - MenuBar.Append (file_item); + menu_bar.Append (file_item); // Hacky way to hide the menubar, but the accellerators // will simply be disabled when using Hide () - MenuBar.HeightRequest = 1; - MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); + menu_bar.HeightRequest = 1; + menu_bar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); - return MenuBar; + return menu_bar; } } } - diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index fdc99f3d..98d95ded 100644 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -69,14 +69,14 @@ namespace SparkleShare { public string HTML { get { - List change_sets = SparkleShare.Controller.GetLog (this.selected_folder); - return SparkleShare.Controller.GetHTMLLog (change_sets); + List change_sets = Program.Controller.GetLog (this.selected_folder); + return Program.Controller.GetHTMLLog (change_sets); } } public string [] Folders { get { - return SparkleShare.Controller.Folders.ToArray (); + return Program.Controller.Folders.ToArray (); } } @@ -86,19 +86,19 @@ namespace SparkleShare { public SparkleEventLogController () { - SparkleShare.Controller.AvatarFetched += delegate { + Program.Controller.AvatarFetched += delegate { if (UpdateContentEvent != null) UpdateContentEvent (HTML); }; - SparkleShare.Controller.OnIdle += delegate { + Program.Controller.OnIdle += delegate { if (UpdateContentEvent != null) UpdateContentEvent (HTML); }; - SparkleShare.Controller.FolderListChanged += delegate { + Program.Controller.FolderListChanged += delegate { if (this.selected_folder != null && - !SparkleShare.Controller.Folders.Contains (this.selected_folder)) { + !Program.Controller.Folders.Contains (this.selected_folder)) { this.selected_folder = null; } @@ -110,7 +110,7 @@ namespace SparkleShare { UpdateContentEvent (HTML); }; - SparkleShare.Controller.NotificationRaised += delegate { + Program.Controller.NotificationRaised += delegate { if (UpdateContentEvent != null) UpdateContentEvent (HTML); }; diff --git a/SparkleShare/SparkleExtensions.cs b/SparkleShare/SparkleExtensions.cs new file mode 100644 index 00000000..348835b9 --- /dev/null +++ b/SparkleShare/SparkleExtensions.cs @@ -0,0 +1,35 @@ +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons (hylkebons@gmail.com) +// +// 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 (http://www.gnu.org/licenses/). + + +using System; +using System.IO; + +namespace SparkleShare { + + public static class Extensions { + + public static string Combine (this String [] parts) + { + string new_path = ""; + + foreach (string part in parts) + new_path = Path.Combine (new_path, part); + + return new_path; + } + } +} diff --git a/SparkleShare/SparkleLinController.cs b/SparkleShare/SparkleLinController.cs index 34e27385..0cc2168e 100644 --- a/SparkleShare/SparkleLinController.cs +++ b/SparkleShare/SparkleLinController.cs @@ -73,8 +73,11 @@ namespace SparkleShare { // from the Internet category if needed public override void InstallLauncher () { - string apps_path = SparkleHelpers.CombineMore (SparklePaths.HomePath, ".local", "share", "applications"); - string desktopfile_path = SparkleHelpers.CombineMore (apps_path, "sparkleshare.desktop"); + string apps_path = + new string [] {SparkleConfig.DefaultConfig.HomePath, + ".local", "share", "applications"}.Combine (); + + string desktopfile_path = Path.Combine (apps_path, "sparkleshare.desktop"); if (!File.Exists (desktopfile_path)) { if (!Directory.Exists (apps_path)) @@ -104,8 +107,8 @@ namespace SparkleShare { // list of bookmarked places public override void AddToBookmarks () { - string bookmarks_file_path = Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks"); - string sparkleshare_bookmark = "file://" + SparklePaths.SparklePath + " SparkleShare"; + string bookmarks_file_path = Path.Combine (SparkleConfig.DefaultConfig.HomePath, ".gtk-bookmarks"); + string sparkleshare_bookmark = "file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"; if (File.Exists (bookmarks_file_path)) { StreamReader reader = new StreamReader (bookmarks_file_path); @@ -114,12 +117,12 @@ namespace SparkleShare { if (!bookmarks.Contains (sparkleshare_bookmark)) { TextWriter writer = File.AppendText (bookmarks_file_path); - writer.WriteLine ("file://" + SparklePaths.SparklePath + " SparkleShare"); + writer.WriteLine ("file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"); writer.Close (); } } else { StreamWriter writer = new StreamWriter (bookmarks_file_path); - writer.WriteLine ("file://" + SparklePaths.SparklePath + " SparkleShare"); + writer.WriteLine ("file://" + SparkleConfig.DefaultConfig.FoldersPath + " SparkleShare"); writer.Close (); } } @@ -128,13 +131,14 @@ namespace SparkleShare { // Creates the SparkleShare folder in the user's home folder public override bool CreateSparkleShareFolder () { - if (!Directory.Exists (SparklePaths.SparklePath)) { + if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) { - Directory.CreateDirectory (SparklePaths.SparklePath); - SparkleHelpers.DebugInfo ("Controller", "Created '" + SparklePaths.SparklePath + "'"); + Directory.CreateDirectory (SparkleConfig.DefaultConfig.FoldersPath); + SparkleHelpers.DebugInfo ("Controller", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'"); - string gvfs_command_path = SparkleHelpers.CombineMore (Path.VolumeSeparatorChar.ToString (), - "usr", "bin", "gvfs-set-attribute"); + string gvfs_command_path = + new string [] {Path.VolumeSeparatorChar.ToString (), + "usr", "bin", "gvfs-set-attribute"}.Combine (); // Add a special icon to the SparkleShare folder if (File.Exists (gvfs_command_path)) { @@ -145,12 +149,12 @@ namespace SparkleShare { process.StartInfo.FileName = "gvfs-set-attribute"; // Clear the custom (legacy) icon path - process.StartInfo.Arguments = "-t unset " + SparklePaths.SparklePath + " metadata::custom-icon"; + process.StartInfo.Arguments = "-t unset " + SparkleConfig.DefaultConfig.FoldersPath + " metadata::custom-icon"; process.Start (); process.WaitForExit (); // Give the SparkleShare folder an icon name, so that it scales - process.StartInfo.Arguments = SparklePaths.SparklePath + " metadata::custom-icon-name 'folder-sparkleshare'"; + process.StartInfo.Arguments = SparkleConfig.DefaultConfig.FoldersPath + " metadata::custom-icon-name 'folder-sparkleshare'"; process.Start (); process.WaitForExit (); } @@ -164,13 +168,13 @@ namespace SparkleShare { public override string EventLogHTML { get { - string path = SparkleHelpers.CombineMore (Defines.PREFIX, - "share", "sparkleshare", "html", "event-log.html"); + string path = new string [] {Defines.PREFIX, + "share", "sparkleshare", "html", "event-log.html"}.Combine (); string html = String.Join (Environment.NewLine, File.ReadAllLines (path)); html = html.Replace ("", "file://" + - SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js")); + new string [] {Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js"}.Combine ()); return html; } @@ -179,8 +183,8 @@ namespace SparkleShare { public override string DayEntryHTML { get { - string path = SparkleHelpers.CombineMore (Defines.PREFIX, - "share", "sparkleshare", "html", "day-entry.html"); + string path = new string [] {Defines.PREFIX, + "share", "sparkleshare", "html", "day-entry.html"}.Combine (); return String.Join (Environment.NewLine, File.ReadAllLines (path)); } @@ -189,8 +193,8 @@ namespace SparkleShare { public override string EventEntryHTML { get { - string path = SparkleHelpers.CombineMore (Defines.PREFIX, - "share", "sparkleshare", "html", "event-entry.html"); + string path = new string [] {Defines.PREFIX, + "share", "sparkleshare", "html", "event-entry.html"}.Combine (); return String.Join (Environment.NewLine, File.ReadAllLines (path)); } @@ -199,7 +203,7 @@ namespace SparkleShare { public override void OpenSparkleShareFolder (string subfolder) { - string folder = Path.Combine (SparklePaths.SparklePath, subfolder); + string folder = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder); Process process = new Process (); process.StartInfo.FileName = "xdg-open"; diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 0e7ecb72..2ea766ad 100644 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -43,10 +43,8 @@ namespace SparkleShare { private Button SyncButton; private Table Table; - - private ProgressBar progress_bar = new ProgressBar () { PulseStep = 0.01 }; - private Timer progress_bar_pulse_timer = new Timer () { Interval = 25, Enabled = true }; - + private ProgressBar progress_bar = new ProgressBar (); + // Short alias for the translations public static string _ (string s) @@ -64,7 +62,7 @@ namespace SparkleShare { Reset (); switch (type) { - case PageType.Setup: + case PageType.Setup: { Header = _("Welcome to SparkleShare!"); Description = _("Before we can create a SparkleShare folder on this " + @@ -79,12 +77,12 @@ namespace SparkleShare { Xalign = 0 }; - NameEntry = new Entry (SparkleShare.Controller.UserName); + NameEntry = new Entry (Controller.GuessedUserName); NameEntry.Changed += delegate { CheckSetupPage (); }; - EmailEntry = new Entry (); + EmailEntry = new Entry (Controller.GuessedUserEmail); EmailEntry.Changed += delegate { CheckSetupPage (); }; @@ -116,13 +114,14 @@ namespace SparkleShare { CheckSetupPage (); break; + } - case PageType.Add: + case PageType.Add: { - Header = _("Where is your remote folder?"); + Header = _("Where is your project?"); Table = new Table (6, 2, false) { - RowSpacing = 12 + RowSpacing = 0 }; HBox layout_server = new HBox (true, 0); @@ -150,8 +149,8 @@ namespace SparkleShare { ListStore server_store = new ListStore (typeof (string)); - //TODO foreach (string host in SparkleShare.Controller.PreviousHosts) - // server_store.AppendValues (host); + foreach (string host in Program.Controller.PreviousHosts) + server_store.AppendValues (host); ServerEntry.Completion.Model = server_store; ServerEntry.Completion.TextColumn = 0; @@ -173,11 +172,7 @@ namespace SparkleShare { Table.Attach (layout_server, 0, 2, 1, 2); // Github radiobutton - string github_text = "" + "Github" + "\n" + - "" + - _("Free hosting for Free and Open Source Software projects.") + "\n" + - _("Also has paid accounts for extra private space and bandwidth.") + - ""; + string github_text = "" + "Github" + ""; RadioButton radio_button_github = new RadioButton (radio_button, github_text); (radio_button_github.Child as Label).UseMarkup = true; @@ -190,11 +185,7 @@ namespace SparkleShare { // Gitorious radiobutton - string gitorious_text = "" + _("Gitorious") + "\n" + - "" + - _("Completely Free as in Freedom infrastructure.") + "\n" + - _("Free accounts for Free and Open Source projects.") + - ""; + string gitorious_text = "" + _("Gitorious") + ""; RadioButton radio_button_gitorious = new RadioButton (radio_button, gitorious_text); (radio_button_gitorious.Child as Label).UseMarkup = true; @@ -207,11 +198,7 @@ namespace SparkleShare { // GNOME radiobutton - string gnome_text = "" + _("The GNOME Project") + "\n"+ - "" + - _("GNOME is an easy to understand interface to your computer.") + "\n" + - _("Select this option if you’re a developer or designer working on GNOME.") + - ""; + string gnome_text = "" + _("The GNOME Project") + ""; RadioButton radio_button_gnome = new RadioButton (radio_button, gnome_text); (radio_button_gnome.Child as Label).UseMarkup = true; @@ -236,6 +223,15 @@ namespace SparkleShare { FolderEntry = new SparkleEntry (); FolderEntry.ExampleText = _("Folder"); + FolderEntry.Completion = new EntryCompletion(); + + ListStore folder_store = new ListStore (typeof (string)); + + //foreach (string host in Program.Controller.FolderPaths) + // folder_store.AppendValues (host); + + FolderEntry.Completion.Model = folder_store; + FolderEntry.Completion.TextColumn = 0; FolderEntry.Changed += delegate { CheckAddPage (); @@ -245,7 +241,10 @@ namespace SparkleShare { layout_folder.PackStart (FolderEntry, true, true, 0); Table.Attach (layout_folder, 0, 2, 5, 6); - Add (Table); + + VBox box = new VBox (false, 0); + box.PackStart (Table, false, false, 0); + Add (box); // Cancel button Button cancel_button = new Button (_("Cancel")); @@ -256,7 +255,7 @@ namespace SparkleShare { // Sync button - SyncButton = new Button (_("Sync")); + SyncButton = new Button (_("Add")); SyncButton.Clicked += delegate { string server = ServerEntry.Text; @@ -280,27 +279,33 @@ namespace SparkleShare { CheckAddPage (); break; + } - case PageType.Syncing: + case PageType.Syncing: { - Header = String.Format (_("Syncing folder ‘{0}’…"), Controller.SyncingFolder); + Header = String.Format (_("Adding project ‘{0}’…"), Controller.SyncingFolder); Description = _("This may take a while." + Environment.NewLine) + _("Are you sure it’s not coffee o'clock?"); - Button button = new Button () { + Button finish_button = new Button () { Sensitive = false, Label = _("Finish") }; - button.Clicked += delegate { - Close (); + Button cancel_button = new Button () { + Label = _("Cancel") }; - AddButton (button); + cancel_button.Clicked += delegate { + Controller.SyncingCancelled (); + }; - this.progress_bar_pulse_timer.Elapsed += delegate { + AddButton (cancel_button); + AddButton (finish_button); + + Controller.UpdateProgressBarEvent += delegate (double percentage) { Application.Invoke (delegate { - progress_bar.Pulse (); + this.progress_bar.Fraction = percentage / 100; }); }; @@ -313,32 +318,59 @@ namespace SparkleShare { Add (bar_wrapper); break; + } - case PageType.Error: - - string n = Environment.NewLine; + case PageType.Error: { Header = _("Something went wrong") + "…"; - Description = "We don't know exactly what the problem is, " + - "but we can try to help you pinpoint it."; + + VBox points = new VBox (false, 0); + Image list_point_one = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)) { }; + Image list_point_two = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)) { }; + Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)) { }; + + Label label_one = new Label () { + Text = "First, have you tried turning it off and on again?", + Wrap = true, + Xalign = 0 + }; + + Label label_two = new Label () { + Markup = "" + Controller.PreviousUrl + " is the address we've compiled. " + + "Does this look alright?", + Wrap = true, + Xalign = 0 + }; + + Label label_three = new Label () { + Text = "The host needs to know who you are. Did you upload the key that's in " + + "your SparkleShare folder?", + Wrap = true, + Xalign = 0 + }; + + + points.PackStart (new Label ("Please check the following:") { Xalign = 0 }, false, false, 6); + + HBox point_one = new HBox (false, 0); + point_one.PackStart (list_point_one, false, false, 0); + point_one.PackStart (label_one, true, true, 12); + points.PackStart (point_one, false, false, 12); + + HBox point_two = new HBox (false, 0); + point_two.PackStart (list_point_two, false, false, 0); + point_two.PackStart (label_two, true, true, 12); + points.PackStart (point_two, false, false, 12); + + HBox point_three = new HBox (false, 0); + point_three.PackStart (list_point_three, false, false, 0); + point_three.PackStart (label_three, true, true, 12); + points.PackStart (point_three, false, false, 12); + + points.PackStart (new Label (""), true, true, 0); - Label l = new Label ( - "First, have you tried turning it off and on again?" + n + - n + - Controller.SyncingFolder +" is the address we've compiled from the information " + - "you entered. Does this look correct?" + n + - n + - "The host needs to know who you are. Have you uploaded the key that sits in your SparkleShare folder?"); - - - - l.Xpad = 12; - l.Wrap = true; - - - - Button try_again_button = new Button (_("Try Again")) { + Button try_again_button = new Button (_("Try Again…")) { Sensitive = true }; @@ -347,34 +379,36 @@ namespace SparkleShare { }; AddButton (try_again_button); - Add (l); + Add (points); break; + } - case PageType.Finished: + case PageType.Finished: { UrgencyHint = true; if (!HasToplevelFocus) { string title = String.Format (_("‘{0}’ has been successfully added"), Controller.SyncingFolder); - string subtext = _(""); + string subtext = ""; - //TODO new SparkleBubble (title, subtext).Show (); + SparkleUI.Bubbles.Controller.ShowBubble (title, subtext, null); } - Header = _("Folder synced successfully!"); - Description = _("Access the synced files from your SparkleShare folder."); + Header = _("Project successfully added!"); + Description = _("Access the files from your SparkleShare folder."); // A button that opens the synced folder Button open_folder_button = new Button (_("Open Folder")); open_folder_button.Clicked += delegate { - SparkleShare.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); + Program.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); }; Button finish_button = new Button (_("Finish")); finish_button.Clicked += delegate { + Controller.FinishedPageCompleted (); Close (); }; @@ -386,10 +420,116 @@ namespace SparkleShare { break; } + + case PageType.Tutorial: { + + switch (Controller.TutorialPageNumber) { + case 1: { + Header = _("What's happening next?"); + Description = _("SparkleShare creates a special folder in your personal folder " + + "that will keep track of your projects."); + + Button skip_tutorial_button = new Button (_("Skip Tutorial")); + skip_tutorial_button.Clicked += delegate { + Controller.TutorialSkipped (); + }; + + Button continue_button = new Button (_("Continue")); + continue_button.Clicked += delegate { + Controller.TutorialPageCompleted (); + }; + + Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-1.png"); + + Add (slide); + + AddButton (skip_tutorial_button); + AddButton (continue_button); + + break; + } + + case 2: { + Header = _("Sharing files with others"); + Description = _("All files added to your project folders are synced with the host " + + "automatically, as well as with your collaborators."); + + Button continue_button = new Button (_("Continue")); + continue_button.Clicked += delegate { + Controller.TutorialPageCompleted (); + }; + + Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-2.png"); + + Add (slide); + AddButton (continue_button); + + break; + } + + case 3: { + Header = _("The status icon is here to help"); + Description = _("It shows the syncing process status, " + + "and contains links to your projects and the event log."); + + Button continue_button = new Button (_("Continue")); + continue_button.Clicked += delegate { + Controller.TutorialPageCompleted (); + }; + + Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-3.png"); + + Add (slide); + AddButton (continue_button); + + break; + } + + case 4: { + Header = _("Adding projects to SparkleShare"); + Description = _("Just click this button when you see it on the web, and " + + "the project will be automatically added:"); + + Label label = new Label (_("…or select ‘Add Project…’ from the status icon menu " + + "to add one by hand.")) { + Wrap = true, + Xalign = 0, + UseMarkup = true + }; + + Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-4.png"); + + Button add_project_button = new Button (_("Add Project…")); + add_project_button.Clicked += delegate { + Controller.TutorialPageCompleted (); + }; + + Button finish_button = new Button (_("Finish")); + finish_button.Clicked += delegate { + Close (); + }; + + + VBox box = new VBox (false, 0); + box.Add (slide); + box.Add (label); + + Add (box); + + AddButton (add_project_button); + AddButton (finish_button); + + break; + } + } + + break; + } + } + ShowAll (); }); }; - } @@ -398,7 +538,7 @@ namespace SparkleShare { private void CheckSetupPage () { if (NameEntry.Text.Length > 0 && - SparkleShare.Controller.IsValidEmail (EmailEntry.Text)) { + Program.Controller.IsValidEmail (EmailEntry.Text)) { NextButton.Sensitive = true; } else { diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 1ca4f9cc..af0b141f 100644 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -25,7 +25,8 @@ namespace SparkleShare { Add, Syncing, Error, - Finished + Finished, + Tutorial } @@ -33,6 +34,22 @@ namespace SparkleShare { public event ChangePageEventHandler ChangePageEvent; public delegate void ChangePageEventHandler (PageType page); + + public event UpdateProgressBarEventHandler UpdateProgressBarEvent; + public delegate void UpdateProgressBarEventHandler (double percentage); + + + public int TutorialPageNumber { + get { + return this.tutorial_page_number; + } + } + + public string PreviousUrl { + get { + return this.previous_url; + } + } public string PreviousServer { get { @@ -58,11 +75,30 @@ namespace SparkleShare { } } - private string previous_server = ""; - private string previous_folder = ""; - private string syncing_folder = ""; + public string GuessedUserName { + get { + return Program.Controller.UserName; + } + } + + public string GuessedUserEmail { + get { + if (Program.Controller.UserEmail.Equals ("Unknown")) + return ""; + else + return Program.Controller.UserEmail; + } + } + + + private string previous_server = ""; + private string previous_folder = ""; + private string previous_url = ""; + private string syncing_folder = ""; + private int tutorial_page_number = 1; private PageType previous_page; + public SparkleSetupController () { ChangePageEvent += delegate (PageType page) { @@ -94,34 +130,59 @@ namespace SparkleShare { Program.Controller.UpdateState (); if (ChangePageEvent != null) - ChangePageEvent (PageType.Add); + ChangePageEvent (PageType.Tutorial); + } + + + public void TutorialPageCompleted () + { + this.tutorial_page_number++; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Tutorial); + } + + + public void TutorialSkipped () + { + this.tutorial_page_number = 4; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Tutorial); } public void AddPageCompleted (string server, string folder_name) { - this.syncing_folder = folder_name; + this.syncing_folder = Path.GetFileNameWithoutExtension (folder_name); this.previous_server = server; this.previous_folder = folder_name; if (ChangePageEvent != null) ChangePageEvent (PageType.Syncing); - Program.Controller.FolderFetched += (target_folder_name) => { - this.syncing_folder = target_folder_name; - + Program.Controller.FolderFetched += delegate { if (ChangePageEvent != null) ChangePageEvent (PageType.Finished); + + this.syncing_folder = ""; }; - Program.Controller.FolderFetchError += delegate { + Program.Controller.FolderFetchError += delegate (string remote_url) { + this.previous_url = remote_url; + if (ChangePageEvent != null) ChangePageEvent (PageType.Error); this.syncing_folder = ""; }; + + Program.Controller.FolderFetching += delegate (double percentage) { + if (UpdateProgressBarEvent != null) + UpdateProgressBarEvent (percentage); + }; - Program.Controller.FetchFolder (server, this.syncing_folder); + Program.Controller.FetchFolder (server, folder_name); } @@ -132,6 +193,15 @@ namespace SparkleShare { } + public void SyncingCancelled () + { + Program.Controller.StopFetcher (); + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Add); + } + + public void FinishedPageCompleted () { this.previous_server = ""; diff --git a/SparkleShare/SparkleSetupWindow.cs b/SparkleShare/SparkleSetupWindow.cs index 68284636..15ec845f 100644 --- a/SparkleShare/SparkleSetupWindow.cs +++ b/SparkleShare/SparkleSetupWindow.cs @@ -23,6 +23,7 @@ using System.Text.RegularExpressions; using System.Timers; using Gtk; +using Mono.Unix; using SparkleLib; namespace SparkleShare { @@ -41,7 +42,7 @@ namespace SparkleShare { public SparkleSetupWindow () : base ("") { - Title = "SparkleShare Setup"; + Title = Catalog.GetString ("SparkleShare Setup"); BorderWidth = 0; IconName = "folder-sparkleshare"; Resizable = false; @@ -70,17 +71,13 @@ namespace SparkleShare { EventBox box = new EventBox (); Gdk.Color bg_color = new Gdk.Color (); - Gdk.Color.Parse ("#2e3336", ref bg_color); + Gdk.Color.Parse ("#000", ref bg_color); box.ModifyBg (StateType.Normal, bg_color); - string image_path = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", - "pixmaps", "side-splash.png"); + Image side_splash = SparkleUIHelpers.GetImage ("side-splash.png"); + side_splash.Yalign = 1; - Image side_splash = new Image (image_path) { - Yalign = 1 - }; - - box.Add (side_splash); + box.Add (side_splash); HBox.PackStart (box, false, false, 0); HBox.PackStart (VBox, true, true, 0); @@ -125,7 +122,7 @@ namespace SparkleShare { layout_vertical.PackStart (description, false, false, 21); if (widget != null) - layout_vertical.PackStart (widget, true, true, 21); + layout_vertical.PackStart (widget, true, true, 0); Wrapper.PackStart (layout_vertical, true, true, 0); ShowAll (); @@ -148,9 +145,7 @@ namespace SparkleShare { new public void ShowAll () { - - Present (); - + Present (); base.ShowAll (); } diff --git a/SparkleShare/SparkleShare.csproj b/SparkleShare/SparkleShare.csproj index 079ec8de..199f702d 100644 --- a/SparkleShare/SparkleShare.csproj +++ b/SparkleShare/SparkleShare.csproj @@ -1,5 +1,5 @@ - + Debug AnyCPU @@ -9,6 +9,7 @@ SparkleShare 2.0 SparkleShare + v3.5 true @@ -37,15 +38,9 @@ - - - {2C914413-B31C-4362-93C7-1AE34F09112A} - SparkleLib - - - + @@ -63,11 +58,10 @@ - - + @@ -77,5 +71,7 @@ + + diff --git a/SparkleShare/SparkleShare.sln b/SparkleShare/SparkleShare.sln index 7f23f4cf..9716fc21 100644 --- a/SparkleShare/SparkleShare.sln +++ b/SparkleShare/SparkleShare.sln @@ -1,20 +1,14 @@  -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +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\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 - {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 {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 @@ -22,7 +16,5 @@ Global EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = SparkleShare.csproj - outputpath = ..\bin - name = SparkleShare EndGlobalSection EndGlobal diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index c468bc9d..d779684d 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -23,7 +23,7 @@ using System.Timers; using AppIndicator; #endif using Gtk; -using SparkleLib; +using Mono.Unix; namespace SparkleShare { @@ -31,6 +31,8 @@ namespace SparkleShare { // user's notification area public class SparkleStatusIcon { + public SparkleStatusIconController Controller = new SparkleStatusIconController (); + private Timer Animation; private Gdk.Pixbuf [] AnimationFrames; private int FrameNumber; @@ -46,14 +48,14 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return s; + return Catalog.GetString (s); } public SparkleStatusIcon () { AnimationFrames = CreateAnimationFrames (); - Animation = CreateAnimation (); + Animation = CreateAnimation (); #if HAVE_APP_INDICATOR this.indicator = new ApplicationIndicator ("sparkleshare", @@ -66,45 +68,63 @@ namespace SparkleShare { this.status_icon.Activate += ShowMenu; // Primary mouse button click this.status_icon.PopupMenu += ShowMenu; // Secondary mouse button click + this.status_icon.Pixbuf = AnimationFrames [0]; #endif - SetNormalState (); + if (Controller.Folders.Length == 0) + StateText = _("Welcome to SparkleShare!"); + else + StateText = _("Up to date") + " " + Controller.FolderSize; + CreateMenu (); - SparkleShare.Controller.FolderSizeChanged += delegate { + Controller.UpdateMenuEvent += delegate (IconState state) { Application.Invoke (delegate { - if (!Animation.Enabled) - SetNormalState (); + switch (state) { + case IconState.Idle: - UpdateMenu (); - }); - }; - - SparkleShare.Controller.FolderListChanged += delegate { - Application.Invoke (delegate { - SetNormalState (); - CreateMenu (); - }); - }; + Animation.Stop (); - SparkleShare.Controller.OnIdle += delegate { - Application.Invoke (delegate { - SetNormalState (); - UpdateMenu (); - }); - }; + if (Controller.Folders.Length == 0) + StateText = _("Welcome to SparkleShare!"); + else + StateText = _("Up to date") + " " + Controller.FolderSize; - SparkleShare.Controller.OnSyncing += delegate { - Application.Invoke (delegate { - SetAnimationState (); - UpdateMenu (); - }); - }; + #if HAVE_APP_INDICATOR + this.indicator.IconName = "process-syncing-sparkleshare-i"; + #else + this.status_icon.Pixbuf = AnimationFrames [0]; + #endif - SparkleShare.Controller.OnError += delegate { - Application.Invoke (delegate { - SetNormalState (true); - UpdateMenu (); + UpdateStateText (); + CreateMenu (); + + break; + + case IconState.Syncing: + + StateText = _("Syncing"); + UpdateStateText (); // TODO + + if (!Animation.Enabled) + Animation.Start (); + + break; + + case IconState.Error: + + StateText = _("Not everything is synced"); + UpdateStateText (); + CreateMenu (); + + #if HAVE_APP_INDICATOR + this.indicator.IconName = "sparkleshare-syncing-error"; + #else + this.status_icon.Pixbuf = SparkleUIHelpers.GetIcon ("sparkleshare-syncing-error", 24); + #endif + + break; + } }); }; } @@ -176,18 +196,18 @@ namespace SparkleShare { }; folder_item.Activated += delegate { - SparkleShare.Controller.OpenSparkleShareFolder (); + Program.Controller.OpenSparkleShareFolder (); }; Menu.Add (folder_item); - if (SparkleShare.Controller.Folders.Count > 0) { + if (Program.Controller.Folders.Count > 0) { // Creates a menu item for each repository with a link to their logs - foreach (string folder_name in SparkleShare.Controller.Folders) { + foreach (string folder_name in Program.Controller.Folders) { Gdk.Pixbuf folder_icon; - if (SparkleShare.Controller.UnsyncedFolders.Contains (folder_name)) { + if (Program.Controller.UnsyncedFolders.Contains (folder_name)) { folder_icon = IconTheme.Default.LoadIcon ("dialog-error", 16, IconLookupFlags.GenericFallback); @@ -205,7 +225,7 @@ namespace SparkleShare { } } else { - MenuItem no_folders_item = new MenuItem (_("No Remote Folders Yet")) { + MenuItem no_folders_item = new MenuItem (_("No projects yet")) { Sensitive = false }; @@ -215,9 +235,9 @@ namespace SparkleShare { Menu.Add (new SeparatorMenuItem ()); // Opens the wizard to add a new remote folder - MenuItem sync_item = new MenuItem (_("Add Remote Folder…")); + MenuItem sync_item = new MenuItem (_("Add Project")); - if (SparkleShare.Controller.FirstRun) + if (Program.Controller.FirstRun) sync_item.Sensitive = false; sync_item.Activated += delegate { @@ -241,7 +261,7 @@ namespace SparkleShare { MenuItem recent_events_item = new MenuItem (_("Show Recent Events")); - if (SparkleShare.Controller.Folders.Count < 1) + if (Program.Controller.Folders.Count < 1) recent_events_item.Sensitive = false; recent_events_item.Activated += delegate { @@ -258,13 +278,13 @@ namespace SparkleShare { MenuItem notify_item; - if (SparkleShare.Controller.NotificationsEnabled) + if (Program.Controller.NotificationsEnabled) notify_item = new MenuItem (_("Turn Notifications Off")); else notify_item = new MenuItem (_("Turn Notifications On")); notify_item.Activated += delegate { - SparkleShare.Controller.ToggleNotifications (); + Program.Controller.ToggleNotifications (); CreateMenu (); }; @@ -291,7 +311,7 @@ namespace SparkleShare { MenuItem quit_item = new MenuItem (_("Quit")); quit_item.Activated += delegate { - SparkleShare.Controller.Quit (); + Program.Controller.Quit (); }; Menu.Add (quit_item); @@ -308,12 +328,12 @@ namespace SparkleShare { private EventHandler OpenFolderDelegate (string name) { return delegate { - SparkleShare.Controller.OpenSparkleShareFolder (name); + Program.Controller.OpenSparkleShareFolder (name); }; } - public void UpdateMenu () + public void UpdateStateText () { ((Menu.Children [0] as MenuItem).Child as Label).Text = StateText; Menu.ShowAll (); @@ -323,11 +343,7 @@ namespace SparkleShare { // Makes the menu visible private void ShowMenu (object o, EventArgs args) { - if ((SparkleBackend.Platform == PlatformID.Unix || - SparkleBackend.Platform == PlatformID.MacOSX)) - Menu.Popup (null, null, SetPosition, 0, Global.CurrentEventTime); - else - Menu.Popup (null, null, null, 0, Global.CurrentEventTime); + Menu.Popup (null, null, SetPosition, 0, Global.CurrentEventTime); } @@ -337,63 +353,6 @@ namespace SparkleShare { StatusIcon.PositionMenu (menu, out x, out y, out push_in, this.status_icon.Handle); } #endif - - // The state when there's nothing going on - private void SetNormalState () - { - SetNormalState (false); - } - - - // The state when there's nothing going on - private void SetNormalState (bool error) - { - Animation.Stop (); - - if (SparkleShare.Controller.Folders.Count == 0) { - StateText = _("Welcome to SparkleShare!"); - - Application.Invoke (delegate { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "process-syncing-sparkleshare-i"; - #else - this.status_icon.Pixbuf = AnimationFrames [0]; - #endif - }); - - } else { - if (error) { - StateText = _("Not everything is synced"); - - Application.Invoke (delegate { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "sparkleshare-syncing-error"; - #else - this.status_icon.Pixbuf = SparkleUIHelpers.GetIcon ("sparkleshare-syncing-error", 24); - #endif - }); - } else { - StateText = _("Up to date") + " (" + SparkleShare.Controller.FolderSize + ")"; - Application.Invoke (delegate { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "process-syncing-sparkleshare-i"; - #else - this.status_icon.Pixbuf = AnimationFrames [0]; - #endif - }); - } - } - } - - - // The state when animating - private void SetAnimationState () - { - StateText = _("Syncing…"); - - if (!Animation.Enabled) - Animation.Start (); - } } diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 0353c214..6fc54782 100644 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -38,29 +38,29 @@ namespace SparkleShare { public string [] Folders { get { - return SparkleShare.Controller.Folders.ToArray (); + return Program.Controller.Folders.ToArray (); } } public string FolderSize { get { - return SparkleShare.Controller.FolderSize; + return Program.Controller.FolderSize; } } public SparkleStatusIconController () { - SparkleShare.Controller.FolderSizeChanged += delegate { + Program.Controller.FolderSizeChanged += delegate { if (UpdateMenuEvent != null) UpdateMenuEvent (CurrentState); }; - SparkleShare.Controller.FolderListChanged += delegate { + Program.Controller.FolderListChanged += delegate { if (UpdateMenuEvent != null) UpdateMenuEvent (CurrentState); }; - SparkleShare.Controller.OnIdle += delegate { + Program.Controller.OnIdle += delegate { if (CurrentState != IconState.Error) CurrentState = IconState.Idle; @@ -68,14 +68,16 @@ namespace SparkleShare { UpdateMenuEvent (CurrentState); }; - SparkleShare.Controller.OnSyncing += delegate { + Program.Controller.OnSyncing += delegate { CurrentState = IconState.Syncing; + // TODO up down both + if (UpdateMenuEvent != null) UpdateMenuEvent (IconState.Syncing); }; - SparkleShare.Controller.OnError += delegate { + Program.Controller.OnError += delegate { CurrentState = IconState.Error; if (UpdateMenuEvent != null) diff --git a/SparkleShare/SparkleUIHelpers.cs b/SparkleShare/SparkleUIHelpers.cs index 4786be01..2ad40ff0 100644 --- a/SparkleShare/SparkleUIHelpers.cs +++ b/SparkleShare/SparkleUIHelpers.cs @@ -40,14 +40,20 @@ namespace SparkleShare { public static Gdk.Pixbuf GetIcon (string name, int size) { IconTheme icon_theme = new IconTheme (); - icon_theme.AppendSearchPath (SparklePaths.SparkleIconPath); - icon_theme.AppendSearchPath (SparklePaths.SparkleLocalIconPath); + + icon_theme.AppendSearchPath ( + Path.Combine (SparkleUI.AssetsPath, "icons")); + + icon_theme.AppendSearchPath ( + Path.Combine (SparkleConfig.ConfigPath, "icons")); try { return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); + } catch { try { return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); + } catch { return null; } @@ -55,6 +61,15 @@ namespace SparkleShare { } + public static Image GetImage (string name) + { + string image_path = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", + "pixmaps", name); + + return new Image (image_path); + } + + // Converts a Gdk RGB color to a hex value. // Example: from "rgb:0,0,0" to "#000000" public static string GdkColorToHex (Gdk.Color color) diff --git a/SparkleShare/Windows/Program.cs b/SparkleShare/Windows/Program.cs index 54a104d0..50e42c1c 100644 --- a/SparkleShare/Windows/Program.cs +++ b/SparkleShare/Windows/Program.cs @@ -22,13 +22,16 @@ using System.IO; using System.Runtime.InteropServices; using System.Text; +#if __MonoCS__ +using Mono.Unix; +//using Mono.Unix.Native; +#endif using SparkleLib; using SparkleLib.Options; namespace SparkleShare { // This is SparkleShare! - // http://blogs.msdn.com/b/ericlippert/archive/2010/03/09/do-not-name-a-class-the-same-as-its-namespace-part-one.aspx public class Program { public static SparkleController Controller; @@ -38,22 +41,18 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { +#if __MonoCS__ + return Catalog.GetString (s); +#else return s; +#endif } +#if !__MonoCS__ [STAThread] +#endif public static void Main (string [] args) { - // Don't allow running as root on Linux or Mac -#if __MonoCS__ - if (new Mono.Unix.UnixUserInfo (Mono.Unix.UnixEnvironment.UserName).UserId == 0) { - - Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); - Console.WriteLine (_("Things would go utterly wrong.")); - Environment.Exit (-1); - } -#endif - // Parse the command line options bool show_help = false; OptionSet option_set = new OptionSet () { @@ -73,25 +72,10 @@ namespace SparkleShare { if (show_help) ShowHelp (option_set); - // Load the right controller for the OS - string controller_name = "Lin"; - switch (SparkleBackend.Platform) { - case PlatformID.Unix: - SetProcessName ("sparkleshare"); - break; - case PlatformID.MacOSX: - controller_name = "Mac"; - break; - case PlatformID.Win32NT: - controller_name = "Win"; - break; - } // Initialize the controller this way so that // there aren't any exceptions in the OS specific UI's - Controller = (SparkleController) Activator.CreateInstance ( - Type.GetType ("SparkleShare.Sparkle" + controller_name + "Controller")); - + Controller = new SparkleController (); Controller.Initialize (); if (Controller != null) { diff --git a/SparkleShare/Windows/SparkleWinController.cs b/SparkleShare/Windows/SparkleController.cs similarity index 98% rename from SparkleShare/Windows/SparkleWinController.cs rename to SparkleShare/Windows/SparkleController.cs index 202cc4e9..73f063f2 100644 --- a/SparkleShare/Windows/SparkleWinController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -28,9 +28,9 @@ using CefSharp; namespace SparkleShare { - public class SparkleWinController : SparkleController { + public class SparkleController : SparkleControllerBase { - public SparkleWinController () : base () + public SparkleController () : base () { } diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index e23c68c6..1a53f228 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -71,6 +71,12 @@ True GlobalAssemblyInfo.tt
+ + SparkleControllerBase.cs + + + SparkleExtensions.cs + @@ -104,8 +110,8 @@ - + Form @@ -121,7 +127,6 @@ - Component diff --git a/SparkleShare/sparkleshare.in b/SparkleShare/sparkleshare.in index 88302a5c..3e71f404 100644 --- a/SparkleShare/sparkleshare.in +++ b/SparkleShare/sparkleshare.in @@ -1,5 +1,10 @@ #!/bin/bash +if [[ $UID -eq 0 ]]; then + echo "Cannot run as root. Things would go utterly wrong." + exit 1 +fi + if [ "$XDG_RUNTIME_DIR" ]; then pidfile=${XDG_RUNTIME_DIR}/sparkleshare.pid else From c3a8dc4e0a6cfbd5c0df14855640eb18f7f8223a Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 2 Oct 2011 02:31:40 +0200 Subject: [PATCH 051/134] Copy server descriptions from old linux version --- SparkleShare/Windows/SparkleSetup.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 5441c9fe..b1d3dabe 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -200,15 +200,18 @@ namespace SparkleShare { } private void radio_button_github_MouseEnter (object sender, EventArgs e) { - showInfo ("To use github to store your files you need to ..."); + showInfo (_("Free hosting for Free and Open Source Software projects.") + + _("Also has paid accounts for extra private space and bandwidth.")); } private void radio_button_gitorious_MouseEnter (object sender, EventArgs e) { - showInfo ("To use gitorious to store your files you need to ..."); + showInfo (_("Completely Free as in Freedom infrastructure.") + + _("Free accounts for Free and Open Source projects.")); } private void radio_button_gnome_MouseEnter (object sender, EventArgs e) { - showInfo ("To use gnome project to store your files you need to ..."); + showInfo (_("GNOME is an easy to understand interface to your computer.") + + _("Select this option if you're a developer or designer working on GNOME.")); } private void panel_server_selection_MouseLeave (object sender, EventArgs e) { From dbc0fddf108ef1d0e76de209f46e51f9c43b9234 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 2 Oct 2011 03:15:11 +0200 Subject: [PATCH 052/134] fix startup threading issue when Repositories is not null --- SparkleShare/SparkleControllerBase.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index f2276553..476c82b9 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -36,7 +36,7 @@ namespace SparkleShare { public abstract class SparkleControllerBase { - public List Repositories; + public List Repositories = new List (); public string FolderSize; public readonly string SparklePath = SparkleConfig.DefaultConfig.FoldersPath; @@ -155,6 +155,9 @@ namespace SparkleShare { } }; + // FIXME: this should probably not called in a thread, because + // Repositories will not be valid until PopulateRepositories + // has been finished, but other functions use Repositories new Thread (new ThreadStart (PopulateRepositories)).Start (); } @@ -643,7 +646,7 @@ namespace SparkleShare { // folders in the SparkleShare folder private void PopulateRepositories () { - Repositories = new List (); + List TempRepositories = new List (); foreach (string folder_name in SparkleConfig.DefaultConfig.Folders) { string folder_path = new SparkleFolder (folder_name).FullPath; @@ -654,6 +657,8 @@ namespace SparkleShare { SparkleConfig.DefaultConfig.RemoveFolder (folder_name); } + Repositories = TempRepositories; + if (FolderListChanged != null) FolderListChanged (); From 3da25900f3baa74005e69b94e311d914bb7b126b Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 2 Oct 2011 03:49:35 +0200 Subject: [PATCH 053/134] workaround for unexpected exception --- SparkleShare/Windows/SparkleStatusIcon.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 02c1ea3e..ed964bfc 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -348,7 +348,8 @@ namespace SparkleShare { public static void SafeInvoke (this Control uiElement, Action updater, bool forceSynchronous) { if (uiElement == null) { - throw new ArgumentNullException ("uiElement"); + //throw new ArgumentNullException ("uiElement"); + return; } if (uiElement.InvokeRequired) { From 9f8224c0a034b0b220bd16a40dff01fe0ae19aa3 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Oct 2011 02:02:14 +0200 Subject: [PATCH 054/134] Made the ssh-agent close when quitting the application --- SparkleShare/Windows/SparkleController.cs | 26 ++++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 73f063f2..48b331d8 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -64,7 +64,9 @@ namespace SparkleShare { if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("HOME"))) System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); - StartSshAgent (); + StartSshAgent(); + // Start the agent but also make it stop when application is qutting + Application.ApplicationExit += new EventHandler(this.StopSshAgent); base.Initialize (); } @@ -160,15 +162,17 @@ namespace SparkleShare { { 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 (); + ProcessStartInfo processInfo = new ProcessStartInfo (); + Process process; + processInfo.FileName = "ssh-agent"; + processInfo.UseShellExecute = false; + processInfo.RedirectStandardOutput = true; + + process = Process.Start (processInfo); string Output = process.StandardOutput.ReadToEnd (); - process.WaitForExit (); + process.WaitForExit(); + process.Close (); Match AuthSock = new Regex (@"SSH_AUTH_SOCK=([^;\n\r]*)").Match (Output); if (AuthSock.Success) { @@ -186,6 +190,12 @@ namespace SparkleShare { } } + private void StopSshAgent (object sender, EventArgs e) + { + int pid = Int32.Parse(System.Environment.GetEnvironmentVariable("SSH_AGENT_PID")); + Process.GetProcessById(pid).Kill(); + } + } From f7c0c90478cfd4b9bd27dc7afd215ca9da3c20ab Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Wed, 5 Oct 2011 02:04:44 +0200 Subject: [PATCH 055/134] Made the ssh-agent close when quitting the application. Also made the nameEntry and emailENtry field react when you type --- SparkleShare/Windows/SparkleSetup.Designer.cs | 472 +++++++++--------- SparkleShare/Windows/SparkleSetup.cs | 19 +- 2 files changed, 246 insertions(+), 245 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 0e1c8a84..08750441 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -23,173 +23,175 @@ namespace SparkleShare { /// the contents of this method with the code editor. /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleSetup)); - this.pictureBox = new System.Windows.Forms.PictureBox (); - this.panel_info = new System.Windows.Forms.Panel (); - this.label_info = new System.Windows.Forms.Label (); - this.tabControl = new SparkleShare.controls.TablessControl (); - this.setupPage = new System.Windows.Forms.TabPage (); - this.groupBox1 = new System.Windows.Forms.GroupBox (); - this.EmailEntry = new System.Windows.Forms.TextBox (); - this.NameEntry = new System.Windows.Forms.TextBox (); - this.label13 = new System.Windows.Forms.Label (); - this.label12 = new System.Windows.Forms.Label (); - this.label11 = new System.Windows.Forms.Label (); - this.label10 = new System.Windows.Forms.Label (); - this.buttonNext = new System.Windows.Forms.Button (); - this.addPage = new System.Windows.Forms.TabPage (); - this.panel_folder_selection = new System.Windows.Forms.Panel (); - this.groupbox_folder_selection = new System.Windows.Forms.GroupBox (); - this.label5 = new System.Windows.Forms.Label (); - this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); - this.panel_server_selection = new System.Windows.Forms.Panel (); - this.groupbox_server_selection = new System.Windows.Forms.GroupBox (); - this.ServerEntry = new SparkleShare.controls.ExampleTextBox (); - this.radio_button_gnome = new System.Windows.Forms.RadioButton (); - this.radio_button_gitorious = new System.Windows.Forms.RadioButton (); - this.radio_button_github = new System.Windows.Forms.RadioButton (); - this.radio_button_own_server = new System.Windows.Forms.RadioButton (); - this.buttonSync = new System.Windows.Forms.Button (); - this.buttonCancel = new System.Windows.Forms.Button (); - this.label4 = new System.Windows.Forms.Label (); - this.syncingPage = new System.Windows.Forms.TabPage (); - this.syncingProgressBar = new System.Windows.Forms.ProgressBar (); - this.buttonFinish = new System.Windows.Forms.Button (); - this.label7 = new System.Windows.Forms.Label (); - this.label6 = new System.Windows.Forms.Label (); - this.errorPage = new System.Windows.Forms.TabPage (); - this.buttonTryAgain = new System.Windows.Forms.Button (); - this.label3 = new System.Windows.Forms.Label (); - this.label2 = new System.Windows.Forms.Label (); - this.label1 = new System.Windows.Forms.Label (); - this.finishedPage = new System.Windows.Forms.TabPage (); - this.label9 = new System.Windows.Forms.Label (); - this.label8 = new System.Windows.Forms.Label (); - this.buttonFinished = new System.Windows.Forms.Button (); - this.buttonOpenFolder = new System.Windows.Forms.Button (); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); - this.panel_info.SuspendLayout (); - this.tabControl.SuspendLayout (); - this.setupPage.SuspendLayout (); - this.groupBox1.SuspendLayout (); - this.addPage.SuspendLayout (); - this.panel_folder_selection.SuspendLayout (); - this.groupbox_folder_selection.SuspendLayout (); - this.panel_server_selection.SuspendLayout (); - this.groupbox_server_selection.SuspendLayout (); - this.syncingPage.SuspendLayout (); - this.errorPage.SuspendLayout (); - this.finishedPage.SuspendLayout (); - this.SuspendLayout (); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SparkleSetup)); + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.panel_info = new System.Windows.Forms.Panel(); + this.label_info = new System.Windows.Forms.Label(); + this.tabControl = new SparkleShare.controls.TablessControl(); + this.setupPage = new System.Windows.Forms.TabPage(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.EmailEntry = new System.Windows.Forms.TextBox(); + this.NameEntry = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.buttonNext = new System.Windows.Forms.Button(); + this.addPage = new System.Windows.Forms.TabPage(); + this.panel_folder_selection = new System.Windows.Forms.Panel(); + this.groupbox_folder_selection = new System.Windows.Forms.GroupBox(); + this.label5 = new System.Windows.Forms.Label(); + this.FolderEntry = new SparkleShare.controls.ExampleTextBox(); + this.panel_server_selection = new System.Windows.Forms.Panel(); + this.groupbox_server_selection = new System.Windows.Forms.GroupBox(); + this.ServerEntry = new SparkleShare.controls.ExampleTextBox(); + this.radio_button_gnome = new System.Windows.Forms.RadioButton(); + this.radio_button_gitorious = new System.Windows.Forms.RadioButton(); + this.radio_button_github = new System.Windows.Forms.RadioButton(); + this.radio_button_own_server = new System.Windows.Forms.RadioButton(); + this.buttonSync = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.label4 = new System.Windows.Forms.Label(); + this.syncingPage = new System.Windows.Forms.TabPage(); + this.syncingProgressBar = new System.Windows.Forms.ProgressBar(); + this.buttonFinish = new System.Windows.Forms.Button(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.errorPage = new System.Windows.Forms.TabPage(); + this.buttonTryAgain = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.finishedPage = new System.Windows.Forms.TabPage(); + this.label9 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.buttonFinished = new System.Windows.Forms.Button(); + this.buttonOpenFolder = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.panel_info.SuspendLayout(); + this.tabControl.SuspendLayout(); + this.setupPage.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.addPage.SuspendLayout(); + this.panel_folder_selection.SuspendLayout(); + this.groupbox_folder_selection.SuspendLayout(); + this.panel_server_selection.SuspendLayout(); + this.groupbox_server_selection.SuspendLayout(); + this.syncingPage.SuspendLayout(); + this.errorPage.SuspendLayout(); + this.finishedPage.SuspendLayout(); + this.SuspendLayout(); // // pictureBox // this.pictureBox.Dock = System.Windows.Forms.DockStyle.Left; - this.pictureBox.Location = new System.Drawing.Point (0, 0); + this.pictureBox.Location = new System.Drawing.Point(0, 0); this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size (150, 396); + this.pictureBox.Size = new System.Drawing.Size(150, 396); this.pictureBox.TabIndex = 1; this.pictureBox.TabStop = false; // // panel_info // this.panel_info.BackColor = System.Drawing.Color.White; - this.panel_info.Controls.Add (this.label_info); - this.panel_info.Location = new System.Drawing.Point (0, 0); + this.panel_info.Controls.Add(this.label_info); + this.panel_info.Location = new System.Drawing.Point(0, 0); this.panel_info.Name = "panel_info"; - this.panel_info.Size = new System.Drawing.Size (150, 396); + this.panel_info.Size = new System.Drawing.Size(150, 396); this.panel_info.TabIndex = 7; this.panel_info.Visible = false; // // label_info // - this.label_info.Location = new System.Drawing.Point (12, 105); + this.label_info.Location = new System.Drawing.Point(12, 105); this.label_info.Name = "label_info"; - this.label_info.Size = new System.Drawing.Size (112, 253); + this.label_info.Size = new System.Drawing.Size(112, 253); this.label_info.TabIndex = 1; this.label_info.Text = "Informative text"; // // tabControl // - this.tabControl.Controls.Add (this.setupPage); - this.tabControl.Controls.Add (this.addPage); - this.tabControl.Controls.Add (this.syncingPage); - this.tabControl.Controls.Add (this.errorPage); - this.tabControl.Controls.Add (this.finishedPage); + this.tabControl.Controls.Add(this.setupPage); + this.tabControl.Controls.Add(this.addPage); + this.tabControl.Controls.Add(this.syncingPage); + this.tabControl.Controls.Add(this.errorPage); + this.tabControl.Controls.Add(this.finishedPage); this.tabControl.Dock = System.Windows.Forms.DockStyle.Right; - this.tabControl.Location = new System.Drawing.Point (150, 0); + this.tabControl.Location = new System.Drawing.Point(150, 0); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size (514, 396); + this.tabControl.Size = new System.Drawing.Size(514, 396); this.tabControl.TabIndex = 0; this.tabControl.TabStop = false; // // setupPage // - this.setupPage.Controls.Add (this.groupBox1); - this.setupPage.Controls.Add (this.label11); - this.setupPage.Controls.Add (this.label10); - this.setupPage.Controls.Add (this.buttonNext); - this.setupPage.Location = new System.Drawing.Point (4, 22); + this.setupPage.Controls.Add(this.groupBox1); + this.setupPage.Controls.Add(this.label11); + this.setupPage.Controls.Add(this.label10); + this.setupPage.Controls.Add(this.buttonNext); + this.setupPage.Location = new System.Drawing.Point(4, 22); this.setupPage.Name = "setupPage"; - this.setupPage.Padding = new System.Windows.Forms.Padding (3); - this.setupPage.Size = new System.Drawing.Size (506, 370); + this.setupPage.Padding = new System.Windows.Forms.Padding(3); + this.setupPage.Size = new System.Drawing.Size(506, 370); this.setupPage.TabIndex = 0; this.setupPage.Text = "Setup"; this.setupPage.UseVisualStyleBackColor = true; // // groupBox1 // - this.groupBox1.Controls.Add (this.EmailEntry); - this.groupBox1.Controls.Add (this.NameEntry); - this.groupBox1.Controls.Add (this.label13); - this.groupBox1.Controls.Add (this.label12); - this.groupBox1.Location = new System.Drawing.Point (14, 119); + this.groupBox1.Controls.Add(this.EmailEntry); + this.groupBox1.Controls.Add(this.NameEntry); + this.groupBox1.Controls.Add(this.label13); + this.groupBox1.Controls.Add(this.label12); + this.groupBox1.Location = new System.Drawing.Point(14, 119); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size (429, 102); + this.groupBox1.Size = new System.Drawing.Size(429, 102); this.groupBox1.TabIndex = 7; this.groupBox1.TabStop = false; this.groupBox1.Text = "Information about you"; // // EmailEntry // - this.EmailEntry.Location = new System.Drawing.Point (150, 54); + this.EmailEntry.Location = new System.Drawing.Point(150, 54); this.EmailEntry.Name = "EmailEntry"; - this.EmailEntry.Size = new System.Drawing.Size (275, 20); + this.EmailEntry.Size = new System.Drawing.Size(275, 20); this.EmailEntry.TabIndex = 10; + this.EmailEntry.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckSetupPage); // // NameEntry // - this.NameEntry.Location = new System.Drawing.Point (150, 28); + this.NameEntry.Location = new System.Drawing.Point(150, 28); this.NameEntry.Name = "NameEntry"; - this.NameEntry.Size = new System.Drawing.Size (275, 20); + this.NameEntry.Size = new System.Drawing.Size(275, 20); this.NameEntry.TabIndex = 9; + this.NameEntry.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CheckSetupPage); // // label13 // this.label13.AutoSize = true; - this.label13.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label13.Location = new System.Drawing.Point (15, 57); + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.Location = new System.Drawing.Point(15, 57); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size (41, 13); + this.label13.Size = new System.Drawing.Size(41, 13); this.label13.TabIndex = 8; this.label13.Text = "Email:"; // // label12 // this.label12.AutoSize = true; - this.label12.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label12.Location = new System.Drawing.Point (15, 31); + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.Location = new System.Drawing.Point(15, 31); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size (65, 13); + this.label12.Size = new System.Drawing.Size(65, 13); this.label12.TabIndex = 7; this.label12.Text = "Full name:"; // // label11 // - this.label11.Location = new System.Drawing.Point (11, 44); + this.label11.Location = new System.Drawing.Point(11, 44); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size (307, 62); + this.label11.Size = new System.Drawing.Size(307, 62); this.label11.TabIndex = 2; this.label11.Text = "Before we can create a SparkleShare folder on this computer, we need a few bits o" + "f information from you.\r\n"; @@ -197,55 +199,55 @@ namespace SparkleShare { // label10 // this.label10.AutoSize = true; - this.label10.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label10.Location = new System.Drawing.Point (8, 18); + this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label10.Location = new System.Drawing.Point(8, 18); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size (222, 20); + this.label10.Size = new System.Drawing.Size(222, 20); this.label10.TabIndex = 1; this.label10.Text = "Welcome to SparkleShare!"; // // buttonNext // this.buttonNext.Enabled = false; - this.buttonNext.Location = new System.Drawing.Point (431, 350); + this.buttonNext.Location = new System.Drawing.Point(431, 350); this.buttonNext.Name = "buttonNext"; - this.buttonNext.Size = new System.Drawing.Size (75, 23); + this.buttonNext.Size = new System.Drawing.Size(75, 23); this.buttonNext.TabIndex = 0; this.buttonNext.Text = "Next"; this.buttonNext.UseVisualStyleBackColor = true; - this.buttonNext.Click += new System.EventHandler (this.buttonNext_Click); + this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click); // // addPage // - this.addPage.Controls.Add (this.panel_folder_selection); - this.addPage.Controls.Add (this.panel_server_selection); - this.addPage.Controls.Add (this.buttonSync); - this.addPage.Controls.Add (this.buttonCancel); - this.addPage.Controls.Add (this.label4); - this.addPage.Location = new System.Drawing.Point (4, 22); + this.addPage.Controls.Add(this.panel_folder_selection); + this.addPage.Controls.Add(this.panel_server_selection); + this.addPage.Controls.Add(this.buttonSync); + this.addPage.Controls.Add(this.buttonCancel); + this.addPage.Controls.Add(this.label4); + this.addPage.Location = new System.Drawing.Point(4, 22); this.addPage.Name = "addPage"; - this.addPage.Padding = new System.Windows.Forms.Padding (3); - this.addPage.Size = new System.Drawing.Size (506, 370); + this.addPage.Padding = new System.Windows.Forms.Padding(3); + this.addPage.Size = new System.Drawing.Size(506, 370); this.addPage.TabIndex = 1; this.addPage.Text = "Add"; this.addPage.UseVisualStyleBackColor = true; // // panel_folder_selection // - this.panel_folder_selection.Controls.Add (this.groupbox_folder_selection); - this.panel_folder_selection.Location = new System.Drawing.Point (2, 213); + this.panel_folder_selection.Controls.Add(this.groupbox_folder_selection); + this.panel_folder_selection.Location = new System.Drawing.Point(2, 213); this.panel_folder_selection.Name = "panel_folder_selection"; - this.panel_folder_selection.Size = new System.Drawing.Size (512, 123); + this.panel_folder_selection.Size = new System.Drawing.Size(512, 123); this.panel_folder_selection.TabIndex = 13; - this.panel_folder_selection.MouseLeave += new System.EventHandler (this.panel_folder_selection_MouseLeave); + this.panel_folder_selection.MouseLeave += new System.EventHandler(this.panel_folder_selection_MouseLeave); // // groupbox_folder_selection // - this.groupbox_folder_selection.Controls.Add (this.label5); - this.groupbox_folder_selection.Controls.Add (this.FolderEntry); - this.groupbox_folder_selection.Location = new System.Drawing.Point (10, 20); + this.groupbox_folder_selection.Controls.Add(this.label5); + this.groupbox_folder_selection.Controls.Add(this.FolderEntry); + this.groupbox_folder_selection.Location = new System.Drawing.Point(10, 20); this.groupbox_folder_selection.Name = "groupbox_folder_selection"; - this.groupbox_folder_selection.Size = new System.Drawing.Size (470, 88); + this.groupbox_folder_selection.Size = new System.Drawing.Size(470, 88); this.groupbox_folder_selection.TabIndex = 11; this.groupbox_folder_selection.TabStop = false; this.groupbox_folder_selection.Text = "Folder selection"; @@ -253,9 +255,9 @@ namespace SparkleShare { // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (6, 43); + this.label5.Location = new System.Drawing.Point(6, 43); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (121, 13); + this.label5.Size = new System.Drawing.Size(121, 13); this.label5.TabIndex = 9; this.label5.Text = "Folder name (on server):"; // @@ -263,31 +265,31 @@ namespace SparkleShare { // this.FolderEntry.ExampleText = "/path/to/folder"; this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.FolderEntry.Location = new System.Drawing.Point (133, 40); + this.FolderEntry.Location = new System.Drawing.Point(133, 40); this.FolderEntry.Name = "FolderEntry"; - this.FolderEntry.Size = new System.Drawing.Size (318, 20); + this.FolderEntry.Size = new System.Drawing.Size(318, 20); this.FolderEntry.TabIndex = 8; - this.FolderEntry.MouseEnter += new System.EventHandler (this.FolderEntry_MouseEnter); + this.FolderEntry.MouseEnter += new System.EventHandler(this.FolderEntry_MouseEnter); // // panel_server_selection // - this.panel_server_selection.Controls.Add (this.groupbox_server_selection); - this.panel_server_selection.Location = new System.Drawing.Point (0, 53); + this.panel_server_selection.Controls.Add(this.groupbox_server_selection); + this.panel_server_selection.Location = new System.Drawing.Point(0, 53); this.panel_server_selection.Name = "panel_server_selection"; - this.panel_server_selection.Size = new System.Drawing.Size (512, 154); + this.panel_server_selection.Size = new System.Drawing.Size(512, 154); this.panel_server_selection.TabIndex = 12; - this.panel_server_selection.MouseLeave += new System.EventHandler (this.panel_server_selection_MouseLeave); + this.panel_server_selection.MouseLeave += new System.EventHandler(this.panel_server_selection_MouseLeave); // // groupbox_server_selection // - this.groupbox_server_selection.Controls.Add (this.ServerEntry); - this.groupbox_server_selection.Controls.Add (this.radio_button_gnome); - this.groupbox_server_selection.Controls.Add (this.radio_button_gitorious); - this.groupbox_server_selection.Controls.Add (this.radio_button_github); - this.groupbox_server_selection.Controls.Add (this.radio_button_own_server); - this.groupbox_server_selection.Location = new System.Drawing.Point (15, 9); + this.groupbox_server_selection.Controls.Add(this.ServerEntry); + this.groupbox_server_selection.Controls.Add(this.radio_button_gnome); + this.groupbox_server_selection.Controls.Add(this.radio_button_gitorious); + this.groupbox_server_selection.Controls.Add(this.radio_button_github); + this.groupbox_server_selection.Controls.Add(this.radio_button_own_server); + this.groupbox_server_selection.Location = new System.Drawing.Point(15, 9); this.groupbox_server_selection.Name = "groupbox_server_selection"; - this.groupbox_server_selection.Size = new System.Drawing.Size (470, 123); + this.groupbox_server_selection.Size = new System.Drawing.Size(470, 123); this.groupbox_server_selection.TabIndex = 11; this.groupbox_server_selection.TabStop = false; this.groupbox_server_selection.Text = "Server selection"; @@ -296,172 +298,172 @@ namespace SparkleShare { // this.ServerEntry.ExampleText = "address-to-server/ip-to-server"; this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.ServerEntry.Location = new System.Drawing.Point (139, 21); + this.ServerEntry.Location = new System.Drawing.Point(139, 21); this.ServerEntry.Name = "ServerEntry"; - this.ServerEntry.Size = new System.Drawing.Size (312, 20); + this.ServerEntry.Size = new System.Drawing.Size(312, 20); this.ServerEntry.TabIndex = 10; // // radio_button_gnome // this.radio_button_gnome.AutoSize = true; - this.radio_button_gnome.Location = new System.Drawing.Point (6, 91); + this.radio_button_gnome.Location = new System.Drawing.Point(6, 91); this.radio_button_gnome.Name = "radio_button_gnome"; - this.radio_button_gnome.Size = new System.Drawing.Size (165, 17); + this.radio_button_gnome.Size = new System.Drawing.Size(165, 17); this.radio_button_gnome.TabIndex = 9; this.radio_button_gnome.Text = "The GNOME Project account"; this.radio_button_gnome.UseVisualStyleBackColor = true; - this.radio_button_gnome.MouseEnter += new System.EventHandler (this.radio_button_gnome_MouseEnter); + this.radio_button_gnome.MouseEnter += new System.EventHandler(this.radio_button_gnome_MouseEnter); // // radio_button_gitorious // this.radio_button_gitorious.AutoSize = true; - this.radio_button_gitorious.Location = new System.Drawing.Point (6, 68); + this.radio_button_gitorious.Location = new System.Drawing.Point(6, 68); this.radio_button_gitorious.Name = "radio_button_gitorious"; - this.radio_button_gitorious.Size = new System.Drawing.Size (108, 17); + this.radio_button_gitorious.Size = new System.Drawing.Size(108, 17); this.radio_button_gitorious.TabIndex = 8; this.radio_button_gitorious.Text = "Gitorious account"; this.radio_button_gitorious.UseVisualStyleBackColor = true; - this.radio_button_gitorious.MouseEnter += new System.EventHandler (this.radio_button_gitorious_MouseEnter); + this.radio_button_gitorious.MouseEnter += new System.EventHandler(this.radio_button_gitorious_MouseEnter); // // radio_button_github // this.radio_button_github.AutoSize = true; - this.radio_button_github.Location = new System.Drawing.Point (6, 45); + this.radio_button_github.Location = new System.Drawing.Point(6, 45); this.radio_button_github.Name = "radio_button_github"; - this.radio_button_github.Size = new System.Drawing.Size (98, 17); + this.radio_button_github.Size = new System.Drawing.Size(98, 17); this.radio_button_github.TabIndex = 7; this.radio_button_github.Text = "Github account"; this.radio_button_github.UseVisualStyleBackColor = true; - this.radio_button_github.MouseEnter += new System.EventHandler (this.radio_button_github_MouseEnter); + this.radio_button_github.MouseEnter += new System.EventHandler(this.radio_button_github_MouseEnter); // // radio_button_own_server // this.radio_button_own_server.AutoSize = true; this.radio_button_own_server.Checked = true; - this.radio_button_own_server.Location = new System.Drawing.Point (6, 22); + this.radio_button_own_server.Location = new System.Drawing.Point(6, 22); this.radio_button_own_server.Name = "radio_button_own_server"; - this.radio_button_own_server.Size = new System.Drawing.Size (115, 17); + this.radio_button_own_server.Size = new System.Drawing.Size(115, 17); this.radio_button_own_server.TabIndex = 6; this.radio_button_own_server.TabStop = true; this.radio_button_own_server.Text = "On my own Server:"; this.radio_button_own_server.UseVisualStyleBackColor = true; - this.radio_button_own_server.MouseEnter += new System.EventHandler (this.radio_button_own_server_MouseEnter); + this.radio_button_own_server.MouseEnter += new System.EventHandler(this.radio_button_own_server_MouseEnter); // // buttonSync // - this.buttonSync.Location = new System.Drawing.Point (431, 355); + this.buttonSync.Location = new System.Drawing.Point(431, 355); this.buttonSync.Name = "buttonSync"; - this.buttonSync.Size = new System.Drawing.Size (75, 23); + this.buttonSync.Size = new System.Drawing.Size(75, 23); this.buttonSync.TabIndex = 9; this.buttonSync.Text = "Sync"; this.buttonSync.UseVisualStyleBackColor = true; - this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); + this.buttonSync.Click += new System.EventHandler(this.buttonSync_Click); // // buttonCancel // - this.buttonCancel.Location = new System.Drawing.Point (350, 355); + this.buttonCancel.Location = new System.Drawing.Point(350, 355); this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size (75, 23); + this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 8; this.buttonCancel.Text = "Cancel"; this.buttonCancel.UseVisualStyleBackColor = true; - this.buttonCancel.Click += new System.EventHandler (this.buttonCancel_Click); + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // // label4 // this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.Location = new System.Drawing.Point (8, 18); + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Location = new System.Drawing.Point(8, 18); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (240, 20); + this.label4.Size = new System.Drawing.Size(240, 20); this.label4.TabIndex = 0; this.label4.Text = "Where is your remote folder?"; // // syncingPage // - this.syncingPage.Controls.Add (this.syncingProgressBar); - this.syncingPage.Controls.Add (this.buttonFinish); - this.syncingPage.Controls.Add (this.label7); - this.syncingPage.Controls.Add (this.label6); - this.syncingPage.Location = new System.Drawing.Point (4, 22); + this.syncingPage.Controls.Add(this.syncingProgressBar); + this.syncingPage.Controls.Add(this.buttonFinish); + this.syncingPage.Controls.Add(this.label7); + this.syncingPage.Controls.Add(this.label6); + this.syncingPage.Location = new System.Drawing.Point(4, 22); this.syncingPage.Name = "syncingPage"; - this.syncingPage.Size = new System.Drawing.Size (506, 370); + this.syncingPage.Size = new System.Drawing.Size(506, 370); this.syncingPage.TabIndex = 2; this.syncingPage.Text = "Syncing"; this.syncingPage.UseVisualStyleBackColor = true; // // syncingProgressBar // - this.syncingProgressBar.Location = new System.Drawing.Point (14, 109); + this.syncingProgressBar.Location = new System.Drawing.Point(14, 109); this.syncingProgressBar.Name = "syncingProgressBar"; - this.syncingProgressBar.Size = new System.Drawing.Size (492, 23); + this.syncingProgressBar.Size = new System.Drawing.Size(492, 23); this.syncingProgressBar.TabIndex = 3; // // buttonFinish // this.buttonFinish.Enabled = false; - this.buttonFinish.Location = new System.Drawing.Point (431, 350); + this.buttonFinish.Location = new System.Drawing.Point(431, 350); this.buttonFinish.Name = "buttonFinish"; - this.buttonFinish.Size = new System.Drawing.Size (75, 23); + this.buttonFinish.Size = new System.Drawing.Size(75, 23); this.buttonFinish.TabIndex = 2; this.buttonFinish.Text = "Finish"; this.buttonFinish.UseVisualStyleBackColor = true; - this.buttonFinish.Click += new System.EventHandler (this.buttonFinish_Click); + this.buttonFinish.Click += new System.EventHandler(this.buttonFinish_Click); // // label7 // - this.label7.Location = new System.Drawing.Point (11, 44); + this.label7.Location = new System.Drawing.Point(11, 44); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (307, 62); + this.label7.Size = new System.Drawing.Size(307, 62); this.label7.TabIndex = 1; this.label7.Text = "This may take a while.\r\nAre you sure its not coffee o\'clock?\r\n"; // // label6 // this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label6.Location = new System.Drawing.Point (8, 18); + this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label6.Location = new System.Drawing.Point(8, 18); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size (123, 20); + this.label6.Size = new System.Drawing.Size(123, 20); this.label6.TabIndex = 0; this.label6.Text = "Syncing folder"; // // errorPage // - this.errorPage.Controls.Add (this.buttonTryAgain); - this.errorPage.Controls.Add (this.label3); - this.errorPage.Controls.Add (this.label2); - this.errorPage.Controls.Add (this.label1); - this.errorPage.Location = new System.Drawing.Point (4, 22); + this.errorPage.Controls.Add(this.buttonTryAgain); + this.errorPage.Controls.Add(this.label3); + this.errorPage.Controls.Add(this.label2); + this.errorPage.Controls.Add(this.label1); + this.errorPage.Location = new System.Drawing.Point(4, 22); this.errorPage.Name = "errorPage"; - this.errorPage.Size = new System.Drawing.Size (506, 370); + this.errorPage.Size = new System.Drawing.Size(506, 370); this.errorPage.TabIndex = 3; this.errorPage.Text = "Error"; this.errorPage.UseVisualStyleBackColor = true; // // buttonTryAgain // - this.buttonTryAgain.Location = new System.Drawing.Point (431, 350); + this.buttonTryAgain.Location = new System.Drawing.Point(431, 350); this.buttonTryAgain.Name = "buttonTryAgain"; - this.buttonTryAgain.Size = new System.Drawing.Size (75, 23); + this.buttonTryAgain.Size = new System.Drawing.Size(75, 23); this.buttonTryAgain.TabIndex = 3; this.buttonTryAgain.Text = "Try Again"; this.buttonTryAgain.UseVisualStyleBackColor = true; - this.buttonTryAgain.Click += new System.EventHandler (this.buttonTryAgain_Click); + this.buttonTryAgain.Click += new System.EventHandler(this.buttonTryAgain_Click); // // label3 // - this.label3.Location = new System.Drawing.Point (11, 106); + this.label3.Location = new System.Drawing.Point(11, 106); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (307, 129); + this.label3.Size = new System.Drawing.Size(307, 129); this.label3.TabIndex = 2; - this.label3.Text = resources.GetString ("label3.Text"); + this.label3.Text = resources.GetString("label3.Text"); // // label2 // - this.label2.Location = new System.Drawing.Point (11, 44); + this.label2.Location = new System.Drawing.Point(11, 44); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (307, 62); + this.label2.Size = new System.Drawing.Size(307, 62); this.label2.TabIndex = 1; this.label2.Text = "We don\'t know exactly what the problem is, but we can try to help you pinpoint it" + "."; @@ -469,96 +471,96 @@ namespace SparkleShare { // label1 // this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label1.Location = new System.Drawing.Point (8, 18); + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label1.Location = new System.Drawing.Point(8, 18); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (191, 20); + this.label1.Size = new System.Drawing.Size(191, 20); this.label1.TabIndex = 0; this.label1.Text = "Something went wrong"; // // finishedPage // - this.finishedPage.Controls.Add (this.label9); - this.finishedPage.Controls.Add (this.label8); - this.finishedPage.Controls.Add (this.buttonFinished); - this.finishedPage.Controls.Add (this.buttonOpenFolder); - this.finishedPage.Location = new System.Drawing.Point (4, 22); + this.finishedPage.Controls.Add(this.label9); + this.finishedPage.Controls.Add(this.label8); + this.finishedPage.Controls.Add(this.buttonFinished); + this.finishedPage.Controls.Add(this.buttonOpenFolder); + this.finishedPage.Location = new System.Drawing.Point(4, 22); this.finishedPage.Name = "finishedPage"; - this.finishedPage.Size = new System.Drawing.Size (506, 370); + this.finishedPage.Size = new System.Drawing.Size(506, 370); this.finishedPage.TabIndex = 4; this.finishedPage.Text = "Finished"; this.finishedPage.UseVisualStyleBackColor = true; // // label9 // - this.label9.Location = new System.Drawing.Point (11, 44); + this.label9.Location = new System.Drawing.Point(11, 44); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size (307, 62); + this.label9.Size = new System.Drawing.Size(307, 62); this.label9.TabIndex = 3; this.label9.Text = "Access the synced files from your SparkleShare folder."; // // label8 // this.label8.AutoSize = true; - this.label8.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label8.Location = new System.Drawing.Point (8, 18); + this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label8.Location = new System.Drawing.Point(8, 18); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (228, 20); + this.label8.Size = new System.Drawing.Size(228, 20); this.label8.TabIndex = 2; this.label8.Text = "Folder synced successfully!"; // // buttonFinished // - this.buttonFinished.Location = new System.Drawing.Point (431, 350); + this.buttonFinished.Location = new System.Drawing.Point(431, 350); this.buttonFinished.Name = "buttonFinished"; - this.buttonFinished.Size = new System.Drawing.Size (75, 23); + this.buttonFinished.Size = new System.Drawing.Size(75, 23); this.buttonFinished.TabIndex = 1; this.buttonFinished.Text = "Finish"; this.buttonFinished.UseVisualStyleBackColor = true; - this.buttonFinished.Click += new System.EventHandler (this.buttonFinished_Click); + this.buttonFinished.Click += new System.EventHandler(this.buttonFinished_Click); // // buttonOpenFolder // - this.buttonOpenFolder.Location = new System.Drawing.Point (350, 350); + this.buttonOpenFolder.Location = new System.Drawing.Point(350, 350); this.buttonOpenFolder.Name = "buttonOpenFolder"; - this.buttonOpenFolder.Size = new System.Drawing.Size (75, 23); + this.buttonOpenFolder.Size = new System.Drawing.Size(75, 23); this.buttonOpenFolder.TabIndex = 0; this.buttonOpenFolder.Text = "Open Folder"; this.buttonOpenFolder.UseVisualStyleBackColor = true; - this.buttonOpenFolder.Click += new System.EventHandler (this.buttonOpenFolder_Click); + this.buttonOpenFolder.Click += new System.EventHandler(this.buttonOpenFolder_Click); // // SparkleSetup // - this.ClientSize = new System.Drawing.Size (664, 396); - this.Controls.Add (this.panel_info); - this.Controls.Add (this.tabControl); - this.Controls.Add (this.pictureBox); + this.ClientSize = new System.Drawing.Size(664, 396); + this.Controls.Add(this.panel_info); + this.Controls.Add(this.tabControl); + this.Controls.Add(this.pictureBox); this.Name = "SparkleSetup"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "SparkleShare Setup"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleSetup_FormClosing); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit (); - this.panel_info.ResumeLayout (false); - this.tabControl.ResumeLayout (false); - this.setupPage.ResumeLayout (false); - this.setupPage.PerformLayout (); - this.groupBox1.ResumeLayout (false); - this.groupBox1.PerformLayout (); - this.addPage.ResumeLayout (false); - this.addPage.PerformLayout (); - this.panel_folder_selection.ResumeLayout (false); - this.groupbox_folder_selection.ResumeLayout (false); - this.groupbox_folder_selection.PerformLayout (); - this.panel_server_selection.ResumeLayout (false); - this.groupbox_server_selection.ResumeLayout (false); - this.groupbox_server_selection.PerformLayout (); - this.syncingPage.ResumeLayout (false); - this.syncingPage.PerformLayout (); - this.errorPage.ResumeLayout (false); - this.errorPage.PerformLayout (); - this.finishedPage.ResumeLayout (false); - this.finishedPage.PerformLayout (); - this.ResumeLayout (false); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SparkleSetup_FormClosing); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.panel_info.ResumeLayout(false); + this.tabControl.ResumeLayout(false); + this.setupPage.ResumeLayout(false); + this.setupPage.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.addPage.ResumeLayout(false); + this.addPage.PerformLayout(); + this.panel_folder_selection.ResumeLayout(false); + this.groupbox_folder_selection.ResumeLayout(false); + this.groupbox_folder_selection.PerformLayout(); + this.panel_server_selection.ResumeLayout(false); + this.groupbox_server_selection.ResumeLayout(false); + this.groupbox_server_selection.PerformLayout(); + this.syncingPage.ResumeLayout(false); + this.syncingPage.PerformLayout(); + this.errorPage.ResumeLayout(false); + this.errorPage.PerformLayout(); + this.finishedPage.ResumeLayout(false); + this.finishedPage.PerformLayout(); + this.ResumeLayout(false); } diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 34f6c33c..dd0fbbc6 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -178,53 +178,52 @@ namespace SparkleShare { // entries filled in by the user if (!String.IsNullOrEmpty(NameEntry.Text) && Program.Controller.IsValidEmail (EmailEntry.Text)) { - buttonNext.Enabled = true; } else { buttonNext.Enabled = false; } } - private void showInfo (string text) { + private void ShowInfo (string text) { pictureBox.Visible = false; panel_info.Visible = true; label_info.Text = text; } - private void hideInfo () { + private void HideInfo () { pictureBox.Visible = true; panel_info.Visible = false; } private void radio_button_own_server_MouseEnter (object sender, EventArgs e) { - showInfo ("To use your own server you need to ..."); + ShowInfo ("To use your own server you need to ..."); } private void radio_button_github_MouseEnter (object sender, EventArgs e) { - showInfo (_("Free hosting for Free and Open Source Software projects.") + + ShowInfo (_("Free hosting for Free and Open Source Software projects.") + _("Also has paid accounts for extra private space and bandwidth.")); } private void radio_button_gitorious_MouseEnter (object sender, EventArgs e) { - showInfo (_("Completely Free as in Freedom infrastructure.") + + ShowInfo (_("Completely Free as in Freedom infrastructure.") + _("Free accounts for Free and Open Source projects.")); } private void radio_button_gnome_MouseEnter (object sender, EventArgs e) { - showInfo (_("GNOME is an easy to understand interface to your computer.") + + ShowInfo (_("GNOME is an easy to understand interface to your computer.") + _("Select this option if you're a developer or designer working on GNOME.")); } private void panel_server_selection_MouseLeave (object sender, EventArgs e) { - hideInfo (); + HideInfo (); } private void FolderEntry_MouseEnter (object sender, EventArgs e) { - showInfo ("This is the path to your git project ..."); + ShowInfo ("This is the path to your git project ..."); } private void panel_folder_selection_MouseLeave (object sender, EventArgs e) { - hideInfo (); + HideInfo (); } } } From f6941873ce6ebaa4737068378ce99efa1a5528ae Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Wed, 5 Oct 2011 22:55:22 +0200 Subject: [PATCH 056/134] Added the git command to get the TextTemplating repo, which is needed in order to successfully build the application --- SparkleShare/Windows/build.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index f38f4de7..c9caebd9 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -2,5 +2,6 @@ set WinDirNet=%WinDir%\Microsoft.NET\Framework set msbuild="%WinDirNet%\v3.5\msbuild.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" +git submodule update --init %msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln From b2289fb65b2da8d88a6e2f91f0d6a3558ea3c6eb Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Wed, 5 Oct 2011 23:59:22 +0200 Subject: [PATCH 057/134] Moved the code to kill the SSH Agent to the SparkleControllerBase instead --- SparkleShare/SparkleControllerBase.cs | 12 +++++------- SparkleShare/Windows/SparkleController.cs | 8 -------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 476c82b9..f178513c 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -1128,6 +1128,10 @@ namespace SparkleShare { Environment.Exit (0); #else System.Windows.Forms.Application.Exit (); + + // Also kill the SSH_AGENT + int pid = Int32.Parse(System.Environment.GetEnvironmentVariable("SSH_AGENT_PID")); + Process.GetProcessById(pid).Kill(); #endif } @@ -1135,13 +1139,10 @@ namespace SparkleShare { // Checks to see if an email address is valid public bool IsValidEmail (string email) { - Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); + Regex regex = new Regex(@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); return regex.IsMatch (email); } - - - public void AddNoteToFolder (string folder_name, string revision, string note) { folder_name = folder_name.Replace ("%20", " "); @@ -1153,9 +1154,6 @@ namespace SparkleShare { } } - - - private string [] tango_palette = new string [] {"#eaab00", "#e37222", "#3892ab", "#33c2cb", "#19b271", "#9eab05", "#8599a8", "#9ca696", "#b88454", "#cc0033", "#8f6678", "#8c6cd0", "#796cbf", "#4060af", diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 48b331d8..64eda898 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -65,8 +65,6 @@ namespace SparkleShare { System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); StartSshAgent(); - // Start the agent but also make it stop when application is qutting - Application.ApplicationExit += new EventHandler(this.StopSshAgent); base.Initialize (); } @@ -190,12 +188,6 @@ namespace SparkleShare { } } - private void StopSshAgent (object sender, EventArgs e) - { - int pid = Int32.Parse(System.Environment.GetEnvironmentVariable("SSH_AGENT_PID")); - Process.GetProcessById(pid).Kill(); - } - } From f715217ff086108e7b3dd1b63e6660e4358531ec Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Thu, 6 Oct 2011 00:29:51 +0200 Subject: [PATCH 058/134] Updated the build.cmd to update the submodules to make a cleaner build process --- SparkleShare/Windows/build.cmd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index c9caebd9..db003853 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -1,7 +1,15 @@ @echo off set WinDirNet=%WinDir%\Microsoft.NET\Framework set msbuild="%WinDirNet%\v3.5\msbuild.exe" +set gitpath="C:\msysgit\bin\git.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" +if not exist %gitpath% ( + echo "Could not find git binary at %gitpath%, please install msysgit to C:\msysgit" + pause + exit + ) +set PATH=C:\msysgit\bin;%PATH% +cd ..\..\ git submodule update --init - +cd SparkleShare\Windows %msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln From 8d46eb4dda3b16d27f0ed8a04b0863a11ad0ae61 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Fri, 7 Oct 2011 01:10:57 +0200 Subject: [PATCH 059/134] Updated the file to match the correct programming style used in sparkleshare --- SparkleShare/SparkleControllerBase.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index f178513c..ce851369 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -1130,8 +1130,8 @@ namespace SparkleShare { System.Windows.Forms.Application.Exit (); // Also kill the SSH_AGENT - int pid = Int32.Parse(System.Environment.GetEnvironmentVariable("SSH_AGENT_PID")); - Process.GetProcessById(pid).Kill(); + int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); + Process.GetProcessById (pid).Kill (); #endif } @@ -1139,7 +1139,7 @@ namespace SparkleShare { // Checks to see if an email address is valid public bool IsValidEmail (string email) { - Regex regex = new Regex(@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); + Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); return regex.IsMatch (email); } From 940c5ae1598fbc0f90742fb5649ce7b1b78e303d Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Mon, 10 Oct 2011 01:32:57 +0200 Subject: [PATCH 060/134] Added better handling of the ssh-agent process --- SparkleShare/SparkleControllerBase.cs | 11 ++++- SparkleShare/Windows/SparkleController.cs | 54 ++++++++++++++--------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index ce851369..f63ae4a1 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -1130,8 +1130,15 @@ namespace SparkleShare { System.Windows.Forms.Application.Exit (); // Also kill the SSH_AGENT - int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); - Process.GetProcessById (pid).Kill (); + try { + // Check if we created the process, if so bring it down. Else leave it running + if (!System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK").Equals("unknown")) { + int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); + Process.GetProcessById (pid).Kill (); + } + } catch (Exception e) { + // Handle exception if needed + } #endif } diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 64eda898..18f1a6ba 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -158,34 +158,44 @@ namespace SparkleShare { private void StartSshAgent () { - if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK"))) { + // Check to see if the process is running + Process [] ProcessList = Process.GetProcesses (); + foreach (Process p in ProcessList) { + if (p.ToString ().Contains ("ssh-agent")) { + System.Environment.SetEnvironmentVariable ("SSH_AGENT_PID", p.Id.ToString ()); + System.Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK", "unknown"); + return; + } + } - ProcessStartInfo processInfo = new ProcessStartInfo (); + // If it wasn't running we start it + if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID"))) { + + ProcessStartInfo processInfo = new ProcessStartInfo (); Process process; - processInfo.FileName = "ssh-agent"; - processInfo.UseShellExecute = false; - processInfo.RedirectStandardOutput = true; - - process = Process.Start (processInfo); - string Output = process.StandardOutput.ReadToEnd (); - process.WaitForExit(); + processInfo.FileName = "ssh-agent"; + processInfo.UseShellExecute = false; + processInfo.RedirectStandardOutput = true; + + process = Process.Start (processInfo); + string Output = process.StandardOutput.ReadToEnd (); + process.WaitForExit (); process.Close (); - 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 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"); - } - } + 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"); + } + } } From 7f4234a18ddc7f5a3bfa03585d97867c9ae8f883 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Mon, 10 Oct 2011 01:43:33 +0200 Subject: [PATCH 061/134] Fixed the spacing --- SparkleShare/SparkleControllerBase.cs | 290 ++++++++++++---------- SparkleShare/Windows/SparkleController.cs | 123 ++++----- 2 files changed, 215 insertions(+), 198 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index f63ae4a1..99641445 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -45,19 +45,19 @@ namespace SparkleShare { public event FolderFetchedEventHandler FolderFetched; public delegate void FolderFetchedEventHandler (); - + public event FolderFetchErrorEventHandler FolderFetchError; public delegate void FolderFetchErrorEventHandler (string remote_url); - + public event FolderFetchingEventHandler FolderFetching; public delegate void FolderFetchingEventHandler (double percentage); - + public event FolderListChangedEventHandler FolderListChanged; public delegate void FolderListChangedEventHandler (); public event FolderSizeChangedEventHandler FolderSizeChanged; public delegate void FolderSizeChangedEventHandler (string folder_size); - + public event AvatarFetchedEventHandler AvatarFetched; public delegate void AvatarFetchedEventHandler (); @@ -98,7 +98,7 @@ namespace SparkleShare { { } - + public virtual void Initialize () { InstallLauncher (); @@ -118,8 +118,8 @@ namespace SparkleShare { // Watch the SparkleShare folder FileSystemWatcher watcher = new FileSystemWatcher (SparkleConfig.DefaultConfig.FoldersPath) { IncludeSubdirectories = false, - EnableRaisingEvents = true, - Filter = "*" + EnableRaisingEvents = true, + Filter = "*" }; // Remove the repository when a delete event occurs @@ -142,13 +142,13 @@ namespace SparkleShare { // Handle invitations when the user saves an // invitation into the SparkleShare folder if (args.Name.EndsWith (".sparkle") && !FirstRun) { - XmlDocument xml_doc = new XmlDocument (); + XmlDocument xml_doc = new XmlDocument (); xml_doc.Load (args.Name); string server = xml_doc.GetElementsByTagName ("server") [0].InnerText; string folder = xml_doc.GetElementsByTagName ("folder") [0].InnerText; - string token = xml_doc.GetElementsByTagName ("token") [0].InnerText; - + string token = xml_doc.GetElementsByTagName ("token") [0].InnerText; + // FIXME: this is broken :\ if (OnInvitation != null) OnInvitation (server, folder, token); @@ -162,8 +162,10 @@ namespace SparkleShare { } - public bool FirstRun { - get { + public bool FirstRun + { + get + { return SparkleConfig.DefaultConfig.User.Email.Equals ("Unknown"); } } @@ -188,8 +190,8 @@ namespace SparkleShare { SparkleHelpers.DebugInfo ("WebRequest", url); - HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url); - HttpWebResponse response = (HttpWebResponse) request.GetResponse(); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create (url); + HttpWebResponse response = (HttpWebResponse)request.GetResponse (); if (response.StatusCode == HttpStatusCode.OK) { response.Close (); @@ -202,8 +204,10 @@ namespace SparkleShare { } - public List Folders { - get { + public List Folders + { + get + { List folders = SparkleConfig.DefaultConfig.Folders; folders.Sort (); return folders; @@ -211,24 +215,28 @@ namespace SparkleShare { } - public List PreviousHosts { - get { + public List PreviousHosts + { + get + { List hosts = SparkleConfig.DefaultConfig.HostsWithUsername; - hosts.AddRange(SparkleConfig.DefaultConfig.Hosts); + hosts.AddRange (SparkleConfig.DefaultConfig.Hosts); hosts.Sort (); return hosts; } } - public List UnsyncedFolders { - get { + public List UnsyncedFolders + { + get + { List unsynced_folders = new List (); foreach (SparkleRepoBase repo in Repositories) { if (repo.HasUnsyncedChanges) unsynced_folders.Add (repo.Name); - } + } return unsynced_folders; } @@ -263,26 +271,26 @@ namespace SparkleShare { if (name == null) return GetLog (); - string path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, name}.Combine (); + string path = new string [] { SparkleConfig.DefaultConfig.FoldersPath, name }.Combine (); int log_size = 50; - + foreach (SparkleRepoBase repo in Repositories) { - if (repo.LocalPath.Equals (path)) + if (repo.LocalPath.Equals (path)) return repo.GetChangeSets (log_size); } return null; } - - + + public abstract string EventLogHTML { get; } public abstract string DayEntryHTML { get; } public abstract string EventEntryHTML { get; } - - + + public string GetHTMLLog (List change_sets) { - List activity_days = new List (); + List activity_days = new List (); List emails = new List (); change_sets.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); @@ -297,9 +305,9 @@ namespace SparkleShare { bool change_set_inserted = false; foreach (ActivityDay stored_activity_day in activity_days) { - if (stored_activity_day.DateTime.Year == change_set.Timestamp.Year && + if (stored_activity_day.DateTime.Year == change_set.Timestamp.Year && stored_activity_day.DateTime.Month == change_set.Timestamp.Month && - stored_activity_day.DateTime.Day == change_set.Timestamp.Day) { + stored_activity_day.DateTime.Day == change_set.Timestamp.Day) { bool squash = false; foreach (SparkleChangeSet existing_set in stored_activity_day) { @@ -314,8 +322,8 @@ namespace SparkleShare { existing_set.MovedTo.AddRange (change_set.MovedTo); existing_set.Notes.AddRange (change_set.Notes); - existing_set.Added = existing_set.Added.Distinct ().ToList (); - existing_set.Edited = existing_set.Edited.Distinct ().ToList (); + existing_set.Added = existing_set.Added.Distinct ().ToList (); + existing_set.Edited = existing_set.Edited.Distinct ().ToList (); existing_set.Deleted = existing_set.Deleted.Distinct ().ToList (); if (DateTime.Compare (existing_set.Timestamp, change_set.Timestamp) < 1) { @@ -350,10 +358,10 @@ namespace SparkleShare { FetchAvatars (emails, 48); })).Start (); - string event_log_html = EventLogHTML; - string day_entry_html = DayEntryHTML; + string event_log_html = EventLogHTML; + string day_entry_html = DayEntryHTML; string event_entry_html = EventEntryHTML; - string event_log = ""; + string event_log = ""; foreach (ActivityDay activity_day in activity_days) { string event_entries = ""; @@ -369,31 +377,31 @@ namespace SparkleShare { foreach (string file_path in change_set.Edited) { string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder, file_path}.Combine (); - + if (File.Exists (absolute_file_path)) event_entry += "
" + file_path + "
"; else event_entry += "
" + file_path + "
"; } } - + if (change_set.Added.Count > 0) { foreach (string file_path in change_set.Added) { string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder, file_path}.Combine (); - + if (File.Exists (absolute_file_path)) event_entry += "
" + file_path + "
"; else event_entry += "
" + file_path + "
"; } } - + if (change_set.Deleted.Count > 0) { foreach (string file_path in change_set.Deleted) { string absolute_file_path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, change_set.Folder, file_path}.Combine (); - + if (File.Exists (absolute_file_path)) event_entry += "
" + file_path + "
"; else @@ -444,7 +452,7 @@ namespace SparkleShare { comments += "
" + "

" + - note.User.Name + "

" + + note.User.Name + "

" + note.Body + "
"; } @@ -458,7 +466,7 @@ namespace SparkleShare { else change_set_avatar = ""; - event_entry += ""; + event_entry += ""; string timestamp = change_set.Timestamp.ToString ("H:mm"); @@ -476,19 +484,19 @@ namespace SparkleShare { .Replace ("", comments); } - string day_entry = ""; - DateTime today = DateTime.Now; + string day_entry = ""; + DateTime today = DateTime.Now; DateTime yesterday = DateTime.Now.AddDays (-1); - if (today.Day == activity_day.DateTime.Day && - today.Month == activity_day.DateTime.Month && - today.Year == activity_day.DateTime.Year) { + if (today.Day == activity_day.DateTime.Day && + today.Month == activity_day.DateTime.Month && + today.Year == activity_day.DateTime.Year) { day_entry = day_entry_html.Replace ("", "Today"); - } else if (yesterday.Day == activity_day.DateTime.Day && + } else if (yesterday.Day == activity_day.DateTime.Day && yesterday.Month == activity_day.DateTime.Month && - yesterday.Year == activity_day.DateTime.Year) { + yesterday.Year == activity_day.DateTime.Year) { day_entry = day_entry_html.Replace ("", "Yesterday"); @@ -497,20 +505,20 @@ namespace SparkleShare { // TRANSLATORS: This is the date in the event logs day_entry = day_entry_html.Replace ("", - activity_day.DateTime.ToString (_("dddd, MMMM d, yyyy"))); + activity_day.DateTime.ToString (_ ("dddd, MMMM d, yyyy"))); } else { // TRANSLATORS: This is the date in the event logs, without the year day_entry = day_entry_html.Replace ("", - activity_day.DateTime.ToString (_("dddd, MMMM d"))); + activity_day.DateTime.ToString (_ ("dddd, MMMM d"))); } } event_log += day_entry.Replace ("", event_entries); } - string html = event_log_html.Replace ("", event_log) + string html = event_log_html.Replace ("", event_log) .Replace ("", UserName) .Replace ("", "file://" + GetAvatar (UserEmail, 48)); @@ -542,7 +550,7 @@ namespace SparkleShare { { foreach (SparkleRepoBase repo in Repositories) { if (repo.Status == SyncStatus.SyncDown || - repo.Status == SyncStatus.SyncUp || + repo.Status == SyncStatus.SyncUp || repo.IsBuffering) { if (OnSyncing != null) @@ -579,7 +587,7 @@ namespace SparkleShare { if (backend == null) return; - + SparkleRepoBase repo = new SparkleRepoGit (folder_path, SparkleBackend.DefaultBackend); repo.NewChangeSet += delegate (SparkleChangeSet change_set) { @@ -601,13 +609,13 @@ namespace SparkleShare { }; repo.SyncStatusChanged += delegate (SyncStatus status) { -/* if (status == SyncStatus.SyncUp) { - foreach (string path in repo.UnsyncedFilePaths) - Console.WriteLine (path); - } -*/ - if (status == SyncStatus.Idle || - status == SyncStatus.SyncUp || + /* if (status == SyncStatus.SyncUp) { + foreach (string path in repo.UnsyncedFilePaths) + Console.WriteLine (path); + } + */ + if (status == SyncStatus.Idle || + status == SyncStatus.SyncUp || status == SyncStatus.SyncDown || status == SyncStatus.Error) { @@ -661,7 +669,7 @@ namespace SparkleShare { if (FolderListChanged != null) FolderListChanged (); - + FolderSize = GetFolderSize (); if (FolderSizeChanged != null) @@ -669,8 +677,10 @@ namespace SparkleShare { } - public bool NotificationsEnabled { - get { + public bool NotificationsEnabled + { + get + { string notifications_enabled = SparkleConfig.DefaultConfig.GetConfigOption ("notifications"); @@ -682,10 +692,11 @@ namespace SparkleShare { return notifications_enabled.Equals (bool.TrueString); } } - } + } - public void ToggleNotifications () { + public void ToggleNotifications () + { bool notifications_enabled = SparkleConfig.DefaultConfig.GetConfigOption ("notifications") .Equals (bool.TrueString); @@ -709,26 +720,26 @@ namespace SparkleShare { private string FormatMessage (SparkleChangeSet change_set) { string file_name = ""; - string message = ""; + string message = ""; if (change_set.Added.Count > 0) { file_name = change_set.Added [0]; - message = String.Format (_("added ‘{0}’"), file_name); + message = String.Format (_ ("added ‘{0}’"), file_name); } if (change_set.MovedFrom.Count > 0) { file_name = change_set.MovedFrom [0]; - message = String.Format (_("moved ‘{0}’"), file_name); + message = String.Format (_ ("moved ‘{0}’"), file_name); } if (change_set.Edited.Count > 0) { file_name = change_set.Edited [0]; - message = String.Format (_("edited ‘{0}’"), file_name); + message = String.Format (_ ("edited ‘{0}’"), file_name); } if (change_set.Deleted.Count > 0) { file_name = change_set.Deleted [0]; - message = String.Format (_("deleted ‘{0}’"), file_name); + message = String.Format (_ ("deleted ‘{0}’"), file_name); } int changes_count = (change_set.Added.Count + @@ -745,7 +756,7 @@ namespace SparkleShare { #endif } else if (changes_count < 0) { - message += _("did something magical"); + message += _ ("did something magical"); } return message; @@ -767,14 +778,14 @@ namespace SparkleShare { return 0; try { - foreach (FileInfo file in parent.GetFiles()) { + foreach (FileInfo file in parent.GetFiles ()) { if (!file.Exists) return 0; size += file.Length; } - foreach (DirectoryInfo directory in parent.GetDirectories()) + foreach (DirectoryInfo directory in parent.GetDirectories ()) size += CalculateFolderSize (directory); } catch (Exception) { @@ -807,7 +818,7 @@ namespace SparkleShare { OpenSparkleShareFolder (""); } - + // Adds the user's SparkleShare key to the ssh-agent, // so all activity is done with this key public void AddKey () @@ -817,16 +828,18 @@ namespace SparkleShare { Process process = new Process (); process.StartInfo.RedirectStandardOutput = true; - process.StartInfo.UseShellExecute = false; - process.StartInfo.FileName = "ssh-add"; - process.StartInfo.Arguments = "\"" + Path.Combine (keys_path, key_file_name) + "\""; + process.StartInfo.UseShellExecute = false; + process.StartInfo.FileName = "ssh-add"; + process.StartInfo.Arguments = "\"" + Path.Combine (keys_path, key_file_name) + "\""; process.Start (); process.WaitForExit (); } - public bool BackendIsPresent { - get { + public bool BackendIsPresent + { + get + { return SparkleBackend.DefaultBackend.IsPresent; } } @@ -835,11 +848,13 @@ namespace SparkleShare { // Looks up the user's name from the global configuration public string UserName { - get { + get + { return SparkleConfig.DefaultConfig.User.Name; } - set { + set + { SparkleConfig.DefaultConfig.User = new SparkleUser (value, UserEmail); } } @@ -848,20 +863,22 @@ namespace SparkleShare { // Looks up the user's email from the global configuration public string UserEmail { - get { + get + { return SparkleConfig.DefaultConfig.User.Email; } - - set { + + set + { SparkleConfig.DefaultConfig.User = new SparkleUser (UserName, value); } } - + // Generates and installs an RSA keypair to identify this system public void GenerateKeyPair () { - string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath); + string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath); string key_file_name = "sparkleshare." + UserEmail + ".key"; string key_file_path = Path.Combine (keys_path, key_file_name); @@ -878,7 +895,7 @@ namespace SparkleShare { Process process = new Process () { EnableRaisingEvents = true }; - + process.StartInfo.WorkingDirectory = keys_path; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; @@ -898,7 +915,7 @@ namespace SparkleShare { File.Copy (key_file_path + ".pub", Path.Combine (SparklePath, UserName + "'s key.txt")); }; - + process.Start (); process.WaitForExit (); } @@ -909,8 +926,8 @@ namespace SparkleShare { public void FetchAvatars (List emails, int size) { List old_avatars = new List (); - bool avatar_fetched = false; - string avatar_path = new string [] { + bool avatar_fetched = false; + string avatar_path = new string [] { Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath), "icons", size + "x" + size, "status"}.Combine (); @@ -922,7 +939,7 @@ namespace SparkleShare { foreach (string raw_email in emails) { // Gravatar wants lowercase emails - string email = raw_email.ToLower (); + string email = raw_email.ToLower (); string avatar_file_path = Path.Combine (avatar_path, "avatar-" + email); if (File.Exists (avatar_file_path)) { @@ -935,30 +952,30 @@ namespace SparkleShare { } } else { - WebClient client = new WebClient (); - string url = "http://gravatar.com/avatar/" + GetMD5 (email) + - ".jpg?s=" + size + "&d=404"; + WebClient client = new WebClient (); + string url = "http://gravatar.com/avatar/" + GetMD5 (email) + + ".jpg?s=" + size + "&d=404"; - try { - // Fetch the avatar - byte [] buffer = client.DownloadData (url); + try { + // Fetch the avatar + byte [] buffer = client.DownloadData (url); - // Write the avatar data to a - // if not empty - if (buffer.Length > 255) { - avatar_fetched = true; - File.WriteAllBytes (avatar_file_path, buffer); - SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email); - } + // Write the avatar data to a + // if not empty + if (buffer.Length > 255) { + avatar_fetched = true; + File.WriteAllBytes (avatar_file_path, buffer); + SparkleHelpers.DebugInfo ("Controller", "Fetched gravatar for " + email); + } - } catch (WebException e) { + } catch (WebException e) { SparkleHelpers.DebugInfo ("Controller", "Failed fetching gravatar for " + email); // Stop downloading further avatars if we have no internet access if (e.Status == WebExceptionStatus.Timeout) break; - } - } + } + } } // Fetch new versions of the avatars that we @@ -992,23 +1009,23 @@ namespace SparkleShare { // Strip the '.git' from the name string canonical_name = Path.GetFileNameWithoutExtension (remote_folder); - string tmp_folder = Path.Combine (tmp_path, canonical_name); + string tmp_folder = Path.Combine (tmp_path, canonical_name); string backend = null; -/* if (remote_folder.EndsWith (".hg")) { - remote_folder = remote_folder.Substring (0, (remote_folder.Length - 3)); - fetcher = new SparkleFetcherHg (server, remote_folder, tmp_folder); - backend = "Hg"; + /* if (remote_folder.EndsWith (".hg")) { + remote_folder = remote_folder.Substring (0, (remote_folder.Length - 3)); + fetcher = new SparkleFetcherHg (server, remote_folder, tmp_folder); + backend = "Hg"; - } else if (remote_folder.EndsWith (".scp")) { - remote_folder = remote_folder.Substring (0, (remote_folder.Length - 4)); - fetcher = new SparkleFetcherScp (server, remote_folder, tmp_folder); - backend = "Scp"; + } else if (remote_folder.EndsWith (".scp")) { + remote_folder = remote_folder.Substring (0, (remote_folder.Length - 4)); + fetcher = new SparkleFetcherScp (server, remote_folder, tmp_folder); + backend = "Scp"; - } else {*/ - this.fetcher = new SparkleFetcherGit (server, remote_folder, tmp_folder); - backend = "Git"; + } else {*/ + this.fetcher = new SparkleFetcherGit (server, remote_folder, tmp_folder); + backend = "Git"; //} bool target_folder_exists = Directory.Exists ( @@ -1070,8 +1087,8 @@ namespace SparkleShare { if (Directory.Exists (tmp_path)) Directory.Delete (tmp_path, true); }; - - + + this.fetcher.ProgressChanged += delegate (double percentage) { if (FolderFetching != null) FolderFetching (percentage); @@ -1093,8 +1110,8 @@ namespace SparkleShare { private string GetMD5 (string s) { MD5 md5 = new MD5CryptoServiceProvider (); - Byte[] bytes = ASCIIEncoding.Default.GetBytes (s); - Byte[] encoded_bytes = md5.ComputeHash (bytes); + Byte [] bytes = ASCIIEncoding.Default.GetBytes (s); + Byte [] encoded_bytes = md5.ComputeHash (bytes); return BitConverter.ToString (encoded_bytes).ToLower ().Replace ("-", ""); } @@ -1104,17 +1121,17 @@ namespace SparkleShare { public void TryQuit () { foreach (SparkleRepoBase repo in Repositories) { - if (repo.Status == SyncStatus.SyncUp || + if (repo.Status == SyncStatus.SyncUp || repo.Status == SyncStatus.SyncDown || repo.IsBuffering) { if (OnQuitWhileSyncing != null) OnQuitWhileSyncing (); - + return; } } - + Quit (); } @@ -1132,7 +1149,7 @@ namespace SparkleShare { // Also kill the SSH_AGENT try { // Check if we created the process, if so bring it down. Else leave it running - if (!System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK").Equals("unknown")) { + if (!System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK").Equals ("unknown")) { int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); Process.GetProcessById (pid).Kill (); } @@ -1153,7 +1170,7 @@ namespace SparkleShare { public void AddNoteToFolder (string folder_name, string revision, string note) { folder_name = folder_name.Replace ("%20", " "); - note = note.Replace ("%20", " "); + note = note.Replace ("%20", " "); foreach (SparkleRepoBase repo in Repositories) { if (repo.Name.Equals (folder_name)) @@ -1168,20 +1185,19 @@ namespace SparkleShare { private string AssignColor (string s) { - string hash = GetMD5 (s).Substring (0, 8); + string hash = GetMD5 (s).Substring (0, 8); string numbers = Regex.Replace (hash, "[a-z]", ""); - int number = 3 + int.Parse (numbers); + int number = 3 + int.Parse (numbers); return this.tango_palette [number % this.tango_palette.Length]; } } public class ChangeSet : SparkleChangeSet { } - - + + // All change sets that happened on a day - public class ActivityDay : List - { + public class ActivityDay : List { public DateTime DateTime; public ActivityDay (DateTime date_time) diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 18f1a6ba..5846bbd3 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -30,12 +30,13 @@ namespace SparkleShare { public class SparkleController : SparkleControllerBase { - public SparkleController () : base () - { - } + public SparkleController () + : base () + { + } - public override void Initialize () - { + public override void Initialize () + { Settings settings = new Settings (); BrowserSettings browserSettings = new BrowserSettings (); @@ -46,28 +47,28 @@ namespace SparkleShare { CEF.RegisterScheme ("application", "sparkleshare", new ApplicationSchemeHandlerFactory ()); CEF.RegisterScheme ("application", "file", new FileSchemeHandlerFactory ()); - - Application.EnableVisualStyles (); - Application.SetCompatibleTextRenderingDefault (false); - // Add msysgit to path, as we cannot asume it is added to the path - // Asume it is installed in @"C:\msysgit\bin" for now - string MSysGit=@"C:\msysgit"; + Application.EnableVisualStyles (); + Application.SetCompatibleTextRenderingDefault (false); - string newPath = MSysGit + @"\bin" + ";" - + MSysGit + @"\mingw\bin" + ";" - + MSysGit + @"\cmd" + ";" - + System.Environment.ExpandEnvironmentVariables ("%PATH%"); - System.Environment.SetEnvironmentVariable ("PATH", newPath); - System.Environment.SetEnvironmentVariable ("PLINK_PROTOCOL", "ssh"); + // Add msysgit to path, as we cannot asume it is added to the path + // Asume it is installed in @"C:\msysgit\bin" for now + string MSysGit = @"C:\msysgit"; - if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("HOME"))) - System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); + string newPath = MSysGit + @"\bin" + ";" + + MSysGit + @"\mingw\bin" + ";" + + MSysGit + @"\cmd" + ";" + + System.Environment.ExpandEnvironmentVariables ("%PATH%"); + System.Environment.SetEnvironmentVariable ("PATH", newPath); + System.Environment.SetEnvironmentVariable ("PLINK_PROTOCOL", "ssh"); - StartSshAgent(); + if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("HOME"))) + System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%")); - base.Initialize (); - } + StartSshAgent (); + + base.Initialize (); + } public override string EventLogHTML { @@ -111,53 +112,53 @@ namespace SparkleShare { } - // 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 () - { - } + // Creates a .desktop entry in autostart folder to + // start SparkleShare automatically at login + public override void EnableSystemAutostart () + { + } - // Adds the SparkleShare folder to the user's - // list of bookmarked places - public override void AddToBookmarks () - { - } + // Installs a launcher so the user can launch SparkleShare + // from the Internet category if needed + public override void InstallLauncher () + { + } - // Creates the SparkleShare folder in the user's home folder - public override bool CreateSparkleShareFolder () - { - if (!Directory.Exists (SparklePaths.SparklePath)) { + // Adds the SparkleShare folder to the user's + // list of bookmarked places + public override void AddToBookmarks () + { + } - Directory.CreateDirectory (SparklePaths.SparklePath); - SparkleHelpers.DebugInfo ("Config", "Created '" + SparklePaths.SparklePath + "'"); - return true; + // 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 false; - } + return true; - 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(); - } + } - private void StartSshAgent () - { + 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 (); + } + + private void StartSshAgent () + { // Check to see if the process is running Process [] ProcessList = Process.GetProcesses (); foreach (Process p in ProcessList) { @@ -196,9 +197,9 @@ namespace SparkleShare { SparkleHelpers.DebugInfo ("SSH", "ssh-agent started, PID=unknown"); } } - } + } - } + } } From cf657259aee33c46252c0c25fc816c68902ee338 Mon Sep 17 00:00:00 2001 From: wimh Date: Mon, 17 Oct 2011 21:20:38 +0200 Subject: [PATCH 062/134] fix errors after merge, add code to support new features --- SparkleShare/Windows/SparkleController.cs | 10 ++++ SparkleShare/Windows/SparkleSetup.cs | 12 ++++- SparkleShare/Windows/SparkleShare.csproj | 47 ++++++++++++++++++ SparkleShare/Windows/build.cmd | 3 ++ data/plugins/build.cmd | 11 +++++ data/plugins/parse_plugins.xsl | 33 +++++++++++++ tools/xslt/Program.cs | 18 +++++++ tools/xslt/Properties/AssemblyInfo.cs | 36 ++++++++++++++ tools/xslt/build.cmd | 6 +++ tools/xslt/xslt.csproj | 59 +++++++++++++++++++++++ tools/xslt/xslt.sln | 20 ++++++++ 11 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 data/plugins/build.cmd create mode 100644 data/plugins/parse_plugins.xsl create mode 100644 tools/xslt/Program.cs create mode 100644 tools/xslt/Properties/AssemblyInfo.cs create mode 100644 tools/xslt/build.cmd create mode 100644 tools/xslt/xslt.csproj create mode 100644 tools/xslt/xslt.sln diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 73f063f2..630c4756 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +using System.Reflection; using SparkleLib; using System; using System.Collections.Generic; @@ -30,6 +31,15 @@ namespace SparkleShare { public class SparkleController : SparkleControllerBase { + public override string PluginsPath + { + get + { + return Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "plugins"); + } + } + + public SparkleController () : base () { } diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index b1d3dabe..d98e36d4 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -52,8 +52,8 @@ namespace SparkleShare { switch (type) { case PageType.Add: tabControl.SelectedIndex = 1; - if (!string.IsNullOrEmpty (Controller.PreviousServer)) - ServerEntry.Text = Controller.PreviousServer; + if (!string.IsNullOrEmpty (Controller.PreviousUrl)) + ServerEntry.Text = Controller.PreviousUrl; else ServerEntry.Text = ""; FolderEntry.Text = ""; @@ -78,6 +78,14 @@ namespace SparkleShare { tabControl.SelectedIndex = 2; Show (); break; + case PageType.Tutorial: + if (Controller.TutorialPageNumber==1) + Controller.TutorialSkipped (); + else + Controller.ShowAddPage (); + break; + default: + throw new NotImplementedException("unknown PageType"); } }); }; diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index aa14867a..04d1290a 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -80,6 +80,9 @@ SparkleExtensions.cs + + SparklePlugin.cs + @@ -225,4 +228,48 @@ Icons.resx + + + plugins\bitbucket.png + Always + + + plugins\github.png + Always + + + plugins\gitorious.png + Always + + + plugins\gnome.png + Always + + + plugins\own-server.png + Always + + + + + plugins\bitbucket.xml + Always + + + plugins\github.xml + Always + + + plugins\gitorious.xml + Always + + + plugins\gnome.xml + Always + + + plugins\own-server.xml + Always + + \ No newline at end of file diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index f38f4de7..116c7abc 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -1,4 +1,7 @@ @echo off + +call %~dp0\..\..\data\plugins\build.cmd + set WinDirNet=%WinDir%\Microsoft.NET\Framework set msbuild="%WinDirNet%\v3.5\msbuild.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" diff --git a/data/plugins/build.cmd b/data/plugins/build.cmd new file mode 100644 index 00000000..88e88349 --- /dev/null +++ b/data/plugins/build.cmd @@ -0,0 +1,11 @@ +@echo off +pushd %~dp0 + +set xslt=..\..\tools\xslt\bin\release\xslt.exe +if not exist %xslt% call ..\..\tools\xslt\build.cmd + +for %%a in (*.xml.in) do ( + %xslt% parse_plugins.xsl %%a %%~dpna +) + +popd diff --git a/data/plugins/parse_plugins.xsl b/data/plugins/parse_plugins.xsl new file mode 100644 index 00000000..bded3cc8 --- /dev/null +++ b/data/plugins/parse_plugins.xsl @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/xslt/Program.cs b/tools/xslt/Program.cs new file mode 100644 index 00000000..3c83769a --- /dev/null +++ b/tools/xslt/Program.cs @@ -0,0 +1,18 @@ +using System; +using System.Xml.Xsl; + +namespace xslt { + class Program { + static void Main (string [] args) + { + if (args.Length < 3) { + Console.WriteLine ("usage: xslt.exe "); + return; + } + + var xsl = new XslCompiledTransform (); + xsl.Load (args [0]); + xsl.Transform (args [1], args [2]); + } + } +} diff --git a/tools/xslt/Properties/AssemblyInfo.cs b/tools/xslt/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..de3f66b6 --- /dev/null +++ b/tools/xslt/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("xslt")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("Arbor")] +[assembly: AssemblyProduct ("xslt")] +[assembly: AssemblyCopyright ("Copyright © Arbor 2011")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible (false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid ("651c6b20-ae3a-4ddb-926d-58fae061a383")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] diff --git a/tools/xslt/build.cmd b/tools/xslt/build.cmd new file mode 100644 index 00000000..d6db03bd --- /dev/null +++ b/tools/xslt/build.cmd @@ -0,0 +1,6 @@ +@echo off +set WinDirNet=%WinDir%\Microsoft.NET\Framework +set msbuild="%WinDirNet%\v3.5\msbuild.exe" +if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" + +%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\xslt.sln diff --git a/tools/xslt/xslt.csproj b/tools/xslt/xslt.csproj new file mode 100644 index 00000000..f587b44e --- /dev/null +++ b/tools/xslt/xslt.csproj @@ -0,0 +1,59 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {61025396-A57B-4566-9C2D-2F6A51681A2C} + Exe + Properties + xslt + xslt + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + \ No newline at end of file diff --git a/tools/xslt/xslt.sln b/tools/xslt/xslt.sln new file mode 100644 index 00000000..2e811fcd --- /dev/null +++ b/tools/xslt/xslt.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xslt", "xslt.csproj", "{61025396-A57B-4566-9C2D-2F6A51681A2C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {61025396-A57B-4566-9C2D-2F6A51681A2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61025396-A57B-4566-9C2D-2F6A51681A2C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61025396-A57B-4566-9C2D-2F6A51681A2C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61025396-A57B-4566-9C2D-2F6A51681A2C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From f75ce66443c3c0aaf3ec039c3fd3c0ad796a6d91 Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 21 Oct 2011 22:08:30 +0200 Subject: [PATCH 063/134] refs #18 fix handling of allow_passwordless_join setting --- SparkleLib/SparkleListenerIrc.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SparkleLib/SparkleListenerIrc.cs b/SparkleLib/SparkleListenerIrc.cs index 7a998b38..0f9d1472 100644 --- a/SparkleLib/SparkleListenerIrc.cs +++ b/SparkleLib/SparkleListenerIrc.cs @@ -49,9 +49,8 @@ namespace SparkleLib { // Option to allow access to channel when no password is defined try { - this.allow_passwordless_join = Convert.ToBoolean ( - SparkleConfig.DefaultConfig.GetConfigOption ("allow_passwordless_join")); - + string option = SparkleConfig.DefaultConfig.GetConfigOption ("allow_passwordless_join"); + this.allow_passwordless_join = option==null || Convert.ToBoolean (option); } catch (Exception) { this.allow_passwordless_join = true; } @@ -141,6 +140,9 @@ namespace SparkleLib { } else { SparkleHelpers.DebugInfo ("ListenerIrc", "Dangerous channel, change the setting to access"); + base.is_connecting = false; + OnDisconnected (); + throw new ConnectionException ("Dangerous channel, change the setting to access"); } } From a7d5e2ffc24cbc8c5a97eb8dc0bf997cc6d22d24 Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 21 Oct 2011 22:38:18 +0200 Subject: [PATCH 064/134] fix PopulateRepositories --- SparkleShare/SparkleControllerBase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 0202e292..9ff3e4ae 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -571,7 +571,7 @@ namespace SparkleShare { // Adds a repository to the list of repositories - private void AddRepository (string folder_path) + private void AddRepository (List RepositoryList, string folder_path) { if (folder_path.Equals (SparkleConfig.DefaultConfig.TmpPath)) return; @@ -621,7 +621,7 @@ namespace SparkleShare { UpdateState (); }; - Repositories.Add (repo); + RepositoryList.Add (repo); } @@ -654,7 +654,7 @@ namespace SparkleShare { string folder_path = new SparkleFolder (folder_name).FullPath; if (Directory.Exists (folder_path)) - AddRepository (folder_path); + AddRepository (TempRepositories, folder_path); else SparkleConfig.DefaultConfig.RemoveFolder (folder_name); } @@ -1043,7 +1043,7 @@ namespace SparkleShare { } SparkleConfig.DefaultConfig.AddFolder (target_folder_name, this.fetcher.RemoteUrl, backend); - AddRepository (target_folder_path); + AddRepository (Repositories, target_folder_path); if (FolderFetched != null) FolderFetched (); From 3c3ddd0f3155e247595698d59b52fe002e715f0c Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 21 Oct 2011 23:57:51 +0200 Subject: [PATCH 065/134] Improve SparkleSetup --- SparkleShare/Windows/SparkleSetup.Designer.cs | 1 + SparkleShare/Windows/SparkleSetup.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 0e1c8a84..4654fa55 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -300,6 +300,7 @@ namespace SparkleShare { this.ServerEntry.Name = "ServerEntry"; this.ServerEntry.Size = new System.Drawing.Size (312, 20); this.ServerEntry.TabIndex = 10; + this.ServerEntry.MouseEnter += new System.EventHandler (this.radio_button_own_server_MouseEnter); // // radio_button_gnome // diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index ea41e788..1f447bde 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -46,6 +46,7 @@ namespace SparkleShare { pictureBox.Image = Icons.side_splash; this.ClientSize = new Size (this.ClientSize.Width, Icons.side_splash.Size.Height); + panel_info.Size = pictureBox.Size; this.Icon = Icons.sparkleshare; Controller.ChangePageEvent += delegate (PageType type) { From 82a687dcb7fa00e0bb3b3e310dcef2f52631b388 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 22 Oct 2011 00:09:51 +0200 Subject: [PATCH 066/134] fix build --- SparkleShare/Windows/build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index 39556257..282fc313 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -7,7 +7,7 @@ set msbuild="%WinDirNet%\v3.5\msbuild.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" set wixBinDir=%WIX%\bin -rem %msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln +%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln if "%1"=="installer" ( if exist "%wixBinDir%" ( From 55423aaf300d401dc7f1900cb1c1296c1fa6e30d Mon Sep 17 00:00:00 2001 From: PierreAronnax Date: Sun, 23 Oct 2011 11:07:12 +0200 Subject: [PATCH 067/134] SparkleSetup: use CheckSetupPage and CheckAddPage again. Fixing not being able to click next button --- SparkleShare/Windows/SparkleSetup.Designer.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 4654fa55..f1c605de 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -157,6 +157,7 @@ namespace SparkleShare { this.EmailEntry.Name = "EmailEntry"; this.EmailEntry.Size = new System.Drawing.Size (275, 20); this.EmailEntry.TabIndex = 10; + this.EmailEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); // // NameEntry // @@ -164,6 +165,7 @@ namespace SparkleShare { this.NameEntry.Name = "NameEntry"; this.NameEntry.Size = new System.Drawing.Size (275, 20); this.NameEntry.TabIndex = 9; + this.NameEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); // // label13 // @@ -267,6 +269,7 @@ namespace SparkleShare { this.FolderEntry.Name = "FolderEntry"; this.FolderEntry.Size = new System.Drawing.Size (318, 20); this.FolderEntry.TabIndex = 8; + this.FolderEntry.TextChanged += new System.EventHandler (this.CheckAddPage); this.FolderEntry.MouseEnter += new System.EventHandler (this.FolderEntry_MouseEnter); // // panel_server_selection @@ -300,6 +303,7 @@ namespace SparkleShare { this.ServerEntry.Name = "ServerEntry"; this.ServerEntry.Size = new System.Drawing.Size (312, 20); this.ServerEntry.TabIndex = 10; + this.ServerEntry.TextChanged += new System.EventHandler (this.CheckAddPage); this.ServerEntry.MouseEnter += new System.EventHandler (this.radio_button_own_server_MouseEnter); // // radio_button_gnome @@ -311,6 +315,7 @@ namespace SparkleShare { this.radio_button_gnome.TabIndex = 9; this.radio_button_gnome.Text = "The GNOME Project account"; this.radio_button_gnome.UseVisualStyleBackColor = true; + this.radio_button_gnome.CheckedChanged += new System.EventHandler (this.CheckAddPage); this.radio_button_gnome.MouseEnter += new System.EventHandler (this.radio_button_gnome_MouseEnter); // // radio_button_gitorious @@ -322,6 +327,7 @@ namespace SparkleShare { this.radio_button_gitorious.TabIndex = 8; this.radio_button_gitorious.Text = "Gitorious account"; this.radio_button_gitorious.UseVisualStyleBackColor = true; + this.radio_button_gitorious.CheckedChanged += new System.EventHandler (this.CheckAddPage); this.radio_button_gitorious.MouseEnter += new System.EventHandler (this.radio_button_gitorious_MouseEnter); // // radio_button_github @@ -333,6 +339,7 @@ namespace SparkleShare { this.radio_button_github.TabIndex = 7; this.radio_button_github.Text = "Github account"; this.radio_button_github.UseVisualStyleBackColor = true; + this.radio_button_github.CheckedChanged += new System.EventHandler (this.CheckAddPage); this.radio_button_github.MouseEnter += new System.EventHandler (this.radio_button_github_MouseEnter); // // radio_button_own_server @@ -350,6 +357,7 @@ namespace SparkleShare { // // buttonSync // + this.buttonSync.Enabled = false; this.buttonSync.Location = new System.Drawing.Point (431, 355); this.buttonSync.Name = "buttonSync"; this.buttonSync.Size = new System.Drawing.Size (75, 23); From d97e8a8826dc2bc2efdae7a332b6e9e10814e040 Mon Sep 17 00:00:00 2001 From: PierreAronnax Date: Tue, 25 Oct 2011 17:28:32 +0200 Subject: [PATCH 068/134] SparkleListenerTCP: Fixing Reconnect Calling socket.Connect again after socket.Close causes an ObjectDisposedException. Recreating the socket before connecting fixes this. --- SparkleLib/SparkleListenerTcp.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SparkleLib/SparkleListenerTcp.cs b/SparkleLib/SparkleListenerTcp.cs index 15274b9b..c844bf02 100755 --- a/SparkleLib/SparkleListenerTcp.cs +++ b/SparkleLib/SparkleListenerTcp.cs @@ -39,7 +39,6 @@ namespace SparkleLib { base (server, folder_identifier) { base.channels.Add (folder_identifier); - this.socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.connected = false; } @@ -70,9 +69,11 @@ namespace SparkleLib { // Connect and subscribe to the channel int port = Server.Port; if (port < 0) port = 9999; - this.socket.Connect (Server.Host, port); lock (this.mutex) { + this.socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + this.socket.Connect (Server.Host, port); + base.is_connecting = false; this.connected = true; From 9204fef03df1d5e267407cc096db9332ad23bffd Mon Sep 17 00:00:00 2001 From: PierreAronnax Date: Tue, 25 Oct 2011 20:16:20 +0200 Subject: [PATCH 069/134] SparkleListenerBase: Fixing delivering of queued messages. Removing a list item from inside a foreach causes a "InvalidOperationException: Collection Was Modified" error. First creating a copy fixes this. --- SparkleLib/SparkleListenerBase.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SparkleLib/SparkleListenerBase.cs b/SparkleLib/SparkleListenerBase.cs index e7ae5c4f..4914b69a 100755 --- a/SparkleLib/SparkleListenerBase.cs +++ b/SparkleLib/SparkleListenerBase.cs @@ -148,7 +148,7 @@ namespace SparkleLib { public bool HasQueueDownAnnouncement (string folder_identifier) { - foreach (SparkleAnnouncement announcement in this.queue_down) { + foreach (SparkleAnnouncement announcement in this.queue_down.GetRange(0, this.queue_down.Count)) { if (announcement.FolderIdentifier.Equals (folder_identifier)) { this.queue_down.Remove (announcement); return true; @@ -174,9 +174,9 @@ namespace SparkleLib { Connected (); if (this.queue_up.Count > 0) { - SparkleHelpers.DebugInfo ("Listener", "Delivering queued messages..."); + SparkleHelpers.DebugInfo ("Listener", "Delivering " + this.queue_up.Count + " queued messages..."); - foreach (SparkleAnnouncement announcement in this.queue_up) { + foreach (SparkleAnnouncement announcement in this.queue_up.GetRange(0, this.queue_up.Count)) { AnnounceBase (announcement); this.queue_up.Remove (announcement); } From 1b0e504a0e566a3ea4511542e56b46c937f8fc8e Mon Sep 17 00:00:00 2001 From: PierreAronnax Date: Wed, 26 Oct 2011 18:43:07 +0200 Subject: [PATCH 070/134] OpenSparkleShareFolder support for Fixing https://github.com/wimh/SparkleShare/issues/16 --- SparkleShare/Windows/SparkleController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 630c4756..1a4cdbe2 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -160,7 +160,7 @@ namespace SparkleShare { public override void OpenSparkleShareFolder (string subfolder) { Process process = new Process(); - process.StartInfo.Arguments = ",/root," + SparkleHelpers.CombineMore(SparklePaths.SparklePath, subfolder); + process.StartInfo.Arguments = ",/root," + SparkleHelpers.CombineMore(SparkleConfig.DefaultConfig.FoldersPath, subfolder); process.StartInfo.FileName = "explorer"; process.Start(); From a6deb997203035370f42e121e6b4961e47aa2d7b Mon Sep 17 00:00:00 2001 From: PierreAronnax Date: Wed, 26 Oct 2011 19:45:46 +0300 Subject: [PATCH 071/134] OpenSparkleShareFolder support for Fixing https://github.com/wimh/SparkleShare/issues/16 --- SparkleShare/Windows/SparkleController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 630c4756..1a4cdbe2 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -160,7 +160,7 @@ namespace SparkleShare { public override void OpenSparkleShareFolder (string subfolder) { Process process = new Process(); - process.StartInfo.Arguments = ",/root," + SparkleHelpers.CombineMore(SparklePaths.SparklePath, subfolder); + process.StartInfo.Arguments = ",/root," + SparkleHelpers.CombineMore(SparkleConfig.DefaultConfig.FoldersPath, subfolder); process.StartInfo.FileName = "explorer"; process.Start(); From a10dc3b3fb0c7b395d079d6b827b437a4cae781b Mon Sep 17 00:00:00 2001 From: wimh Date: Thu, 27 Oct 2011 19:07:43 +0200 Subject: [PATCH 072/134] Revert "refs #18 fix handling of allow_passwordless_join setting" This reverts commit 475c4b479e780d24bfc474b34c62420743daac6a. --- SparkleLib/SparkleListenerIrc.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/SparkleLib/SparkleListenerIrc.cs b/SparkleLib/SparkleListenerIrc.cs index 0f9d1472..7a998b38 100644 --- a/SparkleLib/SparkleListenerIrc.cs +++ b/SparkleLib/SparkleListenerIrc.cs @@ -49,8 +49,9 @@ namespace SparkleLib { // Option to allow access to channel when no password is defined try { - string option = SparkleConfig.DefaultConfig.GetConfigOption ("allow_passwordless_join"); - this.allow_passwordless_join = option==null || Convert.ToBoolean (option); + this.allow_passwordless_join = Convert.ToBoolean ( + SparkleConfig.DefaultConfig.GetConfigOption ("allow_passwordless_join")); + } catch (Exception) { this.allow_passwordless_join = true; } @@ -140,9 +141,6 @@ namespace SparkleLib { } else { SparkleHelpers.DebugInfo ("ListenerIrc", "Dangerous channel, change the setting to access"); - base.is_connecting = false; - OnDisconnected (); - throw new ConnectionException ("Dangerous channel, change the setting to access"); } } From ce2f8b99f5d1fe6025a772657e85812dd6bbb5ef Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sat, 29 Oct 2011 19:26:42 +0200 Subject: [PATCH 073/134] Adjusted the code regarding to wimh's comment. Now the SSH_AGENT is killed on application exit --- SparkleShare/SparkleControllerBase.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index bba430fe..03f71f39 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -1148,13 +1148,10 @@ namespace SparkleShare { #else System.Windows.Forms.Application.Exit (); - // Also kill the SSH_AGENT + // Also kill the SSH_AGENT that we started try { - // Check if we created the process, if so bring it down. Else leave it running - if (!System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK").Equals ("unknown")) { - int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); - Process.GetProcessById (pid).Kill (); - } + int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); + Process.GetProcessById (pid).Kill (); } catch (Exception e) { // Handle exception if needed } From 639a777bfe7dd24f0afe2ad0a28a4e12d2c1a198 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Wed, 2 Nov 2011 21:48:43 +0100 Subject: [PATCH 074/134] Added exceptionhandling for the ssh-agent killing --- SparkleShare/SparkleControllerBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 03f71f39..d8a94d4a 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -1152,8 +1152,8 @@ namespace SparkleShare { try { int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); Process.GetProcessById (pid).Kill (); - } catch (Exception e) { - // Handle exception if needed + } catch (ArgumentException) { + SparkleHelpers.DebugInfo ("SSH", "Could not kill the ssh-agent, due to the process wasn't running"); } #endif } From 451b511f1fc33b303ad8b6ac4a2d5c7a65af26b4 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Thu, 3 Nov 2011 01:55:30 +0100 Subject: [PATCH 075/134] Added the treeview with dummy objects, just to test the graphics --- SparkleShare/Windows/SparkleSetup.Designer.cs | 176 +----------------- SparkleShare/Windows/SparkleSetup.cs | 97 +++++----- 2 files changed, 50 insertions(+), 223 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index f1c605de..529782c2 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -25,8 +25,6 @@ namespace SparkleShare { private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleSetup)); this.pictureBox = new System.Windows.Forms.PictureBox (); - this.panel_info = new System.Windows.Forms.Panel (); - this.label_info = new System.Windows.Forms.Label (); this.tabControl = new SparkleShare.controls.TablessControl (); this.setupPage = new System.Windows.Forms.TabPage (); this.groupBox1 = new System.Windows.Forms.GroupBox (); @@ -38,17 +36,7 @@ namespace SparkleShare { this.label10 = new System.Windows.Forms.Label (); this.buttonNext = new System.Windows.Forms.Button (); this.addPage = new System.Windows.Forms.TabPage (); - this.panel_folder_selection = new System.Windows.Forms.Panel (); - this.groupbox_folder_selection = new System.Windows.Forms.GroupBox (); - this.label5 = new System.Windows.Forms.Label (); - this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); this.panel_server_selection = new System.Windows.Forms.Panel (); - this.groupbox_server_selection = new System.Windows.Forms.GroupBox (); - this.ServerEntry = new SparkleShare.controls.ExampleTextBox (); - this.radio_button_gnome = new System.Windows.Forms.RadioButton (); - this.radio_button_gitorious = new System.Windows.Forms.RadioButton (); - this.radio_button_github = new System.Windows.Forms.RadioButton (); - this.radio_button_own_server = new System.Windows.Forms.RadioButton (); this.buttonSync = new System.Windows.Forms.Button (); this.buttonCancel = new System.Windows.Forms.Button (); this.label4 = new System.Windows.Forms.Label (); @@ -68,15 +56,10 @@ namespace SparkleShare { this.buttonFinished = new System.Windows.Forms.Button (); this.buttonOpenFolder = new System.Windows.Forms.Button (); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); - this.panel_info.SuspendLayout (); this.tabControl.SuspendLayout (); this.setupPage.SuspendLayout (); this.groupBox1.SuspendLayout (); this.addPage.SuspendLayout (); - this.panel_folder_selection.SuspendLayout (); - this.groupbox_folder_selection.SuspendLayout (); - this.panel_server_selection.SuspendLayout (); - this.groupbox_server_selection.SuspendLayout (); this.syncingPage.SuspendLayout (); this.errorPage.SuspendLayout (); this.finishedPage.SuspendLayout (); @@ -91,24 +74,6 @@ namespace SparkleShare { this.pictureBox.TabIndex = 1; this.pictureBox.TabStop = false; // - // panel_info - // - this.panel_info.BackColor = System.Drawing.Color.White; - this.panel_info.Controls.Add (this.label_info); - this.panel_info.Location = new System.Drawing.Point (0, 0); - this.panel_info.Name = "panel_info"; - this.panel_info.Size = new System.Drawing.Size (150, 396); - this.panel_info.TabIndex = 7; - this.panel_info.Visible = false; - // - // label_info - // - this.label_info.Location = new System.Drawing.Point (12, 105); - this.label_info.Name = "label_info"; - this.label_info.Size = new System.Drawing.Size (112, 253); - this.label_info.TabIndex = 1; - this.label_info.Text = "Informative text"; - // // tabControl // this.tabControl.Controls.Add (this.setupPage); @@ -219,7 +184,6 @@ namespace SparkleShare { // // addPage // - this.addPage.Controls.Add (this.panel_folder_selection); this.addPage.Controls.Add (this.panel_server_selection); this.addPage.Controls.Add (this.buttonSync); this.addPage.Controls.Add (this.buttonCancel); @@ -232,128 +196,12 @@ namespace SparkleShare { this.addPage.Text = "Add"; this.addPage.UseVisualStyleBackColor = true; // - // panel_folder_selection - // - this.panel_folder_selection.Controls.Add (this.groupbox_folder_selection); - this.panel_folder_selection.Location = new System.Drawing.Point (2, 213); - this.panel_folder_selection.Name = "panel_folder_selection"; - this.panel_folder_selection.Size = new System.Drawing.Size (512, 123); - this.panel_folder_selection.TabIndex = 13; - this.panel_folder_selection.MouseLeave += new System.EventHandler (this.panel_folder_selection_MouseLeave); - // - // groupbox_folder_selection - // - this.groupbox_folder_selection.Controls.Add (this.label5); - this.groupbox_folder_selection.Controls.Add (this.FolderEntry); - this.groupbox_folder_selection.Location = new System.Drawing.Point (10, 20); - this.groupbox_folder_selection.Name = "groupbox_folder_selection"; - this.groupbox_folder_selection.Size = new System.Drawing.Size (470, 88); - this.groupbox_folder_selection.TabIndex = 11; - this.groupbox_folder_selection.TabStop = false; - this.groupbox_folder_selection.Text = "Folder selection"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (6, 43); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (121, 13); - this.label5.TabIndex = 9; - this.label5.Text = "Folder name (on server):"; - // - // FolderEntry - // - this.FolderEntry.ExampleText = "/path/to/folder"; - this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.FolderEntry.Location = new System.Drawing.Point (133, 40); - this.FolderEntry.Name = "FolderEntry"; - this.FolderEntry.Size = new System.Drawing.Size (318, 20); - this.FolderEntry.TabIndex = 8; - this.FolderEntry.TextChanged += new System.EventHandler (this.CheckAddPage); - this.FolderEntry.MouseEnter += new System.EventHandler (this.FolderEntry_MouseEnter); - // // panel_server_selection // - this.panel_server_selection.Controls.Add (this.groupbox_server_selection); this.panel_server_selection.Location = new System.Drawing.Point (0, 53); this.panel_server_selection.Name = "panel_server_selection"; - this.panel_server_selection.Size = new System.Drawing.Size (512, 154); + this.panel_server_selection.Size = new System.Drawing.Size (512, 283); this.panel_server_selection.TabIndex = 12; - this.panel_server_selection.MouseLeave += new System.EventHandler (this.panel_server_selection_MouseLeave); - // - // groupbox_server_selection - // - this.groupbox_server_selection.Controls.Add (this.ServerEntry); - this.groupbox_server_selection.Controls.Add (this.radio_button_gnome); - this.groupbox_server_selection.Controls.Add (this.radio_button_gitorious); - this.groupbox_server_selection.Controls.Add (this.radio_button_github); - this.groupbox_server_selection.Controls.Add (this.radio_button_own_server); - this.groupbox_server_selection.Location = new System.Drawing.Point (15, 9); - this.groupbox_server_selection.Name = "groupbox_server_selection"; - this.groupbox_server_selection.Size = new System.Drawing.Size (470, 123); - this.groupbox_server_selection.TabIndex = 11; - this.groupbox_server_selection.TabStop = false; - this.groupbox_server_selection.Text = "Server selection"; - // - // ServerEntry - // - this.ServerEntry.ExampleText = "address-to-server/ip-to-server"; - this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.ServerEntry.Location = new System.Drawing.Point (139, 21); - this.ServerEntry.Name = "ServerEntry"; - this.ServerEntry.Size = new System.Drawing.Size (312, 20); - this.ServerEntry.TabIndex = 10; - this.ServerEntry.TextChanged += new System.EventHandler (this.CheckAddPage); - this.ServerEntry.MouseEnter += new System.EventHandler (this.radio_button_own_server_MouseEnter); - // - // radio_button_gnome - // - this.radio_button_gnome.AutoSize = true; - this.radio_button_gnome.Location = new System.Drawing.Point (6, 91); - this.radio_button_gnome.Name = "radio_button_gnome"; - this.radio_button_gnome.Size = new System.Drawing.Size (165, 17); - this.radio_button_gnome.TabIndex = 9; - this.radio_button_gnome.Text = "The GNOME Project account"; - this.radio_button_gnome.UseVisualStyleBackColor = true; - this.radio_button_gnome.CheckedChanged += new System.EventHandler (this.CheckAddPage); - this.radio_button_gnome.MouseEnter += new System.EventHandler (this.radio_button_gnome_MouseEnter); - // - // radio_button_gitorious - // - this.radio_button_gitorious.AutoSize = true; - this.radio_button_gitorious.Location = new System.Drawing.Point (6, 68); - this.radio_button_gitorious.Name = "radio_button_gitorious"; - this.radio_button_gitorious.Size = new System.Drawing.Size (108, 17); - this.radio_button_gitorious.TabIndex = 8; - this.radio_button_gitorious.Text = "Gitorious account"; - this.radio_button_gitorious.UseVisualStyleBackColor = true; - this.radio_button_gitorious.CheckedChanged += new System.EventHandler (this.CheckAddPage); - this.radio_button_gitorious.MouseEnter += new System.EventHandler (this.radio_button_gitorious_MouseEnter); - // - // radio_button_github - // - this.radio_button_github.AutoSize = true; - this.radio_button_github.Location = new System.Drawing.Point (6, 45); - this.radio_button_github.Name = "radio_button_github"; - this.radio_button_github.Size = new System.Drawing.Size (98, 17); - this.radio_button_github.TabIndex = 7; - this.radio_button_github.Text = "Github account"; - this.radio_button_github.UseVisualStyleBackColor = true; - this.radio_button_github.CheckedChanged += new System.EventHandler (this.CheckAddPage); - this.radio_button_github.MouseEnter += new System.EventHandler (this.radio_button_github_MouseEnter); - // - // radio_button_own_server - // - this.radio_button_own_server.AutoSize = true; - this.radio_button_own_server.Checked = true; - this.radio_button_own_server.Location = new System.Drawing.Point (6, 22); - this.radio_button_own_server.Name = "radio_button_own_server"; - this.radio_button_own_server.Size = new System.Drawing.Size (115, 17); - this.radio_button_own_server.TabIndex = 6; - this.radio_button_own_server.TabStop = true; - this.radio_button_own_server.Text = "On my own Server:"; - this.radio_button_own_server.UseVisualStyleBackColor = true; - this.radio_button_own_server.MouseEnter += new System.EventHandler (this.radio_button_own_server_MouseEnter); // // buttonSync // @@ -364,7 +212,7 @@ namespace SparkleShare { this.buttonSync.TabIndex = 9; this.buttonSync.Text = "Sync"; this.buttonSync.UseVisualStyleBackColor = true; - this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); + //this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); // // buttonCancel // @@ -539,7 +387,6 @@ namespace SparkleShare { // SparkleSetup // this.ClientSize = new System.Drawing.Size (664, 396); - this.Controls.Add (this.panel_info); this.Controls.Add (this.tabControl); this.Controls.Add (this.pictureBox); this.Name = "SparkleSetup"; @@ -547,7 +394,6 @@ namespace SparkleShare { this.Text = "SparkleShare Setup"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleSetup_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit (); - this.panel_info.ResumeLayout (false); this.tabControl.ResumeLayout (false); this.setupPage.ResumeLayout (false); this.setupPage.PerformLayout (); @@ -555,12 +401,6 @@ namespace SparkleShare { this.groupBox1.PerformLayout (); this.addPage.ResumeLayout (false); this.addPage.PerformLayout (); - this.panel_folder_selection.ResumeLayout (false); - this.groupbox_folder_selection.ResumeLayout (false); - this.groupbox_folder_selection.PerformLayout (); - this.panel_server_selection.ResumeLayout (false); - this.groupbox_server_selection.ResumeLayout (false); - this.groupbox_server_selection.PerformLayout (); this.syncingPage.ResumeLayout (false); this.syncingPage.PerformLayout (); this.errorPage.ResumeLayout (false); @@ -598,24 +438,12 @@ namespace SparkleShare { private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label10; private System.Windows.Forms.Button buttonNext; - private System.Windows.Forms.GroupBox groupbox_folder_selection; - private System.Windows.Forms.Label label5; - private controls.ExampleTextBox FolderEntry; - private System.Windows.Forms.Panel panel_info; private System.Windows.Forms.Panel panel_server_selection; - private System.Windows.Forms.GroupBox groupbox_server_selection; - private controls.ExampleTextBox ServerEntry; - private System.Windows.Forms.RadioButton radio_button_gnome; - private System.Windows.Forms.RadioButton radio_button_gitorious; - private System.Windows.Forms.RadioButton radio_button_github; - private System.Windows.Forms.RadioButton radio_button_own_server; - private System.Windows.Forms.Label label_info; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.TextBox EmailEntry; private System.Windows.Forms.TextBox NameEntry; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label12; - private System.Windows.Forms.Panel panel_folder_selection; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index d5ef3897..1894f9ec 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -46,7 +46,6 @@ namespace SparkleShare { pictureBox.Image = Icons.side_splash; this.ClientSize = new Size (this.ClientSize.Width, Icons.side_splash.Size.Height); - panel_info.Size = pictureBox.Size; this.Icon = Icons.sparkleshare; Controller.ChangePageEvent += delegate (PageType type) { @@ -54,12 +53,29 @@ namespace SparkleShare { switch (type) { case PageType.Add: tabControl.SelectedIndex = 1; - if (!string.IsNullOrEmpty (Controller.PreviousUrl)) - ServerEntry.Text = Controller.PreviousUrl; - else - ServerEntry.Text = ""; - FolderEntry.Text = ""; - radio_button_own_server.Checked = true; + TreeNode treeNode1 = new TreeNode ("Node 1;additional info"); + TreeNode treeNode2 = new TreeNode ("Node 2;additional info"); + TreeNode treeNode3 = new TreeNode ("Node 3;additional info"); + + ImageList imageList = new ImageList (); + imageList.ImageSize = new Size (32, 32); + imageList.Images.Add (Icons.sparkleshare); + + TreeView treeView = new TreeView (); + treeView.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; + treeView.FullRowSelect = true; + treeView.ImageIndex = 0; + treeView.Indent = 35; + + treeView.Nodes.AddRange (new System.Windows.Forms.TreeNode [] {treeNode1,treeNode2,treeNode3}); + treeView.SelectedImageIndex = 0; + treeView.ImageList = imageList; + treeView.ShowLines = false; + treeView.ShowRootLines = false; + treeView.Size = new System.Drawing.Size (448, 192); + + this.panel_server_selection.Controls.Add (treeView); + //CheckAddPage (null, null); Show (); break; @@ -107,7 +123,7 @@ namespace SparkleShare { { this.Hide (); } - + /* private void buttonSync_Click (object sender, EventArgs e) { string server = ServerEntry.Text; @@ -124,7 +140,7 @@ namespace SparkleShare { Controller.AddPageCompleted (server, folder_name); } - + private void CheckAddPage (object sender, EventArgs e) { buttonSync.Enabled = false; @@ -146,12 +162,14 @@ namespace SparkleShare { buttonSync.Enabled = true; } } - + */ + /* private void radio_button_own_server_CheckedChanged (object sender, EventArgs e) { ServerEntry.Enabled = radio_button_own_server.Checked; CheckAddPage (sender,e); } + */ private void buttonFinish_Click (object sender, EventArgs e) { @@ -192,47 +210,28 @@ namespace SparkleShare { buttonNext.Enabled = false; } } + } + + public class TreeView : System.Windows.Forms.TreeView { + + public TreeView () + { - private void ShowInfo (string text) { - pictureBox.Visible = false; - panel_info.Visible = true; - label_info.Text = text; } - - private void HideInfo () { - pictureBox.Visible = true; - panel_info.Visible = false; - } - - private void radio_button_own_server_MouseEnter (object sender, EventArgs e) { - ShowInfo ("To use your own server you need to ..."); - } - - private void radio_button_github_MouseEnter (object sender, EventArgs e) { - ShowInfo (_("Free hosting for Free and Open Source Software projects.") + - _("Also has paid accounts for extra private space and bandwidth.")); - } - - private void radio_button_gitorious_MouseEnter (object sender, EventArgs e) { - ShowInfo (_("Completely Free as in Freedom infrastructure.") + - _("Free accounts for Free and Open Source projects.")); - } - - private void radio_button_gnome_MouseEnter (object sender, EventArgs e) { - ShowInfo (_("GNOME is an easy to understand interface to your computer.") + - _("Select this option if you're a developer or designer working on GNOME.")); - } - - private void panel_server_selection_MouseLeave (object sender, EventArgs e) { - HideInfo (); - } - - private void FolderEntry_MouseEnter (object sender, EventArgs e) { - ShowInfo ("This is the path to your git project ..."); - } - - private void panel_folder_selection_MouseLeave (object sender, EventArgs e) { - HideInfo (); + protected override void OnDrawNode (DrawTreeNodeEventArgs e) + { + e.Graphics.DrawString (e.Node.Text.Split (';') [0], new Font ("Microsoft Sans Serif", 13), + new SolidBrush (Color.Black), e.Bounds.X, e.Bounds.Y); + e.Graphics.DrawString (e.Node.Text.Split (';') [1], new Font ("Microsoft Sans Serif", 9), + new SolidBrush (Color.Black), e.Bounds.X + 10, e.Bounds.Y + 15); } } + + public class TreeNode : System.Windows.Forms.TreeNode { + public TreeNode (string text) + { + this.Text = text; + } + } + } From 9607a3801da63944b760b58093f8bfff02cc40cc Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 4 Nov 2011 22:44:39 +0100 Subject: [PATCH 076/134] fix compiler errors caused by merge --- SparkleLib/SparkleFetcherBase.cs | 2 +- SparkleLib/SparkleRepoBase.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index 5cfc1d12..2028aa8e 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -206,7 +206,7 @@ namespace SparkleLib { new_ssh_config += line + Environment.NewLine; } - if (string.IsNullOrWhiteSpace (new_ssh_config)) { + if (string.IsNullOrEmpty (new_ssh_config.Trim ())) { File.Delete (ssh_config_file_path); } else { diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 461115bd..1ca3d1df 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -106,6 +106,8 @@ namespace SparkleLib { }; this.remote_timer.Elapsed += delegate { + string identifier = Identifier; + bool time_to_poll = (DateTime.Compare (this.last_poll, DateTime.Now.Subtract (this.poll_interval)) < 0); From ac53979104c71194a2e988fade259778053ec2f1 Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 4 Nov 2011 23:43:29 +0100 Subject: [PATCH 077/134] refactor killing ssh-agent --- SparkleShare/SparkleControllerBase.cs | 10 +-------- SparkleShare/Windows/SparkleController.cs | 27 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index a586ad63..dd333958 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -1143,7 +1143,7 @@ namespace SparkleShare { } - public void Quit () + public virtual void Quit () { foreach (SparkleRepoBase repo in Repositories) repo.Dispose (); @@ -1152,14 +1152,6 @@ namespace SparkleShare { Environment.Exit (0); #else System.Windows.Forms.Application.Exit (); - - // Also kill the SSH_AGENT that we started - try { - int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID")); - Process.GetProcessById (pid).Kill (); - } catch (ArgumentException) { - SparkleHelpers.DebugInfo ("SSH", "Could not kill the ssh-agent, due to the process wasn't running"); - } #endif } diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 1a4cdbe2..5d54d868 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -30,6 +30,7 @@ using CefSharp; namespace SparkleShare { public class SparkleController : SparkleControllerBase { + private int sshAgentPid; public override string PluginsPath { @@ -166,12 +167,18 @@ namespace SparkleShare { process.Start(); } + public override void Quit () + { + KillSshAgent (); + base.Quit (); + } + private void StartSshAgent () { - if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK"))) { + if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK"))) { - Process process = new Process (); - process.StartInfo.FileName = "ssh-agent"; + Process process = new Process (); + process.StartInfo.FileName = "ssh-agent"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; @@ -187,6 +194,7 @@ namespace SparkleShare { Match AgentPid = new Regex (@"SSH_AGENT_PID=([^;\n\r]*)").Match (Output); if (AgentPid.Success) { + Int32.TryParse (AgentPid.Groups [1].Value, out sshAgentPid); System.Environment.SetEnvironmentVariable ("SSH_AGENT_PID", AgentPid.Groups[1].Value); SparkleHelpers.DebugInfo ("SSH", "ssh-agent started, PID=" + AgentPid.Groups[1].Value); } @@ -196,7 +204,18 @@ namespace SparkleShare { } } + private void KillSshAgent () + { + if (sshAgentPid != 0) { + // Kill the SSH_AGENT that we started + try { + Process.GetProcessById (sshAgentPid).Kill (); + } catch (ArgumentException) { + SparkleHelpers.DebugInfo ("SSH", "Could not kill the ssh-agent, because the process wasn't running"); + } + } + } - } + } } From 9b45ce37d57582802f815da4ae918a0eb6ff3da2 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 11:45:35 +0100 Subject: [PATCH 078/134] Pushing progress to work on laptop --- SparkleShare/Windows/SparkleSetup.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 1894f9ec..235d4f21 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -53,21 +53,23 @@ namespace SparkleShare { switch (type) { case PageType.Add: tabControl.SelectedIndex = 1; - TreeNode treeNode1 = new TreeNode ("Node 1;additional info"); - TreeNode treeNode2 = new TreeNode ("Node 2;additional info"); - TreeNode treeNode3 = new TreeNode ("Node 3;additional info"); ImageList imageList = new ImageList (); imageList.ImageSize = new Size (32, 32); - imageList.Images.Add (Icons.sparkleshare); - TreeView treeView = new TreeView (); treeView.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; treeView.FullRowSelect = true; treeView.ImageIndex = 0; treeView.Indent = 35; - treeView.Nodes.AddRange (new System.Windows.Forms.TreeNode [] {treeNode1,treeNode2,treeNode3}); + TreeNode [] nodes = new TreeNode[Controller.Plugins.Count]; + + for (int i = 0; i < Controller.Plugins.Count; i++) { + nodes [i].Text = Controller.Plugins [i].Name + ";" + Controller.Plugins; + imageList.Images.Add (new Icon(Controller.Plugins [i].ImagePath)); + } + + treeView.Nodes.AddRange (nodes); treeView.SelectedImageIndex = 0; treeView.ImageList = imageList; treeView.ShowLines = false; @@ -203,7 +205,7 @@ namespace SparkleShare { { // Enables or disables the 'Next' button depending on the // entries filled in by the user - if (!String.IsNullOrEmpty(NameEntry.Text) && + if (!String.IsNullOrEmpty (NameEntry.Text) && Program.Controller.IsValidEmail (EmailEntry.Text)) { buttonNext.Enabled = true; } else { From 0e0e74017959d2a0bd5c0612593cd02bb499e1a7 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 13:00:50 +0100 Subject: [PATCH 079/134] Treeview is now working, without logic though --- SparkleShare/Windows/SparkleSetup.Designer.cs | 69 +++++++++++++++--- SparkleShare/Windows/SparkleSetup.cs | 70 +++++++++---------- 2 files changed, 91 insertions(+), 48 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 529782c2..a2b44596 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -36,6 +36,8 @@ namespace SparkleShare { this.label10 = new System.Windows.Forms.Label (); this.buttonNext = new System.Windows.Forms.Button (); this.addPage = new System.Windows.Forms.TabPage (); + this.label5 = new System.Windows.Forms.Label (); + this.label14 = new System.Windows.Forms.Label (); this.panel_server_selection = new System.Windows.Forms.Panel (); this.buttonSync = new System.Windows.Forms.Button (); this.buttonCancel = new System.Windows.Forms.Button (); @@ -55,6 +57,8 @@ namespace SparkleShare { this.label8 = new System.Windows.Forms.Label (); this.buttonFinished = new System.Windows.Forms.Button (); this.buttonOpenFolder = new System.Windows.Forms.Button (); + this.server_address = new SparkleShare.controls.ExampleTextBox (); + this.server_remote_path = new SparkleShare.controls.ExampleTextBox (); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); this.tabControl.SuspendLayout (); this.setupPage.SuspendLayout (); @@ -111,7 +115,7 @@ namespace SparkleShare { this.groupBox1.Controls.Add (this.label12); this.groupBox1.Location = new System.Drawing.Point (14, 119); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size (429, 102); + this.groupBox1.Size = new System.Drawing.Size (471, 102); this.groupBox1.TabIndex = 7; this.groupBox1.TabStop = false; this.groupBox1.Text = "Information about you"; @@ -174,7 +178,7 @@ namespace SparkleShare { // buttonNext // this.buttonNext.Enabled = false; - this.buttonNext.Location = new System.Drawing.Point (431, 350); + this.buttonNext.Location = new System.Drawing.Point (410, 316); this.buttonNext.Name = "buttonNext"; this.buttonNext.Size = new System.Drawing.Size (75, 23); this.buttonNext.TabIndex = 0; @@ -184,6 +188,10 @@ namespace SparkleShare { // // addPage // + this.addPage.Controls.Add (this.server_remote_path); + this.addPage.Controls.Add (this.server_address); + this.addPage.Controls.Add (this.label5); + this.addPage.Controls.Add (this.label14); this.addPage.Controls.Add (this.panel_server_selection); this.addPage.Controls.Add (this.buttonSync); this.addPage.Controls.Add (this.buttonCancel); @@ -196,27 +204,46 @@ namespace SparkleShare { this.addPage.Text = "Add"; this.addPage.UseVisualStyleBackColor = true; // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point (197, 267); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size (113, 20); + this.label5.TabIndex = 15; + this.label5.Text = "Remote path"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label14.Location = new System.Drawing.Point (8, 267); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size (75, 20); + this.label14.TabIndex = 14; + this.label14.Text = "Address"; + // // panel_server_selection // - this.panel_server_selection.Location = new System.Drawing.Point (0, 53); + this.panel_server_selection.Location = new System.Drawing.Point (12, 54); this.panel_server_selection.Name = "panel_server_selection"; - this.panel_server_selection.Size = new System.Drawing.Size (512, 283); + this.panel_server_selection.Size = new System.Drawing.Size (479, 189); this.panel_server_selection.TabIndex = 12; // // buttonSync // this.buttonSync.Enabled = false; - this.buttonSync.Location = new System.Drawing.Point (431, 355); + this.buttonSync.Location = new System.Drawing.Point (416, 339); this.buttonSync.Name = "buttonSync"; this.buttonSync.Size = new System.Drawing.Size (75, 23); this.buttonSync.TabIndex = 9; this.buttonSync.Text = "Sync"; this.buttonSync.UseVisualStyleBackColor = true; - //this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); // // buttonCancel // - this.buttonCancel.Location = new System.Drawing.Point (350, 355); + this.buttonCancel.Location = new System.Drawing.Point (335, 339); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size (75, 23); this.buttonCancel.TabIndex = 8; @@ -298,7 +325,7 @@ namespace SparkleShare { // // buttonTryAgain // - this.buttonTryAgain.Location = new System.Drawing.Point (431, 350); + this.buttonTryAgain.Location = new System.Drawing.Point (380, 319); this.buttonTryAgain.Name = "buttonTryAgain"; this.buttonTryAgain.Size = new System.Drawing.Size (75, 23); this.buttonTryAgain.TabIndex = 3; @@ -366,7 +393,7 @@ namespace SparkleShare { // // buttonFinished // - this.buttonFinished.Location = new System.Drawing.Point (431, 350); + this.buttonFinished.Location = new System.Drawing.Point (399, 318); this.buttonFinished.Name = "buttonFinished"; this.buttonFinished.Size = new System.Drawing.Size (75, 23); this.buttonFinished.TabIndex = 1; @@ -376,7 +403,7 @@ namespace SparkleShare { // // buttonOpenFolder // - this.buttonOpenFolder.Location = new System.Drawing.Point (350, 350); + this.buttonOpenFolder.Location = new System.Drawing.Point (318, 318); this.buttonOpenFolder.Name = "buttonOpenFolder"; this.buttonOpenFolder.Size = new System.Drawing.Size (75, 23); this.buttonOpenFolder.TabIndex = 0; @@ -384,6 +411,24 @@ namespace SparkleShare { this.buttonOpenFolder.UseVisualStyleBackColor = true; this.buttonOpenFolder.Click += new System.EventHandler (this.buttonOpenFolder_Click); // + // server_address + // + this.server_address.ExampleText = ""; + this.server_address.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.server_address.Location = new System.Drawing.Point (12, 290); + this.server_address.Name = "server_address"; + this.server_address.Size = new System.Drawing.Size (168, 20); + this.server_address.TabIndex = 16; + // + // server_remote_path + // + this.server_remote_path.ExampleText = ""; + this.server_remote_path.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.server_remote_path.Location = new System.Drawing.Point (201, 290); + this.server_remote_path.Name = "server_remote_path"; + this.server_remote_path.Size = new System.Drawing.Size (168, 20); + this.server_remote_path.TabIndex = 17; + // // SparkleSetup // this.ClientSize = new System.Drawing.Size (664, 396); @@ -444,6 +489,10 @@ namespace SparkleShare { private System.Windows.Forms.TextBox NameEntry; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label14; + private SparkleShare.controls.ExampleTextBox server_remote_path; + private SparkleShare.controls.ExampleTextBox server_address; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 235d4f21..f2fd878d 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -34,18 +34,16 @@ namespace SparkleShare { public SparkleSetupController Controller = new SparkleSetupController (); // Short alias for the translations - public static string _ (string s) - { + public static string _ (string s) { return s; } - public SparkleSetup () - { + public SparkleSetup () { InitializeComponent (); pictureBox.Image = Icons.side_splash; - this.ClientSize = new Size (this.ClientSize.Width, Icons.side_splash.Size.Height); + //this.ClientSize = new Size (this.ClientSize.Width, Icons.side_splash.Size.Height); this.Icon = Icons.sparkleshare; Controller.ChangePageEvent += delegate (PageType type) { @@ -54,6 +52,11 @@ namespace SparkleShare { case PageType.Add: tabControl.SelectedIndex = 1; + // Set exampletext for textboxes + server_address.ExampleText = _ ("Server address"); + server_remote_path.ExampleText = "/path/to/project"; + + // Set up the treeview ImageList imageList = new ImageList (); imageList.ImageSize = new Size (32, 32); TreeView treeView = new TreeView (); @@ -62,19 +65,21 @@ namespace SparkleShare { treeView.ImageIndex = 0; treeView.Indent = 35; - TreeNode [] nodes = new TreeNode[Controller.Plugins.Count]; + TreeNode [] nodes = new TreeNode [Controller.Plugins.Count]; for (int i = 0; i < Controller.Plugins.Count; i++) { - nodes [i].Text = Controller.Plugins [i].Name + ";" + Controller.Plugins; - imageList.Images.Add (new Icon(Controller.Plugins [i].ImagePath)); + nodes [i] = new TreeNode (Controller.Plugins [i].Name + ";" + Controller.Plugins[i].Description); + nodes [i].ImageIndex = i; + nodes [i].SelectedImageIndex = i; + imageList.Images.Add (Image.FromFile (Controller.Plugins [i].ImagePath)); } - + treeView.Nodes.AddRange (nodes); - treeView.SelectedImageIndex = 0; treeView.ImageList = imageList; treeView.ShowLines = false; treeView.ShowRootLines = false; - treeView.Size = new System.Drawing.Size (448, 192); + treeView.Size = new System.Drawing.Size (this.panel_server_selection.Size.Width, + this.panel_server_selection.Size.Height); this.panel_server_selection.Controls.Add (treeView); @@ -99,20 +104,19 @@ namespace SparkleShare { Show (); break; case PageType.Tutorial: - if (Controller.TutorialPageNumber==1) + if (Controller.TutorialPageNumber == 1) Controller.TutorialSkipped (); else Controller.ShowAddPage (); break; default: - throw new NotImplementedException("unknown PageType"); + throw new NotImplementedException ("unknown PageType"); } }); }; } - private void SparkleSetup_FormClosing (object sender, FormClosingEventArgs e) - { + private void SparkleSetup_FormClosing (object sender, FormClosingEventArgs e) { if (e.CloseReason != CloseReason.ApplicationExitCall && e.CloseReason != CloseReason.TaskManagerClosing && e.CloseReason != CloseReason.WindowsShutDown) { @@ -121,8 +125,7 @@ namespace SparkleShare { } } - private void buttonCancel_Click (object sender, EventArgs e) - { + private void buttonCancel_Click (object sender, EventArgs e) { this.Hide (); } /* @@ -142,7 +145,7 @@ namespace SparkleShare { Controller.AddPageCompleted (server, folder_name); } - + /* private void CheckAddPage (object sender, EventArgs e) { buttonSync.Enabled = false; @@ -173,36 +176,30 @@ namespace SparkleShare { } */ - private void buttonFinish_Click (object sender, EventArgs e) - { + private void buttonFinish_Click (object sender, EventArgs e) { this.Hide (); } - private void buttonTryAgain_Click (object sender, EventArgs e) - { + private void buttonTryAgain_Click (object sender, EventArgs e) { Controller.ErrorPageCompleted (); } - private void buttonFinished_Click (object sender, EventArgs e) - { + private void buttonFinished_Click (object sender, EventArgs e) { this.Hide (); } - private void buttonOpenFolder_Click (object sender, EventArgs e) - { + private void buttonOpenFolder_Click (object sender, EventArgs e) { Program.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); } - private void buttonNext_Click (object sender, EventArgs e) - { + private void buttonNext_Click (object sender, EventArgs e) { string full_name = NameEntry.Text; string email = EmailEntry.Text; Controller.SetupPageCompleted (full_name, email); } - private void CheckSetupPage (object sender, EventArgs e) - { + private void CheckSetupPage (object sender, EventArgs e) { // Enables or disables the 'Next' button depending on the // entries filled in by the user if (!String.IsNullOrEmpty (NameEntry.Text) && @@ -216,22 +213,19 @@ namespace SparkleShare { public class TreeView : System.Windows.Forms.TreeView { - public TreeView () - { + public TreeView () { } - protected override void OnDrawNode (DrawTreeNodeEventArgs e) - { - e.Graphics.DrawString (e.Node.Text.Split (';') [0], new Font ("Microsoft Sans Serif", 13), + protected override void OnDrawNode (DrawTreeNodeEventArgs e) { + e.Graphics.DrawString (e.Node.Text.Split (';') [0], new Font (Font.SystemFontName, 13), new SolidBrush (Color.Black), e.Bounds.X, e.Bounds.Y); - e.Graphics.DrawString (e.Node.Text.Split (';') [1], new Font ("Microsoft Sans Serif", 9), + e.Graphics.DrawString (e.Node.Text.Split (';') [1], new Font (Font.SystemFontName, 9), new SolidBrush (Color.Black), e.Bounds.X + 10, e.Bounds.Y + 15); } } public class TreeNode : System.Windows.Forms.TreeNode { - public TreeNode (string text) - { + public TreeNode (string text) { this.Text = text; } } From 150c5103713650d7f41daa2d4cd73f7a90aa7f0d Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 17:53:43 +0100 Subject: [PATCH 080/134] Example text and some other stuff now works --- SparkleShare/Windows/SparkleSetup.Designer.cs | 48 +++++++------- SparkleShare/Windows/SparkleSetup.cs | 62 +++++-------------- 2 files changed, 40 insertions(+), 70 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index a2b44596..a6ab4f1e 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -36,6 +36,8 @@ namespace SparkleShare { this.label10 = new System.Windows.Forms.Label (); this.buttonNext = new System.Windows.Forms.Button (); this.addPage = new System.Windows.Forms.TabPage (); + this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); + this.ServerEntry = new SparkleShare.controls.ExampleTextBox (); this.label5 = new System.Windows.Forms.Label (); this.label14 = new System.Windows.Forms.Label (); this.panel_server_selection = new System.Windows.Forms.Panel (); @@ -57,8 +59,6 @@ namespace SparkleShare { this.label8 = new System.Windows.Forms.Label (); this.buttonFinished = new System.Windows.Forms.Button (); this.buttonOpenFolder = new System.Windows.Forms.Button (); - this.server_address = new SparkleShare.controls.ExampleTextBox (); - this.server_remote_path = new SparkleShare.controls.ExampleTextBox (); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); this.tabControl.SuspendLayout (); this.setupPage.SuspendLayout (); @@ -188,8 +188,8 @@ namespace SparkleShare { // // addPage // - this.addPage.Controls.Add (this.server_remote_path); - this.addPage.Controls.Add (this.server_address); + this.addPage.Controls.Add (this.FolderEntry); + this.addPage.Controls.Add (this.ServerEntry); this.addPage.Controls.Add (this.label5); this.addPage.Controls.Add (this.label14); this.addPage.Controls.Add (this.panel_server_selection); @@ -204,6 +204,24 @@ namespace SparkleShare { this.addPage.Text = "Add"; this.addPage.UseVisualStyleBackColor = true; // + // FolderEntry + // + this.FolderEntry.ExampleText = ""; + this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.FolderEntry.Location = new System.Drawing.Point (201, 290); + this.FolderEntry.Name = "FolderEntry"; + this.FolderEntry.Size = new System.Drawing.Size (168, 20); + this.FolderEntry.TabIndex = 17; + // + // ServerEntry + // + this.ServerEntry.ExampleText = _ ("Server address"); + this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.ServerEntry.Location = new System.Drawing.Point (12, 290); + this.ServerEntry.Name = "ServerEntry"; + this.ServerEntry.Size = new System.Drawing.Size (168, 20); + this.ServerEntry.TabIndex = 16; + // // label5 // this.label5.AutoSize = true; @@ -411,24 +429,6 @@ namespace SparkleShare { this.buttonOpenFolder.UseVisualStyleBackColor = true; this.buttonOpenFolder.Click += new System.EventHandler (this.buttonOpenFolder_Click); // - // server_address - // - this.server_address.ExampleText = ""; - this.server_address.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.server_address.Location = new System.Drawing.Point (12, 290); - this.server_address.Name = "server_address"; - this.server_address.Size = new System.Drawing.Size (168, 20); - this.server_address.TabIndex = 16; - // - // server_remote_path - // - this.server_remote_path.ExampleText = ""; - this.server_remote_path.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.server_remote_path.Location = new System.Drawing.Point (201, 290); - this.server_remote_path.Name = "server_remote_path"; - this.server_remote_path.Size = new System.Drawing.Size (168, 20); - this.server_remote_path.TabIndex = 17; - // // SparkleSetup // this.ClientSize = new System.Drawing.Size (664, 396); @@ -491,8 +491,8 @@ namespace SparkleShare { private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label14; - private SparkleShare.controls.ExampleTextBox server_remote_path; - private SparkleShare.controls.ExampleTextBox server_address; + private SparkleShare.controls.ExampleTextBox FolderEntry; + private SparkleShare.controls.ExampleTextBox ServerEntry; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index f2fd878d..ec223a32 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -33,6 +33,8 @@ namespace SparkleShare { public SparkleSetupController Controller = new SparkleSetupController (); + private TreeView treeView; + // Short alias for the translations public static string _ (string s) { return s; @@ -43,7 +45,6 @@ namespace SparkleShare { InitializeComponent (); pictureBox.Image = Icons.side_splash; - //this.ClientSize = new Size (this.ClientSize.Width, Icons.side_splash.Size.Height); this.Icon = Icons.sparkleshare; Controller.ChangePageEvent += delegate (PageType type) { @@ -52,23 +53,20 @@ namespace SparkleShare { case PageType.Add: tabControl.SelectedIndex = 1; - // Set exampletext for textboxes - server_address.ExampleText = _ ("Server address"); - server_remote_path.ExampleText = "/path/to/project"; - // Set up the treeview ImageList imageList = new ImageList (); imageList.ImageSize = new Size (32, 32); - TreeView treeView = new TreeView (); + treeView = new TreeView (); treeView.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; treeView.FullRowSelect = true; treeView.ImageIndex = 0; treeView.Indent = 35; + treeView.AfterSelect += new TreeViewEventHandler (CheckAddPage); TreeNode [] nodes = new TreeNode [Controller.Plugins.Count]; for (int i = 0; i < Controller.Plugins.Count; i++) { - nodes [i] = new TreeNode (Controller.Plugins [i].Name + ";" + Controller.Plugins[i].Description); + nodes [i] = new TreeNode (Controller.Plugins [i].Name + ";" + Controller.Plugins [i].Description); nodes [i].ImageIndex = i; nodes [i].SelectedImageIndex = i; imageList.Images.Add (Image.FromFile (Controller.Plugins [i].ImagePath)); @@ -78,12 +76,12 @@ namespace SparkleShare { treeView.ImageList = imageList; treeView.ShowLines = false; treeView.ShowRootLines = false; - treeView.Size = new System.Drawing.Size (this.panel_server_selection.Size.Width, - this.panel_server_selection.Size.Height); + treeView.Size = new System.Drawing.Size (panel_server_selection.Size.Width, + panel_server_selection.Size.Height); - this.panel_server_selection.Controls.Add (treeView); + panel_server_selection.Controls.Add (treeView); + treeView.SelectedNode = treeView.Nodes [0]; - //CheckAddPage (null, null); Show (); break; case PageType.Error: @@ -128,53 +126,25 @@ namespace SparkleShare { private void buttonCancel_Click (object sender, EventArgs e) { this.Hide (); } - /* - private void buttonSync_Click (object sender, EventArgs e) - { - string server = ServerEntry.Text; - string folder_name = FolderEntry.Text; - if (radio_button_gitorious.Checked) - server = "gitorious.org"; - - if (radio_button_github.Checked) - server = "github.com"; - - if (radio_button_gnome.Checked) - server = "gnome.org"; - - Controller.AddPageCompleted (server, folder_name); + private void buttonSync_Click (object sender, EventArgs e) { + Controller.AddPageCompleted (ServerEntry.Text, FolderEntry.Text); } - /* - private void CheckAddPage (object sender, EventArgs e) - { + + private void CheckAddPage (object sender, EventArgs e) { buttonSync.Enabled = false; - if (radio_button_own_server.Checked) - FolderEntry.ExampleText = _ ("Folder"); - else if (radio_button_github.Checked) - FolderEntry.ExampleText = _ ("Username/Folder"); - else if (radio_button_gitorious.Checked) - FolderEntry.ExampleText = _ ("Project/Folder"); - else if(radio_button_gnome.Checked) - FolderEntry.ExampleText = _ ("Project"); + FolderEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].PathExample; + ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].AddressExample; // Enables or disables the 'Next' button depending on the // entries filled in by the user buttonSync.Enabled = false; if (!String.IsNullOrEmpty (FolderEntry.Text)) { - if (!radio_button_own_server.Checked || !String.IsNullOrEmpty (ServerEntry.Text)) + if (!String.IsNullOrEmpty (ServerEntry.Text)) buttonSync.Enabled = true; } } - */ - /* - private void radio_button_own_server_CheckedChanged (object sender, EventArgs e) - { - ServerEntry.Enabled = radio_button_own_server.Checked; - CheckAddPage (sender,e); - } - */ private void buttonFinish_Click (object sender, EventArgs e) { this.Hide (); From 81f2ba28afc101f71316ea02a4c6c70990a9a7c8 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 17:58:41 +0100 Subject: [PATCH 081/134] Treeview now focuses on the first choice. Also added better support for translations --- SparkleShare/Windows/SparkleSetup.Designer.cs | 6 +++--- SparkleShare/Windows/SparkleSetup.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index a6ab4f1e..84941c1d 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -230,7 +230,7 @@ namespace SparkleShare { this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size (113, 20); this.label5.TabIndex = 15; - this.label5.Text = "Remote path"; + this.label5.Text = _ ("Remote path"); // // label14 // @@ -240,7 +240,7 @@ namespace SparkleShare { this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size (75, 20); this.label14.TabIndex = 14; - this.label14.Text = "Address"; + this.label14.Text = _ ("Address"); // // panel_server_selection // @@ -277,7 +277,7 @@ namespace SparkleShare { this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size (240, 20); this.label4.TabIndex = 0; - this.label4.Text = "Where is your remote folder?"; + this.label4.Text = _ ("Where is your remote folder?"); // // syncingPage // diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index ec223a32..60488875 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -81,7 +81,7 @@ namespace SparkleShare { panel_server_selection.Controls.Add (treeView); treeView.SelectedNode = treeView.Nodes [0]; - + treeView.Select (); Show (); break; case PageType.Error: From c4646b237a52cdd359e96cbf281cf6f796002584 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 18:06:24 +0100 Subject: [PATCH 082/134] Now supporting translations for the UI --- SparkleShare/Windows/SparkleSetup.Designer.cs | 4 ---- SparkleShare/Windows/SparkleSetup.cs | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 84941c1d..19934b4c 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -215,7 +215,6 @@ namespace SparkleShare { // // ServerEntry // - this.ServerEntry.ExampleText = _ ("Server address"); this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.ServerEntry.Location = new System.Drawing.Point (12, 290); this.ServerEntry.Name = "ServerEntry"; @@ -230,7 +229,6 @@ namespace SparkleShare { this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size (113, 20); this.label5.TabIndex = 15; - this.label5.Text = _ ("Remote path"); // // label14 // @@ -240,7 +238,6 @@ namespace SparkleShare { this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size (75, 20); this.label14.TabIndex = 14; - this.label14.Text = _ ("Address"); // // panel_server_selection // @@ -277,7 +274,6 @@ namespace SparkleShare { this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size (240, 20); this.label4.TabIndex = 0; - this.label4.Text = _ ("Where is your remote folder?"); // // syncingPage // diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 60488875..2a1b9782 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -44,6 +44,12 @@ namespace SparkleShare { public SparkleSetup () { InitializeComponent (); + /* Support translations for the UI */ + this.label5.Text = _ ("Remote path"); + this.label14.Text = _ ("Address"); + this.label4.Text = _ ("Where is your remote folder?"); + this.ServerEntry.ExampleText = _ ("Server address"); + pictureBox.Image = Icons.side_splash; this.Icon = Icons.sparkleshare; From b1ebb9b6c4bd7f22b02b639abf815f316ee7052b Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 18:21:08 +0100 Subject: [PATCH 083/134] Add the button eventhandler to buttonSync --- SparkleShare/Windows/SparkleSetup.Designer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 19934b4c..241c2527 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -255,6 +255,7 @@ namespace SparkleShare { this.buttonSync.TabIndex = 9; this.buttonSync.Text = "Sync"; this.buttonSync.UseVisualStyleBackColor = true; + this.buttonSync.Click += new System.EventHandler(buttonSync_Click); // // buttonCancel // From f5a9514c4335112a644ff134827b35b061abaa01 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 18:52:25 +0100 Subject: [PATCH 084/134] Added text for the designer in visual studio. Also added eventhandlers when pressing buttons within textbox ServerEntry and FolderEntry --- SparkleShare/Windows/SparkleSetup.Designer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 241c2527..8a95eb25 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -212,14 +212,17 @@ namespace SparkleShare { this.FolderEntry.Name = "FolderEntry"; this.FolderEntry.Size = new System.Drawing.Size (168, 20); this.FolderEntry.TabIndex = 17; + this.FolderEntry.TextChanged += new System.EventHandler (this.CheckAddPage); // // ServerEntry // + this.ServerEntry.ExampleText = ""; this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.ServerEntry.Location = new System.Drawing.Point (12, 290); this.ServerEntry.Name = "ServerEntry"; this.ServerEntry.Size = new System.Drawing.Size (168, 20); this.ServerEntry.TabIndex = 16; + this.ServerEntry.TextChanged += new System.EventHandler (this.CheckAddPage); // // label5 // @@ -229,6 +232,7 @@ namespace SparkleShare { this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size (113, 20); this.label5.TabIndex = 15; + this.label5.Text = "Remote path"; // // label14 // @@ -238,6 +242,7 @@ namespace SparkleShare { this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size (75, 20); this.label14.TabIndex = 14; + this.label14.Text = "Address"; // // panel_server_selection // @@ -255,7 +260,7 @@ namespace SparkleShare { this.buttonSync.TabIndex = 9; this.buttonSync.Text = "Sync"; this.buttonSync.UseVisualStyleBackColor = true; - this.buttonSync.Click += new System.EventHandler(buttonSync_Click); + this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); // // buttonCancel // @@ -273,8 +278,9 @@ namespace SparkleShare { this.label4.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.Location = new System.Drawing.Point (8, 18); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (240, 20); + this.label4.Size = new System.Drawing.Size (68, 20); this.label4.TabIndex = 0; + this.label4.Text = "Header"; // // syncingPage // From dab558c3c0adf25c9ec888ace13f3296efb8e2b6 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 18:53:23 +0100 Subject: [PATCH 085/134] Added logic for the different options, like checks wheter the necessary info has been entered --- SparkleShare/Windows/SparkleSetup.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 2a1b9782..a439aab4 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -68,6 +68,7 @@ namespace SparkleShare { treeView.ImageIndex = 0; treeView.Indent = 35; treeView.AfterSelect += new TreeViewEventHandler (CheckAddPage); + treeView.HideSelection = false; TreeNode [] nodes = new TreeNode [Controller.Plugins.Count]; @@ -134,20 +135,27 @@ namespace SparkleShare { } private void buttonSync_Click (object sender, EventArgs e) { - Controller.AddPageCompleted (ServerEntry.Text, FolderEntry.Text); + Controller.AddPageCompleted (Controller.Plugins [treeView.SelectedNode.Index].Address, + FolderEntry.Text); } private void CheckAddPage (object sender, EventArgs e) { buttonSync.Enabled = false; FolderEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].PathExample; - ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].AddressExample; + ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].Address; // Enables or disables the 'Next' button depending on the // entries filled in by the user buttonSync.Enabled = false; - if (!String.IsNullOrEmpty (FolderEntry.Text)) { - if (!String.IsNullOrEmpty (ServerEntry.Text)) + + if (treeView.SelectedNode.Index == 0) { + if (!String.IsNullOrEmpty (FolderEntry.Text)) { + if (!String.IsNullOrEmpty (ServerEntry.Text)) + buttonSync.Enabled = true; + } + } else { + if (!String.IsNullOrEmpty (FolderEntry.Text)) buttonSync.Enabled = true; } } From a29180d43778ddb72bd430fea0adf442e3093fd0 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 18:56:05 +0100 Subject: [PATCH 086/134] Fixed the logic so that it now works with own server --- SparkleShare/Windows/SparkleSetup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index a439aab4..0ea84934 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -135,8 +135,11 @@ namespace SparkleShare { } private void buttonSync_Click (object sender, EventArgs e) { - Controller.AddPageCompleted (Controller.Plugins [treeView.SelectedNode.Index].Address, - FolderEntry.Text); + if (treeView.SelectedNode.Index == 0) + Controller.AddPageCompleted (ServerEntry.Text, FolderEntry.Text); + else + Controller.AddPageCompleted (Controller.Plugins [treeView.SelectedNode.Index].Address, + FolderEntry.Text); } private void CheckAddPage (object sender, EventArgs e) { From a7fa005645c40dfc4c68c26e68ab07bcd49150e4 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 19:17:11 +0100 Subject: [PATCH 087/134] Added myself to the AUTHORS file. --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index fb3bb87c..5aa038cf 100755 --- a/AUTHORS +++ b/AUTHORS @@ -40,6 +40,7 @@ Contributors: Travis Glenn Hansen Vincent Untz Will Thompson + Konstantinos Vaggelakos Thanks very much! From 90b0b7232ce1240c915d0203b4beaa1ead765f4f Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 20 Nov 2011 19:53:14 +0100 Subject: [PATCH 088/134] Fixed the itemheight. Now using the 24x24 icons again --- SparkleShare/Windows/SparkleSetup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 0ea84934..5d664026 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -61,7 +61,7 @@ namespace SparkleShare { // Set up the treeview ImageList imageList = new ImageList (); - imageList.ImageSize = new Size (32, 32); + imageList.ImageSize = new Size (24, 24); treeView = new TreeView (); treeView.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; treeView.FullRowSelect = true; @@ -69,6 +69,7 @@ namespace SparkleShare { treeView.Indent = 35; treeView.AfterSelect += new TreeViewEventHandler (CheckAddPage); treeView.HideSelection = false; + treeView.ItemHeight = 40; TreeNode [] nodes = new TreeNode [Controller.Plugins.Count]; From 07a9ffb6211a372c35172f9aa95e67e40290fb35 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Mon, 28 Nov 2011 00:53:52 +0100 Subject: [PATCH 089/134] The window is now not sizable, and has no maximize button. This is a separate commit so that this can be chosen later --- SparkleShare/Windows/SparkleSetup.Designer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 8a95eb25..1682eeea 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -437,6 +437,8 @@ namespace SparkleShare { this.ClientSize = new System.Drawing.Size (664, 396); this.Controls.Add (this.tabControl); this.Controls.Add (this.pictureBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; this.Name = "SparkleSetup"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "SparkleShare Setup"; From e13c31c63d96ea8f5b76633131b3ee1dd6bb351c Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Mon, 28 Nov 2011 01:11:23 +0100 Subject: [PATCH 090/134] Fixed the bugs with the textboxes when selecting different servers --- SparkleShare/Windows/SparkleSetup.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 5d664026..229b964b 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -48,7 +48,6 @@ namespace SparkleShare { this.label5.Text = _ ("Remote path"); this.label14.Text = _ ("Address"); this.label4.Text = _ ("Where is your remote folder?"); - this.ServerEntry.ExampleText = _ ("Server address"); pictureBox.Image = Icons.side_splash; this.Icon = Icons.sparkleshare; @@ -90,6 +89,7 @@ namespace SparkleShare { panel_server_selection.Controls.Add (treeView); treeView.SelectedNode = treeView.Nodes [0]; treeView.Select (); + CheckAddPage (null, null); Show (); break; case PageType.Error: @@ -144,10 +144,19 @@ namespace SparkleShare { } private void CheckAddPage (object sender, EventArgs e) { - buttonSync.Enabled = false; + // If the "own server" choice is selected, allow input to the server entry box + if (treeView.SelectedNode.Index == 0) { + ServerEntry.Enabled = true; + ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].AddressExample; + } else { + ServerEntry.Text = ""; //Clear any previous input data so that exampletext can show + FolderEntry.Text = ""; + ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].Address; + ServerEntry.Enabled = false; + } FolderEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].PathExample; - ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].Address; + // Enables or disables the 'Next' button depending on the // entries filled in by the user From f2285541bbc18fd391138c3aef4d905aa9201e5e Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 4 Dec 2011 02:17:23 +0100 Subject: [PATCH 091/134] The treeview selection and textboxes should now play along together --- SparkleShare/Windows/SparkleSetup.cs | 55 +++++++++++++++------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 229b964b..d8a2d512 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -34,6 +34,7 @@ namespace SparkleShare { public SparkleSetupController Controller = new SparkleSetupController (); private TreeView treeView; + private bool clearFolderEntry; // Short alias for the translations public static string _ (string s) { @@ -66,7 +67,7 @@ namespace SparkleShare { treeView.FullRowSelect = true; treeView.ImageIndex = 0; treeView.Indent = 35; - treeView.AfterSelect += new TreeViewEventHandler (CheckAddPage); + treeView.AfterSelect += new TreeViewEventHandler (CheckTreeNode); treeView.HideSelection = false; treeView.ItemHeight = 40; @@ -76,6 +77,7 @@ namespace SparkleShare { nodes [i] = new TreeNode (Controller.Plugins [i].Name + ";" + Controller.Plugins [i].Description); nodes [i].ImageIndex = i; nodes [i].SelectedImageIndex = i; + nodes [i].Tag = Controller.Plugins [i].Name; imageList.Images.Add (Image.FromFile (Controller.Plugins [i].ImagePath)); } @@ -143,21 +145,22 @@ namespace SparkleShare { FolderEntry.Text); } - private void CheckAddPage (object sender, EventArgs e) { + private void CheckTreeNode (object sender, EventArgs e) { // If the "own server" choice is selected, allow input to the server entry box - if (treeView.SelectedNode.Index == 0) { + if (treeView.SelectedNode.Tag.ToString () == "On my own server") { ServerEntry.Enabled = true; ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].AddressExample; } else { ServerEntry.Text = ""; //Clear any previous input data so that exampletext can show - FolderEntry.Text = ""; ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].Address; ServerEntry.Enabled = false; } - + FolderEntry.Text = ""; FolderEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].PathExample; - + CheckAddPage (null, null); + } + private void CheckAddPage (object sender, EventArgs e) { // Enables or disables the 'Next' button depending on the // entries filled in by the user buttonSync.Enabled = false; @@ -207,24 +210,24 @@ namespace SparkleShare { } } } - - public class TreeView : System.Windows.Forms.TreeView { - - public TreeView () { - - } - protected override void OnDrawNode (DrawTreeNodeEventArgs e) { - e.Graphics.DrawString (e.Node.Text.Split (';') [0], new Font (Font.SystemFontName, 13), - new SolidBrush (Color.Black), e.Bounds.X, e.Bounds.Y); - e.Graphics.DrawString (e.Node.Text.Split (';') [1], new Font (Font.SystemFontName, 9), - new SolidBrush (Color.Black), e.Bounds.X + 10, e.Bounds.Y + 15); - } - } - - public class TreeNode : System.Windows.Forms.TreeNode { - public TreeNode (string text) { - this.Text = text; - } - } - } + +public class TreeView : System.Windows.Forms.TreeView { + + private string selectedNodeTag; + private string prevNodeTag; + + protected override void OnDrawNode (DrawTreeNodeEventArgs e) { + e.Graphics.DrawString (e.Node.Text.Split (';') [0], new Font (Font.SystemFontName, 13), + new SolidBrush (Color.Black), e.Bounds.X, e.Bounds.Y); + e.Graphics.DrawString (e.Node.Text.Split (';') [1], new Font (Font.SystemFontName, 9), + new SolidBrush (Color.Black), e.Bounds.X + 10, e.Bounds.Y + 15); + } +} + +public class TreeNode : System.Windows.Forms.TreeNode { + public TreeNode (string text) { + this.Text = text; + } +} + From df4fb6573382203f8716ffd2ec00271345685c10 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Sun, 4 Dec 2011 02:18:29 +0100 Subject: [PATCH 092/134] Removed old debugging variables --- SparkleShare/Windows/SparkleSetup.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index d8a2d512..3947a4a9 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -34,7 +34,6 @@ namespace SparkleShare { public SparkleSetupController Controller = new SparkleSetupController (); private TreeView treeView; - private bool clearFolderEntry; // Short alias for the translations public static string _ (string s) { @@ -214,9 +213,6 @@ namespace SparkleShare { public class TreeView : System.Windows.Forms.TreeView { - private string selectedNodeTag; - private string prevNodeTag; - protected override void OnDrawNode (DrawTreeNodeEventArgs e) { e.Graphics.DrawString (e.Node.Text.Split (';') [0], new Font (Font.SystemFontName, 13), new SolidBrush (Color.Black), e.Bounds.X, e.Bounds.Y); From db7e99ea969ac6bf6a7a593e14eb7d9ade52ee39 Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Tue, 6 Dec 2011 21:26:33 +0100 Subject: [PATCH 093/134] First attempt at patching the mentioned bugs --- SparkleShare/Windows/SparkleSetup.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 3947a4a9..1e186902 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -57,7 +57,12 @@ namespace SparkleShare { switch (type) { case PageType.Add: tabControl.SelectedIndex = 1; - + // Check whether the treeView is already created + if (treeView != null) { + CheckAddPage (null, null); + CheckTreeNode (null, null); + break; + } // Set up the treeview ImageList imageList = new ImageList (); imageList.ImageSize = new Size (24, 24); @@ -91,6 +96,8 @@ namespace SparkleShare { treeView.SelectedNode = treeView.Nodes [0]; treeView.Select (); CheckAddPage (null, null); + CheckTreeNode (null, null); + Console.WriteLine ("AddPage"); Show (); break; case PageType.Error: @@ -145,15 +152,17 @@ namespace SparkleShare { } private void CheckTreeNode (object sender, EventArgs e) { - // If the "own server" choice is selected, allow input to the server entry box - if (treeView.SelectedNode.Tag.ToString () == "On my own server") { + // If the "own server" choice is selected, the address field is empty + if (String.IsNullOrEmpty (Controller.Plugins [treeView.SelectedNode.Index].Address)) { ServerEntry.Enabled = true; ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].AddressExample; } else { - ServerEntry.Text = ""; //Clear any previous input data so that exampletext can show + ServerEntry.Enabled = false; ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].Address; ServerEntry.Enabled = false; } + //Clear any previous input data so that exampletext can show + ServerEntry.Text = ""; FolderEntry.Text = ""; FolderEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].PathExample; CheckAddPage (null, null); From b707844fc13a261cdb05f351c0dd24f31625a4fb Mon Sep 17 00:00:00 2001 From: Konstantinos Vaggelakos Date: Tue, 6 Dec 2011 22:52:56 +0100 Subject: [PATCH 094/134] Fixed the problem when canceling and opening again --- SparkleShare/Windows/SparkleSetup.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 1e186902..4910360c 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -58,10 +58,9 @@ namespace SparkleShare { case PageType.Add: tabControl.SelectedIndex = 1; // Check whether the treeView is already created + // If it is dispose it and start over if (treeView != null) { - CheckAddPage (null, null); - CheckTreeNode (null, null); - break; + treeView.Dispose(); } // Set up the treeview ImageList imageList = new ImageList (); @@ -97,7 +96,6 @@ namespace SparkleShare { treeView.Select (); CheckAddPage (null, null); CheckTreeNode (null, null); - Console.WriteLine ("AddPage"); Show (); break; case PageType.Error: From eab3e8fc42cedff32b7415386801d1bbfc328ad0 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 10 Dec 2011 21:48:41 +0100 Subject: [PATCH 095/134] don't assume specific order in treeView to avoid problems when own-server.xml was renamed or removed --- SparkleShare/Windows/SparkleSetup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 4910360c..807a6dec 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -142,7 +142,7 @@ namespace SparkleShare { } private void buttonSync_Click (object sender, EventArgs e) { - if (treeView.SelectedNode.Index == 0) + if (String.IsNullOrEmpty (Controller.Plugins [treeView.SelectedNode.Index].Address)) Controller.AddPageCompleted (ServerEntry.Text, FolderEntry.Text); else Controller.AddPageCompleted (Controller.Plugins [treeView.SelectedNode.Index].Address, @@ -171,7 +171,7 @@ namespace SparkleShare { // entries filled in by the user buttonSync.Enabled = false; - if (treeView.SelectedNode.Index == 0) { + if (String.IsNullOrEmpty (Controller.Plugins [treeView.SelectedNode.Index].Address)) { if (!String.IsNullOrEmpty (FolderEntry.Text)) { if (!String.IsNullOrEmpty (ServerEntry.Text)) buttonSync.Enabled = true; From 613fa43f0d0c494f4c006421efea41dd896345d2 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 10 Dec 2011 22:07:55 +0100 Subject: [PATCH 096/134] avoid empty lines being added to .ssh/config file --- SparkleLib/SparkleFetcherBase.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index 2028aa8e..0ab93307 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -142,17 +142,17 @@ namespace SparkleLib { string ssh_config_path = Path.Combine (path, ".ssh"); string ssh_config_file_path = SparkleHelpers.CombineMore (path, ".ssh", "config"); - string ssh_config = Environment.NewLine + "# " + - Environment.NewLine + "Host " + host + - Environment.NewLine + "\tStrictHostKeyChecking no" + - Environment.NewLine + "# "; + string ssh_config = "\n# " + + "\nHost " + host + + "\n\tStrictHostKeyChecking no" + + "\n# "; if (!Directory.Exists (ssh_config_path)) Directory.CreateDirectory (ssh_config_path); if (File.Exists (ssh_config_file_path)) { TextWriter writer = File.AppendText (ssh_config_file_path); - writer.WriteLine (ssh_config); + writer.Write (ssh_config); writer.Close (); } else { @@ -185,7 +185,7 @@ namespace SparkleLib { string current_ssh_config = File.ReadAllText (ssh_config_file_path); current_ssh_config = current_ssh_config.Trim (); - string [] lines = current_ssh_config.Split (Environment.NewLine.ToCharArray ()); + string [] lines = current_ssh_config.Split ('\n'); string new_ssh_config = ""; bool in_sparkleshare_section = false; @@ -203,7 +203,7 @@ namespace SparkleLib { if (in_sparkleshare_section) continue; - new_ssh_config += line + Environment.NewLine; + new_ssh_config += line + "\n"; // do not use Environment.NewLine because file is in unix format } if (string.IsNullOrEmpty (new_ssh_config.Trim ())) { From 7d5336c6fefa0dc45b7ffe7717e5c6f72b321471 Mon Sep 17 00:00:00 2001 From: wimh Date: Thu, 15 Dec 2011 20:58:30 +0100 Subject: [PATCH 097/134] add gettext-cs-utils submodule --- .gitmodules | 3 +++ tools/gettext-cs-utils | 1 + 2 files changed, 4 insertions(+) create mode 160000 tools/gettext-cs-utils diff --git a/.gitmodules b/.gitmodules index ccaf797a..47a14910 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "tools/TextTemplating"] path = tools/TextTemplating url = git://github.com/wimh/TextTemplating.git +[submodule "tools\\gettext-cs-utils"] + path = tools\\gettext-cs-utils + url = git://github.com/wimh/gettext-cs-utils.git diff --git a/tools/gettext-cs-utils b/tools/gettext-cs-utils new file mode 160000 index 00000000..6dc54585 --- /dev/null +++ b/tools/gettext-cs-utils @@ -0,0 +1 @@ +Subproject commit 6dc54585cda0bc101f23672487ffb901e28d266e From 6cda13852c6aee767e5edb59a72b66ba2514da7f Mon Sep 17 00:00:00 2001 From: wimh Date: Thu, 15 Dec 2011 22:20:48 +0100 Subject: [PATCH 098/134] start using gettext-cs-utils (try: "SparkleShare --help" after setting language in Main) --- .gitignore | 1 + SparkleShare/Windows/Program.cs | 6 +- SparkleShare/Windows/SparkleShare.csproj | 130 +++++++++++++++++++++++ SparkleShare/Windows/Strings.tt | 10 ++ SparkleShare/Windows/build.cmd | 5 + 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 SparkleShare/Windows/Strings.tt diff --git a/.gitignore b/.gitignore index 6c9e3630..fd34b967 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ build/m4/shave/shave-libtool SparkleLib/Defines.cs SparkleLib/windows/Defines.cs SparkleLib/windows/GlobalAssemblyInfo.cs +SparkleShare/Windows/Strings.cs SparkleShare/sparkleshare po/sparkleshare.pot SparkleShare/Nautilus/sparkleshare-nautilus-extension.py diff --git a/SparkleShare/Windows/Program.cs b/SparkleShare/Windows/Program.cs index 50e42c1c..b254ea4f 100644 --- a/SparkleShare/Windows/Program.cs +++ b/SparkleShare/Windows/Program.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Runtime.InteropServices; using System.Text; @@ -44,7 +45,7 @@ namespace SparkleShare { #if __MonoCS__ return Catalog.GetString (s); #else - return s; + return Strings.T(s); #endif } @@ -53,6 +54,9 @@ namespace SparkleShare { #endif public static void Main (string [] args) { + //var culture = CultureInfo.GetCultureInfo ("en"); // FIXME: test only + //System.Threading.Thread.CurrentThread.CurrentUICulture = culture; + // Parse the command line options bool show_help = false; OptionSet option_set = new OptionSet () { diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 04d1290a..a48328d9 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -55,7 +55,12 @@ + + False + ..\..\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\bin\Release\Gettext.Cs.dll + + 3.5 @@ -137,6 +142,11 @@ Component + + True + True + Strings.tt + @@ -271,5 +281,125 @@ plugins\own-server.xml Always + + po\ar.po + Always + + + po\bg.po + Always + + + po\ca.po + Always + + + po\cs_CZ.po + Always + + + po\da.po + Always + + + po\de.po + Always + + + po\el.po + Always + + + po\eo.po + Always + + + po\es.po + Always + + + po\fi.po + Always + + + po\fr.po + Always + + + po\he.po + Always + + + po\hu.po + Always + + + po\it.po + Always + + + po\ja.po + Always + + + po\nl.po + Always + + + po\nn_NO.po + Always + + + po\no_NO.po + Always + + + po\pl.po + Always + + + po\pt_BR.po + Always + + + po\ru.po + Always + + + po\sk.po + Always + + + po\sl.po + Always + + + po\sr_RS.po + Always + + + po\sv.po + Always + + + po\te.po + Always + + + po\uk.po + Always + + + po\zh_CN.po + Always + + + po\zh_TW.po + Always + + + TextTemplatingFileGenerator + Strings.cs + \ No newline at end of file diff --git a/SparkleShare/Windows/Strings.tt b/SparkleShare/Windows/Strings.tt new file mode 100644 index 00000000..15a29926 --- /dev/null +++ b/SparkleShare/Windows/Strings.tt @@ -0,0 +1,10 @@ +<#@ assembly name="System.Configuration" #> + +<# + this.ClassName = "Strings"; + this.ResourceName = "Strings"; + this.NamespaceName = "SparkleShare"; + this.DefaultResourceDir = "po"; + this.DefaultFileFormat = "{{culture}}.po"; +#> +<#@ include file="..\..\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\Templates\Strings.tt" #> diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index 282fc313..2f4ab8ea 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -7,6 +7,11 @@ set msbuild="%WinDirNet%\v3.5\msbuild.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" set wixBinDir=%WIX%\bin + + +%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="AnyCPU" %~dp0..\..\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\Gettext.Cs.csproj + + %msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln if "%1"=="installer" ( From 5f12850321a98234469ef913feec23aba45b1dfd Mon Sep 17 00:00:00 2001 From: focusheart Date: Sat, 24 Dec 2011 09:18:17 +0100 Subject: [PATCH 099/134] Update Chinese (China) translation from Transifex --- po/zh_CN.po | 303 ++++++++++++++++++++++++---------------------------- 1 file changed, 138 insertions(+), 165 deletions(-) diff --git a/po/zh_CN.po b/po/zh_CN.po index f147ae46..acbdc6e5 100755 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -1,14 +1,15 @@ # This file is distributed under the same license as the SparkleShare package. # # Translators: +# , 2011. # , 2011. msgid "" msgstr "" "Project-Id-Version: SparkleShare\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-30 15:50+0100\n" -"PO-Revision-Date: 2011-10-30 14:50+0000\n" -"Last-Translator: deejay1 \n" +"POT-Creation-Date: 2011-12-04 12:45+0100\n" +"PO-Revision-Date: 2011-12-08 07:18+0000\n" +"Last-Translator: focusheart \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -17,27 +18,27 @@ msgstr "" #: ../data/plugins/bitbucket.xml.in.h:1 ../data/plugins/github.xml.in.h:1 msgid "/username/project" -msgstr "" +msgstr "/username/project" #: ../data/plugins/bitbucket.xml.in.h:2 msgid "Bitbucket" -msgstr "" +msgstr "小桶" #: ../data/plugins/bitbucket.xml.in.h:3 msgid "Free code hosting for Git and Mercurial" -msgstr "" +msgstr "免费的Git与Mercurial代码托管" #: ../data/plugins/github.xml.in.h:2 msgid "Free public Git repositories with collaborator management" -msgstr "" +msgstr "具备协作管理的免费开放仓库" #: ../data/plugins/github.xml.in.h:3 msgid "Github" -msgstr "" +msgstr "Github" #: ../data/plugins/gitorious.xml.in.h:1 msgid "/project/repository" -msgstr "" +msgstr "/project/repository" #: ../data/plugins/gitorious.xml.in.h:2 msgid "Gitorious" @@ -45,15 +46,15 @@ msgstr "Gitorious" #: ../data/plugins/gitorious.xml.in.h:3 msgid "Open source infrastructure for hosting open source projects" -msgstr "" +msgstr "托管开源项目的开源架构" #: ../data/plugins/gnome.xml.in.h:1 msgid "/project" -msgstr "" +msgstr "/project" #: ../data/plugins/gnome.xml.in.h:2 msgid "A free and easy interface for your computer" -msgstr "" +msgstr "为你的计算机提供一个免费并且简单的接口" #: ../data/plugins/gnome.xml.in.h:3 msgid "The GNOME Project" @@ -61,182 +62,155 @@ msgstr "GMOME项目" #: ../data/plugins/own-server.xml.in.h:1 msgid "/path/to/project" -msgstr "" +msgstr "/path/to/project" #: ../data/plugins/own-server.xml.in.h:2 msgid "Everything under my control" -msgstr "" +msgstr "一切尽在你的掌控" #: ../data/plugins/own-server.xml.in.h:3 msgid "On my own server" -msgstr "" +msgstr "拥有你自己的服务器" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:70 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:88 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:84 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:102 #: ../SparkleShare/SparkleSetup.cs:75 ../SparkleShare/SparkleStatusIcon.cs:75 #: ../SparkleShare/SparkleStatusIcon.cs:89 msgid "Welcome to SparkleShare!" msgstr "欢迎使用 SparkleShare!" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:72 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:90 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:86 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:104 #: ../SparkleShare/SparkleStatusIcon.cs:77 #: ../SparkleShare/SparkleStatusIcon.cs:91 msgid "Up to date" -msgstr "" +msgstr "保持最新" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:99 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:113 #: ../SparkleShare/SparkleStatusIcon.cs:106 msgid "Syncing…" msgstr "同步中..." -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:109 -#: ../SparkleShare/SparkleStatusIcon.cs:116 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:125 +#: ../SparkleShare/SparkleStatusIcon.cs:118 msgid "Not everything is synced" -msgstr "" +msgstr "尚有内容未同步" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:113 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:141 msgid "Copy Web Link" msgstr "复制Web链接" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:115 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:142 msgid "Copy the web address of this file to the clipboard" msgstr "复制该文件的Web地址到剪贴板" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:147 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:174 msgid "Get Earlier Version" msgstr "获取较早的版本" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:149 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:175 msgid "Make a copy of an earlier version in this folder" msgstr "在本目录中制作一个较早的版本" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:161 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:162 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:188 msgid "Select to get a copy of this version" msgstr "获取该版本的复制" -#: ../SparkleShare/Program.cs:51 +#: ../SparkleShare/Program.cs:50 msgid "Print version information" -msgstr "" +msgstr "打印版本信息" -#: ../SparkleShare/Program.cs:52 +#: ../SparkleShare/Program.cs:51 msgid "Show this help text" -msgstr "" +msgstr "显示当前帮助文字" + +#: ../SparkleShare/Program.cs:83 +msgid "SparkleShare, a collaboration and sharing tool." +msgstr "SparkleShare,协作与分享的工具" #: ../SparkleShare/Program.cs:84 -msgid "SparkleShare, a collaboration and sharing tool." -msgstr "" - -#: ../SparkleShare/Program.cs:85 msgid "Copyright (C) 2010 Hylke Bons" -msgstr "" +msgstr "版权(C) 2010 Hylke Bons" -#: ../SparkleShare/Program.cs:87 +#: ../SparkleShare/Program.cs:86 msgid "This program comes with ABSOLUTELY NO WARRANTY." msgstr "本程序不提供任何质量保证" -#: ../SparkleShare/Program.cs:89 +#: ../SparkleShare/Program.cs:88 msgid "This is free software, and you are welcome to redistribute it " msgstr "这是自由软件,欢迎您再次分发。" -#: ../SparkleShare/Program.cs:90 +#: ../SparkleShare/Program.cs:89 msgid "under certain conditions. Please read the GNU GPLv3 for details." msgstr "在某种条件下。详情请参见 GNU GPLv3。" -#: ../SparkleShare/Program.cs:92 +#: ../SparkleShare/Program.cs:91 msgid "SparkleShare automatically syncs Git repositories in " -msgstr "" +msgstr "SparkleShare 自动同步Git仓库" -#: ../SparkleShare/Program.cs:93 +#: ../SparkleShare/Program.cs:92 msgid "the ~/SparkleShare folder with their remote origins." -msgstr "" +msgstr "~/SparkleShare 目录与远程所有" -#: ../SparkleShare/Program.cs:95 +#: ../SparkleShare/Program.cs:94 msgid "Usage: sparkleshare [start|stop|restart] [OPTION]..." msgstr "用法:sparkleshare [start|stop|restart] [OPTION]..." -#: ../SparkleShare/Program.cs:96 +#: ../SparkleShare/Program.cs:95 msgid "Sync SparkleShare folder with remote repositories." -msgstr "" +msgstr "与远程仓库同步SparkleShare " -#: ../SparkleShare/Program.cs:98 +#: ../SparkleShare/Program.cs:97 msgid "Arguments:" msgstr "参数:" -#: ../SparkleShare/Program.cs:108 +#: ../SparkleShare/Program.cs:107 msgid "SparkleShare " msgstr "SparkleShare" #. A menu item that takes the user to http://www.sparkleshare.org/ -#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:295 +#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:297 msgid "About SparkleShare" msgstr "关于 SparkleShare" #: ../SparkleShare/SparkleAbout.cs:70 #, csharp-format msgid "A newer version ({0}) is available!" -msgstr "" +msgstr "有新版本({0})了!" #: ../SparkleShare/SparkleAbout.cs:79 msgid "You are running the latest version." -msgstr "" +msgstr "你所使用的是最新版本" -#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:113 +#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:110 msgid "Checking for updates..." -msgstr "" +msgstr "正在检查更新..." -#: ../SparkleShare/SparkleControllerBase.cs:493 +#: ../SparkleShare/SparkleControllerBase.cs:489 msgid "dddd, MMMM d, yyyy" -msgstr "" +msgstr "dddd,MMMM d, yyyy" -#: ../SparkleShare/SparkleControllerBase.cs:499 +#: ../SparkleShare/SparkleControllerBase.cs:495 msgid "dddd, MMMM d" -msgstr "" +msgstr "ddd, MMMM d" -#: ../SparkleShare/SparkleControllerBase.cs:707 -#, csharp-format -msgid "added ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:712 -#, csharp-format -msgid "moved ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:717 -#, csharp-format -msgid "edited ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:722 -#, csharp-format -msgid "deleted ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:731 -#, csharp-format -msgid "and {0} more" -msgid_plural "and {0} more" -msgstr[0] "" - -#: ../SparkleShare/SparkleControllerBase.cs:735 -msgid "did something magical" -msgstr "" - -#: ../SparkleShare/SparkleEventLog.cs:58 +#: ../SparkleShare/SparkleEventLog.cs:56 msgid "Recent Events" -msgstr "" +msgstr "最近事件" -#: ../SparkleShare/SparkleEventLog.cs:169 -#: ../SparkleShare/SparkleEventLog.cs:188 +#: ../SparkleShare/SparkleEventLog.cs:145 +#: ../SparkleShare/SparkleEventLog.cs:164 msgid "All Folders" -msgstr "" +msgstr "所有目录" -#: ../SparkleShare/SparkleSetup.cs:76 -msgid "" -"Before we can create a SparkleShare folder on this computer, we need a few " -"bits of information from you." -msgstr "" +#: ../SparkleShare/SparkleOptions.cs:486 +msgid "OptionName" +msgstr "选项名称" #: ../SparkleShare/SparkleSetup.cs:83 msgid "Full Name:" @@ -252,153 +226,152 @@ msgstr "下一步" #: ../SparkleShare/SparkleSetup.cs:129 msgid "Where's your project hosted?" -msgstr "" +msgstr "你的项目托管在哪里?" -#: ../SparkleShare/SparkleSetup.cs:275 +#: ../SparkleShare/SparkleSetup.cs:266 msgid "Address" -msgstr "" +msgstr "地址" -#: ../SparkleShare/SparkleSetup.cs:295 +#: ../SparkleShare/SparkleSetup.cs:286 msgid "Remote Path" -msgstr "" +msgstr "远程路径" #. Cancel button -#: ../SparkleShare/SparkleSetup.cs:309 ../SparkleShare/SparkleSetup.cs:345 +#: ../SparkleShare/SparkleSetup.cs:300 ../SparkleShare/SparkleSetup.cs:336 msgid "Cancel" msgstr "取消" #. Sync button -#: ../SparkleShare/SparkleSetup.cs:316 +#: ../SparkleShare/SparkleSetup.cs:307 msgid "Add" -msgstr "" +msgstr "添加" -#: ../SparkleShare/SparkleSetup.cs:335 +#: ../SparkleShare/SparkleSetup.cs:326 #, csharp-format msgid "Adding project ‘{0}’…" -msgstr "" +msgstr "添加项目'{0}'..." -#: ../SparkleShare/SparkleSetup.cs:336 +#: ../SparkleShare/SparkleSetup.cs:327 msgid "This may take a while." -msgstr "" +msgstr "这可能要花一点时间。" -#: ../SparkleShare/SparkleSetup.cs:337 +#: ../SparkleShare/SparkleSetup.cs:328 msgid "Are you sure it’s not coffee o'clock?" -msgstr "" +msgstr "你不觉得现在是休息时间么?" -#: ../SparkleShare/SparkleSetup.cs:341 ../SparkleShare/SparkleSetup.cs:457 -#: ../SparkleShare/SparkleSetup.cs:556 +#: ../SparkleShare/SparkleSetup.cs:332 ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:558 msgid "Finish" msgstr "完成" -#: ../SparkleShare/SparkleSetup.cs:374 +#: ../SparkleShare/SparkleSetup.cs:365 msgid "Something went wrong" -msgstr "" +msgstr "好像有什么问题" -#: ../SparkleShare/SparkleSetup.cs:422 +#: ../SparkleShare/SparkleSetup.cs:413 msgid "Try Again…" -msgstr "" +msgstr "再试试看..." -#: ../SparkleShare/SparkleSetup.cs:441 +#: ../SparkleShare/SparkleSetup.cs:432 #, csharp-format msgid "‘{0}’ has been successfully added" -msgstr "" +msgstr "'{0}'被成功添加" -#: ../SparkleShare/SparkleSetup.cs:447 +#: ../SparkleShare/SparkleSetup.cs:438 msgid "Project successfully added!" -msgstr "" +msgstr "项目成功添加!" -#: ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:439 msgid "Access the files from your SparkleShare folder." -msgstr "" +msgstr "从你的SparkleShare目录访问这些文件。" #. A button that opens the synced folder -#: ../SparkleShare/SparkleSetup.cs:451 +#: ../SparkleShare/SparkleSetup.cs:442 msgid "Open Folder" msgstr "打开文件夹" -#: ../SparkleShare/SparkleSetup.cs:477 +#: ../SparkleShare/SparkleSetup.cs:484 msgid "What's happening next?" -msgstr "" +msgstr "下来做什么?" -#: ../SparkleShare/SparkleSetup.cs:478 +#: ../SparkleShare/SparkleSetup.cs:485 msgid "" "SparkleShare creates a special folder in your personal folder that will keep" " track of your projects." -msgstr "" +msgstr "SparkleShare在你的个人文件夹中创建了一个特别的文件夹用以保持跟踪你的项目。" -#: ../SparkleShare/SparkleSetup.cs:481 +#: ../SparkleShare/SparkleSetup.cs:488 msgid "Skip Tutorial" -msgstr "" +msgstr "跳过教程" -#: ../SparkleShare/SparkleSetup.cs:486 ../SparkleShare/SparkleSetup.cs:506 -#: ../SparkleShare/SparkleSetup.cs:524 +#: ../SparkleShare/SparkleSetup.cs:493 ../SparkleShare/SparkleSetup.cs:513 +#: ../SparkleShare/SparkleSetup.cs:531 msgid "Continue" -msgstr "" +msgstr "继续" -#: ../SparkleShare/SparkleSetup.cs:502 +#: ../SparkleShare/SparkleSetup.cs:509 msgid "Sharing files with others" -msgstr "" +msgstr "与他人分享文件" -#: ../SparkleShare/SparkleSetup.cs:503 +#: ../SparkleShare/SparkleSetup.cs:510 msgid "" "All files added to your project folders are synced with the host " "automatically, as well as with your collaborators." -msgstr "" +msgstr "所有添加到你的项目中的文件都将与服务器自动同步,你的所有协作伙伴们也是如此。" -#: ../SparkleShare/SparkleSetup.cs:520 +#: ../SparkleShare/SparkleSetup.cs:527 msgid "The status icon is here to help" -msgstr "" +msgstr "状态图标可以提供帮助" -#: ../SparkleShare/SparkleSetup.cs:521 +#: ../SparkleShare/SparkleSetup.cs:528 msgid "" "It shows the syncing process status, and contains links to your projects and" " the event log." -msgstr "" +msgstr "此处显示同步进度状态,并且包含了到你的项目和事件日志的链接。" -#: ../SparkleShare/SparkleSetup.cs:538 +#: ../SparkleShare/SparkleSetup.cs:545 msgid "Adding projects to SparkleShare" -msgstr "" +msgstr "向SparkleShare添加项目" -#: ../SparkleShare/SparkleSetup.cs:539 +#: ../SparkleShare/SparkleSetup.cs:546 msgid "" "Just click this button when you see it on the web, and the project will be " "automatically added:" -msgstr "" +msgstr "在网页上看到这个按钮的时候即可点击,项目会被自动添加进去;" -#: ../SparkleShare/SparkleSetup.cs:542 +#: ../SparkleShare/SparkleSetup.cs:549 msgid "" "…or select ‘Add Hosted Project…’ from the status icon menu to add one" " by hand." -msgstr "" - -#. Opens the wizard to add a new remote folder -#: ../SparkleShare/SparkleSetup.cs:551 -#: ../SparkleShare/SparkleStatusIcon.cs:238 -msgid "Add Hosted Project…" -msgstr "" +msgstr "...或者从状态图标菜单中选择 '添加已托管的项目...'来手工添加。" #: ../SparkleShare/SparkleSetupWindow.cs:44 msgid "SparkleShare Setup" msgstr "SparkleShare " -#: ../SparkleShare/SparkleStatusIcon.cs:228 +#: ../SparkleShare/SparkleStatusIcon.cs:230 msgid "No projects yet" -msgstr "" +msgstr "尚无项目" -#: ../SparkleShare/SparkleStatusIcon.cs:262 +#. Opens the wizard to add a new remote folder +#: ../SparkleShare/SparkleStatusIcon.cs:240 +msgid "Add Hosted Project…" +msgstr "添加已托管的项目" + +#: ../SparkleShare/SparkleStatusIcon.cs:264 msgid "Open Recent Events" -msgstr "" - -#: ../SparkleShare/SparkleStatusIcon.cs:282 -msgid "Turn Notifications Off" -msgstr "" +msgstr "打开最近的活动" #: ../SparkleShare/SparkleStatusIcon.cs:284 +msgid "Turn Notifications Off" +msgstr "关闭通知" + +#: ../SparkleShare/SparkleStatusIcon.cs:286 msgid "Turn Notifications On" -msgstr "" +msgstr "打开通知" #. A menu item that quits the application -#: ../SparkleShare/SparkleStatusIcon.cs:311 +#: ../SparkleShare/SparkleStatusIcon.cs:313 msgid "Quit" msgstr "退出" From dd5c63da909a7c37fa6a79b542b423992985fd8d Mon Sep 17 00:00:00 2001 From: wimh Date: Tue, 27 Dec 2011 13:21:56 +0100 Subject: [PATCH 100/134] Update Spanish (Castilian) translation from Transifex Conflicts: po/es.po --- po/es.po | 208 ++++++++++++++++++++++++------------------------------- 1 file changed, 89 insertions(+), 119 deletions(-) diff --git a/po/es.po b/po/es.po index 553a662a..5640fdfb 100755 --- a/po/es.po +++ b/po/es.po @@ -5,13 +5,14 @@ # , 2011. # jamelrom , 2011. # , 2011. +# , 2011. msgid "" msgstr "" "Project-Id-Version: SparkleShare\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-30 15:50+0100\n" -"PO-Revision-Date: 2011-11-02 12:13+0000\n" -"Last-Translator: elsupergomez \n" +"POT-Creation-Date: 2011-12-04 12:45+0100\n" +"PO-Revision-Date: 2011-12-09 14:13+0000\n" +"Last-Translator: miguxbe \n" "Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/sparkleshare/team/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -76,176 +77,146 @@ msgstr "Todo bajo mi control" msgid "On my own server" msgstr "En mi propio servidor" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:70 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:88 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:84 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:102 #: ../SparkleShare/SparkleSetup.cs:75 ../SparkleShare/SparkleStatusIcon.cs:75 #: ../SparkleShare/SparkleStatusIcon.cs:89 msgid "Welcome to SparkleShare!" msgstr "¡Bienvenido a SparkleShare!" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:72 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:90 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:86 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:104 #: ../SparkleShare/SparkleStatusIcon.cs:77 #: ../SparkleShare/SparkleStatusIcon.cs:91 msgid "Up to date" msgstr "Actualizado" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:99 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:113 #: ../SparkleShare/SparkleStatusIcon.cs:106 msgid "Syncing…" msgstr "Sincronizando..." -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:109 -#: ../SparkleShare/SparkleStatusIcon.cs:116 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:125 +#: ../SparkleShare/SparkleStatusIcon.cs:118 msgid "Not everything is synced" msgstr "Pendiente de sincronizar" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:113 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:141 msgid "Copy Web Link" msgstr "Copiar Enlace" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:115 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:142 msgid "Copy the web address of this file to the clipboard" msgstr "Copiar la dirección web de este archivo al portapapeles" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:147 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:174 msgid "Get Earlier Version" msgstr "Obtener versión anterior" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:149 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:175 msgid "Make a copy of an earlier version in this folder" msgstr "Hacer una copia de una versión anterior en esta carpeta" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:161 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:162 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:188 msgid "Select to get a copy of this version" msgstr "Seleccionar para obtener una copia de esta versión" -#: ../SparkleShare/Program.cs:51 +#: ../SparkleShare/Program.cs:50 msgid "Print version information" msgstr "Muestra la información de la versión" -#: ../SparkleShare/Program.cs:52 +#: ../SparkleShare/Program.cs:51 msgid "Show this help text" msgstr "Mostrar este texto de ayuda" -#: ../SparkleShare/Program.cs:84 +#: ../SparkleShare/Program.cs:83 msgid "SparkleShare, a collaboration and sharing tool." msgstr "SparkleShare, una herramienta de compartición y colaboración" -#: ../SparkleShare/Program.cs:85 +#: ../SparkleShare/Program.cs:84 msgid "Copyright (C) 2010 Hylke Bons" msgstr "Copyright (C) 2010 Hylke Bons" -#: ../SparkleShare/Program.cs:87 +#: ../SparkleShare/Program.cs:86 msgid "This program comes with ABSOLUTELY NO WARRANTY." msgstr "Este programa viene SIN NINGUNA GARANTÍA." -#: ../SparkleShare/Program.cs:89 +#: ../SparkleShare/Program.cs:88 msgid "This is free software, and you are welcome to redistribute it " msgstr "Esto es software libre, y esta invitado a redistribuirlo" -#: ../SparkleShare/Program.cs:90 +#: ../SparkleShare/Program.cs:89 msgid "under certain conditions. Please read the GNU GPLv3 for details." msgstr "" "bajo determinadas condiciones. Por favor lea la GNU GPLv3 para más detalles." -#: ../SparkleShare/Program.cs:92 +#: ../SparkleShare/Program.cs:91 msgid "SparkleShare automatically syncs Git repositories in " msgstr "SparkleShare sincroniza automaticamente repositorios Git en " -#: ../SparkleShare/Program.cs:93 +#: ../SparkleShare/Program.cs:92 msgid "the ~/SparkleShare folder with their remote origins." msgstr "La carpeta ~/SparkleShare con su origen remoto." -#: ../SparkleShare/Program.cs:95 +#: ../SparkleShare/Program.cs:94 msgid "Usage: sparkleshare [start|stop|restart] [OPTION]..." -msgstr "Uso: sparkleshare [start|stop|restart] [OPCION]..." +msgstr "Uso: sparkleshare [start|stop|restart] [OPCIÓN]..." -#: ../SparkleShare/Program.cs:96 +#: ../SparkleShare/Program.cs:95 msgid "Sync SparkleShare folder with remote repositories." msgstr "Sincronizar carpeta SparkleShare con el repositorio remoto." -#: ../SparkleShare/Program.cs:98 +#: ../SparkleShare/Program.cs:97 msgid "Arguments:" msgstr "Parámetros:" -#: ../SparkleShare/Program.cs:108 +#: ../SparkleShare/Program.cs:107 msgid "SparkleShare " msgstr "SparkleShare" #. A menu item that takes the user to http://www.sparkleshare.org/ -#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:295 +#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:297 msgid "About SparkleShare" msgstr "Acerca de SparkleShare" #: ../SparkleShare/SparkleAbout.cs:70 #, csharp-format msgid "A newer version ({0}) is available!" -msgstr "Esta disponible una nueva version ({0})" +msgstr "Esta disponible una nueva versión ({0})" #: ../SparkleShare/SparkleAbout.cs:79 msgid "You are running the latest version." msgstr "Estas ejecutando la última versión" -#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:113 +#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:110 msgid "Checking for updates..." msgstr "Comprobando actualizaciones..." -#: ../SparkleShare/SparkleControllerBase.cs:493 +#: ../SparkleShare/SparkleControllerBase.cs:489 msgid "dddd, MMMM d, yyyy" -msgstr "" +msgstr "dddd, MMMM d, yyyy" -#: ../SparkleShare/SparkleControllerBase.cs:499 +#: ../SparkleShare/SparkleControllerBase.cs:495 msgid "dddd, MMMM d" -msgstr "" +msgstr "dddd, MMMM d" -#: ../SparkleShare/SparkleControllerBase.cs:707 -#, csharp-format -msgid "added ‘{0}’" -msgstr "añadido '{0}'" - -#: ../SparkleShare/SparkleControllerBase.cs:712 -#, csharp-format -msgid "moved ‘{0}’" -msgstr "movido '{0}'" - -#: ../SparkleShare/SparkleControllerBase.cs:717 -#, csharp-format -msgid "edited ‘{0}’" -msgstr "editado '{0}'" - -#: ../SparkleShare/SparkleControllerBase.cs:722 -#, csharp-format -msgid "deleted ‘{0}’" -msgstr "eliminado '{0}'" - -#: ../SparkleShare/SparkleControllerBase.cs:731 -#, csharp-format -msgid "and {0} more" -msgid_plural "and {0} more" -msgstr[0] "y {0} más" -msgstr[1] "y {0} más" - -#: ../SparkleShare/SparkleControllerBase.cs:735 -msgid "did something magical" -msgstr "hizo algo mágico" - -#: ../SparkleShare/SparkleEventLog.cs:58 +#: ../SparkleShare/SparkleEventLog.cs:56 msgid "Recent Events" msgstr "Eventos recientes" -#: ../SparkleShare/SparkleEventLog.cs:169 -#: ../SparkleShare/SparkleEventLog.cs:188 +#: ../SparkleShare/SparkleEventLog.cs:145 +#: ../SparkleShare/SparkleEventLog.cs:164 msgid "All Folders" msgstr "Todas las carpetas" -#: ../SparkleShare/SparkleSetup.cs:76 -msgid "" -"Before we can create a SparkleShare folder on this computer, we need a few " -"bits of information from you." -msgstr "" -"Antes de que podamos crear una carpeta de SparkleShare en este equipo, " -"necesitamos un poco de información de usted." +#: ../SparkleShare/SparkleOptions.cs:486 +msgid "OptionName" +msgstr "OptionName" #: ../SparkleShare/SparkleSetup.cs:83 msgid "Full Name:" @@ -261,108 +232,108 @@ msgstr "Siguiente" #: ../SparkleShare/SparkleSetup.cs:129 msgid "Where's your project hosted?" -msgstr "¿Donde esta almacenado su proyecto?" +msgstr "¿Dónde está almacenado su proyecto?" -#: ../SparkleShare/SparkleSetup.cs:275 +#: ../SparkleShare/SparkleSetup.cs:266 msgid "Address" msgstr "Dirección" -#: ../SparkleShare/SparkleSetup.cs:295 +#: ../SparkleShare/SparkleSetup.cs:286 msgid "Remote Path" msgstr "Ruta remota" #. Cancel button -#: ../SparkleShare/SparkleSetup.cs:309 ../SparkleShare/SparkleSetup.cs:345 +#: ../SparkleShare/SparkleSetup.cs:300 ../SparkleShare/SparkleSetup.cs:336 msgid "Cancel" msgstr "Cancelar" #. Sync button -#: ../SparkleShare/SparkleSetup.cs:316 +#: ../SparkleShare/SparkleSetup.cs:307 msgid "Add" msgstr "Añadir" -#: ../SparkleShare/SparkleSetup.cs:335 +#: ../SparkleShare/SparkleSetup.cs:326 #, csharp-format msgid "Adding project ‘{0}’…" msgstr "Añadiendo proyecto '{0}'..." -#: ../SparkleShare/SparkleSetup.cs:336 +#: ../SparkleShare/SparkleSetup.cs:327 msgid "This may take a while." msgstr "Esto tardara un poco." -#: ../SparkleShare/SparkleSetup.cs:337 +#: ../SparkleShare/SparkleSetup.cs:328 msgid "Are you sure it’s not coffee o'clock?" msgstr "¿Seguro que no es la hora del café?" -#: ../SparkleShare/SparkleSetup.cs:341 ../SparkleShare/SparkleSetup.cs:457 -#: ../SparkleShare/SparkleSetup.cs:556 +#: ../SparkleShare/SparkleSetup.cs:332 ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:558 msgid "Finish" msgstr "Finalizar" -#: ../SparkleShare/SparkleSetup.cs:374 +#: ../SparkleShare/SparkleSetup.cs:365 msgid "Something went wrong" msgstr "Algo falló" -#: ../SparkleShare/SparkleSetup.cs:422 +#: ../SparkleShare/SparkleSetup.cs:413 msgid "Try Again…" msgstr "Intenta de nuevo..." -#: ../SparkleShare/SparkleSetup.cs:441 +#: ../SparkleShare/SparkleSetup.cs:432 #, csharp-format msgid "‘{0}’ has been successfully added" msgstr "'{0}' Ha sido añadido correctamente" -#: ../SparkleShare/SparkleSetup.cs:447 +#: ../SparkleShare/SparkleSetup.cs:438 msgid "Project successfully added!" -msgstr "Proyecto añadido con exito!" +msgstr "Proyecto añadido con éxito!" -#: ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:439 msgid "Access the files from your SparkleShare folder." msgstr "Acceso a los archivos desde tu carpeta de SparkleShare." #. A button that opens the synced folder -#: ../SparkleShare/SparkleSetup.cs:451 +#: ../SparkleShare/SparkleSetup.cs:442 msgid "Open Folder" msgstr "Abrir carpeta" -#: ../SparkleShare/SparkleSetup.cs:477 +#: ../SparkleShare/SparkleSetup.cs:484 msgid "What's happening next?" msgstr "¿Qué está pasando ahora?" -#: ../SparkleShare/SparkleSetup.cs:478 +#: ../SparkleShare/SparkleSetup.cs:485 msgid "" "SparkleShare creates a special folder in your personal folder that will keep" " track of your projects." msgstr "" -"SparkleShare crea una carpeta especial en tu carpeta personal que mantendra " +"SparkleShare crea una carpeta especial en tu carpeta personal que mantendrá " "un historial de tus proyectos." -#: ../SparkleShare/SparkleSetup.cs:481 +#: ../SparkleShare/SparkleSetup.cs:488 msgid "Skip Tutorial" msgstr "Saltar Tutorial" -#: ../SparkleShare/SparkleSetup.cs:486 ../SparkleShare/SparkleSetup.cs:506 -#: ../SparkleShare/SparkleSetup.cs:524 +#: ../SparkleShare/SparkleSetup.cs:493 ../SparkleShare/SparkleSetup.cs:513 +#: ../SparkleShare/SparkleSetup.cs:531 msgid "Continue" msgstr "Continuar" -#: ../SparkleShare/SparkleSetup.cs:502 +#: ../SparkleShare/SparkleSetup.cs:509 msgid "Sharing files with others" msgstr "Compartiendo archivos con otros" -#: ../SparkleShare/SparkleSetup.cs:503 +#: ../SparkleShare/SparkleSetup.cs:510 msgid "" "All files added to your project folders are synced with the host " "automatically, as well as with your collaborators." msgstr "" "Todos los ficheros añadidos a tus carpetas de proyectos son sincronizadas " -"automaticamente con el equipo, asi como con tus colaboradores." +"automáticamente con el equipo, asi como con tus colaboradores." -#: ../SparkleShare/SparkleSetup.cs:520 +#: ../SparkleShare/SparkleSetup.cs:527 msgid "The status icon is here to help" msgstr "El icono de estado esta aquí para ayudarte" -#: ../SparkleShare/SparkleSetup.cs:521 +#: ../SparkleShare/SparkleSetup.cs:528 msgid "" "It shows the syncing process status, and contains links to your projects and" " the event log." @@ -370,11 +341,11 @@ msgstr "" "Muestra el proceso de sincronización, y contiene enlaces a tus proyectos y " "al registro de eventos." -#: ../SparkleShare/SparkleSetup.cs:538 +#: ../SparkleShare/SparkleSetup.cs:545 msgid "Adding projects to SparkleShare" msgstr "Añadiendo proyectos a SparkleShare" -#: ../SparkleShare/SparkleSetup.cs:539 +#: ../SparkleShare/SparkleSetup.cs:546 msgid "" "Just click this button when you see it on the web, and the project will be " "automatically added:" @@ -382,7 +353,7 @@ msgstr "" "Basta con hacer clic en este botón cuando lo veas en la web, y el proyecto " "se agregará automáticamente:" -#: ../SparkleShare/SparkleSetup.cs:542 +#: ../SparkleShare/SparkleSetup.cs:549 msgid "" "…or select ‘Add Hosted Project…’ from the status icon menu to add one" " by hand." @@ -390,34 +361,33 @@ msgstr "" "... o seleccione \"Agregar proyecto alojado ... \" en el menú del " "icono de estado para agregar uno manualmente." -#. Opens the wizard to add a new remote folder -#: ../SparkleShare/SparkleSetup.cs:551 -#: ../SparkleShare/SparkleStatusIcon.cs:238 -msgid "Add Hosted Project…" -msgstr "Añadir proyecto almacenado..." - #: ../SparkleShare/SparkleSetupWindow.cs:44 msgid "SparkleShare Setup" msgstr "Configuración de SparkleShare" -#: ../SparkleShare/SparkleStatusIcon.cs:228 +#: ../SparkleShare/SparkleStatusIcon.cs:230 msgid "No projects yet" msgstr "No hay proyectos aún" -#: ../SparkleShare/SparkleStatusIcon.cs:262 +#. Opens the wizard to add a new remote folder +#: ../SparkleShare/SparkleStatusIcon.cs:240 +msgid "Add Hosted Project…" +msgstr "Añadir proyecto almacenado..." + +#: ../SparkleShare/SparkleStatusIcon.cs:264 msgid "Open Recent Events" msgstr "Abrir eventos recientes" -#: ../SparkleShare/SparkleStatusIcon.cs:282 +#: ../SparkleShare/SparkleStatusIcon.cs:284 msgid "Turn Notifications Off" msgstr "Desactivar las notificaciones" -#: ../SparkleShare/SparkleStatusIcon.cs:284 +#: ../SparkleShare/SparkleStatusIcon.cs:286 msgid "Turn Notifications On" msgstr "Activar las notificaciones" #. A menu item that quits the application -#: ../SparkleShare/SparkleStatusIcon.cs:311 +#: ../SparkleShare/SparkleStatusIcon.cs:313 msgid "Quit" msgstr "Salir" From aeae84b017050e4f571220dd4c882688cb410a12 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sat, 24 Dec 2011 09:23:41 +0100 Subject: [PATCH 101/134] Update Italian translation from Transifex --- po/it.po | 268 +++++++++++++++++++++++++------------------------------ 1 file changed, 124 insertions(+), 144 deletions(-) diff --git a/po/it.po b/po/it.po index 26e9b608..63faad31 100755 --- a/po/it.po +++ b/po/it.po @@ -2,15 +2,16 @@ # # Translators: # Ilias Bartolini , 2011. +# , 2011. # Luca Delucchi , 2011. # Łukasz Jernaś , 2011. msgid "" msgstr "" "Project-Id-Version: SparkleShare\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-30 15:50+0100\n" -"PO-Revision-Date: 2011-10-30 14:50+0000\n" -"Last-Translator: deejay1 \n" +"POT-Creation-Date: 2011-12-04 12:45+0100\n" +"PO-Revision-Date: 2011-12-19 14:27+0000\n" +"Last-Translator: yakky \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -19,27 +20,27 @@ msgstr "" #: ../data/plugins/bitbucket.xml.in.h:1 ../data/plugins/github.xml.in.h:1 msgid "/username/project" -msgstr "" +msgstr "/nome-utente/progetto" #: ../data/plugins/bitbucket.xml.in.h:2 msgid "Bitbucket" -msgstr "" +msgstr "Bitbucket" #: ../data/plugins/bitbucket.xml.in.h:3 msgid "Free code hosting for Git and Mercurial" -msgstr "" +msgstr "Hosting gratuito di codice per Git e Mercurial" #: ../data/plugins/github.xml.in.h:2 msgid "Free public Git repositories with collaborator management" -msgstr "" +msgstr "Repository pubblici gratuiti con gestione dei collaboratori" #: ../data/plugins/github.xml.in.h:3 msgid "Github" -msgstr "" +msgstr "Github" #: ../data/plugins/gitorious.xml.in.h:1 msgid "/project/repository" -msgstr "" +msgstr "/progetto/repository" #: ../data/plugins/gitorious.xml.in.h:2 msgid "Gitorious" @@ -47,15 +48,15 @@ msgstr "Gitorius" #: ../data/plugins/gitorious.xml.in.h:3 msgid "Open source infrastructure for hosting open source projects" -msgstr "" +msgstr "Infrastruttura Open sourc per lo hosting di progetti open source" #: ../data/plugins/gnome.xml.in.h:1 msgid "/project" -msgstr "" +msgstr "/progetto" #: ../data/plugins/gnome.xml.in.h:2 msgid "A free and easy interface for your computer" -msgstr "" +msgstr "Un'interfaccia gratuita e facile per il tuo computer" #: ../data/plugins/gnome.xml.in.h:3 msgid "The GNOME Project" @@ -63,115 +64,120 @@ msgstr "The GNOME Project" #: ../data/plugins/own-server.xml.in.h:1 msgid "/path/to/project" -msgstr "" +msgstr "/percorso/per/progetto" #: ../data/plugins/own-server.xml.in.h:2 msgid "Everything under my control" -msgstr "" +msgstr "Tutto sotto il mio controllo" #: ../data/plugins/own-server.xml.in.h:3 msgid "On my own server" -msgstr "" +msgstr "Il mio server" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:70 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:88 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:84 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:102 #: ../SparkleShare/SparkleSetup.cs:75 ../SparkleShare/SparkleStatusIcon.cs:75 #: ../SparkleShare/SparkleStatusIcon.cs:89 msgid "Welcome to SparkleShare!" msgstr "Benvenuto in SparkleShare!" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:72 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:90 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:86 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:104 #: ../SparkleShare/SparkleStatusIcon.cs:77 #: ../SparkleShare/SparkleStatusIcon.cs:91 msgid "Up to date" msgstr "Aggiornato" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:99 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:113 #: ../SparkleShare/SparkleStatusIcon.cs:106 msgid "Syncing…" msgstr "Sincronizzazione in corso..." -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:109 -#: ../SparkleShare/SparkleStatusIcon.cs:116 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:125 +#: ../SparkleShare/SparkleStatusIcon.cs:118 msgid "Not everything is synced" msgstr "Non tutto è sincronizzato" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:113 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:141 msgid "Copy Web Link" msgstr "Copia link web" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:115 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:142 msgid "Copy the web address of this file to the clipboard" msgstr "Copia l'indirizzo web di questo file" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:147 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:174 msgid "Get Earlier Version" msgstr "Prendi versione precedente" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:149 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:175 msgid "Make a copy of an earlier version in this folder" msgstr "Esegui una copia di una precedente versione di questa cartella" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:161 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:162 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:188 msgid "Select to get a copy of this version" msgstr "Seleziona per ottenere una copia di questa versione" -#: ../SparkleShare/Program.cs:51 +#: ../SparkleShare/Program.cs:50 msgid "Print version information" msgstr "Stampa informazioni sulla versione" -#: ../SparkleShare/Program.cs:52 +#: ../SparkleShare/Program.cs:51 msgid "Show this help text" msgstr "Mostra questo messaggio di aiuto" -#: ../SparkleShare/Program.cs:84 +#: ../SparkleShare/Program.cs:83 msgid "SparkleShare, a collaboration and sharing tool." msgstr "SparkleShare, uno strumento collaborativo e di condivisione" -#: ../SparkleShare/Program.cs:85 +#: ../SparkleShare/Program.cs:84 msgid "Copyright (C) 2010 Hylke Bons" msgstr "Copyright (C) 2010 Hylke Bons" -#: ../SparkleShare/Program.cs:87 +#: ../SparkleShare/Program.cs:86 msgid "This program comes with ABSOLUTELY NO WARRANTY." msgstr "Questo programma viene fornito ASSOLUTAMENTE SENZA NESSUNA GARANZIA." -#: ../SparkleShare/Program.cs:89 +#: ../SparkleShare/Program.cs:88 msgid "This is free software, and you are welcome to redistribute it " msgstr "Questo è software libero e sei invitato a redistribuirlo" -#: ../SparkleShare/Program.cs:90 +#: ../SparkleShare/Program.cs:89 msgid "under certain conditions. Please read the GNU GPLv3 for details." msgstr "" "rispettando alcune restrizioni. Leggi la licenza GNU GPLv3 per i dettagli" -#: ../SparkleShare/Program.cs:92 +#: ../SparkleShare/Program.cs:91 msgid "SparkleShare automatically syncs Git repositories in " msgstr "SparkleShare sincronizza automaticamente i repository Git nella" -#: ../SparkleShare/Program.cs:93 +#: ../SparkleShare/Program.cs:92 msgid "the ~/SparkleShare folder with their remote origins." msgstr "cartella ~/.SparkleShare con le loro origini." -#: ../SparkleShare/Program.cs:95 +#: ../SparkleShare/Program.cs:94 msgid "Usage: sparkleshare [start|stop|restart] [OPTION]..." msgstr "Utilizzo: sparkleshare [start|stop|restart] [OPTION]..." -#: ../SparkleShare/Program.cs:96 +#: ../SparkleShare/Program.cs:95 msgid "Sync SparkleShare folder with remote repositories." msgstr "Sincronizza cartella SparkleShare con repository remoti." -#: ../SparkleShare/Program.cs:98 +#: ../SparkleShare/Program.cs:97 msgid "Arguments:" msgstr "Argomenti" -#: ../SparkleShare/Program.cs:108 +#: ../SparkleShare/Program.cs:107 msgid "SparkleShare " msgstr "SparkleShare " #. A menu item that takes the user to http://www.sparkleshare.org/ -#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:295 +#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:297 msgid "About SparkleShare" msgstr "Informazioni su SparkleShare" @@ -182,67 +188,32 @@ msgstr "È disponibile una nuova versione ({0})" #: ../SparkleShare/SparkleAbout.cs:79 msgid "You are running the latest version." -msgstr "Stai lanciando l'ultima versione" +msgstr "Stai eseguendo l'ultima versione" -#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:113 +#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:110 msgid "Checking for updates..." -msgstr "Controllando per aggiornamenti..." +msgstr "Controllo aggiornamenti..." -#: ../SparkleShare/SparkleControllerBase.cs:493 +#: ../SparkleShare/SparkleControllerBase.cs:489 msgid "dddd, MMMM d, yyyy" -msgstr "" +msgstr "dddd, MMMM d, yyyy" -#: ../SparkleShare/SparkleControllerBase.cs:499 +#: ../SparkleShare/SparkleControllerBase.cs:495 msgid "dddd, MMMM d" -msgstr "" +msgstr "dddd, MMMM d" -#: ../SparkleShare/SparkleControllerBase.cs:707 -#, csharp-format -msgid "added ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:712 -#, csharp-format -msgid "moved ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:717 -#, csharp-format -msgid "edited ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:722 -#, csharp-format -msgid "deleted ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:731 -#, csharp-format -msgid "and {0} more" -msgid_plural "and {0} more" -msgstr[0] "" -msgstr[1] "" - -#: ../SparkleShare/SparkleControllerBase.cs:735 -msgid "did something magical" -msgstr "" - -#: ../SparkleShare/SparkleEventLog.cs:58 +#: ../SparkleShare/SparkleEventLog.cs:56 msgid "Recent Events" msgstr "Eventi recenti" -#: ../SparkleShare/SparkleEventLog.cs:169 -#: ../SparkleShare/SparkleEventLog.cs:188 +#: ../SparkleShare/SparkleEventLog.cs:145 +#: ../SparkleShare/SparkleEventLog.cs:164 msgid "All Folders" msgstr "Tutte le cartelle" -#: ../SparkleShare/SparkleSetup.cs:76 -msgid "" -"Before we can create a SparkleShare folder on this computer, we need a few " -"bits of information from you." -msgstr "" -"Prima di poter creare una cartella SparkleShare in questo computer, abbiamo " -"bisogno di qualche informazione da voi." +#: ../SparkleShare/SparkleOptions.cs:486 +msgid "OptionName" +msgstr "OptionName" #: ../SparkleShare/SparkleSetup.cs:83 msgid "Full Name:" @@ -258,153 +229,162 @@ msgstr "Successivo" #: ../SparkleShare/SparkleSetup.cs:129 msgid "Where's your project hosted?" -msgstr "" +msgstr "Dov'è ospitato il tuo progetto?" -#: ../SparkleShare/SparkleSetup.cs:275 +#: ../SparkleShare/SparkleSetup.cs:266 msgid "Address" -msgstr "" +msgstr "Indirizzo" -#: ../SparkleShare/SparkleSetup.cs:295 +#: ../SparkleShare/SparkleSetup.cs:286 msgid "Remote Path" -msgstr "" +msgstr "Percorso remoto" #. Cancel button -#: ../SparkleShare/SparkleSetup.cs:309 ../SparkleShare/SparkleSetup.cs:345 +#: ../SparkleShare/SparkleSetup.cs:300 ../SparkleShare/SparkleSetup.cs:336 msgid "Cancel" msgstr "Cancella" #. Sync button -#: ../SparkleShare/SparkleSetup.cs:316 +#: ../SparkleShare/SparkleSetup.cs:307 msgid "Add" -msgstr "" +msgstr "Aggiungi" -#: ../SparkleShare/SparkleSetup.cs:335 +#: ../SparkleShare/SparkleSetup.cs:326 #, csharp-format msgid "Adding project ‘{0}’…" -msgstr "" +msgstr "Progetto '{0}' in aggiunta..." -#: ../SparkleShare/SparkleSetup.cs:336 +#: ../SparkleShare/SparkleSetup.cs:327 msgid "This may take a while." msgstr "Questa operazione potrebbe richiedere un po' di tempo." -#: ../SparkleShare/SparkleSetup.cs:337 +#: ../SparkleShare/SparkleSetup.cs:328 msgid "Are you sure it’s not coffee o'clock?" msgstr "Sei sicuro che non sia l'ora di un caffè?" -#: ../SparkleShare/SparkleSetup.cs:341 ../SparkleShare/SparkleSetup.cs:457 -#: ../SparkleShare/SparkleSetup.cs:556 +#: ../SparkleShare/SparkleSetup.cs:332 ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:558 msgid "Finish" -msgstr "Finito" +msgstr "Fine" -#: ../SparkleShare/SparkleSetup.cs:374 +#: ../SparkleShare/SparkleSetup.cs:365 msgid "Something went wrong" msgstr "Qualcosa è andato storto" -#: ../SparkleShare/SparkleSetup.cs:422 +#: ../SparkleShare/SparkleSetup.cs:413 msgid "Try Again…" -msgstr "" +msgstr "Prova ancora..." -#: ../SparkleShare/SparkleSetup.cs:441 +#: ../SparkleShare/SparkleSetup.cs:432 #, csharp-format msgid "‘{0}’ has been successfully added" msgstr "‘{0}’ è stato aggiunto con successo" -#: ../SparkleShare/SparkleSetup.cs:447 +#: ../SparkleShare/SparkleSetup.cs:438 msgid "Project successfully added!" -msgstr "" +msgstr "Progetto aggiunto con successo" -#: ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:439 msgid "Access the files from your SparkleShare folder." -msgstr "" +msgstr "Accedi i file dalla tua cartella SparkleShare." #. A button that opens the synced folder -#: ../SparkleShare/SparkleSetup.cs:451 +#: ../SparkleShare/SparkleSetup.cs:442 msgid "Open Folder" msgstr "Apri cartella" -#: ../SparkleShare/SparkleSetup.cs:477 +#: ../SparkleShare/SparkleSetup.cs:484 msgid "What's happening next?" -msgstr "" +msgstr "Cosa fare adesso?" -#: ../SparkleShare/SparkleSetup.cs:478 +#: ../SparkleShare/SparkleSetup.cs:485 msgid "" "SparkleShare creates a special folder in your personal folder that will keep" " track of your projects." msgstr "" +"SparkleShare crea una cartella speciale nella tua cartella personale per " +"tenere traccia dei tuoi progetti." -#: ../SparkleShare/SparkleSetup.cs:481 +#: ../SparkleShare/SparkleSetup.cs:488 msgid "Skip Tutorial" -msgstr "" +msgstr "Salta l'Introduzione" -#: ../SparkleShare/SparkleSetup.cs:486 ../SparkleShare/SparkleSetup.cs:506 -#: ../SparkleShare/SparkleSetup.cs:524 +#: ../SparkleShare/SparkleSetup.cs:493 ../SparkleShare/SparkleSetup.cs:513 +#: ../SparkleShare/SparkleSetup.cs:531 msgid "Continue" -msgstr "" +msgstr "Continua" -#: ../SparkleShare/SparkleSetup.cs:502 +#: ../SparkleShare/SparkleSetup.cs:509 msgid "Sharing files with others" -msgstr "" +msgstr "Condividere i tuoi file con altri" -#: ../SparkleShare/SparkleSetup.cs:503 +#: ../SparkleShare/SparkleSetup.cs:510 msgid "" "All files added to your project folders are synced with the host " "automatically, as well as with your collaborators." msgstr "" +"Tutti i file inseriti nelle cartelle dei tuoi progetti sono sincronizzati in" +" automatico con il server e con i tuoi collaboratori." -#: ../SparkleShare/SparkleSetup.cs:520 +#: ../SparkleShare/SparkleSetup.cs:527 msgid "The status icon is here to help" -msgstr "" +msgstr "L'icona di stato è qui per aiutare" -#: ../SparkleShare/SparkleSetup.cs:521 +#: ../SparkleShare/SparkleSetup.cs:528 msgid "" "It shows the syncing process status, and contains links to your projects and" " the event log." msgstr "" +"Mostra il progresso della sicronizzazione, e contiene collegamenti ai tuoi " +"progetti e al registro degli eventi." -#: ../SparkleShare/SparkleSetup.cs:538 +#: ../SparkleShare/SparkleSetup.cs:545 msgid "Adding projects to SparkleShare" -msgstr "" +msgstr "Aggiungere progetti a SparkleShare" -#: ../SparkleShare/SparkleSetup.cs:539 +#: ../SparkleShare/SparkleSetup.cs:546 msgid "" "Just click this button when you see it on the web, and the project will be " "automatically added:" msgstr "" +"Fai click su questo bottone quando lo vedi sul web e il progetto sarà " +"automaticamente aggiunto:" -#: ../SparkleShare/SparkleSetup.cs:542 +#: ../SparkleShare/SparkleSetup.cs:549 msgid "" "…or select ‘Add Hosted Project…’ from the status icon menu to add one" " by hand." msgstr "" - -#. Opens the wizard to add a new remote folder -#: ../SparkleShare/SparkleSetup.cs:551 -#: ../SparkleShare/SparkleStatusIcon.cs:238 -msgid "Add Hosted Project…" -msgstr "" +"...o seleziona 'Aggiungi progetto ospitato' dall'icona di stato per " +"aggiungerne uno a mano." #: ../SparkleShare/SparkleSetupWindow.cs:44 msgid "SparkleShare Setup" msgstr "Impostazioni " -#: ../SparkleShare/SparkleStatusIcon.cs:228 +#: ../SparkleShare/SparkleStatusIcon.cs:230 msgid "No projects yet" -msgstr "" +msgstr "Nessun progetto per il momento" -#: ../SparkleShare/SparkleStatusIcon.cs:262 +#. Opens the wizard to add a new remote folder +#: ../SparkleShare/SparkleStatusIcon.cs:240 +msgid "Add Hosted Project…" +msgstr "Aggiungi progetto ospitato..." + +#: ../SparkleShare/SparkleStatusIcon.cs:264 msgid "Open Recent Events" -msgstr "" +msgstr "Apri eventi recenti" -#: ../SparkleShare/SparkleStatusIcon.cs:282 +#: ../SparkleShare/SparkleStatusIcon.cs:284 msgid "Turn Notifications Off" msgstr "Spegni le notifiche" -#: ../SparkleShare/SparkleStatusIcon.cs:284 +#: ../SparkleShare/SparkleStatusIcon.cs:286 msgid "Turn Notifications On" msgstr "Accendi le notifiche" #. A menu item that quits the application -#: ../SparkleShare/SparkleStatusIcon.cs:311 +#: ../SparkleShare/SparkleStatusIcon.cs:313 msgid "Quit" msgstr "Esci" From f37259c09fd691c1e386951aaa417a837303e25d Mon Sep 17 00:00:00 2001 From: Aleksandar Antoski Date: Sat, 24 Dec 2011 09:24:46 +0100 Subject: [PATCH 102/134] Update Serbian (Russian) translation from Transifex --- po/sr_RS.po | 204 ++++++++++++++++++++++------------------------------ 1 file changed, 86 insertions(+), 118 deletions(-) diff --git a/po/sr_RS.po b/po/sr_RS.po index 17998169..cc38f7f1 100755 --- a/po/sr_RS.po +++ b/po/sr_RS.po @@ -1,15 +1,16 @@ # This file is distributed under the same license as the SparkleShare package. # # Translators: +# Aleksandar Antoski , 2011. # , 2011. # Небојша Јаковљевић , 2011. msgid "" msgstr "" "Project-Id-Version: SparkleShare\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-30 15:50+0100\n" -"PO-Revision-Date: 2011-10-30 14:50+0000\n" -"Last-Translator: deejay1 \n" +"POT-Creation-Date: 2011-12-04 12:45+0100\n" +"PO-Revision-Date: 2011-12-22 10:42+0000\n" +"Last-Translator: Aleksandar Antoski \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -72,104 +73,109 @@ msgstr "" msgid "On my own server" msgstr "" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:70 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:88 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:84 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:102 #: ../SparkleShare/SparkleSetup.cs:75 ../SparkleShare/SparkleStatusIcon.cs:75 #: ../SparkleShare/SparkleStatusIcon.cs:89 msgid "Welcome to SparkleShare!" msgstr "Добродошли у СпарклШер!" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:72 -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:90 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:86 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:104 #: ../SparkleShare/SparkleStatusIcon.cs:77 #: ../SparkleShare/SparkleStatusIcon.cs:91 msgid "Up to date" msgstr "Све је синхронизовано" -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:99 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:113 #: ../SparkleShare/SparkleStatusIcon.cs:106 msgid "Syncing…" msgstr "Синхронизација..." -#: ../SparkleShare/Mac/SparkleStatusIcon.cs:109 -#: ../SparkleShare/SparkleStatusIcon.cs:116 +#: ../SparkleShare/Mac/SparkleStatusIcon.cs:125 +#: ../SparkleShare/SparkleStatusIcon.cs:118 msgid "Not everything is synced" msgstr "Није све синхронизовано" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:113 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:141 msgid "Copy Web Link" msgstr "Копирај веб линк" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:114 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:115 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:142 msgid "Copy the web address of this file to the clipboard" msgstr "Копирај веб адресу ове датотеке" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:147 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:174 msgid "Get Earlier Version" msgstr "Добави ранију верзију" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:148 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:149 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:175 msgid "Make a copy of an earlier version in this folder" msgstr "Направи копију раније верзије у овом директоријуму" -#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:161 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus-extension.py.in:162 +#: ../SparkleShare/Nautilus/sparkleshare-nautilus3-extension.py.in:188 msgid "Select to get a copy of this version" msgstr "Изабери да добавиш копију ове верзије" -#: ../SparkleShare/Program.cs:51 +#: ../SparkleShare/Program.cs:50 msgid "Print version information" msgstr "Исписује информацију о верзији" -#: ../SparkleShare/Program.cs:52 +#: ../SparkleShare/Program.cs:51 msgid "Show this help text" msgstr "Приказује овај текст помоћи" -#: ../SparkleShare/Program.cs:84 +#: ../SparkleShare/Program.cs:83 msgid "SparkleShare, a collaboration and sharing tool." msgstr "СпарклШер, алатка за сарадњу и дељење." -#: ../SparkleShare/Program.cs:85 +#: ../SparkleShare/Program.cs:84 msgid "Copyright (C) 2010 Hylke Bons" msgstr "Copyright (C) 2010 Hylke Bons" -#: ../SparkleShare/Program.cs:87 +#: ../SparkleShare/Program.cs:86 msgid "This program comes with ABSOLUTELY NO WARRANTY." msgstr "Овај програм долази БЕЗ ИКАКВЕ ГАРАНЦИЈЕ." -#: ../SparkleShare/Program.cs:89 +#: ../SparkleShare/Program.cs:88 msgid "This is free software, and you are welcome to redistribute it " msgstr "Ово је слободан софтвер, и можете га редистрибуирати" -#: ../SparkleShare/Program.cs:90 +#: ../SparkleShare/Program.cs:89 msgid "under certain conditions. Please read the GNU GPLv3 for details." msgstr "под одређеним условима. Молимо прочитајте ГНУ ОЈЛв3 за више детаља." -#: ../SparkleShare/Program.cs:92 +#: ../SparkleShare/Program.cs:91 msgid "SparkleShare automatically syncs Git repositories in " msgstr "СпарклШер аутоматски синхронизује Гит ризнице у" -#: ../SparkleShare/Program.cs:93 +#: ../SparkleShare/Program.cs:92 msgid "the ~/SparkleShare folder with their remote origins." msgstr "директоријуму ~/SparkleShare са њиховим удаљеним изворима." -#: ../SparkleShare/Program.cs:95 +#: ../SparkleShare/Program.cs:94 msgid "Usage: sparkleshare [start|stop|restart] [OPTION]..." msgstr "Употреба: sparkleshare [start|stop|restart] [OPTION]..." -#: ../SparkleShare/Program.cs:96 +#: ../SparkleShare/Program.cs:95 msgid "Sync SparkleShare folder with remote repositories." msgstr "Синхронизуј СпарклШер директоријум са удаљеним ризницама." -#: ../SparkleShare/Program.cs:98 +#: ../SparkleShare/Program.cs:97 msgid "Arguments:" msgstr "Аргументи:" -#: ../SparkleShare/Program.cs:108 +#: ../SparkleShare/Program.cs:107 msgid "SparkleShare " msgstr "СпарклШер" #. A menu item that takes the user to http://www.sparkleshare.org/ -#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:295 +#: ../SparkleShare/SparkleAbout.cs:53 ../SparkleShare/SparkleStatusIcon.cs:297 msgid "About SparkleShare" msgstr "О СпарклШеру" @@ -182,67 +188,30 @@ msgstr "Новија верзија ({0}) је доступна!" msgid "You are running the latest version." msgstr "Кориситите последњу верзију." -#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:113 +#: ../SparkleShare/SparkleAbout.cs:88 ../SparkleShare/SparkleAbout.cs:110 msgid "Checking for updates..." msgstr "Проверавам освежења..." -#: ../SparkleShare/SparkleControllerBase.cs:493 +#: ../SparkleShare/SparkleControllerBase.cs:489 msgid "dddd, MMMM d, yyyy" msgstr "" -#: ../SparkleShare/SparkleControllerBase.cs:499 +#: ../SparkleShare/SparkleControllerBase.cs:495 msgid "dddd, MMMM d" msgstr "" -#: ../SparkleShare/SparkleControllerBase.cs:707 -#, csharp-format -msgid "added ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:712 -#, csharp-format -msgid "moved ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:717 -#, csharp-format -msgid "edited ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:722 -#, csharp-format -msgid "deleted ‘{0}’" -msgstr "" - -#: ../SparkleShare/SparkleControllerBase.cs:731 -#, csharp-format -msgid "and {0} more" -msgid_plural "and {0} more" -msgstr[0] "" -msgstr[1] "" -msgstr[2] "" -msgstr[3] "" - -#: ../SparkleShare/SparkleControllerBase.cs:735 -msgid "did something magical" -msgstr "" - -#: ../SparkleShare/SparkleEventLog.cs:58 +#: ../SparkleShare/SparkleEventLog.cs:56 msgid "Recent Events" msgstr "Скорашњи догађаји" -#: ../SparkleShare/SparkleEventLog.cs:169 -#: ../SparkleShare/SparkleEventLog.cs:188 +#: ../SparkleShare/SparkleEventLog.cs:145 +#: ../SparkleShare/SparkleEventLog.cs:164 msgid "All Folders" msgstr "Сви директоријуми" -#: ../SparkleShare/SparkleSetup.cs:76 -msgid "" -"Before we can create a SparkleShare folder on this computer, we need a few " -"bits of information from you." +#: ../SparkleShare/SparkleOptions.cs:486 +msgid "OptionName" msgstr "" -"Пре него што направимо СпарклШер директоријум на овом рачунару, потребно нам" -" је неколико информација од Вас." #: ../SparkleShare/SparkleSetup.cs:83 msgid "Full Name:" @@ -260,151 +229,150 @@ msgstr "Даље" msgid "Where's your project hosted?" msgstr "" -#: ../SparkleShare/SparkleSetup.cs:275 +#: ../SparkleShare/SparkleSetup.cs:266 msgid "Address" msgstr "" -#: ../SparkleShare/SparkleSetup.cs:295 +#: ../SparkleShare/SparkleSetup.cs:286 msgid "Remote Path" msgstr "" #. Cancel button -#: ../SparkleShare/SparkleSetup.cs:309 ../SparkleShare/SparkleSetup.cs:345 +#: ../SparkleShare/SparkleSetup.cs:300 ../SparkleShare/SparkleSetup.cs:336 msgid "Cancel" msgstr "Одустани" #. Sync button -#: ../SparkleShare/SparkleSetup.cs:316 +#: ../SparkleShare/SparkleSetup.cs:307 msgid "Add" -msgstr "" +msgstr "Додајте" -#: ../SparkleShare/SparkleSetup.cs:335 +#: ../SparkleShare/SparkleSetup.cs:326 #, csharp-format msgid "Adding project ‘{0}’…" -msgstr "" +msgstr "Додавање пројекта ‘{0}’…" -#: ../SparkleShare/SparkleSetup.cs:336 +#: ../SparkleShare/SparkleSetup.cs:327 msgid "This may take a while." msgstr "Ово може да потраје." -#: ../SparkleShare/SparkleSetup.cs:337 +#: ../SparkleShare/SparkleSetup.cs:328 msgid "Are you sure it’s not coffee o'clock?" msgstr "Да ли сте сигурни да није време за кафу?" -#: ../SparkleShare/SparkleSetup.cs:341 ../SparkleShare/SparkleSetup.cs:457 -#: ../SparkleShare/SparkleSetup.cs:556 +#: ../SparkleShare/SparkleSetup.cs:332 ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:558 msgid "Finish" msgstr "Заврши" -#: ../SparkleShare/SparkleSetup.cs:374 +#: ../SparkleShare/SparkleSetup.cs:365 msgid "Something went wrong" msgstr "Нешто је пошло наопако" -#: ../SparkleShare/SparkleSetup.cs:422 +#: ../SparkleShare/SparkleSetup.cs:413 msgid "Try Again…" -msgstr "" +msgstr "Покушајте поново..." -#: ../SparkleShare/SparkleSetup.cs:441 +#: ../SparkleShare/SparkleSetup.cs:432 #, csharp-format msgid "‘{0}’ has been successfully added" msgstr "‘{0}’ успешно додато" -#: ../SparkleShare/SparkleSetup.cs:447 +#: ../SparkleShare/SparkleSetup.cs:438 msgid "Project successfully added!" -msgstr "" +msgstr "Пројекат је успешно додат!" -#: ../SparkleShare/SparkleSetup.cs:448 +#: ../SparkleShare/SparkleSetup.cs:439 msgid "Access the files from your SparkleShare folder." msgstr "" #. A button that opens the synced folder -#: ../SparkleShare/SparkleSetup.cs:451 +#: ../SparkleShare/SparkleSetup.cs:442 msgid "Open Folder" msgstr "Отвори директоријум" -#: ../SparkleShare/SparkleSetup.cs:477 +#: ../SparkleShare/SparkleSetup.cs:484 msgid "What's happening next?" msgstr "" -#: ../SparkleShare/SparkleSetup.cs:478 +#: ../SparkleShare/SparkleSetup.cs:485 msgid "" "SparkleShare creates a special folder in your personal folder that will keep" " track of your projects." msgstr "" -#: ../SparkleShare/SparkleSetup.cs:481 +#: ../SparkleShare/SparkleSetup.cs:488 msgid "Skip Tutorial" -msgstr "" +msgstr "Прескочи туторијал" -#: ../SparkleShare/SparkleSetup.cs:486 ../SparkleShare/SparkleSetup.cs:506 -#: ../SparkleShare/SparkleSetup.cs:524 +#: ../SparkleShare/SparkleSetup.cs:493 ../SparkleShare/SparkleSetup.cs:513 +#: ../SparkleShare/SparkleSetup.cs:531 msgid "Continue" -msgstr "" +msgstr "Настави" -#: ../SparkleShare/SparkleSetup.cs:502 +#: ../SparkleShare/SparkleSetup.cs:509 msgid "Sharing files with others" msgstr "" -#: ../SparkleShare/SparkleSetup.cs:503 +#: ../SparkleShare/SparkleSetup.cs:510 msgid "" "All files added to your project folders are synced with the host " "automatically, as well as with your collaborators." msgstr "" -#: ../SparkleShare/SparkleSetup.cs:520 +#: ../SparkleShare/SparkleSetup.cs:527 msgid "The status icon is here to help" msgstr "" -#: ../SparkleShare/SparkleSetup.cs:521 +#: ../SparkleShare/SparkleSetup.cs:528 msgid "" "It shows the syncing process status, and contains links to your projects and" " the event log." msgstr "" -#: ../SparkleShare/SparkleSetup.cs:538 +#: ../SparkleShare/SparkleSetup.cs:545 msgid "Adding projects to SparkleShare" msgstr "" -#: ../SparkleShare/SparkleSetup.cs:539 +#: ../SparkleShare/SparkleSetup.cs:546 msgid "" "Just click this button when you see it on the web, and the project will be " "automatically added:" msgstr "" -#: ../SparkleShare/SparkleSetup.cs:542 +#: ../SparkleShare/SparkleSetup.cs:549 msgid "" "…or select ‘Add Hosted Project…’ from the status icon menu to add one" " by hand." msgstr "" -#. Opens the wizard to add a new remote folder -#: ../SparkleShare/SparkleSetup.cs:551 -#: ../SparkleShare/SparkleStatusIcon.cs:238 -msgid "Add Hosted Project…" -msgstr "" - #: ../SparkleShare/SparkleSetupWindow.cs:44 msgid "SparkleShare Setup" msgstr "СпарклШер подешавања" -#: ../SparkleShare/SparkleStatusIcon.cs:228 +#: ../SparkleShare/SparkleStatusIcon.cs:230 msgid "No projects yet" msgstr "" -#: ../SparkleShare/SparkleStatusIcon.cs:262 +#. Opens the wizard to add a new remote folder +#: ../SparkleShare/SparkleStatusIcon.cs:240 +msgid "Add Hosted Project…" +msgstr "" + +#: ../SparkleShare/SparkleStatusIcon.cs:264 msgid "Open Recent Events" msgstr "" -#: ../SparkleShare/SparkleStatusIcon.cs:282 +#: ../SparkleShare/SparkleStatusIcon.cs:284 msgid "Turn Notifications Off" msgstr "Угаси обавештења" -#: ../SparkleShare/SparkleStatusIcon.cs:284 +#: ../SparkleShare/SparkleStatusIcon.cs:286 msgid "Turn Notifications On" msgstr "Укључи обавештења" #. A menu item that quits the application -#: ../SparkleShare/SparkleStatusIcon.cs:311 +#: ../SparkleShare/SparkleStatusIcon.cs:313 msgid "Quit" msgstr "Крај рада" From 867098d4830558beffb9199e075fd7dc6b02a079 Mon Sep 17 00:00:00 2001 From: wimh Date: Wed, 28 Dec 2011 01:02:30 +0100 Subject: [PATCH 103/134] Continue translation --- SparkleShare/SparkleBubblesController.cs | 10 ++- SparkleShare/SparkleControllerBase.cs | 13 ++-- SparkleShare/SparkleUI.cs | 2 +- SparkleShare/Windows/Program.cs | 26 ++++++- SparkleShare/Windows/SparkleAbout.cs | 5 +- SparkleShare/Windows/SparkleEventLog.cs | 5 +- SparkleShare/Windows/SparkleSetup.Designer.cs | 74 +++++++++++-------- SparkleShare/Windows/SparkleSetup.cs | 7 +- SparkleShare/Windows/SparkleStatusIcon.cs | 6 +- SparkleShare/Windows/SparkleUIHelpers.cs | 13 ++++ 10 files changed, 109 insertions(+), 52 deletions(-) diff --git a/SparkleShare/SparkleBubblesController.cs b/SparkleShare/SparkleBubblesController.cs index dd660b8a..1aae7d10 100755 --- a/SparkleShare/SparkleBubblesController.cs +++ b/SparkleShare/SparkleBubblesController.cs @@ -24,12 +24,18 @@ namespace SparkleShare { public event ShowBubbleEventHandler ShowBubbleEvent; public delegate void ShowBubbleEventHandler (string title, string subtext, string image_path); + // Short alias for the translations + public static string _ (string s) + { + string t=Program._ (s); + return t; + } public SparkleBubblesController () { Program.Controller.ConflictNotificationRaised += delegate { - ShowBubble ("Ouch! Mid-air collision!", - "Don't worry, SparkleShare made a copy of each conflicting file.", + ShowBubble (_("Ouch! Mid-air collision!"), + _("Don't worry, SparkleShare made a copy of each conflicting file."), null); }; diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 4f202b00..b03ab7e9 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -89,11 +89,7 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { -#if __MonoCS__ - return Catalog.GetString (s); -#else - return s; -#endif + return Program._ (s); } @@ -359,6 +355,12 @@ namespace SparkleShare { string event_entry_html = EventEntryHTML; string event_log = ""; + event_entry_html = event_entry_html + .Replace ("Add note", _ ("Add note")) + .Replace ("Show all", _ ("Show all")); + event_log_html = event_log_html + .Replace ("Show all", _ ("Show all")); + foreach (ActivityDay activity_day in activity_days) { string event_entries = ""; @@ -600,6 +602,7 @@ namespace SparkleShare { }; repo.ConflictResolved += delegate { + Program.SetUiCulture(); if (ConflictNotificationRaised != null) ConflictNotificationRaised (); }; diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index d27f7bd9..576710bc 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -46,7 +46,7 @@ namespace SparkleShare { // Short alias for the translations public static string _(string s) { - return s; + return Program._ (s); } diff --git a/SparkleShare/Windows/Program.cs b/SparkleShare/Windows/Program.cs index b254ea4f..01e27275 100644 --- a/SparkleShare/Windows/Program.cs +++ b/SparkleShare/Windows/Program.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; +using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -48,14 +49,27 @@ namespace SparkleShare { return Strings.T(s); #endif } - + +#if !__MonoCS__ + public static void TranslateWinForm (System.Windows.Forms.Form form) + { + form.Text = Program._ (form.Text); + + foreach (var label in form.Controls.All ().OfType ()) { + label.Text = Program._ (label.Text); + } + foreach (var button in form.Controls.All ().OfType ()) { + button.Text = Program._ (button.Text); + } + } +#endif + #if !__MonoCS__ [STAThread] #endif public static void Main (string [] args) { - //var culture = CultureInfo.GetCultureInfo ("en"); // FIXME: test only - //System.Threading.Thread.CurrentThread.CurrentUICulture = culture; + SetUiCulture(); // Parse the command line options bool show_help = false; @@ -96,6 +110,12 @@ namespace SparkleShare { #endif } + public static void SetUiCulture() + { + //var culture = CultureInfo.GetCultureInfo ("en"); // FIXME: test only + //System.Threading.Thread.CurrentThread.CurrentUICulture = culture; + } + // Prints the help output public static void ShowHelp (OptionSet option_set) diff --git a/SparkleShare/Windows/SparkleAbout.cs b/SparkleShare/Windows/SparkleAbout.cs index e1c27088..768b7c97 100644 --- a/SparkleShare/Windows/SparkleAbout.cs +++ b/SparkleShare/Windows/SparkleAbout.cs @@ -18,6 +18,7 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Net; using System.Windows.Forms; @@ -32,7 +33,7 @@ namespace SparkleShare { // Short alias for the translations public static string _(string s) { - return s; + return Program._(s); } @@ -49,6 +50,8 @@ namespace SparkleShare { this.MinimumSize = this.Size; this.version.Text = ""; + Program.TranslateWinForm (this); + Controller.NewVersionEvent += delegate (string new_version) { this.version.Invoke((Action)delegate { this.version.Text = new_version; diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index 765671d6..cc267676 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -44,13 +44,15 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return s; + return Program._ (s); } public SparkleEventLog () { InitializeComponent (); + Program.TranslateWinForm (this); + this.Icon = Icons.sparkleshare; this.change_sets = Program.Controller.GetLog (null); @@ -87,6 +89,7 @@ namespace SparkleShare { public void UpdateEvents (bool silent) { Thread thread = new Thread (new ThreadStart (delegate { + Program.SetUiCulture (); Stopwatch watch = new Stopwatch (); watch.Start (); this.change_sets = Program.Controller.GetLog (this.selected_log); diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 1682eeea..99a427ae 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -45,9 +45,10 @@ namespace SparkleShare { this.buttonCancel = new System.Windows.Forms.Button (); this.label4 = new System.Windows.Forms.Label (); this.syncingPage = new System.Windows.Forms.TabPage (); + this.label16 = new System.Windows.Forms.Label (); + this.label15 = new System.Windows.Forms.Label (); this.syncingProgressBar = new System.Windows.Forms.ProgressBar (); this.buttonFinish = new System.Windows.Forms.Button (); - this.label7 = new System.Windows.Forms.Label (); this.label6 = new System.Windows.Forms.Label (); this.errorPage = new System.Windows.Forms.TabPage (); this.buttonTryAgain = new System.Windows.Forms.Button (); @@ -118,7 +119,6 @@ namespace SparkleShare { this.groupBox1.Size = new System.Drawing.Size (471, 102); this.groupBox1.TabIndex = 7; this.groupBox1.TabStop = false; - this.groupBox1.Text = "Information about you"; // // EmailEntry // @@ -152,9 +152,9 @@ namespace SparkleShare { this.label12.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label12.Location = new System.Drawing.Point (15, 31); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size (65, 13); + this.label12.Size = new System.Drawing.Size (67, 13); this.label12.TabIndex = 7; - this.label12.Text = "Full name:"; + this.label12.Text = "Full Name:"; // // label11 // @@ -163,7 +163,7 @@ namespace SparkleShare { this.label11.Size = new System.Drawing.Size (307, 62); this.label11.TabIndex = 2; this.label11.Text = "Before we can create a SparkleShare folder on this computer, we need a few bits o" + - "f information from you.\r\n"; + "f information from you."; // // label10 // @@ -178,7 +178,7 @@ namespace SparkleShare { // buttonNext // this.buttonNext.Enabled = false; - this.buttonNext.Location = new System.Drawing.Point (410, 316); + this.buttonNext.Location = new System.Drawing.Point (416, 339); this.buttonNext.Name = "buttonNext"; this.buttonNext.Size = new System.Drawing.Size (75, 23); this.buttonNext.TabIndex = 0; @@ -230,9 +230,9 @@ namespace SparkleShare { this.label5.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.Location = new System.Drawing.Point (197, 267); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (113, 20); + this.label5.Size = new System.Drawing.Size (114, 20); this.label5.TabIndex = 15; - this.label5.Text = "Remote path"; + this.label5.Text = "Remote Path"; // // label14 // @@ -258,7 +258,7 @@ namespace SparkleShare { this.buttonSync.Name = "buttonSync"; this.buttonSync.Size = new System.Drawing.Size (75, 23); this.buttonSync.TabIndex = 9; - this.buttonSync.Text = "Sync"; + this.buttonSync.Text = "Add"; this.buttonSync.UseVisualStyleBackColor = true; this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); // @@ -278,15 +278,16 @@ namespace SparkleShare { this.label4.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.Location = new System.Drawing.Point (8, 18); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (68, 20); + this.label4.Size = new System.Drawing.Size (243, 20); this.label4.TabIndex = 0; - this.label4.Text = "Header"; + this.label4.Text = "Where\'s your project hosted?"; // // syncingPage // + this.syncingPage.Controls.Add (this.label16); + this.syncingPage.Controls.Add (this.label15); this.syncingPage.Controls.Add (this.syncingProgressBar); this.syncingPage.Controls.Add (this.buttonFinish); - this.syncingPage.Controls.Add (this.label7); this.syncingPage.Controls.Add (this.label6); this.syncingPage.Location = new System.Drawing.Point (4, 22); this.syncingPage.Name = "syncingPage"; @@ -295,6 +296,24 @@ namespace SparkleShare { this.syncingPage.Text = "Syncing"; this.syncingPage.UseVisualStyleBackColor = true; // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point (11, 57); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size (176, 13); + this.label16.TabIndex = 5; + this.label16.Text = "Are you sure its not coffee o\'clock?"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point (11, 44); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size (112, 13); + this.label15.TabIndex = 4; + this.label15.Text = "This may take a while."; + // // syncingProgressBar // this.syncingProgressBar.Location = new System.Drawing.Point (14, 109); @@ -305,7 +324,7 @@ namespace SparkleShare { // buttonFinish // this.buttonFinish.Enabled = false; - this.buttonFinish.Location = new System.Drawing.Point (431, 350); + this.buttonFinish.Location = new System.Drawing.Point (416, 339); this.buttonFinish.Name = "buttonFinish"; this.buttonFinish.Size = new System.Drawing.Size (75, 23); this.buttonFinish.TabIndex = 2; @@ -313,23 +332,15 @@ namespace SparkleShare { this.buttonFinish.UseVisualStyleBackColor = true; this.buttonFinish.Click += new System.EventHandler (this.buttonFinish_Click); // - // label7 - // - this.label7.Location = new System.Drawing.Point (11, 44); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (307, 62); - this.label7.TabIndex = 1; - this.label7.Text = "This may take a while.\r\nAre you sure its not coffee o\'clock?\r\n"; - // // label6 // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); this.label6.Location = new System.Drawing.Point (8, 18); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size (123, 20); + this.label6.Size = new System.Drawing.Size (79, 20); this.label6.TabIndex = 0; - this.label6.Text = "Syncing folder"; + this.label6.Text = "Syncing"; // // errorPage // @@ -346,11 +357,11 @@ namespace SparkleShare { // // buttonTryAgain // - this.buttonTryAgain.Location = new System.Drawing.Point (380, 319); + this.buttonTryAgain.Location = new System.Drawing.Point (416, 339); this.buttonTryAgain.Name = "buttonTryAgain"; this.buttonTryAgain.Size = new System.Drawing.Size (75, 23); this.buttonTryAgain.TabIndex = 3; - this.buttonTryAgain.Text = "Try Again"; + this.buttonTryAgain.Text = "Try Again"; this.buttonTryAgain.UseVisualStyleBackColor = true; this.buttonTryAgain.Click += new System.EventHandler (this.buttonTryAgain_Click); // @@ -400,7 +411,7 @@ namespace SparkleShare { this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size (307, 62); this.label9.TabIndex = 3; - this.label9.Text = "Access the synced files from your SparkleShare folder."; + this.label9.Text = "Access the files from your SparkleShare folder."; // // label8 // @@ -408,13 +419,13 @@ namespace SparkleShare { this.label8.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); this.label8.Location = new System.Drawing.Point (8, 18); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (228, 20); + this.label8.Size = new System.Drawing.Size (227, 20); this.label8.TabIndex = 2; - this.label8.Text = "Folder synced successfully!"; + this.label8.Text = "Project successfully added!"; // // buttonFinished // - this.buttonFinished.Location = new System.Drawing.Point (399, 318); + this.buttonFinished.Location = new System.Drawing.Point (416, 339); this.buttonFinished.Name = "buttonFinished"; this.buttonFinished.Size = new System.Drawing.Size (75, 23); this.buttonFinished.TabIndex = 1; @@ -424,7 +435,7 @@ namespace SparkleShare { // // buttonOpenFolder // - this.buttonOpenFolder.Location = new System.Drawing.Point (318, 318); + this.buttonOpenFolder.Location = new System.Drawing.Point (335, 339); this.buttonOpenFolder.Name = "buttonOpenFolder"; this.buttonOpenFolder.Size = new System.Drawing.Size (75, 23); this.buttonOpenFolder.TabIndex = 0; @@ -476,7 +487,6 @@ namespace SparkleShare { private System.Windows.Forms.Button buttonSync; private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.PictureBox pictureBox; - private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label6; private System.Windows.Forms.Button buttonFinish; private System.Windows.Forms.ProgressBar syncingProgressBar; @@ -498,6 +508,8 @@ namespace SparkleShare { private System.Windows.Forms.Label label14; private SparkleShare.controls.ExampleTextBox FolderEntry; private SparkleShare.controls.ExampleTextBox ServerEntry; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label15; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 807a6dec..db81ff29 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -37,17 +37,14 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return s; + return Program._ (s); } public SparkleSetup () { InitializeComponent (); - /* Support translations for the UI */ - this.label5.Text = _ ("Remote path"); - this.label14.Text = _ ("Address"); - this.label4.Text = _ ("Where is your remote folder?"); + Program.TranslateWinForm (this); pictureBox.Image = Icons.side_splash; this.Icon = Icons.sparkleshare; diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index ed964bfc..fc5fdae6 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -39,7 +39,7 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return s; + return Program._ (s); } @@ -187,7 +187,7 @@ namespace SparkleShare { Menu.Items.Add (new ToolStripSeparator ()); // Opens the wizard to add a new remote folder - ToolStripMenuItem sync_item = new ToolStripMenuItem (_ ("Add Remote Folder…")); + ToolStripMenuItem sync_item = new ToolStripMenuItem (_ ("Add Hosted Project…")); if (Program.Controller.FirstRun) sync_item.Enabled = false; @@ -206,7 +206,7 @@ namespace SparkleShare { Menu.Items.Add (sync_item); Menu.Items.Add (new ToolStripSeparator ()); - ToolStripMenuItem recent_events_item = new ToolStripMenuItem (_ ("Show Recent Events")); + ToolStripMenuItem recent_events_item = new ToolStripMenuItem (_ ("Open Recent Events")); if (Program.Controller.Folders.Count < 1) recent_events_item.Enabled = false; diff --git a/SparkleShare/Windows/SparkleUIHelpers.cs b/SparkleShare/Windows/SparkleUIHelpers.cs index c9252e3f..91a905b0 100644 --- a/SparkleShare/Windows/SparkleUIHelpers.cs +++ b/SparkleShare/Windows/SparkleUIHelpers.cs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +using System.Collections.Generic; +using System.Windows.Forms; using SparkleLib; using System; using System.IO; @@ -38,5 +40,16 @@ namespace SparkleShare { { return String.Format ("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B); } + + //http://stackoverflow.com/a/1499161/33499 + public static IEnumerable All (this Control.ControlCollection controls) + { + foreach (Control control in controls) { + foreach (Control grandChild in control.Controls.All ()) + yield return grandChild; + + yield return control; + } + } } } From b8667b7b8bed93a66b4067bd46d9ac48ffa7b09a Mon Sep 17 00:00:00 2001 From: wimh Date: Wed, 28 Dec 2011 01:03:27 +0100 Subject: [PATCH 104/134] fix potential crash at shutdown --- SparkleLib/SparkleRepoBase.cs | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 1d775174..86aa8779 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -223,8 +223,11 @@ namespace SparkleLib { public void Dispose () { this.remote_timer.Dispose (); + this.remote_timer = null; this.local_timer.Dispose (); + this.local_timer = null; this.listener.Dispose (); + this.listener = null; } @@ -399,7 +402,8 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Event", "[" + Name + "] " + wct.ToString () + " '" + args.Name + "'"); SparkleHelpers.DebugInfo ("Event", "[" + Name + "] Changes found, checking if settled."); - this.remote_timer.Stop (); + if (this.remote_timer != null) + this.remote_timer.Stop (); lock (this.change_lock) { this.has_changed = true; @@ -448,7 +452,8 @@ namespace SparkleLib { { try { DisableWatching (); - this.remote_timer.Stop (); + if (this.remote_timer != null) + this.remote_timer.Stop (); SparkleHelpers.DebugInfo ("SyncUp", "[" + Name + "] Initiated"); @@ -463,7 +468,8 @@ namespace SparkleLib { if (SyncStatusChanged != null) SyncStatusChanged (SyncStatus.Idle); - this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision)); + if (this.listener != null) + this.listener.AnnounceBase (new SparkleAnnouncement(Identifier, CurrentRevision)); } else { SparkleHelpers.DebugInfo ("SyncUp", "[" + Name + "] Error"); @@ -477,7 +483,8 @@ namespace SparkleLib { if (SyncStatusChanged != null) SyncStatusChanged (SyncStatus.Idle); - this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision)); + if (this.listener != null) + this.listener.AnnounceBase (new SparkleAnnouncement (Identifier, CurrentRevision)); } else { if (SyncStatusChanged != null) @@ -486,7 +493,8 @@ namespace SparkleLib { } } finally { - this.remote_timer.Start (); + if (this.remote_timer != null) + this.remote_timer.Start (); EnableWatching (); } } @@ -495,7 +503,8 @@ namespace SparkleLib { private void SyncDownBase () { SparkleHelpers.DebugInfo ("SyncDown", "[" + Name + "] Initiated"); - this.remote_timer.Stop (); + if (this.remote_timer != null) + this.remote_timer.Stop (); DisableWatching (); if (SyncStatusChanged != null) @@ -551,7 +560,8 @@ namespace SparkleLib { if (SyncStatusChanged != null) SyncStatusChanged (SyncStatus.Idle); - this.remote_timer.Start (); + if (this.remote_timer != null) + this.remote_timer.Start (); EnableWatching (); } @@ -560,7 +570,8 @@ namespace SparkleLib { { lock (watch_lock) { this.watcher.EnableRaisingEvents = false; - this.local_timer.Stop (); + if (this.local_timer != null) + this.local_timer.Stop (); } } @@ -569,7 +580,8 @@ namespace SparkleLib { { lock (watch_lock) { this.watcher.EnableRaisingEvents = true; - this.local_timer.Start (); + if (this.local_timer != null) + this.local_timer.Start (); } } From a6a67ce52090727b8e696e30ec3476bcbfbf2838 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 1 Jan 2012 01:53:44 +0100 Subject: [PATCH 105/134] fix build --- .gitignore | 1 - .gitmodules | 4 +- SparkleShare/Windows/Strings.cs | 146 ++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 SparkleShare/Windows/Strings.cs diff --git a/.gitignore b/.gitignore index fd34b967..6c9e3630 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,6 @@ build/m4/shave/shave-libtool SparkleLib/Defines.cs SparkleLib/windows/Defines.cs SparkleLib/windows/GlobalAssemblyInfo.cs -SparkleShare/Windows/Strings.cs SparkleShare/sparkleshare po/sparkleshare.pot SparkleShare/Nautilus/sparkleshare-nautilus-extension.py diff --git a/.gitmodules b/.gitmodules index 47a14910..64010a74 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,6 @@ [submodule "tools/TextTemplating"] path = tools/TextTemplating url = git://github.com/wimh/TextTemplating.git -[submodule "tools\\gettext-cs-utils"] - path = tools\\gettext-cs-utils +[submodule "tools/gettext-cs-utils"] + path = tools/gettext-cs-utils url = git://github.com/wimh/gettext-cs-utils.git diff --git a/SparkleShare/Windows/Strings.cs b/SparkleShare/Windows/Strings.cs new file mode 100644 index 00000000..4e545d5e --- /dev/null +++ b/SparkleShare/Windows/Strings.cs @@ -0,0 +1,146 @@ + +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Threading; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace SparkleShare +{ + public class Strings + { + private static Object resourceManLock = new Object(); + private static System.Resources.ResourceManager resourceMan; + private static System.Globalization.CultureInfo resourceCulture; + + public const string ResourceName = "Strings"; + + private static string resourcesDir = GetSetting("ResourcesDir", "po"); + private static string fileFormat = GetSetting("ResourcesFileFormat", "{{culture}}.po"); + + private static string GetSetting(string setting, string defaultValue) + { + var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings"); + if (section == null) return defaultValue; + else return section[setting] ?? defaultValue; + } + + + /// + /// Resources directory used to retrieve files from. + /// + public static string ResourcesDirectory + { + get { return resourcesDir; } + set { resourcesDir = value; } + } + + /// + /// Format of the file based on culture and resource name. + /// + public static string FileFormat + { + get { return fileFormat; } + set { fileFormat = value; } + } + + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + public static System.Resources.ResourceManager ResourceManager + { + get + { + + if (object.ReferenceEquals(resourceMan, null)) + { + lock (resourceManLock) + { + if (object.ReferenceEquals(resourceMan, null)) + { + var directory = resourcesDir; + var mgr = new global::Gettext.Cs.GettextResourceManager(ResourceName, directory, fileFormat); + resourceMan = mgr; + } + } + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + public static System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(string t) + { + return T(null, t); + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t) + { + if (String.IsNullOrEmpty(t)) return t; + var translated = ResourceManager.GetString(t, info ?? resourceCulture); + return String.IsNullOrEmpty(translated) ? t : translated; + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(string t, params object[] parameters) + { + return T(null, t, parameters); + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t, params object[] parameters) + { + if (String.IsNullOrEmpty(t)) return t; + return String.Format(T(info, t), parameters); + } + + /// + /// Marks a string for future translation, does not translate it now. + /// + public static string M(string t) + { + return t; + } + + /// + /// Returns the resource set available for the specified culture. + /// + public static System.Resources.ResourceSet GetResourceSet(CultureInfo culture) + { + return ResourceManager.GetResourceSet(culture, true, true); + } + } +} + + From 0dd7605834760ade03ba8295ec982aaff14333a9 Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 8 Jan 2012 22:31:14 +0100 Subject: [PATCH 106/134] Make it compile with Sparkleshare 0.6 and create .msi file correctly --- SparkleLib/Git/SparkleFetcherGit.cs | 3 +- SparkleLib/SparkleConfig.cs | 10 +- SparkleLib/SparkleHelpers.cs | 23 ++++ SparkleLib/windows/SparkleLib.csproj | 6 +- SparkleLib/windows/getversion.tt | 2 +- SparkleShare/SparkleControllerBase.cs | 10 +- SparkleShare/SparkleUI.cs | 9 +- SparkleShare/Windows/SparkleController.cs | 28 +++-- SparkleShare/Windows/SparkleEventLog.cs | 4 +- SparkleShare/Windows/SparkleSetup.Designer.cs | 4 +- SparkleShare/Windows/SparkleSetup.cs | 11 +- SparkleShare/Windows/SparkleShare.csproj | 9 +- SparkleShare/Windows/SparkleShare.wxs | 118 ++++++++++-------- SparkleShare/Windows/SparkleStatusIcon.cs | 19 ++- SparkleShare/Windows/build.cmd | 12 +- 15 files changed, 177 insertions(+), 91 deletions(-) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index 5b0e0098..f542e8b2 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -86,7 +86,8 @@ namespace SparkleLib { this.git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath, "clone " + "--progress " + // Redirects progress stats to standarderror - "\"" + base.remote_url + "\" " + "\"" + base.target_folder + "\""); + "\"" + base.remote_url + "\" " + + "\"" + SparkleHelpers.NormalizeSeparatorsToOS(base.target_folder) + "\""); this.git.StartInfo.RedirectStandardError = true; this.git.Start (); diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index f9f57548..df43b97d 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -173,8 +173,14 @@ namespace SparkleLib { string ssh_config_path = Path.Combine (path, ".ssh"); string ssh_config_file_path = SparkleHelpers.CombineMore (path, ".ssh", "config"); - string ssh_config = "IdentityFile " + - Path.Combine (SparkleConfig.ConfigPath, "sparkleshare." + User.Email + ".key"); + + string ssh_key_path = SparkleHelpers.NormalizeSeparatorsToOS( + Path.Combine(SparkleConfig.ConfigPath, "sparkleshare." + User.Email + ".key")); + if (SparkleHelpers.IsWindows && ssh_key_path.IndexOf(' ') >= 0) + { + ssh_key_path = "\"" + ssh_key_path + "\""; + } + string ssh_config = "IdentityFile " + ssh_key_path; if (!Directory.Exists (ssh_config_path)) Directory.CreateDirectory (ssh_config_path); diff --git a/SparkleLib/SparkleHelpers.cs b/SparkleLib/SparkleHelpers.cs index b2b1a459..0cc856d1 100755 --- a/SparkleLib/SparkleHelpers.cs +++ b/SparkleLib/SparkleHelpers.cs @@ -93,6 +93,29 @@ namespace SparkleLib { { return target.Replace (source + Path.DirectorySeparatorChar, ""); } + + public static bool IsWindows + { + get + { + PlatformID platform = Environment.OSVersion.Platform; + return (platform == PlatformID.Win32NT + || platform == PlatformID.Win32S + || platform == PlatformID.Win32Windows); + } + } + + public static string NormalizeSeparatorsToOS(string path) + { + if (IsWindows) + { + return path.Replace('\\', '/'); + } + else + { + return path; + } + } } } diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 0aec68a9..0bf9c160 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {2C914413-B31C-4362-93C7-1AE34F09112A} Library @@ -75,9 +75,6 @@ SparkleConfig.cs - - SparklePath.cs - SparkleRepoBase.cs @@ -97,7 +94,6 @@ - diff --git a/SparkleLib/windows/getversion.tt b/SparkleLib/windows/getversion.tt index d558b475..7aa89216 100644 --- a/SparkleLib/windows/getversion.tt +++ b/SparkleLib/windows/getversion.tt @@ -19,7 +19,7 @@ process.StartInfo.RedirectStandardOutput = true; process.StartInfo.CreateNoWindow = true; process.StartInfo.FileName = "git"; - process.StartInfo.Arguments = "describe --tags --dirty=-d --always"; + process.StartInfo.Arguments = "describe --tags"; process.StartInfo.WorkingDirectory = Path.GetDirectoryName(Host.TemplateFile); process.Start(); diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 16676e18..7162c52b 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -27,7 +27,9 @@ using System.Text.RegularExpressions; using System.Threading; using System.Xml; +#if __MonoCS__ using Mono.Unix; +#endif using SparkleLib; namespace SparkleShare { @@ -90,7 +92,7 @@ namespace SparkleShare { // Short alias for the translations public static string _ (string s) { - return Catalog.GetString (s); + return Program._(s); } @@ -1081,12 +1083,16 @@ namespace SparkleShare { } - public void Quit () + public virtual void Quit () { foreach (SparkleRepoBase repo in Repositories) repo.Dispose (); +#if __MonoCS__ Environment.Exit (0); +#else + System.Windows.Forms.Application.Exit(); +#endif } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 96ec23f2..abe44ed1 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -23,9 +23,13 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading; +#if __MonoCS__ using Gtk; using Mono.Unix; using Mono.Unix.Native; +#else +using System.Windows.Forms; +#endif using SparkleLib; namespace SparkleShare { @@ -44,17 +48,19 @@ namespace SparkleShare { // Short alias for the translations public static string _(string s) { - return Catalog.GetString (s); + return Program._ (s); } public SparkleUI () { // Initialize the application +#if __MonoCS__ Application.Init (); // Use translations Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); +#endif StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); @@ -73,6 +79,7 @@ namespace SparkleShare { public void Run () { Application.Run (); + StatusIcon.Dispose (); } } } diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index 5d54d868..c42a4d29 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -62,8 +62,9 @@ namespace SparkleShare { Application.SetCompatibleTextRenderingDefault (false); // Add msysgit to path, as we cannot asume it is added to the path - // Asume it is installed in @"C:\msysgit\bin" for now - string MSysGit=@"C:\msysgit"; + // Asume it is installed in @"\msysgit\bin" + string ExecutableDir = Path.GetDirectoryName(Application.ExecutablePath); + string MSysGit = Path.Combine(ExecutableDir, "msysgit"); string newPath = MSysGit + @"\bin" + ";" + MSysGit + @"\mingw\bin" + ";" @@ -110,7 +111,7 @@ namespace SparkleShare { } } - public override string GetAvatar (string email, int size) + /*public override string GetAvatar (string email, int size) { if (string.IsNullOrEmpty (email)) { return "application://sparkleshare/avatar-default-32.png"; @@ -119,7 +120,7 @@ namespace SparkleShare { SparklePaths.SparkleLocalIconPath, size + "x" + size, "status", "avatar-" + email); return avatar_file_path; - } + }*/ // Creates a .desktop entry in autostart folder to @@ -146,18 +147,27 @@ namespace SparkleShare { // 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 + "'"); + if (!Directory.Exists(SparkleConfig.DefaultConfig.FoldersPath)) + { + Directory.CreateDirectory(SparkleConfig.DefaultConfig.FoldersPath); + Directory.CreateDirectory(SparkleConfig.DefaultConfig.TmpPath); + SparkleHelpers.DebugInfo("Config", "Created '" + SparkleConfig.DefaultConfig.FoldersPath + "'"); return true; - } return false; } + public override void OpenFile(string url) + { + Process process = new Process(); + process.StartInfo.Arguments = "\"" + url + "\""; + process.StartInfo.FileName = "start"; + + process.Start(); + } + public override void OpenSparkleShareFolder (string subfolder) { Process process = new Process(); diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index cc267676..5de70192 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -136,7 +136,7 @@ namespace SparkleShare { HTML = HTML.Replace ("", "application://sparkleshare/document-moved-12.png"); - HTML = HTML.Replace ("href='" + SparklePaths.SparklePath, "href='application://file/" + SparklePaths.SparklePath); + HTML = HTML.Replace("href='" + SparkleConfig.DefaultConfig.FoldersPath, "href='application://file/" + SparkleConfig.DefaultConfig.FoldersPath); HTML = HTML.Replace ("file://application://sparkleshare/", "application://sparkleshare/"); HTML = HTML.Replace ("file://", "application://file/"); } @@ -180,7 +180,7 @@ namespace SparkleShare { Filename = Uri.UnescapeDataString (Filename); Filename = Filename.Replace ("/", "\\"); - if (Filename.StartsWith (SparklePaths.SparklePath)) + if (Filename.StartsWith(SparkleConfig.DefaultConfig.FoldersPath)) System.Diagnostics.Process.Start (Filename); } } diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 99a427ae..e0b10d10 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -227,7 +227,7 @@ namespace SparkleShare { // label5 // this.label5.AutoSize = true; - this.label5.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Font = new System.Drawing.Font ("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.Location = new System.Drawing.Point (197, 267); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size (114, 20); @@ -237,7 +237,7 @@ namespace SparkleShare { // label14 // this.label14.AutoSize = true; - this.label14.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label14.Font = new System.Drawing.Font ("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label14.Location = new System.Drawing.Point (8, 267); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size (75, 20); diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index db81ff29..1bf011fe 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -49,7 +49,7 @@ namespace SparkleShare { pictureBox.Image = Icons.side_splash; this.Icon = Icons.sparkleshare; - Controller.ChangePageEvent += delegate (PageType type) { + Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { tabControl.SafeInvoke ((Action)delegate { switch (type) { case PageType.Add: @@ -206,12 +206,19 @@ namespace SparkleShare { // Enables or disables the 'Next' button depending on the // entries filled in by the user if (!String.IsNullOrEmpty (NameEntry.Text) && - Program.Controller.IsValidEmail (EmailEntry.Text)) { + this.IsValidEmail (EmailEntry.Text)) { buttonNext.Enabled = true; } else { buttonNext.Enabled = false; } } + + // Checks to see if an email address is valid + public bool IsValidEmail(string email) + { + Regex regex = new Regex(@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); + return regex.IsMatch(email); + } } } diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index a48328d9..a4effb6a 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 {728483AA-E34B-4441-BF2C-C8BC2901E4E0} Exe SparkleShare @@ -54,7 +54,9 @@ - + + ..\..\bin\CefSharp.dll + False ..\..\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\bin\Release\Gettext.Cs.dll @@ -85,6 +87,9 @@ SparkleExtensions.cs + + SparkleInvite.cs + SparklePlugin.cs diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs index d9f5719a..dc00effc 100644 --- a/SparkleShare/Windows/SparkleShare.wxs +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -1,64 +1,78 @@ - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - MSYSGIT_CAB_EXISTS - - - - - + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index fc5fdae6..8b4bb690 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -56,14 +56,14 @@ namespace SparkleShare { CreateMenu (); SetNormalState (); - Program.Controller.FolderSizeChanged += delegate { + /*Program.Controller.FolderSizeChanged += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { if (!Animation.Enabled) SetNormalState (); UpdateMenu (); }); - }; + };*/ Program.Controller.FolderListChanged += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { @@ -315,7 +315,7 @@ namespace SparkleShare { this.status_icon.Icon = Icon.FromHandle (Icons.sparkleshare_syncing_error_24.GetHicon ()); }); } else { - StateText = _("Up to date") + " (" + Program.Controller.FolderSize + ")"; + StateText = _("Up to date") + " (" + FolderSize + ")"; status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { this.status_icon.Icon = Icon.FromHandle (AnimationFrames [0].GetHicon ()); }); @@ -333,6 +333,19 @@ namespace SparkleShare { Animation.Start (); } + public string FolderSize + { + get + { + double size = 0; + + foreach (SparkleRepoBase repo in Program.Controller.Repositories) + size += repo.Size + repo.HistorySize; + + return Program.Controller.FormatSize(size); + } + } + #region IDisposable Members public void Dispose () diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index 2f4ab8ea..7831694b 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -16,15 +16,13 @@ set wixBinDir=%WIX%\bin if "%1"=="installer" ( if exist "%wixBinDir%" ( - "%wixBinDir%\heat.exe" dir "%git_install_root%." -cg msysGitComponentGroup -gg -scom -sreg -sfrag -srd -dr MSYSGIT_DIR -t addmedia.xlst -var wix.msysgitpath -o msysgit.wxs - "%wixBinDir%\candle" "%~dp0\SparkleShare.wxs" - "%wixBinDir%\candle" "msysgit.wxs - "%wixBinDir%\light" -ext WixUIExtension Sparkleshare.wixobj msysgit.wixobj -dmsysgitpath=%git_install_root% -o SparkleShare.msi + "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\msysgit" -cg msysGitComponentGroup -gg -scom -sreg -sfrag -srd -dr MSYSGIT_DIR -var wix.msysgitpath -o msysgit.wxs + "%wixBinDir%\candle" "%~dp0\SparkleShare.wxs" -ext WixUIExtension -ext WixUtilExtension + "%wixBinDir%\candle" "%~dp0\msysgit.wxs" -ext WixUIExtension -ext WixUtilExtension + "%wixBinDir%\light" -ext WixUIExtension -ext WixUtilExtension Sparkleshare.wixobj msysgit.wixobj -droot="%~dp0\..\.." -dmsysgitpath="%~dp0\..\..\bin\msysgit" -o SparkleShare.msi echo SparkleShare.msi created. - ) else ( echo Not building installer ^(could not find wix, Windows Installer XML toolset^) - echo wix is available at http://wix.sourceforge.net/ + echo wix is available at http://wix.sourceforge.net/ ) - ) else echo Not building installer, as it was not requested. ^(Issue "build.cmd installer" to build installer ^) From 4ccec42125f3dd6e0c13077a220544cd96469f09 Mon Sep 17 00:00:00 2001 From: serras Date: Mon, 9 Jan 2012 16:42:05 +0100 Subject: [PATCH 107/134] Add po and plugins folders to setup --- SparkleShare/Windows/SparkleShare.wxs | 8 +++++++- SparkleShare/Windows/build.cmd | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs index dc00effc..61423a1b 100644 --- a/SparkleShare/Windows/SparkleShare.wxs +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -30,6 +30,10 @@ + + + + @@ -56,6 +60,8 @@ + + @@ -63,7 +69,7 @@ + Value="LaunchApplication">1 diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index 7831694b..6c2a4db7 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -17,9 +17,13 @@ set wixBinDir=%WIX%\bin if "%1"=="installer" ( if exist "%wixBinDir%" ( "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\msysgit" -cg msysGitComponentGroup -gg -scom -sreg -sfrag -srd -dr MSYSGIT_DIR -var wix.msysgitpath -o msysgit.wxs + "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\po" -cg poComponentGroup -gg -scom -sreg -sfrag -srd -dr PO_DIR -var wix.podir -o po.wxs + "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\plugins" -cg pluginsComponentGroup -gg -scom -sreg -sfrag -srd -dr PLUGINS_DIR -var wix.pluginsdir -o plugins.wxs "%wixBinDir%\candle" "%~dp0\SparkleShare.wxs" -ext WixUIExtension -ext WixUtilExtension "%wixBinDir%\candle" "%~dp0\msysgit.wxs" -ext WixUIExtension -ext WixUtilExtension - "%wixBinDir%\light" -ext WixUIExtension -ext WixUtilExtension Sparkleshare.wixobj msysgit.wixobj -droot="%~dp0\..\.." -dmsysgitpath="%~dp0\..\..\bin\msysgit" -o SparkleShare.msi + "%wixBinDir%\candle" "%~dp0\po.wxs" -ext WixUIExtension -ext WixUtilExtension + "%wixBinDir%\candle" "%~dp0\plugins.wxs" -ext WixUIExtension -ext WixUtilExtension + "%wixBinDir%\light" -ext WixUIExtension -ext WixUtilExtension Sparkleshare.wixobj msysgit.wixobj po.wixobj plugins.wixobj -droot="%~dp0\..\.." -dmsysgitpath="%~dp0\..\..\bin\msysgit" -dpodir="%~dp0\..\..\bin\po" -dpluginsdir="%~dp0\..\..\bin\plugins" -o SparkleShare.msi echo SparkleShare.msi created. ) else ( echo Not building installer ^(could not find wix, Windows Installer XML toolset^) From 78a0b5ce34a5afa234952e492fe355f94c01282b Mon Sep 17 00:00:00 2001 From: serras Date: Mon, 9 Jan 2012 18:36:24 +0100 Subject: [PATCH 108/134] Use layout in setup windows --- SparkleLib/Git/SparkleRepoGit.cs | 2 +- SparkleShare/Windows/SparkleSetup.Designer.cs | 731 +++++++++++------- 2 files changed, 446 insertions(+), 287 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index e2eda251..9fa4adbd 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -538,7 +538,7 @@ namespace SparkleLib { List change_sets = new List (); // Console.InputEncoding = System.Text.Encoding.Unicode; - Console.OutputEncoding = System.Text.Encoding.Unicode; + // Console.OutputEncoding = System.Text.Encoding.Unicode; SparkleGit git_log = new SparkleGit (LocalPath, "log -" + count + " --raw -M --date=iso"); git_log.Start (); diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index e0b10d10..9d0abb7c 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -23,144 +23,134 @@ namespace SparkleShare { /// the contents of this method with the code editor. /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (SparkleSetup)); - this.pictureBox = new System.Windows.Forms.PictureBox (); - this.tabControl = new SparkleShare.controls.TablessControl (); - this.setupPage = new System.Windows.Forms.TabPage (); - this.groupBox1 = new System.Windows.Forms.GroupBox (); - this.EmailEntry = new System.Windows.Forms.TextBox (); - this.NameEntry = new System.Windows.Forms.TextBox (); - this.label13 = new System.Windows.Forms.Label (); - this.label12 = new System.Windows.Forms.Label (); - this.label11 = new System.Windows.Forms.Label (); - this.label10 = new System.Windows.Forms.Label (); - this.buttonNext = new System.Windows.Forms.Button (); - this.addPage = new System.Windows.Forms.TabPage (); - this.FolderEntry = new SparkleShare.controls.ExampleTextBox (); - this.ServerEntry = new SparkleShare.controls.ExampleTextBox (); - this.label5 = new System.Windows.Forms.Label (); - this.label14 = new System.Windows.Forms.Label (); - this.panel_server_selection = new System.Windows.Forms.Panel (); - this.buttonSync = new System.Windows.Forms.Button (); - this.buttonCancel = new System.Windows.Forms.Button (); - this.label4 = new System.Windows.Forms.Label (); - this.syncingPage = new System.Windows.Forms.TabPage (); - this.label16 = new System.Windows.Forms.Label (); - this.label15 = new System.Windows.Forms.Label (); - this.syncingProgressBar = new System.Windows.Forms.ProgressBar (); - this.buttonFinish = new System.Windows.Forms.Button (); - this.label6 = new System.Windows.Forms.Label (); - this.errorPage = new System.Windows.Forms.TabPage (); - this.buttonTryAgain = new System.Windows.Forms.Button (); - this.label3 = new System.Windows.Forms.Label (); - this.label2 = new System.Windows.Forms.Label (); - this.label1 = new System.Windows.Forms.Label (); - this.finishedPage = new System.Windows.Forms.TabPage (); - this.label9 = new System.Windows.Forms.Label (); - this.label8 = new System.Windows.Forms.Label (); - this.buttonFinished = new System.Windows.Forms.Button (); - this.buttonOpenFolder = new System.Windows.Forms.Button (); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit (); - this.tabControl.SuspendLayout (); - this.setupPage.SuspendLayout (); - this.groupBox1.SuspendLayout (); - this.addPage.SuspendLayout (); - this.syncingPage.SuspendLayout (); - this.errorPage.SuspendLayout (); - this.finishedPage.SuspendLayout (); - this.SuspendLayout (); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SparkleSetup)); + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.tabControl = new SparkleShare.controls.TablessControl(); + this.setupPage = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.EmailEntry = new System.Windows.Forms.TextBox(); + this.buttonNext = new System.Windows.Forms.Button(); + this.NameEntry = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.addPage = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.panel_server_selection = new System.Windows.Forms.Panel(); + this.label4 = new System.Windows.Forms.Label(); + this.FolderEntry = new SparkleShare.controls.ExampleTextBox(); + this.label14 = new System.Windows.Forms.Label(); + this.ServerEntry = new SparkleShare.controls.ExampleTextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.buttonSync = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.syncingPage = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.label6 = new System.Windows.Forms.Label(); + this.buttonFinish = new System.Windows.Forms.Button(); + this.syncingProgressBar = new System.Windows.Forms.ProgressBar(); + this.label16 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.errorPage = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.buttonTryAgain = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.finishedPage = new System.Windows.Forms.TabPage(); + this.label9 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.buttonFinished = new System.Windows.Forms.Button(); + this.buttonOpenFolder = new System.Windows.Forms.Button(); + this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.tabControl.SuspendLayout(); + this.setupPage.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.addPage.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.syncingPage.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.errorPage.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.finishedPage.SuspendLayout(); + this.tableLayoutPanel5.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); + this.SuspendLayout(); // // pictureBox // this.pictureBox.Dock = System.Windows.Forms.DockStyle.Left; - this.pictureBox.Location = new System.Drawing.Point (0, 0); + this.pictureBox.Location = new System.Drawing.Point(0, 0); this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size (150, 396); + this.pictureBox.Size = new System.Drawing.Size(150, 396); this.pictureBox.TabIndex = 1; this.pictureBox.TabStop = false; // // tabControl // - this.tabControl.Controls.Add (this.setupPage); - this.tabControl.Controls.Add (this.addPage); - this.tabControl.Controls.Add (this.syncingPage); - this.tabControl.Controls.Add (this.errorPage); - this.tabControl.Controls.Add (this.finishedPage); + this.tabControl.Controls.Add(this.setupPage); + this.tabControl.Controls.Add(this.addPage); + this.tabControl.Controls.Add(this.syncingPage); + this.tabControl.Controls.Add(this.errorPage); + this.tabControl.Controls.Add(this.finishedPage); this.tabControl.Dock = System.Windows.Forms.DockStyle.Right; - this.tabControl.Location = new System.Drawing.Point (150, 0); + this.tabControl.Location = new System.Drawing.Point(150, 0); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size (514, 396); + this.tabControl.Size = new System.Drawing.Size(514, 396); this.tabControl.TabIndex = 0; this.tabControl.TabStop = false; // // setupPage // - this.setupPage.Controls.Add (this.groupBox1); - this.setupPage.Controls.Add (this.label11); - this.setupPage.Controls.Add (this.label10); - this.setupPage.Controls.Add (this.buttonNext); - this.setupPage.Location = new System.Drawing.Point (4, 22); + this.setupPage.Controls.Add(this.tableLayoutPanel1); + this.setupPage.Location = new System.Drawing.Point(4, 22); this.setupPage.Name = "setupPage"; - this.setupPage.Padding = new System.Windows.Forms.Padding (3); - this.setupPage.Size = new System.Drawing.Size (506, 370); + this.setupPage.Padding = new System.Windows.Forms.Padding(3); + this.setupPage.Size = new System.Drawing.Size(506, 370); this.setupPage.TabIndex = 0; this.setupPage.Text = "Setup"; this.setupPage.UseVisualStyleBackColor = true; // - // groupBox1 + // tableLayoutPanel1 // - this.groupBox1.Controls.Add (this.EmailEntry); - this.groupBox1.Controls.Add (this.NameEntry); - this.groupBox1.Controls.Add (this.label13); - this.groupBox1.Controls.Add (this.label12); - this.groupBox1.Location = new System.Drawing.Point (14, 119); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size (471, 102); - this.groupBox1.TabIndex = 7; - this.groupBox1.TabStop = false; - // - // EmailEntry - // - this.EmailEntry.Location = new System.Drawing.Point (150, 54); - this.EmailEntry.Name = "EmailEntry"; - this.EmailEntry.Size = new System.Drawing.Size (275, 20); - this.EmailEntry.TabIndex = 10; - this.EmailEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); - // - // NameEntry - // - this.NameEntry.Location = new System.Drawing.Point (150, 28); - this.NameEntry.Name = "NameEntry"; - this.NameEntry.Size = new System.Drawing.Size (275, 20); - this.NameEntry.TabIndex = 9; - this.NameEntry.TextChanged += new System.EventHandler (this.CheckSetupPage); - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label13.Location = new System.Drawing.Point (15, 57); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size (41, 13); - this.label13.TabIndex = 8; - this.label13.Text = "Email:"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label12.Location = new System.Drawing.Point (15, 31); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size (67, 13); - this.label12.TabIndex = 7; - this.label12.Text = "Full Name:"; + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.EmailEntry, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.buttonNext, 1, 6); + this.tableLayoutPanel1.Controls.Add(this.NameEntry, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.label10, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.label13, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.label11, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.label12, 0, 3); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(5); + this.tableLayoutPanel1.RowCount = 7; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(500, 364); + this.tableLayoutPanel1.TabIndex = 8; // // label11 // - this.label11.Location = new System.Drawing.Point (11, 44); + this.tableLayoutPanel1.SetColumnSpan(this.label11, 2); + this.label11.Dock = System.Windows.Forms.DockStyle.Fill; + this.label11.Location = new System.Drawing.Point(8, 30); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size (307, 62); + this.label11.Size = new System.Drawing.Size(484, 30); this.label11.TabIndex = 2; this.label11.Text = "Before we can create a SparkleShare folder on this computer, we need a few bits o" + "f information from you."; @@ -168,307 +158,470 @@ namespace SparkleShare { // label10 // this.label10.AutoSize = true; - this.label10.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label10.Location = new System.Drawing.Point (8, 18); + this.tableLayoutPanel1.SetColumnSpan(this.label10, 2); + this.label10.Dock = System.Windows.Forms.DockStyle.Fill; + this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label10.Location = new System.Drawing.Point(8, 5); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size (222, 20); + this.label10.Size = new System.Drawing.Size(484, 25); this.label10.TabIndex = 1; this.label10.Text = "Welcome to SparkleShare!"; // + // EmailEntry + // + this.EmailEntry.Dock = System.Windows.Forms.DockStyle.Fill; + this.EmailEntry.Location = new System.Drawing.Point(81, 153); + this.EmailEntry.Name = "EmailEntry"; + this.EmailEntry.Size = new System.Drawing.Size(411, 20); + this.EmailEntry.TabIndex = 10; + this.EmailEntry.TextChanged += new System.EventHandler(this.CheckSetupPage); + // // buttonNext // + this.buttonNext.Dock = System.Windows.Forms.DockStyle.Right; this.buttonNext.Enabled = false; - this.buttonNext.Location = new System.Drawing.Point (416, 339); + this.buttonNext.Location = new System.Drawing.Point(417, 331); this.buttonNext.Name = "buttonNext"; - this.buttonNext.Size = new System.Drawing.Size (75, 23); - this.buttonNext.TabIndex = 0; + this.buttonNext.Size = new System.Drawing.Size(75, 25); + this.buttonNext.TabIndex = 3; this.buttonNext.Text = "Next"; this.buttonNext.UseVisualStyleBackColor = true; - this.buttonNext.Click += new System.EventHandler (this.buttonNext_Click); + // + // NameEntry + // + this.NameEntry.Dock = System.Windows.Forms.DockStyle.Fill; + this.NameEntry.Location = new System.Drawing.Point(81, 128); + this.NameEntry.Name = "NameEntry"; + this.NameEntry.Size = new System.Drawing.Size(411, 20); + this.NameEntry.TabIndex = 9; + this.NameEntry.TextChanged += new System.EventHandler(this.CheckSetupPage); + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Dock = System.Windows.Forms.DockStyle.Fill; + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label13.Location = new System.Drawing.Point(8, 150); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(67, 25); + this.label13.TabIndex = 8; + this.label13.Text = "Email:"; + this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Dock = System.Windows.Forms.DockStyle.Fill; + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.Location = new System.Drawing.Point(8, 125); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(67, 25); + this.label12.TabIndex = 7; + this.label12.Text = "Full Name:"; + this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // addPage // - this.addPage.Controls.Add (this.FolderEntry); - this.addPage.Controls.Add (this.ServerEntry); - this.addPage.Controls.Add (this.label5); - this.addPage.Controls.Add (this.label14); - this.addPage.Controls.Add (this.panel_server_selection); - this.addPage.Controls.Add (this.buttonSync); - this.addPage.Controls.Add (this.buttonCancel); - this.addPage.Controls.Add (this.label4); - this.addPage.Location = new System.Drawing.Point (4, 22); + this.addPage.Controls.Add(this.tableLayoutPanel2); + this.addPage.Location = new System.Drawing.Point(4, 22); this.addPage.Name = "addPage"; - this.addPage.Padding = new System.Windows.Forms.Padding (3); - this.addPage.Size = new System.Drawing.Size (506, 370); + this.addPage.Padding = new System.Windows.Forms.Padding(3); + this.addPage.Size = new System.Drawing.Size(506, 370); this.addPage.TabIndex = 1; this.addPage.Text = "Add"; this.addPage.UseVisualStyleBackColor = true; // - // FolderEntry + // tableLayoutPanel2 // - this.FolderEntry.ExampleText = ""; - this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.FolderEntry.Location = new System.Drawing.Point (201, 290); - this.FolderEntry.Name = "FolderEntry"; - this.FolderEntry.Size = new System.Drawing.Size (168, 20); - this.FolderEntry.TabIndex = 17; - this.FolderEntry.TextChanged += new System.EventHandler (this.CheckAddPage); - // - // ServerEntry - // - this.ServerEntry.ExampleText = ""; - this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; - this.ServerEntry.Location = new System.Drawing.Point (12, 290); - this.ServerEntry.Name = "ServerEntry"; - this.ServerEntry.Size = new System.Drawing.Size (168, 20); - this.ServerEntry.TabIndex = 16; - this.ServerEntry.TextChanged += new System.EventHandler (this.CheckAddPage); - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Font = new System.Drawing.Font ("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label5.Location = new System.Drawing.Point (197, 267); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (114, 20); - this.label5.TabIndex = 15; - this.label5.Text = "Remote Path"; - // - // label14 - // - this.label14.AutoSize = true; - this.label14.Font = new System.Drawing.Font ("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label14.Location = new System.Drawing.Point (8, 267); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size (75, 20); - this.label14.TabIndex = 14; - this.label14.Text = "Address"; + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Controls.Add(this.label4, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.panel_server_selection, 0, 2); + this.tableLayoutPanel2.Controls.Add(this.FolderEntry, 1, 5); + this.tableLayoutPanel2.Controls.Add(this.label14, 0, 4); + this.tableLayoutPanel2.Controls.Add(this.ServerEntry, 0, 5); + this.tableLayoutPanel2.Controls.Add(this.label5, 1, 4); + this.tableLayoutPanel2.Controls.Add(this.flowLayoutPanel1, 1, 7); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(10); + this.tableLayoutPanel2.RowCount = 8; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(500, 364); + this.tableLayoutPanel2.TabIndex = 18; // // panel_server_selection // - this.panel_server_selection.Location = new System.Drawing.Point (12, 54); + this.tableLayoutPanel2.SetColumnSpan(this.panel_server_selection, 2); + this.panel_server_selection.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel_server_selection.Location = new System.Drawing.Point(13, 63); this.panel_server_selection.Name = "panel_server_selection"; - this.panel_server_selection.Size = new System.Drawing.Size (479, 189); + this.panel_server_selection.Size = new System.Drawing.Size(474, 171); this.panel_server_selection.TabIndex = 12; // - // buttonSync - // - this.buttonSync.Enabled = false; - this.buttonSync.Location = new System.Drawing.Point (416, 339); - this.buttonSync.Name = "buttonSync"; - this.buttonSync.Size = new System.Drawing.Size (75, 23); - this.buttonSync.TabIndex = 9; - this.buttonSync.Text = "Add"; - this.buttonSync.UseVisualStyleBackColor = true; - this.buttonSync.Click += new System.EventHandler (this.buttonSync_Click); - // - // buttonCancel - // - this.buttonCancel.Location = new System.Drawing.Point (335, 339); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size (75, 23); - this.buttonCancel.TabIndex = 8; - this.buttonCancel.Text = "Cancel"; - this.buttonCancel.UseVisualStyleBackColor = true; - this.buttonCancel.Click += new System.EventHandler (this.buttonCancel_Click); - // // label4 // this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.Location = new System.Drawing.Point (8, 18); + this.tableLayoutPanel2.SetColumnSpan(this.label4, 2); + this.label4.Dock = System.Windows.Forms.DockStyle.Fill; + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label4.Location = new System.Drawing.Point(13, 10); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (243, 20); + this.label4.Size = new System.Drawing.Size(474, 30); this.label4.TabIndex = 0; this.label4.Text = "Where\'s your project hosted?"; // + // FolderEntry + // + this.FolderEntry.Dock = System.Windows.Forms.DockStyle.Fill; + this.FolderEntry.ExampleText = ""; + this.FolderEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.FolderEntry.Location = new System.Drawing.Point(253, 280); + this.FolderEntry.Name = "FolderEntry"; + this.FolderEntry.Size = new System.Drawing.Size(234, 20); + this.FolderEntry.TabIndex = 17; + this.FolderEntry.TextChanged += new System.EventHandler(this.CheckAddPage); + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label14.Location = new System.Drawing.Point(13, 257); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(67, 17); + this.label14.TabIndex = 14; + this.label14.Text = "Address"; + // + // ServerEntry + // + this.ServerEntry.Dock = System.Windows.Forms.DockStyle.Fill; + this.ServerEntry.ExampleText = ""; + this.ServerEntry.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.ServerEntry.Location = new System.Drawing.Point(13, 280); + this.ServerEntry.Name = "ServerEntry"; + this.ServerEntry.Size = new System.Drawing.Size(234, 20); + this.ServerEntry.TabIndex = 16; + this.ServerEntry.TextChanged += new System.EventHandler(this.CheckAddPage); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(253, 257); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(101, 17); + this.label5.TabIndex = 15; + this.label5.Text = "Remote Path"; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.buttonSync); + this.flowLayoutPanel1.Controls.Add(this.buttonCancel); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Right; + this.flowLayoutPanel1.Location = new System.Drawing.Point(328, 322); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(162, 32); + this.flowLayoutPanel1.TabIndex = 18; + // + // buttonSync + // + this.buttonSync.Enabled = false; + this.buttonSync.Location = new System.Drawing.Point(3, 3); + this.buttonSync.Name = "buttonSync"; + this.buttonSync.Size = new System.Drawing.Size(75, 25); + this.buttonSync.TabIndex = 9; + this.buttonSync.Text = "Add"; + this.buttonSync.UseVisualStyleBackColor = true; + this.buttonSync.Click += new System.EventHandler(this.buttonSync_Click); + // + // buttonCancel + // + this.buttonCancel.Dock = System.Windows.Forms.DockStyle.Right; + this.buttonCancel.Location = new System.Drawing.Point(84, 3); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 25); + this.buttonCancel.TabIndex = 8; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // // syncingPage // - this.syncingPage.Controls.Add (this.label16); - this.syncingPage.Controls.Add (this.label15); - this.syncingPage.Controls.Add (this.syncingProgressBar); - this.syncingPage.Controls.Add (this.buttonFinish); - this.syncingPage.Controls.Add (this.label6); - this.syncingPage.Location = new System.Drawing.Point (4, 22); + this.syncingPage.Controls.Add(this.tableLayoutPanel3); + this.syncingPage.Location = new System.Drawing.Point(4, 22); this.syncingPage.Name = "syncingPage"; - this.syncingPage.Size = new System.Drawing.Size (506, 370); + this.syncingPage.Size = new System.Drawing.Size(506, 370); this.syncingPage.TabIndex = 2; this.syncingPage.Text = "Syncing"; this.syncingPage.UseVisualStyleBackColor = true; // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 1; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Controls.Add(this.label6, 0, 0); + this.tableLayoutPanel3.Controls.Add(this.buttonFinish, 0, 6); + this.tableLayoutPanel3.Controls.Add(this.syncingProgressBar, 0, 4); + this.tableLayoutPanel3.Controls.Add(this.label16, 0, 2); + this.tableLayoutPanel3.Controls.Add(this.label15, 0, 1); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.Padding = new System.Windows.Forms.Padding(10); + this.tableLayoutPanel3.RowCount = 7; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 15F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 15F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(506, 370); + this.tableLayoutPanel3.TabIndex = 6; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Dock = System.Windows.Forms.DockStyle.Fill; + this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label6.Location = new System.Drawing.Point(13, 10); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(480, 25); + this.label6.TabIndex = 0; + this.label6.Text = "Syncing"; + // + // buttonFinish + // + this.buttonFinish.Dock = System.Windows.Forms.DockStyle.Right; + this.buttonFinish.Enabled = false; + this.buttonFinish.Location = new System.Drawing.Point(418, 333); + this.buttonFinish.Name = "buttonFinish"; + this.buttonFinish.Size = new System.Drawing.Size(75, 24); + this.buttonFinish.TabIndex = 2; + this.buttonFinish.Text = "Finish"; + this.buttonFinish.UseVisualStyleBackColor = true; + this.buttonFinish.Click += new System.EventHandler(this.buttonFinish_Click); + // + // syncingProgressBar + // + this.syncingProgressBar.Location = new System.Drawing.Point(13, 115); + this.syncingProgressBar.Name = "syncingProgressBar"; + this.syncingProgressBar.Size = new System.Drawing.Size(480, 23); + this.syncingProgressBar.TabIndex = 3; + // // label16 // this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point (11, 57); + this.label16.Dock = System.Windows.Forms.DockStyle.Fill; + this.label16.Location = new System.Drawing.Point(13, 50); this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size (176, 13); + this.label16.Size = new System.Drawing.Size(480, 15); this.label16.TabIndex = 5; this.label16.Text = "Are you sure its not coffee o\'clock?"; // // label15 // this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point (11, 44); + this.label15.Dock = System.Windows.Forms.DockStyle.Fill; + this.label15.Location = new System.Drawing.Point(13, 35); this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size (112, 13); + this.label15.Size = new System.Drawing.Size(480, 15); this.label15.TabIndex = 4; this.label15.Text = "This may take a while."; // - // syncingProgressBar - // - this.syncingProgressBar.Location = new System.Drawing.Point (14, 109); - this.syncingProgressBar.Name = "syncingProgressBar"; - this.syncingProgressBar.Size = new System.Drawing.Size (492, 23); - this.syncingProgressBar.TabIndex = 3; - // - // buttonFinish - // - this.buttonFinish.Enabled = false; - this.buttonFinish.Location = new System.Drawing.Point (416, 339); - this.buttonFinish.Name = "buttonFinish"; - this.buttonFinish.Size = new System.Drawing.Size (75, 23); - this.buttonFinish.TabIndex = 2; - this.buttonFinish.Text = "Finish"; - this.buttonFinish.UseVisualStyleBackColor = true; - this.buttonFinish.Click += new System.EventHandler (this.buttonFinish_Click); - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label6.Location = new System.Drawing.Point (8, 18); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size (79, 20); - this.label6.TabIndex = 0; - this.label6.Text = "Syncing"; - // // errorPage // - this.errorPage.Controls.Add (this.buttonTryAgain); - this.errorPage.Controls.Add (this.label3); - this.errorPage.Controls.Add (this.label2); - this.errorPage.Controls.Add (this.label1); - this.errorPage.Location = new System.Drawing.Point (4, 22); + this.errorPage.Controls.Add(this.tableLayoutPanel4); + this.errorPage.Location = new System.Drawing.Point(4, 22); this.errorPage.Name = "errorPage"; - this.errorPage.Size = new System.Drawing.Size (506, 370); + this.errorPage.Size = new System.Drawing.Size(506, 370); this.errorPage.TabIndex = 3; this.errorPage.Text = "Error"; this.errorPage.UseVisualStyleBackColor = true; // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.ColumnCount = 1; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Controls.Add(this.buttonTryAgain, 0, 5); + this.tableLayoutPanel4.Controls.Add(this.label2, 0, 1); + this.tableLayoutPanel4.Controls.Add(this.label3, 0, 3); + this.tableLayoutPanel4.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.Padding = new System.Windows.Forms.Padding(10); + this.tableLayoutPanel4.RowCount = 6; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 70F)); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F)); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel4.Size = new System.Drawing.Size(506, 370); + this.tableLayoutPanel4.TabIndex = 4; + // // buttonTryAgain // - this.buttonTryAgain.Location = new System.Drawing.Point (416, 339); + this.buttonTryAgain.Dock = System.Windows.Forms.DockStyle.Right; + this.buttonTryAgain.Location = new System.Drawing.Point(418, 333); this.buttonTryAgain.Name = "buttonTryAgain"; - this.buttonTryAgain.Size = new System.Drawing.Size (75, 23); + this.buttonTryAgain.Size = new System.Drawing.Size(75, 24); this.buttonTryAgain.TabIndex = 3; this.buttonTryAgain.Text = "Try Again"; this.buttonTryAgain.UseVisualStyleBackColor = true; - this.buttonTryAgain.Click += new System.EventHandler (this.buttonTryAgain_Click); + this.buttonTryAgain.Click += new System.EventHandler(this.buttonTryAgain_Click); // // label3 // - this.label3.Location = new System.Drawing.Point (11, 106); + this.label3.Dock = System.Windows.Forms.DockStyle.Fill; + this.label3.Location = new System.Drawing.Point(13, 108); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (307, 129); + this.label3.Size = new System.Drawing.Size(480, 70); this.label3.TabIndex = 2; - this.label3.Text = resources.GetString ("label3.Text"); + this.label3.Text = resources.GetString("label3.Text"); // // label2 // - this.label2.Location = new System.Drawing.Point (11, 44); + this.label2.Dock = System.Windows.Forms.DockStyle.Fill; + this.label2.Location = new System.Drawing.Point(13, 30); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (307, 62); + this.label2.Size = new System.Drawing.Size(480, 40); this.label2.TabIndex = 1; this.label2.Text = "We don\'t know exactly what the problem is, but we can try to help you pinpoint it" + "."; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label1 // this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label1.Location = new System.Drawing.Point (8, 18); + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label1.Location = new System.Drawing.Point(13, 10); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (191, 20); + this.label1.Size = new System.Drawing.Size(480, 20); this.label1.TabIndex = 0; this.label1.Text = "Something went wrong"; // // finishedPage // - this.finishedPage.Controls.Add (this.label9); - this.finishedPage.Controls.Add (this.label8); - this.finishedPage.Controls.Add (this.buttonFinished); - this.finishedPage.Controls.Add (this.buttonOpenFolder); - this.finishedPage.Location = new System.Drawing.Point (4, 22); + this.finishedPage.Controls.Add(this.tableLayoutPanel5); + this.finishedPage.Location = new System.Drawing.Point(4, 22); this.finishedPage.Name = "finishedPage"; - this.finishedPage.Size = new System.Drawing.Size (506, 370); + this.finishedPage.Size = new System.Drawing.Size(506, 370); this.finishedPage.TabIndex = 4; this.finishedPage.Text = "Finished"; this.finishedPage.UseVisualStyleBackColor = true; // // label9 // - this.label9.Location = new System.Drawing.Point (11, 44); + this.label9.Location = new System.Drawing.Point(13, 35); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size (307, 62); + this.label9.Size = new System.Drawing.Size(307, 15); this.label9.TabIndex = 3; this.label9.Text = "Access the files from your SparkleShare folder."; // // label8 // this.label8.AutoSize = true; - this.label8.Font = new System.Drawing.Font ("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label8.Location = new System.Drawing.Point (8, 18); + this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label8.Location = new System.Drawing.Point(13, 10); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (227, 20); + this.label8.Size = new System.Drawing.Size(227, 20); this.label8.TabIndex = 2; this.label8.Text = "Project successfully added!"; // // buttonFinished // - this.buttonFinished.Location = new System.Drawing.Point (416, 339); + this.buttonFinished.Location = new System.Drawing.Point(84, 3); this.buttonFinished.Name = "buttonFinished"; - this.buttonFinished.Size = new System.Drawing.Size (75, 23); + this.buttonFinished.Size = new System.Drawing.Size(75, 23); this.buttonFinished.TabIndex = 1; this.buttonFinished.Text = "Finish"; this.buttonFinished.UseVisualStyleBackColor = true; - this.buttonFinished.Click += new System.EventHandler (this.buttonFinished_Click); + this.buttonFinished.Click += new System.EventHandler(this.buttonFinished_Click); // // buttonOpenFolder // - this.buttonOpenFolder.Location = new System.Drawing.Point (335, 339); + this.buttonOpenFolder.Location = new System.Drawing.Point(3, 3); this.buttonOpenFolder.Name = "buttonOpenFolder"; - this.buttonOpenFolder.Size = new System.Drawing.Size (75, 23); + this.buttonOpenFolder.Size = new System.Drawing.Size(75, 23); this.buttonOpenFolder.TabIndex = 0; this.buttonOpenFolder.Text = "Open Folder"; this.buttonOpenFolder.UseVisualStyleBackColor = true; - this.buttonOpenFolder.Click += new System.EventHandler (this.buttonOpenFolder_Click); + this.buttonOpenFolder.Click += new System.EventHandler(this.buttonOpenFolder_Click); + // + // tableLayoutPanel5 + // + this.tableLayoutPanel5.ColumnCount = 1; + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel5.Controls.Add(this.flowLayoutPanel2, 0, 3); + this.tableLayoutPanel5.Controls.Add(this.label9, 0, 1); + this.tableLayoutPanel5.Controls.Add(this.label8, 0, 0); + this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel5.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel5.Name = "tableLayoutPanel5"; + this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(10); + this.tableLayoutPanel5.RowCount = 4; + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 15F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel5.Size = new System.Drawing.Size(506, 370); + this.tableLayoutPanel5.TabIndex = 4; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Controls.Add(this.buttonOpenFolder); + this.flowLayoutPanel2.Controls.Add(this.buttonFinished); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Right; + this.flowLayoutPanel2.Location = new System.Drawing.Point(334, 330); + this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(162, 30); + this.flowLayoutPanel2.TabIndex = 0; // // SparkleSetup // - this.ClientSize = new System.Drawing.Size (664, 396); - this.Controls.Add (this.tabControl); - this.Controls.Add (this.pictureBox); + this.ClientSize = new System.Drawing.Size(664, 396); + this.Controls.Add(this.tabControl); + this.Controls.Add(this.pictureBox); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.Name = "SparkleSetup"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "SparkleShare Setup"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler (this.SparkleSetup_FormClosing); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit (); - this.tabControl.ResumeLayout (false); - this.setupPage.ResumeLayout (false); - this.setupPage.PerformLayout (); - this.groupBox1.ResumeLayout (false); - this.groupBox1.PerformLayout (); - this.addPage.ResumeLayout (false); - this.addPage.PerformLayout (); - this.syncingPage.ResumeLayout (false); - this.syncingPage.PerformLayout (); - this.errorPage.ResumeLayout (false); - this.errorPage.PerformLayout (); - this.finishedPage.ResumeLayout (false); - this.finishedPage.PerformLayout (); - this.ResumeLayout (false); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SparkleSetup_FormClosing); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.tabControl.ResumeLayout(false); + this.setupPage.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.addPage.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.syncingPage.ResumeLayout(false); + this.tableLayoutPanel3.ResumeLayout(false); + this.tableLayoutPanel3.PerformLayout(); + this.errorPage.ResumeLayout(false); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); + this.finishedPage.ResumeLayout(false); + this.tableLayoutPanel5.ResumeLayout(false); + this.tableLayoutPanel5.PerformLayout(); + this.flowLayoutPanel2.ResumeLayout(false); + this.ResumeLayout(false); } @@ -497,9 +650,7 @@ namespace SparkleShare { private System.Windows.Forms.Button buttonOpenFolder; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label10; - private System.Windows.Forms.Button buttonNext; private System.Windows.Forms.Panel panel_server_selection; - private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.TextBox EmailEntry; private System.Windows.Forms.TextBox NameEntry; private System.Windows.Forms.Label label13; @@ -510,6 +661,14 @@ namespace SparkleShare { private SparkleShare.controls.ExampleTextBox ServerEntry; private System.Windows.Forms.Label label16; private System.Windows.Forms.Label label15; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Button buttonNext; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; From 256d5936e69103bc03fb639a54f261d9012eb712 Mon Sep 17 00:00:00 2001 From: serras Date: Sat, 14 Jan 2012 11:08:52 +0100 Subject: [PATCH 109/134] Add windows readme --- README.windows.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 README.windows.md diff --git a/README.windows.md b/README.windows.md new file mode 100644 index 00000000..2b47142a --- /dev/null +++ b/README.windows.md @@ -0,0 +1,29 @@ +# Build on windows + +* When you clone the repository, remember to run `git submodule update --init` + +* Install dotNetFramework [[4.0|http://www.microsoft.com/download/en/details.aspx?id=17851]] (if not installed yet) + +* Install [[msysGit PortableGit 1.7.8|http://code.google.com/p/msysgit/downloads/detail?name=PortableGit-1.7.8-preview20111206.7z]] + * rename the .7z file to .exe, execute and extract to `C:\msysgit` + +* Download [[SmartIrc4net-0.4.0.bin.zip|http://sourceforge.net/projects/smartirc4net/files/SmartIrc4net/0.4.0/SmartIrc4net-0.4.0.bin.zip/download]] + * Copy `Meebey.SmartIrc4net.dll` and `Meebey.SmartIrc4net.xml` from the zip file in `bin\release` to `SparkleShare\bin` (create that directory if it does not exist) + +* Download [[CefSharp-0.3.1.7z|https://github.com/downloads/chillitom/CefSharp/CefSharp-0.3.1.7z]] + * Copy `avcodec-52.dll`, `avformat-52.dll`, `avutil-50.dll`, `CefSharp.dll`, `icudt42.dll` and `libcef.dll` from the 7z file in `CefSharp-0.3.1\Release\` to `SparkleShare\bin` + +* Copy the entire contents of the msysGit folder to `SparkleShare\bin\msysgit` + +* Open a command shell and execute + + sparkleshare\windows\build.cmd + +* `SparkleShare\bin` should now contain `SparkleLib.dll` and `SparkleShare.exe` + +* If you want to build the Windows installer download and install [[WiX|http://wix.sourceforge.net/]] + +* Then run + + sparkleshare\windows\build.cmd installer + From 32831a8a778047f2fc513e6b6824fd7301c6078b Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 15 Jan 2012 11:44:27 +0100 Subject: [PATCH 110/134] Updated Windows build instructions --- README.windows.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.windows.md b/README.windows.md index 2b47142a..48838c29 100644 --- a/README.windows.md +++ b/README.windows.md @@ -2,15 +2,15 @@ * When you clone the repository, remember to run `git submodule update --init` -* Install dotNetFramework [[4.0|http://www.microsoft.com/download/en/details.aspx?id=17851]] (if not installed yet) +* Install [.NET Framework 4.0](http://www.microsoft.com/download/en/details.aspx?id=17851) (if not installed yet) -* Install [[msysGit PortableGit 1.7.8|http://code.google.com/p/msysgit/downloads/detail?name=PortableGit-1.7.8-preview20111206.7z]] - * rename the .7z file to .exe, execute and extract to `C:\msysgit` +* Install [msysGit](http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.8-preview20111206.exe) + * I recommend you to install in `C:\msysgit` -* Download [[SmartIrc4net-0.4.0.bin.zip|http://sourceforge.net/projects/smartirc4net/files/SmartIrc4net/0.4.0/SmartIrc4net-0.4.0.bin.zip/download]] +* Download [SmartIrc4net-0.4.0.bin.zip](http://sourceforge.net/projects/smartirc4net/files/SmartIrc4net/0.4.0/SmartIrc4net-0.4.0.bin.zip/download) * Copy `Meebey.SmartIrc4net.dll` and `Meebey.SmartIrc4net.xml` from the zip file in `bin\release` to `SparkleShare\bin` (create that directory if it does not exist) -* Download [[CefSharp-0.3.1.7z|https://github.com/downloads/chillitom/CefSharp/CefSharp-0.3.1.7z]] +* Download [CefSharp-0.3.1.7z](https://github.com/downloads/chillitom/CefSharp/CefSharp-0.3.1.7z) * Copy `avcodec-52.dll`, `avformat-52.dll`, `avutil-50.dll`, `CefSharp.dll`, `icudt42.dll` and `libcef.dll` from the 7z file in `CefSharp-0.3.1\Release\` to `SparkleShare\bin` * Copy the entire contents of the msysGit folder to `SparkleShare\bin\msysgit` @@ -21,7 +21,7 @@ * `SparkleShare\bin` should now contain `SparkleLib.dll` and `SparkleShare.exe` -* If you want to build the Windows installer download and install [[WiX|http://wix.sourceforge.net/]] +* If you want to build the Windows installer download and install [WiX](http://wix.sourceforge.net/) * Then run From 69829cb54753333524918e6c28d4af75d969b73a Mon Sep 17 00:00:00 2001 From: serras Date: Thu, 19 Jan 2012 20:21:48 +0100 Subject: [PATCH 111/134] Make it compile again in Windows --- SparkleLib/Git/SparkleRepoGit.cs | 8 ++++---- SparkleLib/windows/SparkleLib.csproj | 3 +++ SparkleShare/SparkleStatusIcon.cs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 522ed081..c02fc38d 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -71,7 +71,7 @@ namespace SparkleLib { public override double Size { get { - string file_path = Path.Combine (LocalPath, ".git", "repo_size"); + string file_path = SparkleHelpers.CombineMore (LocalPath, ".git", "repo_size"); try { return double.Parse (File.ReadAllText (file_path)); @@ -85,7 +85,7 @@ namespace SparkleLib { public override double HistorySize { get { - string file_path = Path.Combine (LocalPath, ".git", "repo_history_size"); + string file_path = SparkleHelpers.CombineMore(LocalPath, ".git", "repo_history_size"); try { return double.Parse (File.ReadAllText (file_path)); @@ -105,8 +105,8 @@ namespace SparkleLib { double history_size = CalculateSize ( new DirectoryInfo (Path.Combine (LocalPath, ".git"))); - string size_file_path = Path.Combine (LocalPath, ".git", "repo_size"); - string history_size_file_path = Path.Combine (LocalPath, ".git", "repo_history_size"); + string size_file_path = SparkleHelpers.CombineMore(LocalPath, ".git", "repo_size"); + string history_size_file_path = SparkleHelpers.CombineMore(LocalPath, ".git", "repo_history_size"); File.WriteAllText (size_file_path, size.ToString ()); File.WriteAllText (history_size_file_path, history_size.ToString ()); diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 0bf9c160..0fff07df 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -67,6 +67,9 @@ SparkleFetcherGit.cs + + + SparkleGit.cs Component diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 4d70a5b2..252075a7 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -363,4 +363,4 @@ namespace SparkleShare { SetProperty ("always-show-image", new GLib.Value (true)); } } -} +} \ No newline at end of file From f39e9e2ae32878b349b44b736fa956067399a912 Mon Sep 17 00:00:00 2001 From: serras Date: Thu, 19 Jan 2012 20:33:12 +0100 Subject: [PATCH 112/134] Better Windows instructions --- README.windows.md | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/README.windows.md b/README.windows.md index 48838c29..7de574c7 100644 --- a/README.windows.md +++ b/README.windows.md @@ -7,23 +7,45 @@ * Install [msysGit](http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.8-preview20111206.exe) * I recommend you to install in `C:\msysgit` +* Open a Git console (available in Start Menu > Git > Git Bash). On the command line write + + cd /c + git clone -b gettext-cs git://github.com/serras/SparkleShare.git + cd SparkleShare + git submodule update --init + +* This way you will get the SparkleShare source code in `C:\SparkleShare` + * Download [SmartIrc4net-0.4.0.bin.zip](http://sourceforge.net/projects/smartirc4net/files/SmartIrc4net/0.4.0/SmartIrc4net-0.4.0.bin.zip/download) - * Copy `Meebey.SmartIrc4net.dll` and `Meebey.SmartIrc4net.xml` from the zip file in `bin\release` to `SparkleShare\bin` (create that directory if it does not exist) + * Copy `Meebey.SmartIrc4net.dll` and `Meebey.SmartIrc4net.xml` from the zip file in `bin\release` to `C:\SparkleShare\bin` (create that directory if it does not exist) * Download [CefSharp-0.3.1.7z](https://github.com/downloads/chillitom/CefSharp/CefSharp-0.3.1.7z) - * Copy `avcodec-52.dll`, `avformat-52.dll`, `avutil-50.dll`, `CefSharp.dll`, `icudt42.dll` and `libcef.dll` from the 7z file in `CefSharp-0.3.1\Release\` to `SparkleShare\bin` + * Copy `avcodec-52.dll`, `avformat-52.dll`, `avutil-50.dll`, `CefSharp.dll`, `icudt42.dll` and `libcef.dll` from the 7z file in `CefSharp-0.3.1\Release\` to `c:\SparkleShare\bin` -* Copy the entire contents of the msysGit folder to `SparkleShare\bin\msysgit` +* Copy the entire contents of the msysGit folder to `C:\SparkleShare\bin\msysgit` -* Open a command shell and execute +* Open a command shell (available in Start Menu > Accessories > Command Prompt) and execute - sparkleshare\windows\build.cmd + C: + cd C:\SparkleShare + cd SparkleShare\Windows + build -* `SparkleShare\bin` should now contain `SparkleLib.dll` and `SparkleShare.exe` +* `C:\SparkleShare\bin` should now contain `SparkleLib.dll` and `SparkleShare.exe`, apart from folders `plugins`, `po` and `msysgit` * If you want to build the Windows installer download and install [WiX](http://wix.sourceforge.net/) -* Then run +* Then open a command shell and write almost the same as before, but with `installer` at the end - sparkleshare\windows\build.cmd installer + C: + cd C:\SparkleShare + cd SparkleShare\Windows + build installer +* Each time you would like to get the latest changes open a Git console and run + + cd /c/SparkleShare + git pull + git submodule update + + and then run the build in the command shell. From 41c12d53393d21258deb3454fbc914b6cf828b57 Mon Sep 17 00:00:00 2001 From: serras Date: Thu, 19 Jan 2012 20:35:34 +0100 Subject: [PATCH 113/134] Fix README formatting --- README.windows.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/README.windows.md b/README.windows.md index 7de574c7..08074e59 100644 --- a/README.windows.md +++ b/README.windows.md @@ -9,10 +9,10 @@ * Open a Git console (available in Start Menu > Git > Git Bash). On the command line write - cd /c - git clone -b gettext-cs git://github.com/serras/SparkleShare.git - cd SparkleShare - git submodule update --init + cd /c + git clone -b gettext-cs git://github.com/serras/SparkleShare.git + cd SparkleShare + git submodule update --init * This way you will get the SparkleShare source code in `C:\SparkleShare` @@ -26,10 +26,10 @@ * Open a command shell (available in Start Menu > Accessories > Command Prompt) and execute - C: - cd C:\SparkleShare - cd SparkleShare\Windows - build + C: + cd C:\SparkleShare + cd SparkleShare\Windows + build * `C:\SparkleShare\bin` should now contain `SparkleLib.dll` and `SparkleShare.exe`, apart from folders `plugins`, `po` and `msysgit` @@ -37,15 +37,15 @@ * Then open a command shell and write almost the same as before, but with `installer` at the end - C: - cd C:\SparkleShare - cd SparkleShare\Windows - build installer + C: + cd C:\SparkleShare + cd SparkleShare\Windows + build installer -* Each time you would like to get the latest changes open a Git console and run +Now, each time you would like to get the latest changes open a Git console and run - cd /c/SparkleShare - git pull - git submodule update + cd /c/SparkleShare + git pull + git submodule update - and then run the build in the command shell. +and then run the build in the command shell. From 785db0d9544ecf7abaccbbacabd7ec01dca3e89e Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Fri, 20 Jan 2012 08:21:29 +0100 Subject: [PATCH 114/134] Update README.windows.md --- README.windows.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.windows.md b/README.windows.md index 08074e59..7bd8df88 100644 --- a/README.windows.md +++ b/README.windows.md @@ -1,7 +1,5 @@ # Build on windows -* When you clone the repository, remember to run `git submodule update --init` - * Install [.NET Framework 4.0](http://www.microsoft.com/download/en/details.aspx?id=17851) (if not installed yet) * Install [msysGit](http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.8-preview20111206.exe) From 668bd64c4c50b2a53952d425bc15b3efff40bb3b Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Fri, 20 Jan 2012 08:23:01 +0100 Subject: [PATCH 115/134] Update README.windows.md --- README.windows.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.windows.md b/README.windows.md index 7bd8df88..f464b337 100644 --- a/README.windows.md +++ b/README.windows.md @@ -5,7 +5,7 @@ * Install [msysGit](http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.8-preview20111206.exe) * I recommend you to install in `C:\msysgit` -* Open a Git console (available in Start Menu > Git > Git Bash). On the command line write +* _Clone step_: Open a Git console (available in Start Menu > Git > Git Bash). On the command line write cd /c git clone -b gettext-cs git://github.com/serras/SparkleShare.git @@ -22,7 +22,7 @@ * Copy the entire contents of the msysGit folder to `C:\SparkleShare\bin\msysgit` -* Open a command shell (available in Start Menu > Accessories > Command Prompt) and execute +* _Build step_: Open a command shell (available in Start Menu > Accessories > Command Prompt) and execute C: cd C:\SparkleShare @@ -33,7 +33,7 @@ * If you want to build the Windows installer download and install [WiX](http://wix.sourceforge.net/) -* Then open a command shell and write almost the same as before, but with `installer` at the end +* _Installer build step_: Then open a command shell and write almost the same as before, but with `installer` at the end C: cd C:\SparkleShare @@ -46,4 +46,4 @@ Now, each time you would like to get the latest changes open a Git console and r git pull git submodule update -and then run the build in the command shell. +and then run the build step and/or build installer step in the command shell. From 0b0d62e841059a0b015523411ec3b60a747b5b69 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 22 Jan 2012 00:05:34 +0100 Subject: [PATCH 116/134] improve instructions --- README.windows.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.windows.md b/README.windows.md index f464b337..0ce2019a 100644 --- a/README.windows.md +++ b/README.windows.md @@ -4,6 +4,7 @@ * Install [msysGit](http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.8-preview20111206.exe) * I recommend you to install in `C:\msysgit` + * Use default settings for all other questions during installation * _Clone step_: Open a Git console (available in Start Menu > Git > Git Bash). On the command line write @@ -14,11 +15,8 @@ * This way you will get the SparkleShare source code in `C:\SparkleShare` -* Download [SmartIrc4net-0.4.0.bin.zip](http://sourceforge.net/projects/smartirc4net/files/SmartIrc4net/0.4.0/SmartIrc4net-0.4.0.bin.zip/download) - * Copy `Meebey.SmartIrc4net.dll` and `Meebey.SmartIrc4net.xml` from the zip file in `bin\release` to `C:\SparkleShare\bin` (create that directory if it does not exist) - * Download [CefSharp-0.3.1.7z](https://github.com/downloads/chillitom/CefSharp/CefSharp-0.3.1.7z) - * Copy `avcodec-52.dll`, `avformat-52.dll`, `avutil-50.dll`, `CefSharp.dll`, `icudt42.dll` and `libcef.dll` from the 7z file in `CefSharp-0.3.1\Release\` to `c:\SparkleShare\bin` + * Copy `avcodec-52.dll`, `avformat-52.dll`, `avutil-50.dll`, `CefSharp.dll`, `icudt42.dll` and `libcef.dll` from the 7z file in `CefSharp-0.3.1\Release\` to `c:\SparkleShare\bin` (create that directory if it does not exist) * Copy the entire contents of the msysGit folder to `C:\SparkleShare\bin\msysgit` @@ -31,7 +29,7 @@ * `C:\SparkleShare\bin` should now contain `SparkleLib.dll` and `SparkleShare.exe`, apart from folders `plugins`, `po` and `msysgit` -* If you want to build the Windows installer download and install [WiX](http://wix.sourceforge.net/) +* If you want to build the Windows installer download and install [WiX 3.5](http://wix.sourceforge.net/) * _Installer build step_: Then open a command shell and write almost the same as before, but with `installer` at the end From dd621bb8dcf78f52a194154eb83094e477e63606 Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 22 Jan 2012 19:35:37 +0100 Subject: [PATCH 117/134] Added installation images --- data/install/bannrbmp.bmp | Bin 0 -> 94554 bytes data/install/dlgbmp.bmp | Bin 0 -> 474822 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 data/install/bannrbmp.bmp create mode 100644 data/install/dlgbmp.bmp diff --git a/data/install/bannrbmp.bmp b/data/install/bannrbmp.bmp new file mode 100644 index 0000000000000000000000000000000000000000..ed3fecd099030817c72a75d47d5b0527508e20bb GIT binary patch literal 94554 zcmeHw2YeOBwSHdSdr4mYDbFdcaeYY~zmyj{juSU*s_Dfv1EwQT@4esNd+%yjz4wX` zDyRzt2t@DArWben|Lt9AwOoM#qkEAQ?r#vYvu9>!XJ)@S`<*khljbZB`nT^9zt`~Z z5BPTthwtG3fBW9!`1`%@{TAo<{PcT{e~twFDdx`@@sQ7XFDZJGn}aoSqAKw1(lp7Z zpMHAv>eXx4u3f)={aAl*7Hd-ub7MZoyNKsgBJ{721Xat!Hmjqz>f@Wutd3-1Pr71f zwr+2M^+2ipP({|!nu4<}4d=IaTs?f?`thUJPaL~(`sC-AFMajdr{CP__x0CbfBESr zpItnE^A{Yyix)3mx^(Hvl`Efp_Sxo|@|6px%z5)UzlDEhZFo)L z|CTZQU2D`tH?(JR%%mdT$d88+A7HmDFe71#8(L}XULqxSGM>%bwcf+@hb?f&7D#vd zBW8=5WC(l5#9Rf01hA7oz`H%cBZILqlesCI>6y>u7 zccw|UXR3GQ8uu0@9Vp8s*uN^xAxW0b!_>D6sKf8G0i|g0F`r-?K zIey4o#a|LZ4@LHO#CgXgz*?kLQ$au{=_PJH#{mx1uV{q66cd+r4w{F6`q z=F!I<|K+cK{oju~@{^zZWb)+6bZkfEFJHclDe2P1i$!@^Z~x_qmG8Y6y!8KsUaxC{ zCzvDLf$-VPX?N`3Q7cfypOG3jdF*1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(5997{flR?nC}97}gOI#;Xj$%Wd>38Oof;!_1GxMFle2^~8;X=4 zfAld(c)+z2!Z$WHI_d3nfh(6UXQ@1Mv06$q9|O`w&En=_;jQ#9t~iYwWy#GWXJjwu z;Aj3Nbqw8tN=L|-%}$36Xj}wn)Z|UM?Jura3Qu_X92hLNRT_cY@ROvYHyLkeXn@`h zTBg3f9v^Qde~{eXR+Gk?juKE|yakMpUcg-tkJaD+`xlIqYv*SQXO5fR9J@CHt;zkE J@W2QB{|CLd1(*N; literal 0 HcmV?d00001 diff --git a/data/install/dlgbmp.bmp b/data/install/dlgbmp.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d18088aef33c47f4dce3d3f1f96ca6a1dc6651b7 GIT binary patch literal 474822 zcmeF4cU)Ch+WkXu@|&5=OuCh-^xjdUF{YWs6pfn1R828zirv@|=^g34g9qui6;i(|BRmKMVFt5GrZ4U7!LO7l5H9d`wScfyEM@;LvqNF=z6MPlS)@?(?$CX z(GJIS!Hx#qW1FgT%9I>4MMpYHPFa#erpSimn88m3+)p=T$qpHG;)L@I+%Mv0=PbjI z;G#>m{TH8&viw0(Y;-&8BwNrqqK8) zQQNShwwDWA2jw;m&TaO~ZuHNt_e;MuDC4Go>J{I_^L~l7ehH`j;%fY3tNo*o42(YP zAHLT=c$;6q2ET=+{_~6dXXW_MNc*q)A9V)Q8Bk~7|DFM`-X=}Nuua7fY*GXqfpLJ{ zmM#h)KTd#pqJ5fy_O@v{d)$z!wMzrZMJx&q4D0|n=RA%eJlJlRss+!Tv#|tV$j;d^ zRs`Jak}VV7b7ZG%3Fodk^cLWcbBA=DWmJRN(kpMI*UjCgjjmGo;E)I5{|Na9gvUut zmHfski8x;%dF6|Y>XLh&dt*uDwepw^$`_lJ$=mfa_b35}x+0J2vyN&2cHq4V<8IfXJ6-#4b?su1 zFRPVj?Nz?tu6(gY{%E5#dc81mt!_lA_Kj7V;VU~|Dd`+q&^9Q))jzM*C%efvyODE# zVCEhFw3~h@SA3H%`X|=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MAuK)qHjMmCO7 z+Xu7)W$k7ahI%bd`ve=uOx=>OsA{f_^Y*!ugp7w1_?7p`#~+)dn~mIMVNE)y_Zi3& zw1<<-ZhOu|BHph*Pf++{{?*8$$2kucy(b?~pJ37B*3As(4LLDgRz#B(Qe_4dnWzp6 zdY<4sYo&s=LfSz3Hvf)ifczO`2EOVU0M74h+qk1`1JHhShW0R|5oiy>eqPkWC#R;S z0QE5XEIuItYq^B3%WG^Lw5W=pJreeb+8%GeL^h7u;I#a?+zGk7&|C7%d+blz#rnFy_!2(3nOJ>(NV6IeaN`BlT-RYRUtan9ow zy%S2Yvz%`?=Clx;S7!#4nLc@@N1E=Eq}zq*NY4|TuUW>aB>nlX`cq0?ADMwKmjU4X F{|7!)ig*A3 literal 0 HcmV?d00001 From b0242d94d1adf5a53de138729a93e0aadfddf15b Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 22 Jan 2012 19:44:30 +0100 Subject: [PATCH 118/134] Specify icon for SparkleShare executable Remove dependency on SmartIrc lib Fix bug with Icon.resx file --- SparkleLib/windows/SparkleLib.csproj | 4 - SparkleShare/Windows/Icons.Designer.cs | 108 ++-------- SparkleShare/Windows/Icons.resx | 248 ++++++++++------------- SparkleShare/Windows/SparkleShare.csproj | 4 + 4 files changed, 122 insertions(+), 242 deletions(-) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 0fff07df..5c2cae7f 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -55,10 +55,6 @@ - - False - ..\..\bin\Meebey.SmartIrc4net.dll - 3.5 diff --git a/SparkleShare/Windows/Icons.Designer.cs b/SparkleShare/Windows/Icons.Designer.cs index 6dc550b0..5eacec98 100644 --- a/SparkleShare/Windows/Icons.Designer.cs +++ b/SparkleShare/Windows/Icons.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:2.0.50727.3053 +// Este código fue generado por una herramienta. +// Versión del motor en tiempo de ejecución:2.0.50727.3625 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si +// se vuelve a generar el código. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace SparkleShare { /// - /// A strongly-typed resource class, for looking up localized strings, etc. + /// Clase de recurso con establecimiento inflexible de tipos, para buscar cadenas traducidas, etc. /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o vuelva a generar su proyecto de VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ namespace SparkleShare { } /// - /// Returns the cached ResourceManager instance used by this class. + /// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ namespace SparkleShare { } /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. + /// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos mediante esta clase de recurso con establecimiento inflexible de tipos. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -151,20 +151,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap error { - get { - object obj = ResourceManager.GetObject("error", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap error_active { - get { - object obj = ResourceManager.GetObject("error_active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap folder_sparkleshare_16 { get { object obj = ResourceManager.GetObject("folder_sparkleshare_16", resourceCulture); @@ -207,76 +193,6 @@ namespace SparkleShare { } } - internal static System.Drawing.Bitmap idle0 { - get { - object obj = ResourceManager.GetObject("idle0", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle0_active { - get { - object obj = ResourceManager.GetObject("idle0_active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle1 { - get { - object obj = ResourceManager.GetObject("idle1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle1_active { - get { - object obj = ResourceManager.GetObject("idle1_active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle2 { - get { - object obj = ResourceManager.GetObject("idle2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle2_active { - get { - object obj = ResourceManager.GetObject("idle2_active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle3 { - get { - object obj = ResourceManager.GetObject("idle3", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle3_active { - get { - object obj = ResourceManager.GetObject("idle3_active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle4 { - get { - object obj = ResourceManager.GetObject("idle4", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap idle4_active { - get { - object obj = ResourceManager.GetObject("idle4_active", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap list_point_16 { get { object obj = ResourceManager.GetObject("list_point_16", resourceCulture); diff --git a/SparkleShare/Windows/Icons.resx b/SparkleShare/Windows/Icons.resx index cefaf212..09b2f988 100644 --- a/SparkleShare/Windows/Icons.resx +++ b/SparkleShare/Windows/Icons.resx @@ -118,145 +118,109 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\..\data\icons\avatar-default-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\avatar-default-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\avatar-default-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\avatar-default-32.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\avatar-default-48.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\avatar-default.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\dialog-error-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\dialog-error-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\document-added-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\document-deleted-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\document-edited-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\document-moved-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\error-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\error.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\folder-sparkleshare-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\folder-sparkleshare-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\folder-sparkleshare-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\folder-sparkleshare-256.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\folder-sparkleshare-32.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\folder-sparkleshare-48.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle0-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle1-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle2-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle3-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle4-active.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\idle4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\list-point-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\process-syncing-sparkleshare-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\process-syncing-sparkleshare-i-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\process-syncing-sparkleshare-ii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\process-syncing-sparkleshare-iii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\process-syncing-sparkleshare-iiii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\process-syncing-sparkleshare-iiiii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\process-working-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\sparkleshare-syncing-error-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\sparkleshare-windows-status.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\icons\sparkleshare.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\about.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\side-splash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\tutorial-slide-1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\tutorial-slide-2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\tutorial-slide-3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\..\data\tutorial-slide-4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - + + ..\..\data\icons\avatar-default-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-32.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default-48.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\avatar-default.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\dialog-error-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\dialog-error-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-added-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-deleted-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-edited-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\document-moved-12.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-256.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-32.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\folder-sparkleshare-48.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\list-point-16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-i-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-ii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-iii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-iiii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-syncing-sparkleshare-iiiii-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\process-working-22.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\sparkleshare-syncing-error-24.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\sparkleshare-windows-status.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\icons\sparkleshare.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\about.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\side-splash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\tutorial-slide-1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\tutorial-slide-2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\tutorial-slide-3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\..\data\tutorial-slide-4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index a4effb6a..8f87b853 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -30,6 +30,7 @@ 1.0.0.%2a false true + sparkleshare.ico true @@ -407,4 +408,7 @@ Strings.cs + + + \ No newline at end of file From fbd49206d07d53561a543636c1891a1dc8c135ec Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 22 Jan 2012 19:49:37 +0100 Subject: [PATCH 119/134] Specify WiX 3.6 for building installer --- README.windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.windows.md b/README.windows.md index 0ce2019a..5a05a005 100644 --- a/README.windows.md +++ b/README.windows.md @@ -29,7 +29,7 @@ * `C:\SparkleShare\bin` should now contain `SparkleLib.dll` and `SparkleShare.exe`, apart from folders `plugins`, `po` and `msysgit` -* If you want to build the Windows installer download and install [WiX 3.5](http://wix.sourceforge.net/) +* If you want to build the Windows installer download and install [WiX 3.6](http://wix.sourceforge.net/) * _Installer build step_: Then open a command shell and write almost the same as before, but with `installer` at the end From fb5675e9a8ed69ee8f94a410e216c555bd1133fd Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 22 Jan 2012 19:59:46 +0100 Subject: [PATCH 120/134] Do not include SmartIrc in installer Improve installer building --- SparkleShare/Windows/SparkleShare.wxs | 2 -- SparkleShare/Windows/build.cmd | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs index 61423a1b..8a2ce630 100644 --- a/SparkleShare/Windows/SparkleShare.wxs +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -17,8 +17,6 @@ - - diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index 6c2a4db7..857498cd 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -16,6 +16,7 @@ set wixBinDir=%WIX%\bin if "%1"=="installer" ( if exist "%wixBinDir%" ( + if exist "%~dp0\SparkleShare.msi" del "%~dp0\SparkleShare.msi" "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\msysgit" -cg msysGitComponentGroup -gg -scom -sreg -sfrag -srd -dr MSYSGIT_DIR -var wix.msysgitpath -o msysgit.wxs "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\po" -cg poComponentGroup -gg -scom -sreg -sfrag -srd -dr PO_DIR -var wix.podir -o po.wxs "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\plugins" -cg pluginsComponentGroup -gg -scom -sreg -sfrag -srd -dr PLUGINS_DIR -var wix.pluginsdir -o plugins.wxs @@ -24,7 +25,7 @@ if "%1"=="installer" ( "%wixBinDir%\candle" "%~dp0\po.wxs" -ext WixUIExtension -ext WixUtilExtension "%wixBinDir%\candle" "%~dp0\plugins.wxs" -ext WixUIExtension -ext WixUtilExtension "%wixBinDir%\light" -ext WixUIExtension -ext WixUtilExtension Sparkleshare.wixobj msysgit.wixobj po.wixobj plugins.wixobj -droot="%~dp0\..\.." -dmsysgitpath="%~dp0\..\..\bin\msysgit" -dpodir="%~dp0\..\..\bin\po" -dpluginsdir="%~dp0\..\..\bin\plugins" -o SparkleShare.msi - echo SparkleShare.msi created. + if exist "%~dp0\SparkleShare.msi" echo SparkleShare.msi created. ) else ( echo Not building installer ^(could not find wix, Windows Installer XML toolset^) echo wix is available at http://wix.sourceforge.net/ From b62d32ba1ebb109899082915519aea8589d68de1 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 26 Jan 2012 18:35:19 +0100 Subject: [PATCH 121/134] Update README.windows.md --- README.windows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.windows.md b/README.windows.md index 5a05a005..d9eea36d 100644 --- a/README.windows.md +++ b/README.windows.md @@ -3,7 +3,7 @@ * Install [.NET Framework 4.0](http://www.microsoft.com/download/en/details.aspx?id=17851) (if not installed yet) * Install [msysGit](http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.8-preview20111206.exe) - * I recommend you to install in `C:\msysgit` + * Change install location to `C:\msysgit` (location is hard-coded in the build scrits) * Use default settings for all other questions during installation * _Clone step_: Open a Git console (available in Start Menu > Git > Git Bash). On the command line write @@ -20,7 +20,7 @@ * Copy the entire contents of the msysGit folder to `C:\SparkleShare\bin\msysgit` -* _Build step_: Open a command shell (available in Start Menu > Accessories > Command Prompt) and execute +* _Build step_: Open a command shell (available in Start Menu > Accessories > Command Prompt) and execute (Note to Windows 7 x64 users: change the WinDirNet variable in build.cmd to "%WinDir%\Microsoft.NET\Framework64") C: cd C:\SparkleShare From c9c40b0482f372b8049a54aad394e7063de1fcfd Mon Sep 17 00:00:00 2001 From: Izzy Date: Sun, 29 Jan 2012 10:53:10 -0800 Subject: [PATCH 122/134] Make it look for the icon in the correct place, so we don't have multiple copies of it floating around. --- SparkleShare/Windows/SparkleShare.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 8f87b853..8b8a9434 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -30,7 +30,7 @@ 1.0.0.%2a false true - sparkleshare.ico + ..\..\data\icons\sparkleshare.ico true @@ -409,6 +409,6 @@ - + \ No newline at end of file From ef5a5c04b37f86dbc335b2f49ed97ceb7f9f6fcf Mon Sep 17 00:00:00 2001 From: Izzy Date: Sun, 29 Jan 2012 11:18:37 -0800 Subject: [PATCH 123/134] Aha! There was no Click() event on buttonNext in Windows/SparkleSetup.Designer.cs ! Now I can make it through the initial setup. --- SparkleShare/Windows/SparkleSetup.Designer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 9d0abb7c..aa2f2f9c 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -186,6 +186,7 @@ namespace SparkleShare { this.buttonNext.TabIndex = 3; this.buttonNext.Text = "Next"; this.buttonNext.UseVisualStyleBackColor = true; + this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click); // // NameEntry // From ba7049c8186d4a495a495d8a9d11e3118d56ddf2 Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 5 Feb 2012 19:50:38 +0100 Subject: [PATCH 124/134] Solved issues when compiling in Windows latest version Change executable output to Windows so no command line is shown Remove version from SparkleShare setup name --- SparkleLib/windows/SparkleLib.csproj | 3 +++ SparkleShare/Windows/SparkleShare.csproj | 4 +++- SparkleShare/Windows/SparkleShare.wxs | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 5c2cae7f..06ae5097 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -74,6 +74,9 @@ SparkleConfig.cs + + SparkleExtensions.cs + SparkleRepoBase.cs diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 8b8a9434..0631b40a 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -5,7 +5,7 @@ AnyCPU 9.0.30729 {728483AA-E34B-4441-BF2C-C8BC2901E4E0} - Exe + WinExe SparkleShare 2.0 SparkleShare @@ -31,6 +31,8 @@ false true ..\..\data\icons\sparkleshare.ico + + true diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs index 8a2ce630..db54540b 100644 --- a/SparkleShare/Windows/SparkleShare.wxs +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -1,10 +1,10 @@ - + - From 8ed2523812e9fda49537a0beb9e5cbd010e09fd5 Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 12 Feb 2012 16:51:28 +0100 Subject: [PATCH 125/134] Update projects to use new files --- SparkleLib/SparkleListenerTcp.cs | 4 ++-- SparkleLib/windows/SparkleLib.csproj | 7 ++++++- SparkleShare/Windows/Program.cs | 1 - SparkleShare/Windows/SparkleShare.csproj | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SparkleLib/SparkleListenerTcp.cs b/SparkleLib/SparkleListenerTcp.cs index 1bb38a1d..ff0323eb 100755 --- a/SparkleLib/SparkleListenerTcp.cs +++ b/SparkleLib/SparkleListenerTcp.cs @@ -91,7 +91,7 @@ namespace SparkleLib { this.is_connected = false; this.is_connecting = false; - this.socket.Dispose (); + // this.socket.Dispose (); OnDisconnected (e.Message); return; @@ -158,7 +158,7 @@ namespace SparkleLib { this.is_connected = false; this.is_connecting = false;; - this.socket.Dispose (); + // this.socket.Dispose (); OnDisconnected ("Ping timeout"); return; diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 06ae5097..5958ff3d 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -71,12 +71,18 @@ SparkleRepoGit.cs + + SparkleAnnouncement.cs + SparkleConfig.cs SparkleExtensions.cs + + SparkleListenerFactory.cs + SparkleRepoBase.cs @@ -93,7 +99,6 @@ - diff --git a/SparkleShare/Windows/Program.cs b/SparkleShare/Windows/Program.cs index 01e27275..2e43ea4d 100644 --- a/SparkleShare/Windows/Program.cs +++ b/SparkleShare/Windows/Program.cs @@ -29,7 +29,6 @@ using Mono.Unix; //using Mono.Unix.Native; #endif using SparkleLib; -using SparkleLib.Options; namespace SparkleShare { diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 0631b40a..3fe7bfb3 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -93,6 +93,9 @@ SparkleInvite.cs + + SparkleOptions.cs + SparklePlugin.cs From 87d3e42ce96caae6c7d93310cace747b733f341a Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 12 Feb 2012 17:05:32 +0100 Subject: [PATCH 126/134] Try to fix issue #8 about unmanaged icons in GDI+ --- SparkleShare/Windows/SparkleStatusIcon.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 8b4bb690..0ec05fb8 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -22,6 +22,8 @@ using SparkleLib; using System.Windows.Forms; using System.Drawing; +using System.Runtime.InteropServices; + namespace SparkleShare { // The statusicon that stays in the @@ -109,6 +111,16 @@ namespace SparkleShare { return animation_frames; } + [DllImport("user32.dll", EntryPoint = "DestroyIcon")] + static extern bool DestroyIcon(IntPtr hIcon); + + private Icon GetIconFromBitmap (Bitmap bitmap) + { + IntPtr unmanagedIcon = bitmap.GetHicon(); + Icon icon = (Icon)Icon.FromHandle(unmanagedIcon).Clone(); + DestroyIcon(unmanagedIcon); + return icon; + } // Creates the Animation that handles the syncing animation private Timer CreateAnimation () @@ -126,7 +138,7 @@ namespace SparkleShare { FrameNumber = 0; status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { - this.status_icon.Icon = Icon.FromHandle (AnimationFrames [FrameNumber].GetHicon ()); + this.status_icon.Icon = GetIconFromBitmap( AnimationFrames [FrameNumber]); }); }; @@ -304,7 +316,7 @@ namespace SparkleShare { StateText = _("Welcome to SparkleShare!"); status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { - this.status_icon.Icon = Icon.FromHandle (AnimationFrames [0].GetHicon ()); + this.status_icon.Icon = GetIconFromBitmap (AnimationFrames [0]); }); } else { @@ -312,12 +324,12 @@ namespace SparkleShare { StateText = _("Not everything is synced"); status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { - this.status_icon.Icon = Icon.FromHandle (Icons.sparkleshare_syncing_error_24.GetHicon ()); + this.status_icon.Icon = GetIconFromBitmap (Icons.sparkleshare_syncing_error_24); }); } else { StateText = _("Up to date") + " (" + FolderSize + ")"; status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { - this.status_icon.Icon = Icon.FromHandle (AnimationFrames [0].GetHicon ()); + this.status_icon.Icon = GetIconFromBitmap (AnimationFrames [0]); }); } } From f9462f095f42deae0f398c8512f3b5e527991565 Mon Sep 17 00:00:00 2001 From: serras Date: Sun, 12 Feb 2012 17:24:24 +0100 Subject: [PATCH 127/134] Chnage slightly error message (closes #9) --- SparkleShare/Windows/SparkleSetup.Designer.cs | 176 +++++++++--------- SparkleShare/Windows/SparkleSetup.cs | 3 + 2 files changed, 91 insertions(+), 88 deletions(-) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index aa2f2f9c..484710db 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -28,17 +28,17 @@ namespace SparkleShare { this.tabControl = new SparkleShare.controls.TablessControl(); this.setupPage = new System.Windows.Forms.TabPage(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.label11 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); this.EmailEntry = new System.Windows.Forms.TextBox(); this.buttonNext = new System.Windows.Forms.Button(); this.NameEntry = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.addPage = new System.Windows.Forms.TabPage(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.panel_server_selection = new System.Windows.Forms.Panel(); this.label4 = new System.Windows.Forms.Label(); + this.panel_server_selection = new System.Windows.Forms.Panel(); this.FolderEntry = new SparkleShare.controls.ExampleTextBox(); this.label14 = new System.Windows.Forms.Label(); this.ServerEntry = new SparkleShare.controls.ExampleTextBox(); @@ -56,16 +56,16 @@ namespace SparkleShare { this.errorPage = new System.Windows.Forms.TabPage(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.buttonTryAgain = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.finishedPage = new System.Windows.Forms.TabPage(); - this.label9 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.buttonFinished = new System.Windows.Forms.Button(); - this.buttonOpenFolder = new System.Windows.Forms.Button(); this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.buttonOpenFolder = new System.Windows.Forms.Button(); + this.buttonFinished = new System.Windows.Forms.Button(); + this.label9 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.tabControl.SuspendLayout(); this.setupPage.SuspendLayout(); @@ -144,29 +144,6 @@ namespace SparkleShare { this.tableLayoutPanel1.Size = new System.Drawing.Size(500, 364); this.tableLayoutPanel1.TabIndex = 8; // - // label11 - // - this.tableLayoutPanel1.SetColumnSpan(this.label11, 2); - this.label11.Dock = System.Windows.Forms.DockStyle.Fill; - this.label11.Location = new System.Drawing.Point(8, 30); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(484, 30); - this.label11.TabIndex = 2; - this.label11.Text = "Before we can create a SparkleShare folder on this computer, we need a few bits o" + - "f information from you."; - // - // label10 - // - this.label10.AutoSize = true; - this.tableLayoutPanel1.SetColumnSpan(this.label10, 2); - this.label10.Dock = System.Windows.Forms.DockStyle.Fill; - this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label10.Location = new System.Drawing.Point(8, 5); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(484, 25); - this.label10.TabIndex = 1; - this.label10.Text = "Welcome to SparkleShare!"; - // // EmailEntry // this.EmailEntry.Dock = System.Windows.Forms.DockStyle.Fill; @@ -186,7 +163,7 @@ namespace SparkleShare { this.buttonNext.TabIndex = 3; this.buttonNext.Text = "Next"; this.buttonNext.UseVisualStyleBackColor = true; - this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click); + this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click); // // NameEntry // @@ -197,6 +174,18 @@ namespace SparkleShare { this.NameEntry.TabIndex = 9; this.NameEntry.TextChanged += new System.EventHandler(this.CheckSetupPage); // + // label10 + // + this.label10.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.label10, 2); + this.label10.Dock = System.Windows.Forms.DockStyle.Fill; + this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label10.Location = new System.Drawing.Point(8, 5); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(484, 25); + this.label10.TabIndex = 1; + this.label10.Text = "Welcome to SparkleShare!"; + // // label13 // this.label13.AutoSize = true; @@ -209,6 +198,17 @@ namespace SparkleShare { this.label13.Text = "Email:"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // label11 + // + this.tableLayoutPanel1.SetColumnSpan(this.label11, 2); + this.label11.Dock = System.Windows.Forms.DockStyle.Fill; + this.label11.Location = new System.Drawing.Point(8, 30); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(484, 30); + this.label11.TabIndex = 2; + this.label11.Text = "Before we can create a SparkleShare folder on this computer, we need a few bits o" + + "f information from you."; + // // label12 // this.label12.AutoSize = true; @@ -260,15 +260,6 @@ namespace SparkleShare { this.tableLayoutPanel2.Size = new System.Drawing.Size(500, 364); this.tableLayoutPanel2.TabIndex = 18; // - // panel_server_selection - // - this.tableLayoutPanel2.SetColumnSpan(this.panel_server_selection, 2); - this.panel_server_selection.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel_server_selection.Location = new System.Drawing.Point(13, 63); - this.panel_server_selection.Name = "panel_server_selection"; - this.panel_server_selection.Size = new System.Drawing.Size(474, 171); - this.panel_server_selection.TabIndex = 12; - // // label4 // this.label4.AutoSize = true; @@ -281,6 +272,15 @@ namespace SparkleShare { this.label4.TabIndex = 0; this.label4.Text = "Where\'s your project hosted?"; // + // panel_server_selection + // + this.tableLayoutPanel2.SetColumnSpan(this.panel_server_selection, 2); + this.panel_server_selection.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel_server_selection.Location = new System.Drawing.Point(13, 63); + this.panel_server_selection.Name = "panel_server_selection"; + this.panel_server_selection.Size = new System.Drawing.Size(474, 171); + this.panel_server_selection.TabIndex = 12; + // // FolderEntry // this.FolderEntry.Dock = System.Windows.Forms.DockStyle.Fill; @@ -483,15 +483,6 @@ namespace SparkleShare { this.buttonTryAgain.UseVisualStyleBackColor = true; this.buttonTryAgain.Click += new System.EventHandler(this.buttonTryAgain_Click); // - // label3 - // - this.label3.Dock = System.Windows.Forms.DockStyle.Fill; - this.label3.Location = new System.Drawing.Point(13, 108); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(480, 70); - this.label3.TabIndex = 2; - this.label3.Text = resources.GetString("label3.Text"); - // // label2 // this.label2.Dock = System.Windows.Forms.DockStyle.Fill; @@ -503,6 +494,15 @@ namespace SparkleShare { "."; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // label3 + // + this.label3.Dock = System.Windows.Forms.DockStyle.Fill; + this.label3.Location = new System.Drawing.Point(13, 108); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(480, 70); + this.label3.TabIndex = 2; + this.label3.Text = resources.GetString("label3.Text"); + // // label1 // this.label1.AutoSize = true; @@ -524,44 +524,6 @@ namespace SparkleShare { this.finishedPage.Text = "Finished"; this.finishedPage.UseVisualStyleBackColor = true; // - // label9 - // - this.label9.Location = new System.Drawing.Point(13, 35); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(307, 15); - this.label9.TabIndex = 3; - this.label9.Text = "Access the files from your SparkleShare folder."; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); - this.label8.Location = new System.Drawing.Point(13, 10); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(227, 20); - this.label8.TabIndex = 2; - this.label8.Text = "Project successfully added!"; - // - // buttonFinished - // - this.buttonFinished.Location = new System.Drawing.Point(84, 3); - this.buttonFinished.Name = "buttonFinished"; - this.buttonFinished.Size = new System.Drawing.Size(75, 23); - this.buttonFinished.TabIndex = 1; - this.buttonFinished.Text = "Finish"; - this.buttonFinished.UseVisualStyleBackColor = true; - this.buttonFinished.Click += new System.EventHandler(this.buttonFinished_Click); - // - // buttonOpenFolder - // - this.buttonOpenFolder.Location = new System.Drawing.Point(3, 3); - this.buttonOpenFolder.Name = "buttonOpenFolder"; - this.buttonOpenFolder.Size = new System.Drawing.Size(75, 23); - this.buttonOpenFolder.TabIndex = 0; - this.buttonOpenFolder.Text = "Open Folder"; - this.buttonOpenFolder.UseVisualStyleBackColor = true; - this.buttonOpenFolder.Click += new System.EventHandler(this.buttonOpenFolder_Click); - // // tableLayoutPanel5 // this.tableLayoutPanel5.ColumnCount = 1; @@ -592,6 +554,44 @@ namespace SparkleShare { this.flowLayoutPanel2.Size = new System.Drawing.Size(162, 30); this.flowLayoutPanel2.TabIndex = 0; // + // buttonOpenFolder + // + this.buttonOpenFolder.Location = new System.Drawing.Point(3, 3); + this.buttonOpenFolder.Name = "buttonOpenFolder"; + this.buttonOpenFolder.Size = new System.Drawing.Size(75, 23); + this.buttonOpenFolder.TabIndex = 0; + this.buttonOpenFolder.Text = "Open Folder"; + this.buttonOpenFolder.UseVisualStyleBackColor = true; + this.buttonOpenFolder.Click += new System.EventHandler(this.buttonOpenFolder_Click); + // + // buttonFinished + // + this.buttonFinished.Location = new System.Drawing.Point(84, 3); + this.buttonFinished.Name = "buttonFinished"; + this.buttonFinished.Size = new System.Drawing.Size(75, 23); + this.buttonFinished.TabIndex = 1; + this.buttonFinished.Text = "Finish"; + this.buttonFinished.UseVisualStyleBackColor = true; + this.buttonFinished.Click += new System.EventHandler(this.buttonFinished_Click); + // + // label9 + // + this.label9.Location = new System.Drawing.Point(13, 35); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(307, 15); + this.label9.TabIndex = 3; + this.label9.Text = "Access the files from your SparkleShare folder."; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold); + this.label8.Location = new System.Drawing.Point(13, 10); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(227, 20); + this.label8.TabIndex = 2; + this.label8.Text = "Project successfully added!"; + // // SparkleSetup // this.ClientSize = new System.Drawing.Size(664, 396); diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 1bf011fe..5e3c5664 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -97,6 +97,9 @@ namespace SparkleShare { break; case PageType.Error: tabControl.SelectedIndex = 3; + label3.Text = "First, have you tried turning it off and on again?\n\n" + + Controller.PreviousUrl + " is the address we've compiled. Does this look alright?\n\n" + + "The host needs to know who you are. Have you uploaded the key that sits in your SparkleShare folder?"; Show (); break; case PageType.Finished: From a1c05e9ec504bc326da25046e319705423905407 Mon Sep 17 00:00:00 2001 From: serras Date: Mon, 27 Feb 2012 12:55:16 +0100 Subject: [PATCH 128/134] - Add new project files - Chnage Windows views to keep them in sync with controllers --- SparkleLib/windows/SparkleLib.csproj | 3 + SparkleShare/Windows/SparkleController.cs | 6 +- SparkleShare/Windows/SparkleEventLog.cs | 13 +- SparkleShare/Windows/SparkleSetup.Designer.cs | 232 ++++++++++++++++-- SparkleShare/Windows/SparkleSetup.cs | 227 ++++++++++------- SparkleShare/Windows/SparkleShare.csproj | 3 + SparkleShare/Windows/SparkleStatusIcon.cs | 20 +- 7 files changed, 371 insertions(+), 133 deletions(-) diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index 5958ff3d..2db89ec8 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -86,6 +86,9 @@ SparkleRepoBase.cs + + SparkleUser.cs + SparkleWatcher.cs Component diff --git a/SparkleShare/Windows/SparkleController.cs b/SparkleShare/Windows/SparkleController.cs index c42a4d29..679c8780 100644 --- a/SparkleShare/Windows/SparkleController.cs +++ b/SparkleShare/Windows/SparkleController.cs @@ -125,14 +125,12 @@ namespace SparkleShare { // Creates a .desktop entry in autostart folder to // start SparkleShare automatically at login - public override void EnableSystemAutostart () + public override void CreateStartupItem () { } - // Installs a launcher so the user can launch SparkleShare - // from the Internet category if needed - public override void InstallLauncher () + public override void InstallProtocolHandler() { } diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index 5de70192..2804754e 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -144,9 +144,16 @@ namespace SparkleShare { private void AddHTML () { - Invoke ((Action)delegate { - _browserControl.Reload (); - }); + try + { + Invoke((Action)delegate + { + _browserControl.Reload(); + }); + } + catch (InvalidOperationException e) + { + } } private void SparkleEventLog_FormClosing (object sender, FormClosingEventArgs e) diff --git a/SparkleShare/Windows/SparkleSetup.Designer.cs b/SparkleShare/Windows/SparkleSetup.Designer.cs index 484710db..a920df7d 100644 --- a/SparkleShare/Windows/SparkleSetup.Designer.cs +++ b/SparkleShare/Windows/SparkleSetup.Designer.cs @@ -48,8 +48,10 @@ namespace SparkleShare { this.buttonCancel = new System.Windows.Forms.Button(); this.syncingPage = new System.Windows.Forms.TabPage(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); + this.syncFinishButton = new System.Windows.Forms.Button(); + this.syncCancelButton = new System.Windows.Forms.Button(); this.label6 = new System.Windows.Forms.Label(); - this.buttonFinish = new System.Windows.Forms.Button(); this.syncingProgressBar = new System.Windows.Forms.ProgressBar(); this.label16 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); @@ -66,6 +68,17 @@ namespace SparkleShare { this.buttonFinished = new System.Windows.Forms.Button(); this.label9 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); + this.invitePage = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); + this.InviteAddButton = new System.Windows.Forms.Button(); + this.InviteCancelButton = new System.Windows.Forms.Button(); + this.InviteFolderEntry = new System.Windows.Forms.TextBox(); + this.InviteAddressEntry = new System.Windows.Forms.TextBox(); + this.label19 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.tabControl.SuspendLayout(); this.setupPage.SuspendLayout(); @@ -75,11 +88,15 @@ namespace SparkleShare { this.flowLayoutPanel1.SuspendLayout(); this.syncingPage.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); + this.flowLayoutPanel4.SuspendLayout(); this.errorPage.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); this.finishedPage.SuspendLayout(); this.tableLayoutPanel5.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); + this.invitePage.SuspendLayout(); + this.tableLayoutPanel6.SuspendLayout(); + this.flowLayoutPanel3.SuspendLayout(); this.SuspendLayout(); // // pictureBox @@ -98,6 +115,7 @@ namespace SparkleShare { this.tabControl.Controls.Add(this.syncingPage); this.tabControl.Controls.Add(this.errorPage); this.tabControl.Controls.Add(this.finishedPage); + this.tabControl.Controls.Add(this.invitePage); this.tabControl.Dock = System.Windows.Forms.DockStyle.Right; this.tabControl.Location = new System.Drawing.Point(150, 0); this.tabControl.Name = "tabControl"; @@ -161,9 +179,9 @@ namespace SparkleShare { this.buttonNext.Name = "buttonNext"; this.buttonNext.Size = new System.Drawing.Size(75, 25); this.buttonNext.TabIndex = 3; - this.buttonNext.Text = "Next"; + this.buttonNext.Text = "Continue"; this.buttonNext.UseVisualStyleBackColor = true; - this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click); + this.buttonNext.Click += new System.EventHandler(this.SetupNextClicked); // // NameEntry // @@ -206,8 +224,8 @@ namespace SparkleShare { this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(484, 30); this.label11.TabIndex = 2; - this.label11.Text = "Before we can create a SparkleShare folder on this computer, we need a few bits o" + - "f information from you."; + this.label11.Text = "Before we get started, what\'s your name and email?\r\nDon\'t worry, this information" + + " is only visible to your team members."; // // label12 // @@ -343,7 +361,7 @@ namespace SparkleShare { this.buttonSync.TabIndex = 9; this.buttonSync.Text = "Add"; this.buttonSync.UseVisualStyleBackColor = true; - this.buttonSync.Click += new System.EventHandler(this.buttonSync_Click); + this.buttonSync.Click += new System.EventHandler(this.AddButtonClicked); // // buttonCancel // @@ -354,7 +372,7 @@ namespace SparkleShare { this.buttonCancel.TabIndex = 8; this.buttonCancel.Text = "Cancel"; this.buttonCancel.UseVisualStyleBackColor = true; - this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + this.buttonCancel.Click += new System.EventHandler(this.CancelButtonClicked); // // syncingPage // @@ -370,8 +388,8 @@ namespace SparkleShare { // this.tableLayoutPanel3.ColumnCount = 1; this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Controls.Add(this.flowLayoutPanel4, 0, 6); this.tableLayoutPanel3.Controls.Add(this.label6, 0, 0); - this.tableLayoutPanel3.Controls.Add(this.buttonFinish, 0, 6); this.tableLayoutPanel3.Controls.Add(this.syncingProgressBar, 0, 4); this.tableLayoutPanel3.Controls.Add(this.label16, 0, 2); this.tableLayoutPanel3.Controls.Add(this.label15, 0, 1); @@ -390,6 +408,38 @@ namespace SparkleShare { this.tableLayoutPanel3.Size = new System.Drawing.Size(506, 370); this.tableLayoutPanel3.TabIndex = 6; // + // flowLayoutPanel4 + // + this.flowLayoutPanel4.Controls.Add(this.syncFinishButton); + this.flowLayoutPanel4.Controls.Add(this.syncCancelButton); + this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Right; + this.flowLayoutPanel4.Location = new System.Drawing.Point(334, 330); + this.flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + this.flowLayoutPanel4.Size = new System.Drawing.Size(162, 30); + this.flowLayoutPanel4.TabIndex = 19; + // + // syncFinishButton + // + this.syncFinishButton.Enabled = false; + this.syncFinishButton.Location = new System.Drawing.Point(3, 3); + this.syncFinishButton.Name = "syncFinishButton"; + this.syncFinishButton.Size = new System.Drawing.Size(75, 25); + this.syncFinishButton.TabIndex = 9; + this.syncFinishButton.Text = "Finish"; + this.syncFinishButton.UseVisualStyleBackColor = true; + // + // syncCancelButton + // + this.syncCancelButton.Dock = System.Windows.Forms.DockStyle.Right; + this.syncCancelButton.Location = new System.Drawing.Point(84, 3); + this.syncCancelButton.Name = "syncCancelButton"; + this.syncCancelButton.Size = new System.Drawing.Size(75, 25); + this.syncCancelButton.TabIndex = 8; + this.syncCancelButton.Text = "Cancel"; + this.syncCancelButton.UseVisualStyleBackColor = true; + this.syncCancelButton.Click += new System.EventHandler(this.syncCancelClicked); + // // label6 // this.label6.AutoSize = true; @@ -401,18 +451,6 @@ namespace SparkleShare { this.label6.TabIndex = 0; this.label6.Text = "Syncing"; // - // buttonFinish - // - this.buttonFinish.Dock = System.Windows.Forms.DockStyle.Right; - this.buttonFinish.Enabled = false; - this.buttonFinish.Location = new System.Drawing.Point(418, 333); - this.buttonFinish.Name = "buttonFinish"; - this.buttonFinish.Size = new System.Drawing.Size(75, 24); - this.buttonFinish.TabIndex = 2; - this.buttonFinish.Text = "Finish"; - this.buttonFinish.UseVisualStyleBackColor = true; - this.buttonFinish.Click += new System.EventHandler(this.buttonFinish_Click); - // // syncingProgressBar // this.syncingProgressBar.Location = new System.Drawing.Point(13, 115); @@ -592,6 +630,140 @@ namespace SparkleShare { this.label8.TabIndex = 2; this.label8.Text = "Project successfully added!"; // + // invitePage + // + this.invitePage.Controls.Add(this.tableLayoutPanel6); + this.invitePage.Location = new System.Drawing.Point(4, 22); + this.invitePage.Name = "invitePage"; + this.invitePage.Padding = new System.Windows.Forms.Padding(3); + this.invitePage.Size = new System.Drawing.Size(506, 370); + this.invitePage.TabIndex = 5; + this.invitePage.Text = "Invite"; + this.invitePage.UseVisualStyleBackColor = true; + // + // tableLayoutPanel6 + // + this.tableLayoutPanel6.ColumnCount = 2; + this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel6.Controls.Add(this.flowLayoutPanel3, 1, 6); + this.tableLayoutPanel6.Controls.Add(this.InviteFolderEntry, 1, 4); + this.tableLayoutPanel6.Controls.Add(this.InviteAddressEntry, 1, 3); + this.tableLayoutPanel6.Controls.Add(this.label19, 0, 4); + this.tableLayoutPanel6.Controls.Add(this.label18, 0, 3); + this.tableLayoutPanel6.Controls.Add(this.label17, 0, 1); + this.tableLayoutPanel6.Controls.Add(this.label7, 0, 0); + this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel6.Name = "tableLayoutPanel6"; + this.tableLayoutPanel6.RowCount = 7; + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F)); + this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); + this.tableLayoutPanel6.Size = new System.Drawing.Size(500, 364); + this.tableLayoutPanel6.TabIndex = 0; + // + // flowLayoutPanel3 + // + this.flowLayoutPanel3.Controls.Add(this.InviteAddButton); + this.flowLayoutPanel3.Controls.Add(this.InviteCancelButton); + this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right; + this.flowLayoutPanel3.Location = new System.Drawing.Point(338, 331); + this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel3.Name = "flowLayoutPanel3"; + this.flowLayoutPanel3.Size = new System.Drawing.Size(162, 33); + this.flowLayoutPanel3.TabIndex = 19; + // + // InviteAddButton + // + this.InviteAddButton.Enabled = false; + this.InviteAddButton.Location = new System.Drawing.Point(3, 3); + this.InviteAddButton.Name = "InviteAddButton"; + this.InviteAddButton.Size = new System.Drawing.Size(75, 25); + this.InviteAddButton.TabIndex = 9; + this.InviteAddButton.Text = "Add"; + this.InviteAddButton.UseVisualStyleBackColor = true; + this.InviteAddButton.Click += new System.EventHandler(this.InviteAddButtonClicked); + // + // InviteCancelButton + // + this.InviteCancelButton.Dock = System.Windows.Forms.DockStyle.Right; + this.InviteCancelButton.Location = new System.Drawing.Point(84, 3); + this.InviteCancelButton.Name = "InviteCancelButton"; + this.InviteCancelButton.Size = new System.Drawing.Size(75, 25); + this.InviteCancelButton.TabIndex = 8; + this.InviteCancelButton.Text = "Cancel"; + this.InviteCancelButton.UseVisualStyleBackColor = true; + this.InviteCancelButton.Click += new System.EventHandler(this.InviteCancelButtonClicked); + // + // InviteFolderEntry + // + this.InviteFolderEntry.Dock = System.Windows.Forms.DockStyle.Fill; + this.InviteFolderEntry.Location = new System.Drawing.Point(93, 144); + this.InviteFolderEntry.Name = "InviteFolderEntry"; + this.InviteFolderEntry.ReadOnly = true; + this.InviteFolderEntry.Size = new System.Drawing.Size(404, 20); + this.InviteFolderEntry.TabIndex = 11; + // + // InviteAddressEntry + // + this.InviteAddressEntry.Dock = System.Windows.Forms.DockStyle.Fill; + this.InviteAddressEntry.Location = new System.Drawing.Point(93, 119); + this.InviteAddressEntry.Name = "InviteAddressEntry"; + this.InviteAddressEntry.ReadOnly = true; + this.InviteAddressEntry.Size = new System.Drawing.Size(404, 20); + this.InviteAddressEntry.TabIndex = 10; + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Dock = System.Windows.Forms.DockStyle.Fill; + this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label19.Location = new System.Drawing.Point(3, 141); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(84, 25); + this.label19.TabIndex = 9; + this.label19.Text = "Remote Path:"; + this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Dock = System.Windows.Forms.DockStyle.Fill; + this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label18.Location = new System.Drawing.Point(3, 116); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(84, 25); + this.label18.TabIndex = 8; + this.label18.Text = "Address:"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label17 + // + this.tableLayoutPanel6.SetColumnSpan(this.label17, 2); + this.label17.Dock = System.Windows.Forms.DockStyle.Fill; + this.label17.Location = new System.Drawing.Point(3, 25); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(494, 20); + this.label17.TabIndex = 3; + this.label17.Text = "Do you want to add this project to SparkleShare?"; + // + // label7 + // + this.label7.AutoSize = true; + this.tableLayoutPanel6.SetColumnSpan(this.label7, 2); + this.label7.Dock = System.Windows.Forms.DockStyle.Fill; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.Location = new System.Drawing.Point(3, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(494, 25); + this.label7.TabIndex = 2; + this.label7.Text = "You\'ve received an invite!"; + // // SparkleSetup // this.ClientSize = new System.Drawing.Size(664, 396); @@ -615,6 +787,7 @@ namespace SparkleShare { this.syncingPage.ResumeLayout(false); this.tableLayoutPanel3.ResumeLayout(false); this.tableLayoutPanel3.PerformLayout(); + this.flowLayoutPanel4.ResumeLayout(false); this.errorPage.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.PerformLayout(); @@ -622,6 +795,10 @@ namespace SparkleShare { this.tableLayoutPanel5.ResumeLayout(false); this.tableLayoutPanel5.PerformLayout(); this.flowLayoutPanel2.ResumeLayout(false); + this.invitePage.ResumeLayout(false); + this.tableLayoutPanel6.ResumeLayout(false); + this.tableLayoutPanel6.PerformLayout(); + this.flowLayoutPanel3.ResumeLayout(false); this.ResumeLayout(false); } @@ -642,7 +819,6 @@ namespace SparkleShare { private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.PictureBox pictureBox; private System.Windows.Forms.Label label6; - private System.Windows.Forms.Button buttonFinish; private System.Windows.Forms.ProgressBar syncingProgressBar; private System.Windows.Forms.Button buttonTryAgain; private System.Windows.Forms.Label label9; @@ -670,6 +846,20 @@ namespace SparkleShare { private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.TabPage invitePage; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.TextBox InviteFolderEntry; + private System.Windows.Forms.TextBox InviteAddressEntry; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; + private System.Windows.Forms.Button InviteAddButton; + private System.Windows.Forms.Button InviteCancelButton; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; + private System.Windows.Forms.Button syncFinishButton; + private System.Windows.Forms.Button syncCancelButton; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index 5e3c5664..f85c0d5e 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -49,11 +49,32 @@ namespace SparkleShare { pictureBox.Image = Icons.side_splash; this.Icon = Icons.sparkleshare; + Controller.HideWindowEvent += delegate + { + this.Hide(); + }; + + Controller.ShowWindowEvent += delegate + { + this.Show(); + }; + Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { tabControl.SafeInvoke ((Action)delegate { switch (type) { + case PageType.Setup: + tabControl.SelectedIndex = 0; + NameEntry.Text = Controller.GuessedUserName; + EmailEntry.Text = Controller.GuessedUserEmail; + Show(); + Controller.CheckSetupPage(NameEntry.Text, EmailEntry.Text); + break; + case PageType.Add: tabControl.SelectedIndex = 1; + + // Add plugins to tree + // =================== // Check whether the treeView is already created // If it is dispose it and start over if (treeView != null) { @@ -67,7 +88,6 @@ namespace SparkleShare { treeView.FullRowSelect = true; treeView.ImageIndex = 0; treeView.Indent = 35; - treeView.AfterSelect += new TreeViewEventHandler (CheckTreeNode); treeView.HideSelection = false; treeView.ItemHeight = 40; @@ -89,12 +109,31 @@ namespace SparkleShare { panel_server_selection.Size.Height); panel_server_selection.Controls.Add (treeView); - treeView.SelectedNode = treeView.Nodes [0]; - treeView.Select (); - CheckAddPage (null, null); - CheckTreeNode (null, null); + // Finished adding and populating tree + + // Select first node + treeView.SelectedNode = treeView.Nodes[0]; + treeView.Select(); + Controller.SelectedPluginChanged(0); + + treeView.AfterSelect += new TreeViewEventHandler(CheckTreeNode); + Show (); + Controller.CheckAddPage(ServerEntry.Text, FolderEntry.Text, 1); break; + + case PageType.Invite: + tabControl.SelectedIndex = 5; + InviteAddressEntry.Text = Controller.PendingInvite.Address; + InviteFolderEntry.Text = Controller.PendingInvite.RemotePath; + Show(); + break; + + case PageType.Syncing: + tabControl.SelectedIndex = 2; + Show(); + break; + case PageType.Error: tabControl.SelectedIndex = 3; label3.Text = "First, have you tried turning it off and on again?\n\n" + @@ -102,126 +141,138 @@ namespace SparkleShare { "The host needs to know who you are. Have you uploaded the key that sits in your SparkleShare folder?"; Show (); break; + case PageType.Finished: tabControl.SelectedIndex = 4; Show (); break; - case PageType.Setup: - tabControl.SelectedIndex = 0; - NameEntry.Text = Program.Controller.UserName; - Show (); - break; - case PageType.Syncing: - tabControl.SelectedIndex = 2; - Show (); - break; + case PageType.Tutorial: - if (Controller.TutorialPageNumber == 1) - Controller.TutorialSkipped (); - else - Controller.ShowAddPage (); + // Do nothing in tutorial by now + Controller.TutorialSkipped();; break; + default: throw new NotImplementedException ("unknown PageType"); } }); }; + + Controller.UpdateSetupContinueButtonEvent += new SparkleSetupController.UpdateSetupContinueButtonEventHandler(UpdateSetupContinueButtonEvent); + + Controller.ChangeAddressFieldEvent += new SparkleSetupController.ChangeAddressFieldEventHandler(ChangeAddressFieldEvent); + Controller.ChangePathFieldEvent += new SparkleSetupController.ChangePathFieldEventHandler(ChangePathFieldEvent); + Controller.UpdateAddProjectButtonEvent += new SparkleSetupController.UpdateAddProjectButtonEventHandler(UpdateAddProjectButtonEvent); + + Controller.UpdateProgressBarEvent += new SparkleSetupController.UpdateProgressBarEventHandler(UpdateProgressBarEvent); } private void SparkleSetup_FormClosing (object sender, FormClosingEventArgs e) { if (e.CloseReason != CloseReason.ApplicationExitCall - && e.CloseReason != CloseReason.TaskManagerClosing - && e.CloseReason != CloseReason.WindowsShutDown) { + && e.CloseReason != CloseReason.TaskManagerClosing + && e.CloseReason != CloseReason.WindowsShutDown) { e.Cancel = true; this.Hide (); } } - private void buttonCancel_Click (object sender, EventArgs e) { - this.Hide (); + #region Things for "Setup" page + private void SetupNextClicked(object sender, EventArgs e) + { + Controller.SetupPageCompleted(NameEntry.Text, EmailEntry.Text); } - private void buttonSync_Click (object sender, EventArgs e) { - if (String.IsNullOrEmpty (Controller.Plugins [treeView.SelectedNode.Index].Address)) - Controller.AddPageCompleted (ServerEntry.Text, FolderEntry.Text); - else - Controller.AddPageCompleted (Controller.Plugins [treeView.SelectedNode.Index].Address, - FolderEntry.Text); + private void CheckSetupPage(object sender, EventArgs e) + { + Controller.CheckSetupPage(NameEntry.Text, EmailEntry.Text); } - private void CheckTreeNode (object sender, EventArgs e) { - // If the "own server" choice is selected, the address field is empty - if (String.IsNullOrEmpty (Controller.Plugins [treeView.SelectedNode.Index].Address)) { - ServerEntry.Enabled = true; - ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].AddressExample; - } else { - ServerEntry.Enabled = false; - ServerEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].Address; - ServerEntry.Enabled = false; - } - //Clear any previous input data so that exampletext can show - ServerEntry.Text = ""; - FolderEntry.Text = ""; - FolderEntry.ExampleText = Controller.Plugins [treeView.SelectedNode.Index].PathExample; - CheckAddPage (null, null); + void UpdateSetupContinueButtonEvent(bool button_enabled) + { + buttonNext.Enabled = button_enabled; + } + #endregion + + #region Things for "Add" page + void ChangeAddressFieldEvent(string text, string example_text, FieldState state) + { + ServerEntry.Text = text; + ServerEntry.Enabled = state == FieldState.Enabled; + ServerEntry.ExampleText = example_text; } - private void CheckAddPage (object sender, EventArgs e) { - // Enables or disables the 'Next' button depending on the - // entries filled in by the user - buttonSync.Enabled = false; - - if (String.IsNullOrEmpty (Controller.Plugins [treeView.SelectedNode.Index].Address)) { - if (!String.IsNullOrEmpty (FolderEntry.Text)) { - if (!String.IsNullOrEmpty (ServerEntry.Text)) - buttonSync.Enabled = true; - } - } else { - if (!String.IsNullOrEmpty (FolderEntry.Text)) - buttonSync.Enabled = true; - } + void ChangePathFieldEvent(string text, string example_text, FieldState state) + { + FolderEntry.Text = text; + FolderEntry.Enabled = state == FieldState.Enabled; + FolderEntry.ExampleText = example_text; } - private void buttonFinish_Click (object sender, EventArgs e) { - this.Hide (); + private void CheckTreeNode(object sender, EventArgs e) + { + Controller.SelectedPluginChanged(treeView.SelectedNode.Index); } - private void buttonTryAgain_Click (object sender, EventArgs e) { - Controller.ErrorPageCompleted (); + private void CancelButtonClicked (object sender, EventArgs e) { + Controller.PageCancelled(); } + private void AddButtonClicked(object sender, EventArgs e) + { + Controller.AddPageCompleted(ServerEntry.Text, FolderEntry.Text); + } + + void UpdateAddProjectButtonEvent(bool button_enabled) + { + buttonSync.Enabled = button_enabled; + } + + private void CheckAddPage(object sender, EventArgs e) + { + Controller.CheckAddPage(ServerEntry.Text, FolderEntry.Text, treeView.SelectedNode.Index); + } + #endregion + + #region Things for "Invite" page + private void InviteAddButtonClicked(object sender, EventArgs e) + { + Controller.InvitePageCompleted(); + } + + private void InviteCancelButtonClicked(object sender, EventArgs e) + { + Controller.PageCancelled(); + } + #endregion + + #region Things for "Syncing" page + private void syncCancelClicked(object sender, EventArgs e) + { + Controller.SyncingCancelled(); + } + + void UpdateProgressBarEvent(double percentage) + { + syncingProgressBar.Value = (int)percentage; + } + #endregion + + #region Things for "Error" page + private void buttonTryAgain_Click(object sender, EventArgs e) + { + Controller.ErrorPageCompleted(); + } + #endregion + + #region Thigngs for "Finish" page private void buttonFinished_Click (object sender, EventArgs e) { - this.Hide (); + Controller.FinishPageCompleted(); } private void buttonOpenFolder_Click (object sender, EventArgs e) { - Program.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); - } - - private void buttonNext_Click (object sender, EventArgs e) { - string full_name = NameEntry.Text; - string email = EmailEntry.Text; - - Controller.SetupPageCompleted (full_name, email); - } - - private void CheckSetupPage (object sender, EventArgs e) { - // Enables or disables the 'Next' button depending on the - // entries filled in by the user - if (!String.IsNullOrEmpty (NameEntry.Text) && - this.IsValidEmail (EmailEntry.Text)) { - buttonNext.Enabled = true; - } else { - buttonNext.Enabled = false; - } - } - - // Checks to see if an email address is valid - public bool IsValidEmail(string email) - { - Regex regex = new Regex(@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase); - return regex.IsMatch(email); + Controller.OpenFolderClicked(); } + #endregion } } diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 3fe7bfb3..065690cf 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -99,6 +99,9 @@ SparklePlugin.cs + + SparkleStatusIconController.cs + diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 0ec05fb8..15a3365f 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -30,6 +30,8 @@ namespace SparkleShare { // user's notification area public class SparkleStatusIcon : IDisposable { + public SparkleStatusIconController Controller = new SparkleStatusIconController(); + private Timer Animation; private Bitmap [] AnimationFrames; private int FrameNumber; @@ -57,15 +59,6 @@ namespace SparkleShare { CreateMenu (); SetNormalState (); - - /*Program.Controller.FolderSizeChanged += delegate { - status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { - if (!Animation.Enabled) - SetNormalState (); - - UpdateMenu (); - }); - };*/ Program.Controller.FolderListChanged += delegate { status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { @@ -205,14 +198,7 @@ namespace SparkleShare { sync_item.Enabled = false; sync_item.Click += delegate { - - if (SparkleUI.Setup == null) { - SparkleUI.Setup = new SparkleSetup (); - SparkleUI.Setup.Controller.ShowAddPage (); - } - - if (!SparkleUI.Setup.Visible) - SparkleUI.Setup.Controller.ShowAddPage (); + Controller.AddHostedProjectClicked(); }; Menu.Items.Add (sync_item); From 02b77f894b21098e6167113c1eed7289e0120970 Mon Sep 17 00:00:00 2001 From: serras Date: Mon, 27 Feb 2012 13:04:51 +0100 Subject: [PATCH 129/134] Remove external modules and copy them to 'Windows/tools' --- .gitmodules | 9 - SparkleShare/Windows/sparkleshare.ico | Bin 0 -> 36470 bytes .../tools/TextTemplating/.gitattributes | 2 + .../Windows/tools/TextTemplating/.gitignore | 11 + .../Windows/tools/TextTemplating/ChangeLog | 9 + .../Windows/tools/TextTemplating/Makefile.am | 4 + .../Mono.TextTemplating.Tests/ChangeLog | 65 + .../Mono.TextTemplating.Tests/DummyHost.cs | 113 + .../GenerationTests.cs | 171 + .../Mono.TextTemplating.Tests.csproj | 55 + .../Mono.TextTemplating.Tests/ParsingTests.cs | 191 + .../TemplateEnginePreprocessTemplateTests.cs | 246 + .../TemplatingEngineHelper.cs | 51 + .../Mono.TextTemplating/AssemblyInfo.cs | 37 + .../Mono.TextTemplating/ChangeLog | 212 + .../Mono.TextTemplating/Makefile.am | 55 + .../AssemblyCacheMonitor.cs | 43 + .../DirectiveProcessor.cs | 63 + .../DirectiveProcessorException.cs | 56 + .../EncodingHelper.cs | 40 + .../Engine.cs | 58 + .../Interfaces.cs | 84 + .../ParameterDirectiveProcessor.cs | 268 + .../RequiresProvidesDirectiveProcessor.cs | 196 + .../TextTemplatingSession.cs | 71 + .../TextTransformation.cs | 219 + .../ToStringHelper.cs | 69 + .../Mono.TextTemplating.csproj | 79 + .../Mono.TextTemplating/CompiledTemplate.cs | 113 + .../CrossAppDomainAssemblyResolver.cs | 59 + .../Mono.TextTemplating/ParsedTemplate.cs | 320 + .../Mono.TextTemplating/TemplateGenerator.cs | 373 + .../Mono.TextTemplating/TemplateSettings.cs | 75 + .../Mono.TextTemplating/TemplatingEngine.cs | 963 +++ .../Mono.TextTemplating/Tokeniser.cs | 295 + .../Windows/tools/TextTemplating/README.md | 19 + .../tools/TextTemplating/TextTemplating.sln | 26 + .../TextTransform/AssemblyInfo.cs | 39 + .../TextTemplating/TextTransform/ChangeLog | 25 + .../TextTemplating/TextTransform/Makefile.am | 35 + .../TextTemplating/TextTransform/Options.cs | 1112 +++ .../TextTransform/TextTransform.cs | 174 + .../TextTransform/TextTransform.csproj | 62 + .../Windows/tools/TextTemplating/build.cmd | 5 + .../Gettext.Cs.Tests/Gettext.Cs.Tests.csproj | 67 + .../Core/Gettext.Cs.Tests/PoParserTest.cs | 64 + .../Properties/AssemblyInfo.cs | 57 + .../Gettext.Cs.Web/Controls/AspTranslate.cs | 48 + .../Core/Gettext.Cs.Web/Gettext.Cs.Web.csproj | 60 + .../Gettext.Cs.Web/Properties/AssemblyInfo.cs | 58 + .../Core/Gettext.Cs/Gettext.Cs.csproj | 83 + .../Core/Gettext.Cs/Parser/ParserRequestor.cs | 55 + .../Core/Gettext.Cs/Parser/PoParser.cs | 149 + .../Gettext.Cs/Properties/AssemblyInfo.cs | 58 + .../Resource/DatabaseResourceManager.cs | 86 + .../Resource/DatabaseResourceReader.cs | 121 + .../Resource/DatabaseResourceSet.cs | 50 + .../Resource/FileBasedResourceManager.cs | 295 + .../Resource/GettextResourceManager.cs | 150 + .../Resource/GettextResourceReader.cs | 87 + .../Gettext.Cs/Resource/GettextResourceSet.cs | 49 + .../Core/Gettext.Cs/Templates/Strings.cs | 166 + .../Core/Gettext.Cs/Templates/Strings.tt | 196 + .../Gettext.CsUtils/Gettext.CsUtils.sln | 125 + .../Lib/Gnu.Getopt/AssemblyInfo.cs | 88 + .../Gettext.CsUtils/Lib/Gnu.Getopt/Getopt.cs | 1417 ++++ .../Lib/Gnu.Getopt/Gnu.Getopt.csproj | 122 + .../Gettext.CsUtils/Lib/Gnu.Getopt/LongOpt.cs | 239 + .../Lib/Gnu.Getopt/MessagesBundle.cs.resx | 72 + .../Lib/Gnu.Getopt/MessagesBundle.de.resx | 72 + .../Lib/Gnu.Getopt/MessagesBundle.fr.resx | 72 + .../Lib/Gnu.Getopt/MessagesBundle.hu.resx | 72 + .../Lib/Gnu.Getopt/MessagesBundle.ja.resx | 72 + .../Lib/Gnu.Getopt/MessagesBundle.nl.resx | 72 + .../Lib/Gnu.Getopt/MessagesBundle.no.resx | 72 + .../Lib/Gnu.Getopt/MessagesBundle.resx | 72 + .../Lib/Gnu.Gettext/Gnu.Gettext.csproj | 61 + .../Gnu.Gettext/Properties/AssemblyInfo.cs | 58 + .../Gettext.CsUtils/Lib/Gnu.Gettext/intl.cs | 520 ++ .../Gettext.CsUtils/Lib/Gnu.Gettext/msgfmt.cs | 142 + .../Lib/Gnu.Gettext/msgunfmt.cs | 258 + .../Gettext.Samples.Console.csproj | 92 + .../Gettext.Samples.Console/Program.cs | 76 + .../Properties/AssemblyInfo.cs | 58 + .../Resources/en/Strings.po | 3 + .../Resources/es/Strings.po | 3 + .../Resources/fr/Strings.po | 3 + .../Resources/pt/Strings.po | 3 + .../Gettext.Samples.Console/Strings.cs | 168 + .../Gettext.Samples.Console/Strings.tt | 9 + .../Templates/Strings.pot | 3 + .../scripts/Extract.bat | 30 + .../Gettext.Samples.Database/App.config | 9 + .../Gettext.Samples.Database.csproj | 81 + .../Gettext.Samples.Database/Program.cs | 77 + .../Properties/AssemblyInfo.cs | 58 + .../Gettext.Samples.Database/Strings.cs | 147 + .../Gettext.Samples.Database/Strings.tt | 10 + .../Translated/en/Strings.po | 3 + .../Translated/es/Strings.po | 3 + .../Translated/fr/Strings.po | 3 + .../Translated/pt/Strings.po | 3 + .../scripts/DBDump.bat | 39 + .../Gettext.Samples.Mvc/Content/Site.css | 317 + .../Controllers/AccountController.cs | 373 + .../Controllers/HomeController.cs | 46 + .../Samples/Gettext.Samples.Mvc/Default.aspx | 3 + .../Gettext.Samples.Mvc/Default.aspx.cs | 44 + .../Gettext.Samples.Mvc.Publish.xml | 35 + .../Gettext.Samples.Mvc.csproj | 155 + .../Gettext/AspTranslateControl.cs | 44 + .../Gettext.Samples.Mvc/Gettext/Extract.bat | 32 + .../Gettext/Po/en/Strings.po | 16 + .../Gettext/Po/es/Strings.po | 16 + .../Gettext.Samples.Mvc/Gettext/Strings.cs | 170 + .../Gettext.Samples.Mvc/Gettext/Strings.tt | 9 + .../Gettext/Templates/Strings.pot | 16 + .../Samples/Gettext.Samples.Mvc/Global.asax | 1 + .../Gettext.Samples.Mvc/Global.asax.cs | 54 + .../Gettext.Samples.Mvc/Po/en/Strings.po | 16 + .../Gettext.Samples.Mvc/Po/es/Strings.po | 16 + .../Properties/AssemblyInfo.cs | 57 + .../Scripts/MicrosoftAjax.debug.js | 6850 +++++++++++++++++ .../Scripts/MicrosoftAjax.js | 7 + .../Scripts/MicrosoftMvcAjax.debug.js | 337 + .../Scripts/MicrosoftMvcAjax.js | 23 + .../Scripts/jquery-1.3.2-vsdoc.js | 6255 +++++++++++++++ .../Scripts/jquery-1.3.2.js | 4410 +++++++++++ .../Scripts/jquery-1.3.2.min-vsdoc.js | 6255 +++++++++++++++ .../Scripts/jquery-1.3.2.min.js | 53 + .../Views/Account/ChangePassword.aspx | 42 + .../Views/Account/ChangePasswordSuccess.aspx | 12 + .../Views/Account/LogOn.aspx | 37 + .../Views/Account/Register.aspx | 47 + .../Gettext.Samples.Mvc/Views/Home/About.aspx | 12 + .../Gettext.Samples.Mvc/Views/Home/Index.aspx | 18 + .../Views/Shared/Error.aspx | 11 + .../Views/Shared/LogOnUserControl.ascx | 16 + .../Views/Shared/Site.Master | 40 + .../Gettext.Samples.Mvc/Views/Web.config | 34 + .../Samples/Gettext.Samples.Mvc/Web.config | 157 + .../Gettext.Samples.Spanish.csproj | 92 + .../Gettext.Samples.Spanish/Program.cs | 77 + .../Properties/AssemblyInfo.cs | 58 + .../Resources/en/Strings.po | 3 + .../Resources/es/Strings.po | 3 + .../Resources/fr/Strings.po | 3 + .../Resources/pt/Strings.po | 3 + .../Gettext.Samples.Spanish/Strings.cs | 168 + .../Gettext.Samples.Spanish/Strings.tt | 9 + .../Templates/Strings.pot | 3 + .../scripts/Extract.bat | 30 + .../Scripts/ExtractAspNetStrings.bat | 86 + .../Scripts/ExtractStrings.bat | 74 + .../Gettext.AspExtract/AspStringsExtractor.cs | 128 + .../Gettext.AspExtract/AspStringsParser.cs | 101 + .../Gettext.AspExtract.csproj | 73 + .../Tools/Gettext.AspExtract/Program.cs | 117 + .../Properties/AssemblyInfo.cs | 58 + .../App.config | 15 + .../DatabaseInterface.cs | 275 + .../DatabaseParserRequestor.cs | 56 + .../Gettext.DatabaseResourceGenerator.csproj | 79 + .../Program.cs | 170 + .../Properties/AssemblyInfo.cs | 58 + .../Tools/Gettext.Iconv/Gettext.Iconv.csproj | 71 + .../Tools/Gettext.Iconv/Program.cs | 102 + .../Gettext.Iconv/Properties/AssemblyInfo.cs | 58 + .../Gettext.Msgfmt/Gettext.Msgfmt.csproj | 78 + .../Tools/Gettext.Msgfmt/Program.cs | 106 + .../Gettext.Msgfmt/Properties/AssemblyInfo.cs | 58 + .../Gettext.ResourcesReplacer.csproj | 72 + .../Gettext.ResourcesReplacer/Program.cs | 86 + .../Properties/AssemblyInfo.cs | 58 + .../Gettext.ResourcesReplacer/Replacer.cs | 217 + .../tools/gettext-cs-utils/LicenseHeaders.rb | 129 + .../Windows/tools/gettext-cs-utils/Pack.bat | 46 + .../gettext-cs-utils/license.lgpl.header | 22 + .../Windows/tools}/xslt/Program.cs | 0 .../tools}/xslt/Properties/AssemblyInfo.cs | 0 .../Windows/tools}/xslt/build.cmd | 0 .../Windows/tools}/xslt/xslt.csproj | 0 .../Windows/tools}/xslt/xslt.sln | 0 tools/TextTemplating | 1 - tools/gettext-cs-utils | 1 - 185 files changed, 41427 insertions(+), 11 deletions(-) create mode 100644 SparkleShare/Windows/sparkleshare.ico create mode 100644 SparkleShare/Windows/tools/TextTemplating/.gitattributes create mode 100644 SparkleShare/Windows/tools/TextTemplating/.gitignore create mode 100644 SparkleShare/Windows/tools/TextTemplating/ChangeLog create mode 100644 SparkleShare/Windows/tools/TextTemplating/Makefile.am create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ChangeLog create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplateEnginePreprocessTemplateTests.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplatingEngineHelper.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/ChangeLog create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Makefile.am create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/AssemblyCacheMonitor.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/EncodingHelper.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Interfaces.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ParameterDirectiveProcessor.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTemplatingSession.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CrossAppDomainAssemblyResolver.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/README.md create mode 100644 SparkleShare/Windows/tools/TextTemplating/TextTemplating.sln create mode 100644 SparkleShare/Windows/tools/TextTemplating/TextTransform/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/TextTransform/ChangeLog create mode 100644 SparkleShare/Windows/tools/TextTemplating/TextTransform/Makefile.am create mode 100644 SparkleShare/Windows/tools/TextTemplating/TextTransform/Options.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.cs create mode 100644 SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.csproj create mode 100644 SparkleShare/Windows/tools/TextTemplating/build.cmd create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Gettext.Cs.Tests.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/PoParserTest.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Controls/AspTranslate.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Gettext.Cs.Web.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Gettext.Cs.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/ParserRequestor.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/PoParser.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceManager.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceReader.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceSet.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/FileBasedResourceManager.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceManager.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceReader.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceSet.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.tt create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Gettext.CsUtils.sln create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Getopt.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Gnu.Getopt.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/LongOpt.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.cs.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.de.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.fr.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.hu.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.ja.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.nl.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.no.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.resx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Gnu.Gettext.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/intl.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgfmt.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgunfmt.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Gettext.Samples.Console.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/en/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/es/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/fr/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/pt/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.tt create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Templates/Strings.pot create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/scripts/Extract.bat create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/App.config create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Gettext.Samples.Database.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.tt create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/en/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/es/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/fr/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/pt/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/scripts/DBDump.bat create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Content/Site.css create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/AccountController.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/HomeController.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.Publish.xml create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/AspTranslateControl.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Extract.bat create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/en/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/es/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.tt create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Templates/Strings.pot create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/en/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/es/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.debug.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftMvcAjax.debug.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftMvcAjax.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/jquery-1.3.2-vsdoc.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/jquery-1.3.2.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/jquery-1.3.2.min-vsdoc.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/jquery-1.3.2.min.js create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Account/ChangePassword.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Account/ChangePasswordSuccess.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Account/LogOn.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Account/Register.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Home/About.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Home/Index.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Shared/Error.aspx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Shared/LogOnUserControl.ascx create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Shared/Site.Master create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Views/Web.config create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Web.config create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Gettext.Samples.Spanish.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Resources/en/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Resources/es/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Resources/fr/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Resources/pt/Strings.po create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Strings.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Strings.tt create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/Templates/Strings.pot create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Spanish/scripts/Extract.bat create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Scripts/ExtractAspNetStrings.bat create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Scripts/ExtractStrings.bat create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.AspExtract/AspStringsExtractor.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.AspExtract/AspStringsParser.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.AspExtract/Gettext.AspExtract.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.AspExtract/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.AspExtract/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.DatabaseResourceGenerator/App.config create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.DatabaseResourceGenerator/DatabaseInterface.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.DatabaseResourceGenerator/DatabaseParserRequestor.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.DatabaseResourceGenerator/Gettext.DatabaseResourceGenerator.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.DatabaseResourceGenerator/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.DatabaseResourceGenerator/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.Iconv/Gettext.Iconv.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.Iconv/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.Iconv/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.Msgfmt/Gettext.Msgfmt.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.Msgfmt/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.Msgfmt/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.ResourcesReplacer/Gettext.ResourcesReplacer.csproj create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.ResourcesReplacer/Program.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.ResourcesReplacer/Properties/AssemblyInfo.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Tools/Gettext.ResourcesReplacer/Replacer.cs create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/LicenseHeaders.rb create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/Pack.bat create mode 100644 SparkleShare/Windows/tools/gettext-cs-utils/license.lgpl.header rename {tools => SparkleShare/Windows/tools}/xslt/Program.cs (100%) rename {tools => SparkleShare/Windows/tools}/xslt/Properties/AssemblyInfo.cs (100%) rename {tools => SparkleShare/Windows/tools}/xslt/build.cmd (100%) rename {tools => SparkleShare/Windows/tools}/xslt/xslt.csproj (100%) rename {tools => SparkleShare/Windows/tools}/xslt/xslt.sln (100%) delete mode 160000 tools/TextTemplating delete mode 160000 tools/gettext-cs-utils diff --git a/.gitmodules b/.gitmodules index 64010a74..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +0,0 @@ -[submodule "SmartIrc4net"] - path = SmartIrc4net - url = git://git.qnetp.net/smartirc4net.git -[submodule "tools/TextTemplating"] - path = tools/TextTemplating - url = git://github.com/wimh/TextTemplating.git -[submodule "tools/gettext-cs-utils"] - path = tools/gettext-cs-utils - url = git://github.com/wimh/gettext-cs-utils.git diff --git a/SparkleShare/Windows/sparkleshare.ico b/SparkleShare/Windows/sparkleshare.ico new file mode 100644 index 0000000000000000000000000000000000000000..2e88830e6568eb7f12948d6e80fa8a2373ce6a6b GIT binary patch literal 36470 zcmeHw2S8QF*6y66QZ0bk8+Pp25E~+5OKh=VL&dJKCb3uSiVYR)4J-DBg2WhG5|fyy zi7m#03W9=g`Z=67?_0CaK7u#@&Asox_xA((_Fh#&%a{%*#u99#@31F?E?EKR=dG zld+#0$@%%QaY#F(pPV1wBi*wpa(;enr8{HGqvZS$zc6FPqmdpofkYMwAUerKc?cx^ zQM~ta&RJxFij7NFvB=ZFfL^CftP4SciG>JIu>puPAR&_l0SE0>u>e4qy_qb8{99Gb zUjUwC9u{6?tW{n42cH63_+t2JAJlSyxQ#QKpGys!S{j zem|lIbSB&}u`8)2mWptHl)V?v$&XMb{AE|F*iF2f1zJ`jjmm`lkY*g7lM#Lg`FSBu z(AG?r3jfM0Dz+76K0;n5#En9{0OaEprDAS?Ak;nKkqI<{ew6Qrw6jqED5N`$a@}Tu zR`u+`*EjH{#F&cf^dJN^+UU`sh|^i??t&~XQiS{6`Oh*Wx~Jp zCg>*`qcYh5l<78=+K|$rPe5~7V7IA{kjEp0XCfYG7=TSL9pVz5XwPZ)&_;l1x0o-$Yw8UawB`}(n}~c8(5DA5_70@6z8HH!sADtG-7V1y zK)V2%p?=+vS2vU!bIZim0J@=#njOG+$+og=os})UVPZ8u7{9mDtZddLj8l}O zGg;BLI{a3soph`V=qtNM^?nlg%l9v9fklh|A-7yEaPGnau0sbrc33D-{ulM+_zS{^ zh5w=J*DpLA{~d0o9Dh1O|I~#KbH<I~AHPb0_>%?= z9!Ajy7wI*&%i#A3-pBtmfBf)1Bby9Df=PYS6)imb{&D>L3DR2HLRR$qv{!mo`cuz# za(uMW=W_deI*i&AZ_s%CMs;j6tjmCq_8+(G^Ktf|!Suq>p84WCLc)=7)SIln6W^qz zb?Mvk>8cJ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Tests: + * MonoDevelop.TextTemplating: Include the ASP.NET MVC and + TextTemplating addins in the main solution and build. + diff --git a/SparkleShare/Windows/tools/TextTemplating/Makefile.am b/SparkleShare/Windows/tools/TextTemplating/Makefile.am new file mode 100644 index 00000000..f0cb7546 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = \ + Mono.TextTemplating \ + TextTransform \ + MonoDevelop.TextTemplating diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ChangeLog b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ChangeLog new file mode 100644 index 00000000..061fc503 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ChangeLog @@ -0,0 +1,65 @@ +2009-12-11 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Don't local-copy nunit. + +2009-11-27 Olivier Dagenais + + * GenerationTests.cs: Make tests independent of the runtime + they are running under by stripping the "autogenerated" + comment (i.e. the first 9 lines). + +2009-10-29 Lluis Sanchez Gual + + * Mono.TextTemplating.Tests.csproj: Flush. + +2009-08-13 Lluis Sanchez Gual + + * DummyHost.cs: Fix windows build. + +2009-08-13 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Use assembly refs for + nunit. + +2009-08-12 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Include the ASP.NET MVC + and TextTemplating addins in the main solution and build. + +2009-04-13 Michael Hutchinson + + * GenerationTests.cs: Add tests for Windows/Mac newlines. + +2009-04-03 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Updated. + + * GenerationTests.cs: Add test for C# output. + + * ParsingTests.cs: Track dummy host name change. + + * DummyHost.cs: Add more functionality to dummy host. + +2009-03-13 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Move output dir from + ../bin to ../build. + +2009-03-13 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Fix output directory. + +2009-03-12 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Updated. + + * ParsingTests.cs: Add parser test. + + * DummyHost.cs: Dummy templating host. + +2009-03-12 Michael Hutchinson + + * Mono.TextTemplating.Tests.csproj: Add tests. + + * ParsingTests.cs: Tokeniser state/value/location test. + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs new file mode 100644 index 00000000..027a2ddc --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs @@ -0,0 +1,113 @@ +// +// IncludeFileProviderHost.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.CodeDom.Compiler; +using Microsoft.VisualStudio.TextTemplating; + +namespace Mono.TextTemplating.Tests +{ + + public class DummyHost : ITextTemplatingEngineHost + { + public readonly Dictionary Locations = new Dictionary (); + public readonly Dictionary Contents = new Dictionary (); + public readonly Dictionary HostOptions = new Dictionary (); + List standardAssemblyReferences = new List (); + List standardImports = new List (); + public readonly CompilerErrorCollection Errors = new CompilerErrorCollection (); + public readonly Dictionary DirectiveProcessors = new Dictionary (); + + public virtual object GetHostOption (string optionName) + { + object o; + HostOptions.TryGetValue (optionName, out o); + return o; + } + + public virtual bool LoadIncludeText (string requestFileName, out string content, out string location) + { + content = null; + return Locations.TryGetValue (requestFileName, out location) + && Contents.TryGetValue (requestFileName, out content); + } + + public virtual void LogErrors (CompilerErrorCollection errors) + { + Errors.AddRange (errors); + } + + public virtual AppDomain ProvideTemplatingAppDomain (string content) + { + return null; + } + + public virtual string ResolveAssemblyReference (string assemblyReference) + { + throw new System.NotImplementedException(); + } + + public virtual Type ResolveDirectiveProcessor (string processorName) + { + Type t; + DirectiveProcessors.TryGetValue (processorName, out t); + return t; + } + + public virtual string ResolveParameterValue (string directiveId, string processorName, string parameterName) + { + throw new System.NotImplementedException(); + } + + public virtual string ResolvePath (string path) + { + throw new System.NotImplementedException(); + } + + public virtual void SetFileExtension (string extension) + { + throw new System.NotImplementedException(); + } + + public virtual void SetOutputEncoding (System.Text.Encoding encoding, bool fromOutputDirective) + { + throw new System.NotImplementedException(); + } + + public virtual IList StandardAssemblyReferences { + get { return standardAssemblyReferences; } + } + + public virtual IList StandardImports { + get { return standardImports; } + } + + public virtual string TemplateFile { + get; set; + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs new file mode 100644 index 00000000..1a4bd2b4 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs @@ -0,0 +1,171 @@ +// +// GenerationTests.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.IO; +using NUnit.Framework; +using Microsoft.VisualStudio.TextTemplating; + +namespace Mono.TextTemplating.Tests +{ + + + [TestFixture] + public class GenerationTests + { + [Test] + public void Generate () + { + string Input = ParsingTests.ParseSample1; + string Output = OutputSample1; + Generate (Input, Output, "\n"); + } + + [Test] + public void GenerateMacNewlines () + { + string MacInput = ParsingTests.ParseSample1.Replace ("\n", "\r"); + string MacOutput = OutputSample1.Replace ("\\n", "\\r").Replace ("\n", "\r");; + Generate (MacInput, MacOutput, "\r"); + } + + [Test] + public void GenerateWindowsNewlines () + { + string WinInput = ParsingTests.ParseSample1.Replace ("\n", "\r\n"); + string WinOutput = OutputSample1.Replace ("\\n", "\\r\\n").Replace ("\n", "\r\n"); + Generate (WinInput, WinOutput, "\r\n"); + } + + //NOTE: we set the newline property on the code generator so that the whole files has matching newlines, + // in order to match the newlines in the verbatim code blocks + void Generate (string input, string expectedOutput, string newline) + { + DummyHost host = new DummyHost (); + string className = "GeneratedTextTransformation4f504ca0"; + string code = GenerateCode (host, input, className, newline); + Assert.AreEqual (0, host.Errors.Count); + Assert.AreEqual (expectedOutput, TemplatingEngineHelper.StripHeader (code, newline)); + } + + #region Helpers + + string GenerateCode (ITextTemplatingEngineHost host, string content, string name, string generatorNewline) + { + ParsedTemplate pt = ParsedTemplate.FromText (content, host); + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + + TemplateSettings settings = TemplatingEngine.GetSettings (host, pt); + if (name != null) + settings.Name = name; + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + + var ccu = TemplatingEngine.GenerateCompileUnit (host, content, pt, settings); + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + + var opts = new System.CodeDom.Compiler.CodeGeneratorOptions (); + using (var writer = new System.IO.StringWriter ()) { + writer.NewLine = generatorNewline; + settings.Provider.GenerateCodeFromCompileUnit (ccu, writer, opts); + return writer.ToString (); + } + } + + #endregion + + #region Expected output strings + + public static string OutputSample1 = +@" +namespace Microsoft.VisualStudio.TextTemplating { + + + public partial class GeneratedTextTransformation4f504ca0 : global::Microsoft.VisualStudio.TextTemplating.TextTransformation { + + + #line 9 """" + +baz \#> + + #line default + #line hidden + + public override string TransformText() { + this.GenerationEnvironment = null; + + #line 2 """" + this.Write(""Line One\nLine Two\n""); + + #line default + #line hidden + + #line 4 """" + +foo + + + #line default + #line hidden + + #line 7 """" + this.Write(""Line Three ""); + + #line default + #line hidden + + #line 7 """" + this.Write(global::Microsoft.VisualStudio.TextTemplating.ToStringHelper.ToStringWithCulture( bar )); + + #line default + #line hidden + + #line 7 """" + this.Write(""\nLine Four\n""); + + #line default + #line hidden + return this.GenerationEnvironment.ToString(); + } + + protected override void Initialize() { + base.Initialize(); + } + } +} +"; + #endregion + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj new file mode 100644 index 00000000..75860807 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj @@ -0,0 +1,55 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {CB590106-8331-4CBE-8131-B154E7BF79E1} + Library + Mono.TextTemplating.Tests + Mono.TextTemplating.Tests + + + true + full + false + ..\bin + DEBUG + prompt + 4 + + + none + false + ..\bin + prompt + 4 + + + + + ..\NUnit\lib\nunit.core.dll + False + + + ..\NUnit\lib\nunit.framework.dll + False + + + + + + + + + + + + {A2364D6A-00EF-417C-80A6-815726C70032} + Mono.TextTemplating + False + + + + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs new file mode 100644 index 00000000..5e247509 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs @@ -0,0 +1,191 @@ +// +// Test.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using NUnit.Framework; + +namespace Mono.TextTemplating.Tests +{ + + + [TestFixture] + public class ParsingTests + { + public static string ParseSample1 = +@"<#@ template language=""C#v3.5"" #> +Line One +Line Two +<# +foo +#> +Line Three <#= bar #> +Line Four +<#+ +baz \#> +#> +"; + + [Test] + public void TokenTest () + { + string tf = "test.input"; + Tokeniser tk = new Tokeniser (tf, ParseSample1); + + //line 1 + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 1, 1), tk.Location); + Assert.AreEqual (State.Content, tk.State); + Assert.AreEqual ("", tk.Value); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (State.Directive, tk.State); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 1, 5), tk.Location); + Assert.AreEqual (State.DirectiveName, tk.State); + Assert.AreEqual ("template", tk.Value); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (State.Directive, tk.State); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 1, 14), tk.Location); + Assert.AreEqual (State.DirectiveName, tk.State); + Assert.AreEqual ("language", tk.Value); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (State.Directive, tk.State); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (State.DirectiveValue, tk.State); + Assert.AreEqual (new Location (tf, 1, 23), tk.Location); + Assert.AreEqual ("C#v3.5", tk.Value); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (State.Directive, tk.State); + + //line 2, 3 + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 2, 1), tk.Location); + Assert.AreEqual (State.Content, tk.State); + Assert.AreEqual ("Line One\nLine Two\n", tk.Value); + + //line 4, 5, 6 + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 4, 1), tk.TagStartLocation); + Assert.AreEqual (new Location (tf, 4, 3), tk.Location); + Assert.AreEqual (new Location (tf, 6, 3), tk.TagEndLocation); + Assert.AreEqual (State.Block, tk.State); + Assert.AreEqual ("\nfoo\n", tk.Value); + + //line 7 + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 7, 1), tk.Location); + Assert.AreEqual (State.Content, tk.State); + Assert.AreEqual ("Line Three ", tk.Value); + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 7, 12), tk.TagStartLocation); + Assert.AreEqual (new Location (tf, 7, 15), tk.Location); + Assert.AreEqual (new Location (tf, 7, 22), tk.TagEndLocation); + Assert.AreEqual (State.Expression, tk.State); + Assert.AreEqual (" bar ", tk.Value); + + //line 8 + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 7, 22), tk.Location); + Assert.AreEqual (State.Content, tk.State); + Assert.AreEqual ("\nLine Four\n", tk.Value); + + //line 9, 10, 11 + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 9, 1), tk.TagStartLocation); + Assert.AreEqual (new Location (tf, 9, 4), tk.Location); + Assert.AreEqual (new Location (tf, 11, 3), tk.TagEndLocation); + Assert.AreEqual (State.Helper, tk.State); + Assert.AreEqual (" \nbaz \\#>\n", tk.Value); + + //line 12 + Assert.IsTrue (tk.Advance ()); + Assert.AreEqual (new Location (tf, 12, 1), tk.Location); + Assert.AreEqual (State.Content, tk.State); + Assert.AreEqual ("", tk.Value); + + //EOF + Assert.IsFalse (tk.Advance ()); + Assert.AreEqual (new Location (tf, 12, 1), tk.Location); + Assert.AreEqual (State.EOF, tk.State); + } + + [Test] + public void ParseTest () + { + string tf = "test.input"; + + ParsedTemplate pt = new ParsedTemplate ("test.input"); + Tokeniser tk = new Tokeniser (tf, ParseSample1); + DummyHost host = new DummyHost (); + pt.Parse (host, tk); + + Assert.AreEqual (0, pt.Errors.Count); + var content = new List (pt.Content); + var dirs = new List (pt.Directives); + + Assert.AreEqual (1, dirs.Count); + Assert.AreEqual (6, content.Count); + + Assert.AreEqual ("template", dirs[0].Name); + Assert.AreEqual (1, dirs[0].Attributes.Count); + Assert.AreEqual ("C#v3.5", dirs[0].Attributes["language"]); + Assert.AreEqual (new Location (tf, 1, 1), dirs[0].TagStartLocation); + Assert.AreEqual (new Location (tf, 1, 34), dirs[0].EndLocation); + + Assert.AreEqual ("Line One\nLine Two\n", content[0].Text); + Assert.AreEqual ("\nfoo\n", content[1].Text); + Assert.AreEqual ("Line Three ", content[2].Text); + Assert.AreEqual (" bar ", content[3].Text); + Assert.AreEqual ("\nLine Four\n", content[4].Text); + Assert.AreEqual (" \nbaz \\#>\n", content[5].Text); + + Assert.AreEqual (SegmentType.Content, content[0].Type); + Assert.AreEqual (SegmentType.Block, content[1].Type); + Assert.AreEqual (SegmentType.Content, content[2].Type); + Assert.AreEqual (SegmentType.Expression, content[3].Type); + Assert.AreEqual (SegmentType.Content, content[4].Type); + Assert.AreEqual (SegmentType.Helper, content[5].Type); + + Assert.AreEqual (new Location (tf, 4, 1), content[1].TagStartLocation); + Assert.AreEqual (new Location (tf, 7, 12), content[3].TagStartLocation); + Assert.AreEqual (new Location (tf, 9, 1), content[5].TagStartLocation); + + Assert.AreEqual (new Location (tf, 2, 1), content[0].StartLocation); + Assert.AreEqual (new Location (tf, 4, 3), content[1].StartLocation); + Assert.AreEqual (new Location (tf, 7, 1), content[2].StartLocation); + Assert.AreEqual (new Location (tf, 7, 15), content[3].StartLocation); + Assert.AreEqual (new Location (tf, 7, 22), content[4].StartLocation); + Assert.AreEqual (new Location (tf, 9, 4), content[5].StartLocation); + + Assert.AreEqual (new Location (tf, 6, 3), content[1].EndLocation); + Assert.AreEqual (new Location (tf, 7, 22), content[3].EndLocation); + Assert.AreEqual (new Location (tf, 11, 3), content[5].EndLocation); + } + + + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplateEnginePreprocessTemplateTests.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplateEnginePreprocessTemplateTests.cs new file mode 100644 index 00000000..02bcab11 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplateEnginePreprocessTemplateTests.cs @@ -0,0 +1,246 @@ +// +// TemplateEnginePreprocessTemplateTests.cs +// +// Author: +// Matt Ward +// +// Copyright (c) 2010 Matt Ward +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.IO; +using NUnit.Framework; +using Microsoft.VisualStudio.TextTemplating; + +namespace Mono.TextTemplating.Tests +{ + [TestFixture] + public class TemplateEnginePreprocessTemplateTests + { + [Test] + public void Preprocess () + { + string input = + "<#@ template language=\"C#\" #>\r\n" + + "Test\r\n"; + + string expectedOutput = OutputSample1; + string output = Preprocess (input); + + Assert.AreEqual (expectedOutput, output); + } + + #region Helpers + + string Preprocess (string input) + { + DummyHost host = new DummyHost (); + string className = "PreprocessedTemplate"; + string classNamespace = "Templating"; + string language = null; + string[] references = null; + + TemplatingEngine engine = new TemplatingEngine (); + string output = engine.PreprocessTemplate (input, host, className, classNamespace, out language, out references); + output = output.Replace ("\r\n", "\n"); + return TemplatingEngineHelper.StripHeader (output, "\n"); + } + + #endregion + + #region Expected output strings + + public static string OutputSample1 = +@" +namespace Templating { + + + public partial class PreprocessedTemplate : PreprocessedTemplateBase { + + public virtual string TransformText() { + this.GenerationEnvironment = null; + + #line 2 """" + this.Write(""Test\r\n""); + + #line default + #line hidden + return this.GenerationEnvironment.ToString(); + } + + protected virtual void Initialize() { + } + } + + public class PreprocessedTemplateBase { + + private global::System.Text.StringBuilder builder; + + private global::System.Collections.Generic.IDictionary session; + + private global::System.CodeDom.Compiler.CompilerErrorCollection errors; + + private string currentIndent = string.Empty; + + private global::System.Collections.Generic.Stack indents; + + private ToStringInstanceHelper _toStringHelper = new ToStringInstanceHelper(); + + public virtual global::System.Collections.Generic.IDictionary Session { + get { + return this.session; + } + set { + this.session = value; + } + } + + public global::System.Text.StringBuilder GenerationEnvironment { + get { + if ((this.builder == null)) { + this.builder = new global::System.Text.StringBuilder(); + } + return this.builder; + } + set { + this.builder = value; + } + } + + protected global::System.CodeDom.Compiler.CompilerErrorCollection Errors { + get { + if ((this.errors == null)) { + this.errors = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + } + return this.errors; + } + } + + public string CurrentIndent { + get { + return this.currentIndent; + } + } + + private global::System.Collections.Generic.Stack Indents { + get { + if ((this.indents == null)) { + this.indents = new global::System.Collections.Generic.Stack(); + } + return this.indents; + } + } + + public ToStringInstanceHelper ToStringHelper { + get { + return this._toStringHelper; + } + } + + public void Error(string message) { + this.Errors.Add(new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message)); + } + + public void Warning(string message) { + global::System.CodeDom.Compiler.CompilerError val = new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message); + val.IsWarning = true; + this.Errors.Add(val); + } + + public string PopIndent() { + if ((this.Indents.Count == 0)) { + return string.Empty; + } + int lastPos = (this.currentIndent.Length - this.Indents.Pop()); + string last = this.currentIndent.Substring(lastPos); + this.currentIndent = this.currentIndent.Substring(0, lastPos); + return last; + } + + public void PushIndent(string indent) { + this.Indents.Push(indent.Length); + this.currentIndent = (this.currentIndent + indent); + } + + public void ClearIndent() { + this.currentIndent = string.Empty; + this.Indents.Clear(); + } + + public void Write(string textToAppend) { + this.GenerationEnvironment.Append(textToAppend); + } + + public void Write(string format, params object[] args) { + this.GenerationEnvironment.AppendFormat(format, args); + } + + public void WriteLine(string textToAppend) { + this.GenerationEnvironment.Append(this.currentIndent); + this.GenerationEnvironment.AppendLine(textToAppend); + } + + public void WriteLine(string format, params object[] args) { + this.GenerationEnvironment.Append(this.currentIndent); + this.GenerationEnvironment.AppendFormat(format, args); + this.GenerationEnvironment.AppendLine(); + } + + public class ToStringInstanceHelper { + + private global::System.IFormatProvider formatProvider = global::System.Globalization.CultureInfo.InvariantCulture; + + public global::System.IFormatProvider FormatProvider { + get { + return this.formatProvider; + } + set { + if ((this.formatProvider == null)) { + throw new global::System.ArgumentNullException(""formatProvider""); + } + this.formatProvider = value; + } + } + + public string ToStringWithCulture(object objectToConvert) { + if ((objectToConvert == null)) { + throw new global::System.ArgumentNullException(""objectToConvert""); + } + global::System.Type type = objectToConvert.GetType(); + global::System.Type iConvertibleType = typeof(global::System.IConvertible); + if (iConvertibleType.IsAssignableFrom(type)) { + return ((global::System.IConvertible)(objectToConvert)).ToString(this.formatProvider); + } + global::System.Reflection.MethodInfo methInfo = type.GetMethod(""ToString"", new global::System.Type[] { + iConvertibleType}); + if ((methInfo != null)) { + return ((string)(methInfo.Invoke(objectToConvert, new object[] { + this.formatProvider}))); + } + return objectToConvert.ToString(); + } + } + } +} +"; + #endregion + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplatingEngineHelper.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplatingEngineHelper.cs new file mode 100644 index 00000000..6238f7a8 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating.Tests/TemplatingEngineHelper.cs @@ -0,0 +1,51 @@ +// +// Test.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.IO; + +namespace Mono.TextTemplating.Tests +{ + public static class TemplatingEngineHelper + { + public static string StripHeader (string input, string newLine) + { + using (var writer = new StringWriter ()) { + using (var reader = new StringReader (input)) { + for (int i = 0; i < 9; i++) { + reader.ReadLine (); + } + string line; + while ((line = reader.ReadLine ()) != null) { + writer.Write (line); + writer.Write (newLine); + } + } + return writer.ToString (); + } + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs new file mode 100644 index 00000000..13849716 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs @@ -0,0 +1,37 @@ +// +// AssemblyInfo.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System.Reflection; +using System.Runtime.CompilerServices; +using System; + +[assembly: AssemblyTitle("Mono.TextTemplating")] +[assembly: AssemblyDescription("An implementation of Visual Studio's T4 text templating")] +[assembly: AssemblyCompany("The Mono Project")] +[assembly: AssemblyProduct("MonoDevelop")] +[assembly: AssemblyCopyright("MIT/X11")] +[assembly: CLSCompliant (true)] + +//[assembly: AssemblyVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/ChangeLog b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/ChangeLog new file mode 100644 index 00000000..51377760 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/ChangeLog @@ -0,0 +1,212 @@ +2010-03-15 Michael Hutchinson + + * Mono.TextTemplating/TemplateGenerator.cs: Expose OutputFile + for custom tool to access. + +2010-03-01 Michael Hutchinson + + * Mono.TextTemplating/CrossAppDomainAssemblyResolver.cs: A + handler for AssemblyResolve events that looks them up in the + domain that created the resolver. + + * Makefile.am: + * Mono.TextTemplating.csproj: Added file. + +2009-11-27 Olivier Dagenais + * Mono.TextTemplating/ParsedTemplate.cs: Fixed a bug where the + location of an error was being ignored. + +2009-11-27 Olivier Dagenais + + * Mono.TextTemplating/TemplatingEngine.cs: Mark the generated + type as partial. + +2009-11-25 Michael Hutchinson + + * Mono.TextTemplating/ParsedTemplate.cs: Don't check if + included file exists before trying to resolve it from the + host, because host may use include paths. Patch from Aaron + Bockover. + +2009-08-17 Michael Hutchinson + + * Mono.TextTemplating/TemplatingEngine.cs: Fix NRE when + template fails to compile. + +2009-08-12 Michael Hutchinson + + * Makefile.am: + * Mono.TextTemplating.csproj: Include the ASP.NET MVC and + TextTemplating addins in the main solution and build. + +2009-08-11 Michael Hutchinson + + * Mono.TextTemplating.csproj: + * Mono.TextTemplating/ParsedTemplate.cs: + * Mono.TextTemplating/CompiledTemplate.cs: + * Mono.TextTemplating/TemplatingEngine.cs: + * Mono.TextTemplating/TemplateGenerator.cs: + * Mono.TextTemplating/IExtendedTextTemplatingEngineHost.cs: + Add support for caching compiled templates, and a couple of + bugfixes. Patch from Nathan Baulch + (nathan.baulch@gmail.com). + +2009-06-25 Michael Hutchinson + + * Mono.TextTemplating/TemplatingEngine.cs: Handle expressions + and content in helpers, based on patch from Nathan Baulch. + Liberally add C# 3 sugar to neaten up CodeDOM usage. + +2009-06-25 Michael Hutchinson + + * Mono.TextTemplating/TemplateGenerator.cs: Added overload for + Process template that uses input/output strings directly, + avoiding file read/write. Expose engine to subclasses. + + * Mono.TextTemplating/Tokeniser.cs: Remove outdated TODO. + +2009-04-13 Michael Hutchinson + + * Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs: Use + IConvertible.ToString (formatProvider) when possible. + + Thanks to Stuart Carnie for this patch. + +2009-04-13 Michael Hutchinson + + * Mono.TextTemplating/Tokeniser.cs: Add support for Mac and + Windows newlines. + + * Mono.TextTemplating/TemplatingEngine.cs: Keep temp files + when in debug mode, so that the generated code can be + debugged. + + * Mono.TextTemplating/ParsedTemplate.cs: Fixes for csc + compilation. + + Thanks to Stuart Carnie for this patch. + +2009-04-03 Michael Hutchinson + + * Mono.TextTemplating.csproj: + * Mono.TextTemplating/TemplatingEngine.cs: + * Mono.TextTemplating/TemplateSettings.cs: + * Microsoft.VisualStudio.TextTemplating/Engine.cs: Move the + real engine into the Mono.TextTemplating namespace and + expose helper methods so that they can be tested. + +2009-03-13 Michael Hutchinson + + * Mono.TextTemplating.csproj: Move output dir from ../bin to + ../build. + +2009-03-12 Michael Hutchinson + + * Mono.TextTemplating/Tokeniser.cs: Tweaked location of next + state after directive. + +2009-03-12 Michael Hutchinson + + * Mono.TextTemplating/Tokeniser.cs: Location tweaks within + directives. + + * Mono.TextTemplating/ParsedTemplate.cs: Make Location + equatable. + +2009-03-10 Michael Hutchinson + + * Mono.TextTemplating/Tokeniser.cs: + * Mono.TextTemplating/ParsedTemplate.cs: Fix end location + capture after newline handling changes. + +2009-03-10 Michael Hutchinson + + * Mono.TextTemplating/Tokeniser.cs: + * Microsoft.VisualStudio.TextTemplating/Engine.cs: Match T4's + newline handling. + +2009-03-10 Michael Hutchinson + + * Mono.TextTemplating/ParsedTemplate.cs: Fix logic that + prevented adding directives. + +2009-03-09 Michael Hutchinson + + * Mono.TextTemplating/Tokeniser.cs: + * Mono.TextTemplating/ParsedTemplate.cs: More accurate + location captures. Capture start of tags as well as start of + content. + +2009-03-09 Michael Hutchinson + + * Mono.TextTemplating/TemplateGenerator.cs: Report exceptions + in errors. + + * Mono.TextTemplating/Tokeniser.cs: Make API public. + + * Mono.TextTemplating/ParsedTemplate.cs: Unify segment types. + Track end locations. Make API public. Allow parsing without + includes. + + * Microsoft.VisualStudio.TextTemplating/Engine.cs: Track + location API. + +2009-03-06 Michael Hutchinson + + * Mono.TextTemplating/TemplateGenerator.cs: Fix + SetFileExtension. + + * Microsoft.VisualStudio.TextTemplating/Engine.cs: Capture + hostspecific attribute from template directive. + +2009-03-05 Michael Hutchinson + + * Mono.TextTemplating/TemplateGenerator.cs: Fix output + extension changing. + + * Mono.TextTemplating/Tokeniser.cs: Fix helper regions. + +2009-03-05 Michael Hutchinson + + * Mono.TextTemplating.csproj: Updated. + + * Mono.TextTemplating/TemplateGenerator.cs: Simple template + host implementation. Doesn't handle everything yet. + + * Mono.TextTemplating/Tokeniser.cs: Fix a number of offset + issues that broke most captures. Only allow EOF in content + regions, and in this case capture the last content. Track + current column, for error reporting. + + * Mono.TextTemplating/ParsedTemplate.cs: Overhaul location + tracking for error reporting. Don't record empty segments. + + * Microsoft.VisualStudio.TextTemplating/Engine.cs: Use run + method instead of runner, since the whole thing's done in + the appdomain now. Catch errors from the runner. Use host's + default assemblies and imports. Track ParsedTemplate error + reporting changes. Filter out content regions with only a + single newline. + + * Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs: + Don't cache delegates; this won't work for instances. Maybe + IL generation is called for. + +2009-03-04 Michael Hutchinson + + * AssemblyInfo.cs: + * Mono.TextTemplating: + * Mono.TextTemplating.csproj: + * Mono.TextTemplating/Tokeniser.cs: + * Microsoft.VisualStudio.TextTemplating: + * Mono.TextTemplating/ParsedTemplate.cs: + * Microsoft.VisualStudio.TextTemplating/Engine.cs: + * Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs: + * Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs: + * Microsoft.VisualStudio.TextTemplating/TextTransformation.cs: + * Microsoft.VisualStudio.TextTemplating/ITextTemplatingEngineHost.cs: + * Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs: + * Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs: + Move T4 implementation to its own assembly. Tweak some + appdomain stuff. + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Makefile.am b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Makefile.am new file mode 100644 index 00000000..72ec1552 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Makefile.am @@ -0,0 +1,55 @@ +ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating +ASSEMBLY = $(ADDIN_BUILD)/Mono.TextTemplating.dll + +DEPS = + +REFS = \ + -r:System \ + -r:System.Core + +FILES = \ + AssemblyInfo.cs \ + Microsoft.VisualStudio.TextTemplating/AssemblyCacheMonitor.cs \ + Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs \ + Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs \ + Microsoft.VisualStudio.TextTemplating/EncodingHelper.cs \ + Microsoft.VisualStudio.TextTemplating/Engine.cs \ + Microsoft.VisualStudio.TextTemplating/Interfaces.cs \ + Microsoft.VisualStudio.TextTemplating/ParameterDirectiveProcessor.cs \ + Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs \ + Microsoft.VisualStudio.TextTemplating/TextTemplatingSession.cs \ + Microsoft.VisualStudio.TextTemplating/TextTransformation.cs \ + Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs \ + Mono.TextTemplating/CompiledTemplate.cs \ + Mono.TextTemplating/CrossAppDomainAssemblyResolver.cs \ + Mono.TextTemplating/ParsedTemplate.cs \ + Mono.TextTemplating/TemplateGenerator.cs \ + Mono.TextTemplating/TemplateSettings.cs \ + Mono.TextTemplating/TemplatingEngine.cs \ + Mono.TextTemplating/Tokeniser.cs + +RES = + +all: $(ASSEMBLY) $(ASSEMBLY).mdb $(DATA_FILE_BUILD) + +$(ASSEMBLY): $(build_sources) $(build_resources) $(DEPS) + mkdir -p $(ADDIN_BUILD) + $(CSC) $(CSC_FLAGS) -debug -out:$@ -target:library $(REFS) $(build_deps) \ + $(build_resources:%=/resource:%) $(build_sources) + +$(ASSEMBLY).mdb: $(ASSEMBLY) + +$(DATA_FILE_BUILD): $(srcdir)$(subst $(ADDIN_BUILD),, $@) + mkdir -p $(ADDIN_BUILD)/Schemas + cp $(srcdir)/$(subst $(ADDIN_BUILD),,$@) $@ + +check: all + +assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.TextTemplating +assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb + +CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb +EXTRA_DIST = $(FILES) $(RES) + +include $(top_srcdir)/Makefile.include + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/AssemblyCacheMonitor.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/AssemblyCacheMonitor.cs new file mode 100644 index 00000000..68a17fb0 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/AssemblyCacheMonitor.cs @@ -0,0 +1,43 @@ +// +// AssemblyCacheMonitor.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2010 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public sealed class AssemblyCacheMonitor : MarshalByRefObject + { + public AssemblyCacheMonitor () + { + } + + public int GetStaleAssembliesCount (TimeSpan assemblyStaleTime) + { + throw new NotImplementedException (); + } + } +} + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs new file mode 100644 index 00000000..f86dbd2e --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs @@ -0,0 +1,63 @@ +// +// DirectiveProcessor.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.CodeDom.Compiler; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public abstract class DirectiveProcessor + { + protected DirectiveProcessor () + { + } + + public virtual void Initialize (ITextTemplatingEngineHost host) + { + if (host == null) + throw new ArgumentNullException ("host"); + } + + public virtual void StartProcessingRun (CodeDomProvider languageProvider, string templateContents, CompilerErrorCollection errors) + { + if (languageProvider == null) + throw new ArgumentNullException ("languageProvider"); + this.Errors = errors; + } + + public abstract void FinishProcessingRun (); + public abstract string GetClassCodeForProcessingRun (); + public abstract string[] GetImportsForProcessingRun (); + public abstract string GetPostInitializationCodeForProcessingRun (); + public abstract string GetPreInitializationCodeForProcessingRun (); + public abstract string[] GetReferencesForProcessingRun (); + public abstract bool IsDirectiveSupported (string directiveName); + public abstract void ProcessDirective (string directiveName, IDictionary arguments); + + protected CompilerErrorCollection Errors { get; private set; } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs new file mode 100644 index 00000000..1d95faca --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs @@ -0,0 +1,56 @@ +// +// DirectiveProcessorException.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Runtime.Serialization; + +namespace Microsoft.VisualStudio.TextTemplating +{ + + [Serializable] + public class DirectiveProcessorException : Exception + { + + public DirectiveProcessorException () + { + } + + public DirectiveProcessorException (string message) + : base (message) + { + } + + public DirectiveProcessorException (SerializationInfo info, StreamingContext context) + : base (info, context) + { + } + + public DirectiveProcessorException (string message, Exception inner) + : base (message, inner) + { + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/EncodingHelper.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/EncodingHelper.cs new file mode 100644 index 00000000..9934646b --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/EncodingHelper.cs @@ -0,0 +1,40 @@ +// +// EncodingHelper.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2010 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Text; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public static class EncodingHelper + { + public static Encoding GetEncoding (string filePath) + { + throw new NotImplementedException (); + } + } +} + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs new file mode 100644 index 00000000..fc9c9aac --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs @@ -0,0 +1,58 @@ +// +// Engine.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using System.CodeDom; +using System.CodeDom.Compiler; +using Mono.TextTemplating; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public class Engine : ITextTemplatingEngine + { + TemplatingEngine engine = new TemplatingEngine (); + + public Engine () + { + } + + public string ProcessTemplate (string content, ITextTemplatingEngineHost host) + { + return engine.ProcessTemplate (content, host); + } + + public string PreprocessTemplate (string content, ITextTemplatingEngineHost host, string className, + string classNamespace, out string language, out string[] references) + { + return engine.PreprocessTemplate (content, host, className, classNamespace, out language, out references); + } + + public const string CacheAssembliesOptionString = "CacheAssemblies"; + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Interfaces.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Interfaces.cs new file mode 100644 index 00000000..5ea7413f --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Interfaces.cs @@ -0,0 +1,84 @@ +// +// ITextTemplatingEngineHost.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009-2010 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Text; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections; +using System.Runtime.Serialization; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public interface IRecognizeHostSpecific + { + void SetProcessingRunIsHostSpecific (bool hostSpecific); + bool RequiresProcessingRunIsHostSpecific { get; } + } + + [CLSCompliant(true)] + public interface ITextTemplatingEngine + { + string ProcessTemplate (string content, ITextTemplatingEngineHost host); + string PreprocessTemplate (string content, ITextTemplatingEngineHost host, string className, + string classNamespace, out string language, out string[] references); + } + + [CLSCompliant(true)] + public interface ITextTemplatingEngineHost + { + object GetHostOption (string optionName); + bool LoadIncludeText (string requestFileName, out string content, out string location); + void LogErrors (CompilerErrorCollection errors); + AppDomain ProvideTemplatingAppDomain (string content); + string ResolveAssemblyReference (string assemblyReference); + Type ResolveDirectiveProcessor (string processorName); + string ResolveParameterValue (string directiveId, string processorName, string parameterName); + string ResolvePath (string path); + void SetFileExtension (string extension); + void SetOutputEncoding (Encoding encoding, bool fromOutputDirective); + IList StandardAssemblyReferences { get; } + IList StandardImports { get; } + string TemplateFile { get; } + } + + [CLSCompliant(true)] + public interface ITextTemplatingSession : + IEquatable, IEquatable, IDictionary, + ICollection>, + IEnumerable>, + IEnumerable, ISerializable + { + Guid Id { get; } + } + + [CLSCompliant(true)] + public interface ITextTemplatingSessionHost + { + ITextTemplatingSession CreateSession (); + ITextTemplatingSession Session { get; set; } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ParameterDirectiveProcessor.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ParameterDirectiveProcessor.cs new file mode 100644 index 00000000..9518a428 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ParameterDirectiveProcessor.cs @@ -0,0 +1,268 @@ +// +// ParameterDirectiveProcessor.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2010 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.CodeDom.Compiler; +using System.CodeDom; +using System.IO; +using System.Linq; +using System.Reflection; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public sealed class ParameterDirectiveProcessor : DirectiveProcessor, IRecognizeHostSpecific + { + CodeDomProvider provider; + bool isCSharp; + bool useMonoHack; + + bool hostSpecific; + List postStatements = new List (); + CodeTypeMemberCollection members = new CodeTypeMemberCollection (); + + public ParameterDirectiveProcessor () + { + } + + public override void StartProcessingRun (CodeDomProvider languageProvider, string templateContents, CompilerErrorCollection errors) + { + base.StartProcessingRun (languageProvider, templateContents, errors); + this.provider = languageProvider; + //HACK: Mono as of 2.10.2 doesn't implement GenerateCodeFromMember + if (Type.GetType ("Mono.Runtime") != null) + useMonoHack = true; + if (languageProvider is Microsoft.CSharp.CSharpCodeProvider) + isCSharp = true; + postStatements.Clear (); + members.Clear (); + } + + public override void FinishProcessingRun () + { + var statement = new CodeConditionStatement ( + new CodeBinaryOperatorExpression ( + new CodePropertyReferenceExpression ( + new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "Errors"), "HasErrors"), + CodeBinaryOperatorType.ValueEquality, + new CodePrimitiveExpression (false)), + postStatements.ToArray ()); + + postStatements.Clear (); + postStatements.Add (statement); + } + + public override string GetClassCodeForProcessingRun () + { + var options = new CodeGeneratorOptions (); + using (var sw = new StringWriter ()) { + GenerateCodeFromMembers (sw, options); + return Indent (sw.ToString (), " "); + } + } + + string Indent (string s, string indent) + { + if (isCSharp) + return Mono.TextTemplating.TemplatingEngine.IndentSnippetText (s, indent); + return s; + } + + public override string[] GetImportsForProcessingRun () + { + return null; + } + + public override string GetPostInitializationCodeForProcessingRun () + { + return Indent (StatementsToCode (postStatements), " "); + } + + public override string GetPreInitializationCodeForProcessingRun () + { + return null; + } + + string StatementsToCode (List statements) + { + var options = new CodeGeneratorOptions (); + using (var sw = new StringWriter ()) { + foreach (var statement in statements) + provider.GenerateCodeFromStatement (statement, sw, options); + return sw.ToString (); + } + } + + public override string[] GetReferencesForProcessingRun () + { + return null; + } + + public override bool IsDirectiveSupported (string directiveName) + { + return directiveName == "parameter"; + } + + public override void ProcessDirective (string directiveName, IDictionary arguments) + { + string name = arguments["name"]; + string type = arguments["type"]; + if (string.IsNullOrEmpty (name)) + throw new DirectiveProcessorException ("Parameter directive has no name argument"); + if (string.IsNullOrEmpty (type)) + throw new DirectiveProcessorException ("Parameter directive has no type argument"); + + string fieldName = "_" + name + "Field"; + var typeRef = new CodeTypeReference (type); + var thisRef = new CodeThisReferenceExpression (); + var fieldRef = new CodeFieldReferenceExpression (thisRef, fieldName); + + var property = new CodeMemberProperty () { + Name = name, + Attributes = MemberAttributes.Public | MemberAttributes.Final, + HasGet = true, + HasSet = false, + Type = typeRef + }; + property.GetStatements.Add (new CodeMethodReturnStatement (fieldRef)); + members.Add (new CodeMemberField (typeRef, fieldName)); + members.Add (property); + + string acquiredName = "_" + name + "Acquired"; + var valRef = new CodeVariableReferenceExpression ("data"); + var namePrimitive = new CodePrimitiveExpression (name); + var sessionRef = new CodePropertyReferenceExpression (thisRef, "Session"); + var callContextTypeRefExpr = new CodeTypeReferenceExpression ("System.Runtime.Remoting.Messaging.CallContext"); + var nullPrim = new CodePrimitiveExpression (null); + + var acquiredVariable = new CodeVariableDeclarationStatement (typeof (bool), acquiredName, new CodePrimitiveExpression (false)); + var acquiredVariableRef = new CodeVariableReferenceExpression (acquiredVariable.Name); + this.postStatements.Add (acquiredVariable); + + //checks the local called "data" can be cast and assigned to the field, and if successful, sets acquiredVariable to true + var checkCastThenAssignVal = new CodeConditionStatement ( + new CodeMethodInvokeExpression ( + new CodeTypeOfExpression (typeRef), "IsAssignableFrom", new CodeMethodInvokeExpression (valRef, "GetType")), + new CodeStatement[] { + new CodeAssignStatement (fieldRef, new CodeCastExpression (typeRef, valRef)), + new CodeAssignStatement (acquiredVariableRef, new CodePrimitiveExpression (true)), + }, + new CodeStatement[] { + new CodeExpressionStatement (new CodeMethodInvokeExpression (thisRef, "Error", + new CodePrimitiveExpression ("The type '" + type + "' of the parameter '" + name + + "' did not match the type passed to the template"))), + }); + + //tries to gets the value from the session + var checkSession = new CodeConditionStatement ( + new CodeBinaryOperatorExpression (NotNull (sessionRef), CodeBinaryOperatorType.BooleanAnd, + new CodeMethodInvokeExpression (sessionRef, "ContainsKey", namePrimitive)), + new CodeVariableDeclarationStatement (typeof (object), "data", new CodeIndexerExpression (sessionRef, namePrimitive)), + checkCastThenAssignVal); + + this.postStatements.Add (checkSession); + + //if acquiredVariable is false, tries to gets the value from the host + if (hostSpecific) { + var hostRef = new CodePropertyReferenceExpression (thisRef, "Host"); + var checkHost = new CodeConditionStatement ( + BooleanAnd (IsFalse (acquiredVariableRef), NotNull (hostRef)), + new CodeVariableDeclarationStatement (typeof (string), "data", + new CodeMethodInvokeExpression (hostRef, "ResolveParameterValue", nullPrim, nullPrim, namePrimitive)), + new CodeConditionStatement (NotNull (valRef), checkCastThenAssignVal)); + + this.postStatements.Add (checkHost); + } + + //if acquiredVariable is false, tries to gets the value from the call context + var checkCallContext = new CodeConditionStatement ( + IsFalse (acquiredVariableRef), + new CodeVariableDeclarationStatement (typeof (object), "data", + new CodeMethodInvokeExpression (callContextTypeRefExpr, "LogicalGetData", namePrimitive)), + new CodeConditionStatement (NotNull (valRef), checkCastThenAssignVal)); + + this.postStatements.Add (checkCallContext); + } + + static CodeBinaryOperatorExpression NotNull (CodeExpression reference) + { + return new CodeBinaryOperatorExpression (reference, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression (null)); + } + + static CodeBinaryOperatorExpression IsFalse (CodeExpression expr) + { + return new CodeBinaryOperatorExpression (expr, CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression (false)); + } + + static CodeBinaryOperatorExpression BooleanAnd (CodeExpression expr1, CodeExpression expr2) + { + return new CodeBinaryOperatorExpression (expr1, CodeBinaryOperatorType.BooleanAnd, expr2); + } + + void IRecognizeHostSpecific.SetProcessingRunIsHostSpecific (bool hostSpecific) + { + this.hostSpecific = hostSpecific; + } + + public bool RequiresProcessingRunIsHostSpecific { + get { return false; } + } + + void GenerateCodeFromMembers (StringWriter sw, CodeGeneratorOptions options) + { + if (!useMonoHack) { + foreach (CodeTypeMember member in members) + provider.GenerateCodeFromMember (member, sw, options); + } + + var cgType = typeof (CodeGenerator); + var cgInit = cgType.GetMethod ("InitOutput", BindingFlags.NonPublic | BindingFlags.Instance); + var cgFieldGen = cgType.GetMethod ("GenerateField", BindingFlags.NonPublic | BindingFlags.Instance); + var cgPropGen = cgType.GetMethod ("GenerateProperty", BindingFlags.NonPublic | BindingFlags.Instance); + +#pragma warning disable 0618 + var generator = (CodeGenerator) provider.CreateGenerator (); +#pragma warning restore 0618 + var dummy = new CodeTypeDeclaration ("Foo"); + + foreach (CodeTypeMember member in members) { + var f = member as CodeMemberField; + if (f != null) { + cgInit.Invoke (generator, new object[] { sw, options }); + cgFieldGen.Invoke (generator, new object[] { f }); + continue; + } + var p = member as CodeMemberProperty; + if (p != null) { + cgInit.Invoke (generator, new object[] { sw, options }); + cgPropGen.Invoke (generator, new object[] { p, dummy }); + continue; + } + } + } + } +} + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs new file mode 100644 index 00000000..bb48357c --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs @@ -0,0 +1,196 @@ +// +// RequiresProvidesDirectiveProcessor.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.CodeDom.Compiler; +using System.Text; + +namespace Microsoft.VisualStudio.TextTemplating +{ + + + public abstract class RequiresProvidesDirectiveProcessor : DirectiveProcessor + { + bool isInProcessingRun; + ITextTemplatingEngineHost host; + StringBuilder preInitBuffer = new StringBuilder (); + StringBuilder postInitBuffer = new StringBuilder (); + StringBuilder codeBuffer = new StringBuilder (); + CodeDomProvider languageProvider; + + protected RequiresProvidesDirectiveProcessor () + { + } + + public override void Initialize (ITextTemplatingEngineHost host) + { + base.Initialize (host); + this.host = host; + } + + protected abstract void InitializeProvidesDictionary (string directiveName, IDictionary providesDictionary); + protected abstract void InitializeRequiresDictionary (string directiveName, IDictionary requiresDictionary); + protected abstract string FriendlyName { get; } + + protected abstract void GeneratePostInitializationCode (string directiveName, StringBuilder codeBuffer, CodeDomProvider languageProvider, + IDictionary requiresArguments, IDictionary providesArguments); + protected abstract void GeneratePreInitializationCode (string directiveName, StringBuilder codeBuffer, CodeDomProvider languageProvider, + IDictionary requiresArguments, IDictionary providesArguments); + protected abstract void GenerateTransformCode (string directiveName, StringBuilder codeBuffer, CodeDomProvider languageProvider, + IDictionary requiresArguments, IDictionary providesArguments); + + protected virtual void PostProcessArguments (string directiveName, IDictionary requiresArguments, + IDictionary providesArguments) + { + } + + public override string GetClassCodeForProcessingRun () + { + AssertNotProcessing (); + return codeBuffer.ToString (); + } + + public override string[] GetImportsForProcessingRun () + { + AssertNotProcessing (); + return null; + } + + public override string[] GetReferencesForProcessingRun () + { + AssertNotProcessing (); + return null; + } + + public override string GetPostInitializationCodeForProcessingRun () + { + AssertNotProcessing (); + return postInitBuffer.ToString (); + } + + public override string GetPreInitializationCodeForProcessingRun () + { + AssertNotProcessing (); + return preInitBuffer.ToString (); + } + + public override void StartProcessingRun (CodeDomProvider languageProvider, string templateContents, CompilerErrorCollection errors) + { + AssertNotProcessing (); + isInProcessingRun = true; + base.StartProcessingRun (languageProvider, templateContents, errors); + + this.languageProvider = languageProvider; + codeBuffer.Length = 0; + preInitBuffer.Length = 0; + postInitBuffer.Length = 0; + } + + public override void FinishProcessingRun () + { + isInProcessingRun = false; + } + + void AssertNotProcessing () + { + if (isInProcessingRun) + throw new InvalidOperationException (); + } + + //FIXME: handle escaping + IEnumerable> ParseArgs (string args) + { + var pairs = args.Split (';'); + foreach (var p in pairs) { + int eq = p.IndexOf ('='); + var k = p.Substring (0, eq); + var v = p.Substring (eq); + yield return new KeyValuePair (k, v); + } + } + + public override void ProcessDirective (string directiveName, IDictionary arguments) + { + if (directiveName == null) + throw new ArgumentNullException ("directiveName"); + if (arguments == null) + throw new ArgumentNullException ("arguments"); + + var providesDictionary = new Dictionary (); + var requiresDictionary = new Dictionary (); + + string provides; + if (arguments.TryGetValue ("provides", out provides)) { + foreach (var arg in ParseArgs (provides)) { + providesDictionary.Add (arg.Key, arg.Value); + } + } + + string requires; + if (arguments.TryGetValue ("requires", out requires)) { + foreach (var arg in ParseArgs (requires)) { + requiresDictionary.Add (arg.Key, arg.Value); + } + } + + InitializeRequiresDictionary (directiveName, requiresDictionary); + InitializeProvidesDictionary (directiveName, providesDictionary); + + var id = ProvideUniqueId (directiveName, arguments, requiresDictionary, providesDictionary); + + foreach (var req in requiresDictionary) { + var val = host.ResolveParameterValue (id, FriendlyName, req.Key); + if (val != null) + requiresDictionary[req.Key] = val; + else if (req.Value == null) + throw new DirectiveProcessorException ("Could not resolve required value '" + req.Key + "'"); + } + + foreach (var req in providesDictionary) { + var val = host.ResolveParameterValue (id, FriendlyName, req.Key); + if (val != null) + providesDictionary[req.Key] = val; + } + + PostProcessArguments (directiveName, requiresDictionary, providesDictionary); + + GeneratePreInitializationCode (directiveName, preInitBuffer, languageProvider, requiresDictionary, providesDictionary); + GeneratePostInitializationCode (directiveName, postInitBuffer, languageProvider, requiresDictionary, providesDictionary); + GenerateTransformCode (directiveName, codeBuffer, languageProvider, requiresDictionary, providesDictionary); + } + + protected virtual string ProvideUniqueId (string directiveName, IDictionary arguments, + IDictionary requiresArguments, IDictionary providesArguments) + { + return directiveName; + } + + protected ITextTemplatingEngineHost Host { + get { return host; } + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTemplatingSession.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTemplatingSession.cs new file mode 100644 index 00000000..b29dbd01 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTemplatingSession.cs @@ -0,0 +1,71 @@ +// +// TextTemplatingSession.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2010 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Collections.Generic; +using System.Collections; +using System.Runtime.Serialization; + +namespace Microsoft.VisualStudio.TextTemplating +{ + [Serializable] + public sealed class TextTemplatingSession : Dictionary, ITextTemplatingSession + { + public TextTemplatingSession () : this (Guid.NewGuid ()) + { + } + + public TextTemplatingSession (Guid id) + { + this.Id = id; + } + + public Guid Id { + get; private set; + } + + public override int GetHashCode () + { + return Id.GetHashCode (); + } + + public override bool Equals (object obj) + { + var o = obj as TextTemplatingSession; + return o != null && o.Equals (this); + } + + public bool Equals (Guid other) + { + return other.Equals (Id); + } + + public bool Equals (ITextTemplatingSession other) + { + return other != null && other.Id == this.Id; + } + } +} + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs new file mode 100644 index 00000000..409a36a9 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs @@ -0,0 +1,219 @@ +// +// TextTransformation.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public abstract class TextTransformation : IDisposable + { + Stack indents; + string currentIndent = string.Empty; + CompilerErrorCollection errors; + StringBuilder builder; + bool endsWithNewline; + + public TextTransformation () + { + } + + protected internal virtual void Initialize () + { + } + + public abstract string TransformText (); + + public virtual IDictionary Session { get; set; } + + #region Errors + + public void Error (string message) + { + Errors.Add (new CompilerError (null, -1, -1, null, message)); + } + + public void Warning (string message) + { + var err = new CompilerError (null, -1, -1, null, message) { + IsWarning = true, + }; + Errors.Add (err); + } + + protected internal CompilerErrorCollection Errors { + get { + if (errors == null) + errors = new CompilerErrorCollection (); + return errors; + } + } + + Stack Indents { + get { + if (indents == null) + indents = new Stack (); + return indents; + } + } + + #endregion + + #region Indents + + public string PopIndent () + { + if (Indents.Count == 0) + return ""; + int lastPos = currentIndent.Length - Indents.Pop (); + string last = currentIndent.Substring (lastPos); + currentIndent = currentIndent.Substring (0, lastPos); + return last; + } + + public void PushIndent (string indent) + { + if (indent == null) + throw new ArgumentNullException ("indent"); + Indents.Push (indent.Length); + currentIndent += indent; + } + + public void ClearIndent () + { + currentIndent = string.Empty; + Indents.Clear (); + } + + public string CurrentIndent { + get { return currentIndent; } + } + + #endregion + + #region Writing + + protected StringBuilder GenerationEnvironment { + get { + if (builder == null) + builder = new StringBuilder (); + return builder; + } + set { + builder = value; + } + } + + public void Write (string textToAppend) + { + if (string.IsNullOrEmpty (textToAppend)) + return; + + if ((GenerationEnvironment.Length == 0 || endsWithNewline) && CurrentIndent.Length > 0) { + GenerationEnvironment.Append (CurrentIndent); + } + endsWithNewline = false; + + char last = textToAppend[textToAppend.Length-1]; + if (last == '\n' || last == '\r') { + endsWithNewline = true; + } + + if (CurrentIndent.Length == 0) { + GenerationEnvironment.Append (textToAppend); + return; + } + + //insert CurrentIndent after every newline (\n, \r, \r\n) + //but if there's one at the end of the string, ignore it, it'll be handled next time thanks to endsWithNewline + int lastNewline = 0; + for (int i = 0; i < textToAppend.Length - 1; i++) { + char c = textToAppend[i]; + if (c == '\r') { + if (textToAppend[i + 1] == '\n') { + i++; + if (i == textToAppend.Length - 1) + break; + } + } else if (c != '\n') { + continue; + } + i++; + int len = i - lastNewline; + if (len > 0) { + GenerationEnvironment.Append (textToAppend, lastNewline, i - lastNewline); + } + GenerationEnvironment.Append (CurrentIndent); + lastNewline = i; + } + if (lastNewline > 0) + GenerationEnvironment.Append (textToAppend, lastNewline, textToAppend.Length - lastNewline); + else + GenerationEnvironment.Append (textToAppend); + } + + public void Write (string format, params object[] args) + { + Write (string.Format (format, args)); + } + + public void WriteLine (string textToAppend) + { + Write (textToAppend); + GenerationEnvironment.AppendLine (); + endsWithNewline = true; + } + + public void WriteLine (string format, params object[] args) + { + WriteLine (string.Format (format, args)); + } + + #endregion + + #region Dispose + + public void Dispose () + { + Dispose (true); + GC.SuppressFinalize (this); + } + + protected virtual void Dispose (bool disposing) + { + } + + ~TextTransformation () + { + Dispose (false); + } + + #endregion + + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs new file mode 100644 index 00000000..7f5934e2 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs @@ -0,0 +1,69 @@ +// +// ToStringHelper.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.VisualStudio.TextTemplating +{ + public static class ToStringHelper + { + static object [] formatProviderAsParameterArray; + + static IFormatProvider formatProvider = System.Globalization.CultureInfo.InvariantCulture; + + static ToStringHelper () + { + formatProviderAsParameterArray = new object[] { formatProvider }; + } + + public static string ToStringWithCulture (object objectToConvert) + { + if (objectToConvert == null) + throw new ArgumentNullException ("objectToConvert"); + + IConvertible conv = objectToConvert as IConvertible; + if (conv != null) + return conv.ToString (formatProvider); + + var str = objectToConvert as string; + if (str != null) + return str; + + //TODO: implement a cache of types and DynamicMethods + MethodInfo mi = objectToConvert.GetType ().GetMethod ("ToString", new Type[] { typeof (IFormatProvider) }); + if (mi != null) + return (string) mi.Invoke (objectToConvert, formatProviderAsParameterArray); + return objectToConvert.ToString (); + } + + public static IFormatProvider FormatProvider { + get { return (IFormatProvider)formatProviderAsParameterArray[0]; } + set { formatProviderAsParameterArray[0] = formatProvider = value; } + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj new file mode 100644 index 00000000..2523f46b --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj @@ -0,0 +1,79 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {A2364D6A-00EF-417C-80A6-815726C70032} + Library + Mono.TextTemplating + Mono.TextTemplating + + + true + full + false + ..\bin + DEBUG + prompt + 4 + false + + + none + false + ..\bin + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs new file mode 100644 index 00000000..3e2f9458 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs @@ -0,0 +1,113 @@ +// +// CompiledTemplate.cs +// +// Author: +// Nathan Baulch +// +// Copyright (c) 2009 Nathan Baulch +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Reflection; +using Microsoft.VisualStudio.TextTemplating; +using System.CodeDom.Compiler; +using System.Globalization; + +namespace Mono.TextTemplating +{ + public sealed class CompiledTemplate : MarshalByRefObject, IDisposable + { + ITextTemplatingEngineHost host; + TextTransformation tt; + CultureInfo culture; + string[] assemblyFiles; + + public CompiledTemplate (ITextTemplatingEngineHost host, CompilerResults results, string fullName, CultureInfo culture, + string[] assemblyFiles) + { + AppDomain.CurrentDomain.AssemblyResolve += ResolveReferencedAssemblies; + this.host = host; + this.culture = culture; + this.assemblyFiles = assemblyFiles; + Load (results, fullName); + } + + void Load (CompilerResults results, string fullName) + { + var assembly = results.CompiledAssembly; + Type transformType = assembly.GetType (fullName); + tt = (TextTransformation) Activator.CreateInstance (transformType); + + //set the host property if it exists + var hostProp = transformType.GetProperty ("Host", typeof (ITextTemplatingEngineHost)); + if (hostProp != null && hostProp.CanWrite) + hostProp.SetValue (tt, host, null); + + var sessionHost = host as ITextTemplatingSessionHost; + if (sessionHost != null) { + //FIXME: should we create a session if it's null? + tt.Session = sessionHost.Session; + } + } + + public string Process () + { + tt.Errors.Clear (); + + //set the culture + if (culture != null) + ToStringHelper.FormatProvider = culture; + else + ToStringHelper.FormatProvider = CultureInfo.InvariantCulture; + + tt.Initialize (); + + string output = null; + try { + output = tt.TransformText (); + } catch (Exception ex) { + tt.Error ("Error running transform: " + ex.ToString ()); + } + host.LogErrors (tt.Errors); + + ToStringHelper.FormatProvider = CultureInfo.InvariantCulture; + return output; + } + + System.Reflection.Assembly ResolveReferencedAssemblies (object sender, ResolveEventArgs args) + { + System.Reflection.Assembly asm = null; + foreach (var asmFile in assemblyFiles) { + var name = System.IO.Path.GetFileNameWithoutExtension (asmFile); + if (args.Name.StartsWith (name)) + asm = System.Reflection.Assembly.LoadFrom (asmFile); + } + return asm; + } + + public void Dispose () + { + if (host != null) { + host = null; + AppDomain.CurrentDomain.AssemblyResolve -= ResolveReferencedAssemblies; + } + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CrossAppDomainAssemblyResolver.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CrossAppDomainAssemblyResolver.cs new file mode 100644 index 00000000..593ed734 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CrossAppDomainAssemblyResolver.cs @@ -0,0 +1,59 @@ +// +// CrossAppDomainAssemblyResolver.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2010 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; + +namespace Mono.TextTemplating +{ + [Serializable] + /// + /// Provides a handler for AssemblyResolve events that looks them up in the domain that created the resolver. + /// + public class CrossAppDomainAssemblyResolver + { + ParentDomainLookup parent = new ParentDomainLookup (); + + public System.Reflection.Assembly Resolve (object sender, ResolveEventArgs args) + { + var location = parent.GetAssemblyPath (args.Name); + if (location != null) + return System.Reflection.Assembly.LoadFrom (location); + return null; + } + + class ParentDomainLookup : MarshalByRefObject + { + public string GetAssemblyPath (string name) + { + var assem = System.Reflection.Assembly.Load (name); + if (assem != null) + return assem.Location; + return null; + } + } + } +} + diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs new file mode 100644 index 00000000..f3ba0ae0 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs @@ -0,0 +1,320 @@ +// +// Template.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.IO; +using Microsoft.VisualStudio.TextTemplating; + +namespace Mono.TextTemplating +{ + + + public class ParsedTemplate + { + List segments = new List (); + CompilerErrorCollection errors = new CompilerErrorCollection (); + string rootFileName; + + public ParsedTemplate (string rootFileName) + { + this.rootFileName = rootFileName; + } + + public List RawSegments { + get { return segments; } + } + + public IEnumerable Directives { + get { + foreach (ISegment seg in segments) { + Directive dir = seg as Directive; + if (dir != null) + yield return dir; + } + } + } + + public IEnumerable Content { + get { + foreach (ISegment seg in segments) { + TemplateSegment ts = seg as TemplateSegment; + if (ts != null) + yield return ts; + } + } + } + + public CompilerErrorCollection Errors { + get { return errors; } + } + + public static ParsedTemplate FromText (string content, ITextTemplatingEngineHost host) + { + ParsedTemplate template = new ParsedTemplate (host.TemplateFile); + try { + template.Parse (host, new Tokeniser (host.TemplateFile, content)); + } catch (ParserException ex) { + template.LogError (ex.Message, ex.Location); + } + return template; + } + + public void Parse (ITextTemplatingEngineHost host, Tokeniser tokeniser) + { + Parse (host, tokeniser, true); + } + + public void ParseWithoutIncludes (Tokeniser tokeniser) + { + Parse (null, tokeniser, false); + } + + void Parse (ITextTemplatingEngineHost host, Tokeniser tokeniser, bool parseIncludes) + { + bool skip = false; + while ((skip || tokeniser.Advance ()) && tokeniser.State != State.EOF) { + skip = false; + ISegment seg = null; + switch (tokeniser.State) { + case State.Block: + if (!String.IsNullOrEmpty (tokeniser.Value)) + seg = new TemplateSegment (SegmentType.Block, tokeniser.Value, tokeniser.Location); + break; + case State.Content: + if (!String.IsNullOrEmpty (tokeniser.Value)) + seg = new TemplateSegment (SegmentType.Content, tokeniser.Value, tokeniser.Location); + break; + case State.Expression: + if (!String.IsNullOrEmpty (tokeniser.Value)) + seg = new TemplateSegment (SegmentType.Expression, tokeniser.Value, tokeniser.Location); + break; + case State.Helper: + if (!String.IsNullOrEmpty (tokeniser.Value)) + seg = new TemplateSegment (SegmentType.Helper, tokeniser.Value, tokeniser.Location); + break; + case State.Directive: + Directive directive = null; + string attName = null; + while (!skip && tokeniser.Advance ()) { + switch (tokeniser.State) { + case State.DirectiveName: + if (directive == null) { + directive = new Directive (tokeniser.Value.ToLower (), tokeniser.Location); + directive.TagStartLocation = tokeniser.TagStartLocation; + if (!parseIncludes || directive.Name != "include") + segments.Add (directive); + } else + attName = tokeniser.Value; + break; + case State.DirectiveValue: + if (attName != null && directive != null) + directive.Attributes[attName.ToLower ()] = tokeniser.Value; + else + LogError ("Directive value without name", tokeniser.Location); + attName = null; + break; + case State.Directive: + if (directive != null) + directive.EndLocation = tokeniser.TagEndLocation; + break; + default: + skip = true; + break; + } + } + if (parseIncludes && directive.Name == "include") + Import (host, directive, Path.GetDirectoryName (tokeniser.Location.FileName)); + break; + default: + throw new InvalidOperationException (); + } + if (seg != null) { + seg.TagStartLocation = tokeniser.TagStartLocation; + seg.EndLocation = tokeniser.TagEndLocation; + segments.Add (seg); + } + } + } + + void Import (ITextTemplatingEngineHost host, Directive includeDirective, string relativeToDirectory) + { + string fileName; + if (includeDirective.Attributes.Count > 1 || !includeDirective.Attributes.TryGetValue ("file", out fileName)) { + LogError ("Unexpected attributes in include directive", includeDirective.StartLocation); + return; + } + + //try to resolve path relative to the file that included it + if (!Path.IsPathRooted (fileName)) { + string possible = Path.Combine (relativeToDirectory, fileName); + if (File.Exists (possible)) + fileName = possible; + } + + string content, resolvedName; + if (host.LoadIncludeText (fileName, out content, out resolvedName)) + Parse (host, new Tokeniser (resolvedName, content), true); + else + LogError ("Could not resolve include file '" + fileName + "'.", includeDirective.StartLocation); + } + + void LogError (string message, Location location, bool isWarning) + { + CompilerError err = new CompilerError (); + err.ErrorText = message; + if (location.FileName != null) { + err.Line = location.Line; + err.Column = location.Column; + err.FileName = location.FileName ?? string.Empty; + } else { + err.FileName = rootFileName ?? string.Empty; + } + err.IsWarning = isWarning; + errors.Add (err); + } + + public void LogError (string message) + { + LogError (message, Location.Empty, false); + } + + public void LogWarning (string message) + { + LogError (message, Location.Empty, true); + } + + public void LogError (string message, Location location) + { + LogError (message, location, false); + } + + public void LogWarning (string message, Location location) + { + LogError (message, location, true); + } + } + + public interface ISegment + { + Location StartLocation { get; } + Location EndLocation { get; set; } + Location TagStartLocation {get; set; } + } + + public class TemplateSegment : ISegment + { + public TemplateSegment (SegmentType type, string text, Location start) + { + this.Type = type; + this.StartLocation = start; + this.Text = text; + } + + public SegmentType Type { get; private set; } + public string Text { get; private set; } + public Location TagStartLocation { get; set; } + public Location StartLocation { get; private set; } + public Location EndLocation { get; set; } + } + + public class Directive : ISegment + { + public Directive (string name, Location start) + { + this.Name = name; + this.Attributes = new Dictionary (); + this.StartLocation = start; + } + + public string Name { get; private set; } + public Dictionary Attributes { get; private set; } + public Location TagStartLocation { get; set; } + public Location StartLocation { get; private set; } + public Location EndLocation { get; set; } + + public string Extract (string key) + { + string value; + if (!Attributes.TryGetValue (key, out value)) + return null; + Attributes.Remove (key); + return value; + } + } + + public enum SegmentType + { + Block, + Expression, + Content, + Helper + } + + public struct Location : IEquatable + { + public Location (string fileName, int line, int column) : this() + { + FileName = fileName; + Column = column; + Line = line; + } + + public int Line { get; private set; } + public int Column { get; private set; } + public string FileName { get; private set; } + + public static Location Empty { + get { return new Location (null, -1, -1); } + } + + public Location AddLine () + { + return new Location (this.FileName, this.Line + 1, 1); + } + + public Location AddCol () + { + return AddCols (1); + } + + public Location AddCols (int number) + { + return new Location (this.FileName, this.Line, this.Column + number); + } + + public override string ToString () + { + return string.Format("[{0} ({1},{2})]", FileName, Line, Column); + } + + public bool Equals (Location other) + { + return other.Line == Line && other.Column == Column && other.FileName == FileName; + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs new file mode 100644 index 00000000..dd752857 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs @@ -0,0 +1,373 @@ +// +// TemplatingHost.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.CodeDom.Compiler; +using System.IO; +using System.Text; +using Microsoft.VisualStudio.TextTemplating; + +namespace Mono.TextTemplating +{ + public class TemplateGenerator : MarshalByRefObject, ITextTemplatingEngineHost + { + //re-usable + TemplatingEngine engine; + + //per-run variables + string inputFile, outputFile; + Encoding encoding; + + //host fields + CompilerErrorCollection errors = new CompilerErrorCollection (); + List refs = new List (); + List imports = new List (); + List includePaths = new List (); + List referencePaths = new List (); + + //host properties for consumers to access + public CompilerErrorCollection Errors { get { return errors; } } + public List Refs { get { return refs; } } + public List Imports { get { return imports; } } + public List IncludePaths { get { return includePaths; } } + public List ReferencePaths { get { return referencePaths; } } + public string OutputFile { get { return outputFile; } } + + public TemplateGenerator () + { + Refs.Add (typeof (TextTransformation).Assembly.Location); + Refs.Add (typeof(System.Uri).Assembly.Location); + Imports.Add ("System"); + } + + public CompiledTemplate CompileTemplate (string content) + { + if (String.IsNullOrEmpty (content)) + throw new ArgumentNullException ("content"); + + errors.Clear (); + encoding = Encoding.UTF8; + + return Engine.CompileTemplate (content, this); + } + + protected TemplatingEngine Engine { + get { + if (engine == null) + engine = new TemplatingEngine (); + return engine; + } + } + + public bool ProcessTemplate (string inputFile, string outputFile) + { + if (String.IsNullOrEmpty (inputFile)) + throw new ArgumentNullException ("inputFile"); + if (String.IsNullOrEmpty (outputFile)) + throw new ArgumentNullException ("outputFile"); + + string content; + try { + content = File.ReadAllText (inputFile); + } catch (IOException ex) { + errors.Clear (); + AddError ("Could not read input file '" + inputFile + "':\n" + ex.ToString ()); + return false; + } + + string output; + ProcessTemplate (inputFile, content, ref outputFile, out output); + + try { + if (!errors.HasErrors) + File.WriteAllText (outputFile, output, encoding); + } catch (IOException ex) { + AddError ("Could not write output file '" + outputFile + "':\n" + ex.ToString ()); + } + + return !errors.HasErrors; + } + + public bool ProcessTemplate (string inputFileName, string inputContent, ref string outputFileName, out string outputContent) + { + errors.Clear (); + encoding = Encoding.UTF8; + + this.outputFile = outputFileName; + this.inputFile = inputFileName; + outputContent = Engine.ProcessTemplate (inputContent, this); + outputFileName = this.outputFile; + + return !errors.HasErrors; + } + + public bool PreprocessTemplate (string inputFile, string className, string classNamespace, + string outputFile, System.Text.Encoding encoding, out string language, out string[] references) + { + language = null; + references = null; + + if (string.IsNullOrEmpty (inputFile)) + throw new ArgumentNullException ("inputFile"); + if (string.IsNullOrEmpty (outputFile)) + throw new ArgumentNullException ("outputFile"); + + string content; + try { + content = File.ReadAllText (inputFile); + } catch (IOException ex) { + errors.Clear (); + AddError ("Could not read input file '" + inputFile + "':\n" + ex.ToString ()); + return false; + } + + string output; + PreprocessTemplate (inputFile, className, classNamespace, content, out language, out references, out output); + + try { + if (!errors.HasErrors) + File.WriteAllText (outputFile, output, encoding); + } catch (IOException ex) { + AddError ("Could not write output file '" + outputFile + "':\n" + ex.ToString ()); + } + + return !errors.HasErrors; + } + + public bool PreprocessTemplate (string inputFileName, string className, string classNamespace, string inputContent, + out string language, out string[] references, out string outputContent) + { + errors.Clear (); + encoding = Encoding.UTF8; + + this.inputFile = inputFileName; + outputContent = Engine.PreprocessTemplate (inputContent, this, className, classNamespace, out language, out references); + + return !errors.HasErrors; + } + + CompilerError AddError (string error) + { + CompilerError err = new CompilerError (); + err.ErrorText = error; + Errors.Add (err); + return err; + } + + #region Virtual members + + public virtual object GetHostOption (string optionName) + { + return null; + } + + public virtual AppDomain ProvideTemplatingAppDomain (string content) + { + return null; + } + + //FIXME: implement + protected virtual string ResolveAssemblyReference (string assemblyReference) + { + //foreach (string referencePath in ReferencePaths) { + // + //} + return assemblyReference; + } + + protected virtual string ResolveParameterValue (string directiveId, string processorName, string parameterName) + { + var key = new ParameterKey (processorName, directiveId, parameterName); + string value; + if (parameters.TryGetValue (key, out value)) + return value; + if (processorName != null || directiveId != null) + return ResolveParameterValue (null, null, parameterName); + return null; + } + + protected virtual Type ResolveDirectiveProcessor (string processorName) + { + KeyValuePair value; + if (!directiveProcessors.TryGetValue (processorName, out value)) + throw new Exception (string.Format ("No directive processor registered as '{0}'", processorName)); + var asmPath = ResolveAssemblyReference (value.Value); + if (asmPath == null) + throw new Exception (string.Format ("Could not resolve assembly '{0}' for directive processor '{1}'", value.Value, processorName)); + var asm = System.Reflection.Assembly.LoadFrom (asmPath); + return asm.GetType (value.Key, true); + } + + protected virtual string ResolvePath (string path) + { + path = System.Environment.ExpandEnvironmentVariables (path); + if (Path.IsPathRooted (path)) + return path; + var dir = Path.GetDirectoryName (inputFile); + var test = Path.Combine (dir, path); + if (File.Exists (test)) + return test; + return null; + } + + #endregion + + Dictionary parameters = new Dictionary (); + Dictionary> directiveProcessors = new Dictionary> (); + + public void AddDirectiveProcessor (string name, string klass, string assembly) + { + directiveProcessors.Add (name, new KeyValuePair (klass,assembly)); + } + + public void AddParameter (string processorName, string directiveName, string parameterName, string value) + { + parameters.Add (new ParameterKey (processorName, directiveName, parameterName), value); + } + + protected virtual bool LoadIncludeText (string requestFileName, out string content, out string location) + { + content = ""; + location = ResolvePath (requestFileName); + + if (location == null) { + foreach (string path in includePaths) { + string f = Path.Combine (path, requestFileName); + if (File.Exists (f)) { + location = f; + break; + } + } + } + + if (location == null) + return false; + + try { + content = File.ReadAllText (location); + return true; + } catch (IOException ex) { + AddError ("Could not read included file '" + location + "':\n" + ex.ToString ()); + } + return false; + } + + #region Explicit ITextTemplatingEngineHost implementation + + bool ITextTemplatingEngineHost.LoadIncludeText (string requestFileName, out string content, out string location) + { + return LoadIncludeText (requestFileName, out content, out location); + } + + void ITextTemplatingEngineHost.LogErrors (CompilerErrorCollection errors) + { + this.errors.AddRange (errors); + } + + string ITextTemplatingEngineHost.ResolveAssemblyReference (string assemblyReference) + { + return ResolveAssemblyReference (assemblyReference); + } + + string ITextTemplatingEngineHost.ResolveParameterValue (string directiveId, string processorName, string parameterName) + { + return ResolveParameterValue (directiveId, processorName, parameterName); + } + + Type ITextTemplatingEngineHost.ResolveDirectiveProcessor (string processorName) + { + return ResolveDirectiveProcessor (processorName); + } + + string ITextTemplatingEngineHost.ResolvePath (string path) + { + return ResolvePath (path); + } + + void ITextTemplatingEngineHost.SetFileExtension (string extension) + { + extension = extension.TrimStart ('.'); + if (Path.HasExtension (outputFile)) { + outputFile = Path.ChangeExtension (outputFile, extension); + } else { + outputFile = outputFile + "." + extension; + } + } + + void ITextTemplatingEngineHost.SetOutputEncoding (System.Text.Encoding encoding, bool fromOutputDirective) + { + this.encoding = encoding; + } + + IList ITextTemplatingEngineHost.StandardAssemblyReferences { + get { return refs; } + } + + IList ITextTemplatingEngineHost.StandardImports { + get { return imports; } + } + + string ITextTemplatingEngineHost.TemplateFile { + get { return inputFile; } + } + + #endregion + + struct ParameterKey : IEquatable + { + public ParameterKey (string processorName, string directiveName, string parameterName) + { + this.processorName = processorName ?? ""; + this.directiveName = directiveName ?? ""; + this.parameterName = parameterName ?? ""; + unchecked { + hashCode = this.processorName.GetHashCode () + ^ this.directiveName.GetHashCode () + ^ this.parameterName.GetHashCode (); + } + } + + string processorName, directiveName, parameterName; + int hashCode; + + public override bool Equals (object obj) + { + return obj != null && obj is ParameterKey && Equals ((ParameterKey)obj); + } + + public bool Equals (ParameterKey other) + { + return processorName == other.processorName && directiveName == other.directiveName && parameterName == other.parameterName; + } + + public override int GetHashCode () + { + return hashCode; + } + } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs new file mode 100644 index 00000000..8221c65e --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs @@ -0,0 +1,75 @@ +// +// TemplateSettings.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Text; +using System.Collections.Generic; +using Microsoft.VisualStudio.TextTemplating; + +namespace Mono.TextTemplating +{ + + public class TemplateSettings + { + public TemplateSettings () + { + Imports = new HashSet (); + Assemblies = new HashSet (); + CustomDirectives = new List (); + DirectiveProcessors = new Dictionary (); + } + + public bool HostSpecific { get; set; } + public bool Debug { get; set; } + public string Inherits { get; set; } + public string Name { get; set; } + public string Namespace { get; set; } + public HashSet Imports { get; private set; } + public HashSet Assemblies { get; private set; } + public System.CodeDom.Compiler.CodeDomProvider Provider { get; set; } + public string Language { get; set; } + public string CompilerOptions { get; set; } + public Encoding Encoding { get; set; } + public string Extension { get; set; } + public System.Globalization.CultureInfo Culture { get; set; } + public List CustomDirectives { get; private set; } + public Dictionary DirectiveProcessors { get; private set; } + public bool IncludePreprocessingHelpers { get; set; } + public bool IsPreprocessed { get; set; } + } + + public class CustomDirective + { + public CustomDirective (string processorName, Directive directive) + { + this.ProcessorName = processorName; + this.Directive = directive; + } + + public string ProcessorName { get; set; } + public Directive Directive { get; set; } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs new file mode 100644 index 00000000..5878adce --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs @@ -0,0 +1,963 @@ +// +// Engine.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using System.CodeDom; +using System.CodeDom.Compiler; +using Microsoft.CSharp; +using Microsoft.VisualStudio.TextTemplating; +using System.Linq; +using System.Reflection; + +namespace Mono.TextTemplating +{ + public class TemplatingEngine : MarshalByRefObject, Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngine + { + public string ProcessTemplate (string content, ITextTemplatingEngineHost host) + { + var tpl = CompileTemplate (content, host); + try { + if (tpl != null) + return tpl.Process (); + return null; + } finally { + if (tpl != null) + tpl.Dispose (); + } + } + + public string PreprocessTemplate (string content, ITextTemplatingEngineHost host, string className, + string classNamespace, out string language, out string[] references) + { + if (content == null) + throw new ArgumentNullException ("content"); + if (host == null) + throw new ArgumentNullException ("host"); + if (className == null) + throw new ArgumentNullException ("className"); + if (classNamespace == null) + throw new ArgumentNullException ("classNamespace"); + + language = null; + references = null; + + var pt = ParsedTemplate.FromText (content, host); + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + + var settings = GetSettings (host, pt); + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + settings.Name = className; + settings.Namespace = classNamespace; + settings.IncludePreprocessingHelpers = string.IsNullOrEmpty (settings.Inherits); + settings.IsPreprocessed = true; + language = settings.Language; + + var ccu = GenerateCompileUnit (host, content, pt, settings); + references = ProcessReferences (host, pt, settings).ToArray (); + + host.LogErrors (pt.Errors); + if (pt.Errors.HasErrors) { + return null; + } + + var options = new CodeGeneratorOptions (); + using (var sw = new StringWriter ()) { + settings.Provider.GenerateCodeFromCompileUnit (ccu, sw, options); + return sw.ToString (); + }; + } + + public CompiledTemplate CompileTemplate (string content, ITextTemplatingEngineHost host) + { + if (content == null) + throw new ArgumentNullException ("content"); + if (host == null) + throw new ArgumentNullException ("host"); + + var pt = ParsedTemplate.FromText (content, host); + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + + var settings = GetSettings (host, pt); + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + + if (!string.IsNullOrEmpty (settings.Extension)) { + host.SetFileExtension (settings.Extension); + } + if (settings.Encoding != null) { + //FIXME: when is this called with false? + host.SetOutputEncoding (settings.Encoding, true); + } + + var ccu = GenerateCompileUnit (host, content, pt, settings); + var references = ProcessReferences (host, pt, settings); + if (pt.Errors.HasErrors) { + host.LogErrors (pt.Errors); + return null; + } + + var results = GenerateCode (host, references, settings, ccu); + if (results.Errors.HasErrors) { + host.LogErrors (pt.Errors); + host.LogErrors (results.Errors); + return null; + } + + var templateClassFullName = settings.Namespace + "." + settings.Name; + var domain = host.ProvideTemplatingAppDomain (content); + if (domain != null) { + var type = typeof (CompiledTemplate); + var obj = domain.CreateInstanceAndUnwrap (type.Assembly.FullName, type.FullName, false, + BindingFlags.CreateInstance, null, + new object[] { host, results, templateClassFullName, settings.Culture, references.ToArray () }, + null, null); + return (CompiledTemplate) obj; + } else { + return new CompiledTemplate (host, results, templateClassFullName, settings.Culture, references.ToArray ()); + } + } + + static CompilerResults GenerateCode (ITextTemplatingEngineHost host, IEnumerable references, TemplateSettings settings, CodeCompileUnit ccu) + { + var pars = new CompilerParameters () { + GenerateExecutable = false, + CompilerOptions = settings.CompilerOptions, + IncludeDebugInformation = settings.Debug, + GenerateInMemory = false, + }; + + foreach (var r in references) + pars.ReferencedAssemblies.Add (r); + + if (settings.Debug) + pars.TempFiles.KeepFiles = true; + + return settings.Provider.CompileAssemblyFromDom (pars, ccu); + } + + static HashSet ProcessReferences (ITextTemplatingEngineHost host, ParsedTemplate pt, TemplateSettings settings) + { + var resolved = new HashSet (); + + foreach (string assem in settings.Assemblies.Union (host.StandardAssemblyReferences)) { + if (resolved.Contains (assem)) + continue; + + string resolvedAssem = host.ResolveAssemblyReference (assem); + if (!string.IsNullOrEmpty (resolvedAssem)) { + resolved.Add (resolvedAssem); + } else { + pt.LogError ("Could not resolve assembly reference '" + assem + "'"); + return null; + } + } + return resolved; + } + + public static TemplateSettings GetSettings (ITextTemplatingEngineHost host, ParsedTemplate pt) + { + var settings = new TemplateSettings (); + + foreach (Directive dt in pt.Directives) { + switch (dt.Name) { + case "template": + string val = dt.Extract ("language"); + if (val != null) + settings.Language = val; + val = dt.Extract ("debug"); + if (val != null) + settings.Debug = string.Compare (val, "true", StringComparison.OrdinalIgnoreCase) == 0; + val = dt.Extract ("inherits"); + if (val != null) + settings.Inherits = val; + val = dt.Extract ("culture"); + if (val != null) { + System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.GetCultureInfo (val); + if (culture == null) + pt.LogWarning ("Could not find culture '" + val + "'", dt.StartLocation); + else + settings.Culture = culture; + } + val = dt.Extract ("hostspecific"); + if (val != null) { + settings.HostSpecific = string.Compare (val, "true", StringComparison.OrdinalIgnoreCase) == 0; + } + val = dt.Extract ("CompilerOptions"); + if (val != null) { + settings.CompilerOptions = val; + } + break; + + case "assembly": + string name = dt.Extract ("name"); + if (name == null) + pt.LogError ("Missing name attribute in assembly directive", dt.StartLocation); + else + settings.Assemblies.Add (name); + break; + + case "import": + string namespac = dt.Extract ("namespace"); + if (namespac == null) + pt.LogError ("Missing namespace attribute in import directive", dt.StartLocation); + else + settings.Imports.Add (namespac); + break; + + case "output": + settings.Extension = dt.Extract ("extension"); + string encoding = dt.Extract ("encoding"); + if (encoding != null) + settings.Encoding = Encoding.GetEncoding (encoding); + break; + + case "include": + throw new InvalidOperationException ("Include is handled in the parser"); + + case "parameter": + AddDirective (settings, host, "ParameterDirectiveProcessor", dt); + continue; + + default: + string processorName = dt.Extract ("Processor"); + if (processorName == null) + throw new InvalidOperationException ("Custom directive '" + dt.Name + "' does not specify a processor"); + + AddDirective (settings, host, processorName, dt); + continue; + } + ComplainExcessAttributes (dt, pt); + } + + //initialize the custom processors + foreach (var kv in settings.DirectiveProcessors) { + kv.Value.Initialize (host); + var hs = kv.Value as IRecognizeHostSpecific; + if (hs == null) + continue; + if (hs.RequiresProcessingRunIsHostSpecific && !settings.HostSpecific) { + settings.HostSpecific = true; + pt.LogWarning ("Directive processor '" + kv.Key + "' requires hostspecific=true, forcing on."); + } + hs.SetProcessingRunIsHostSpecific (settings.HostSpecific); + } + + if (settings.Name == null) + settings.Name = string.Format ("GeneratedTextTransformation{0:x}", new System.Random ().Next ()); + if (settings.Namespace == null) + settings.Namespace = typeof (TextTransformation).Namespace; + + //resolve the CodeDOM provider + if (String.IsNullOrEmpty (settings.Language)) { + pt.LogError ("No language was specified for the template"); + return settings; + } + + if (settings.Language == "C#v3.5") { + Dictionary providerOptions = new Dictionary (); + providerOptions.Add ("CompilerVersion", "v3.5"); + settings.Provider = new CSharpCodeProvider (providerOptions); + } + else { + settings.Provider = CodeDomProvider.CreateProvider (settings.Language); + } + + if (settings.Provider == null) { + pt.LogError ("A provider could not be found for the language '" + settings.Language + "'"); + return settings; + } + + return settings; + } + + public static string IndentSnippetText (string text, string indent) + { + var builder = new StringBuilder (text.Length); + builder.Append (indent); + int lastNewline = 0; + for (int i = 0; i < text.Length - 1; i++) { + char c = text[i]; + if (c == '\r') { + if (text[i + 1] == '\n') { + i++; + if (i == text.Length - 1) + break; + } + } else if (c != '\n') { + continue; + } + i++; + int len = i - lastNewline; + if (len > 0) { + builder.Append (text, lastNewline, i - lastNewline); + } + builder.Append (indent); + lastNewline = i; + } + if (lastNewline > 0) + builder.Append (text, lastNewline, text.Length - lastNewline); + else + builder.Append (text); + return builder.ToString (); + } + + static void AddDirective (TemplateSettings settings, ITextTemplatingEngineHost host, string processorName, Directive directive) + { + DirectiveProcessor processor; + if (!settings.DirectiveProcessors.TryGetValue (processorName, out processor)) { + switch (processorName) { + case "ParameterDirectiveProcessor": + processor = new ParameterDirectiveProcessor (); + break; + default: + Type processorType = host.ResolveDirectiveProcessor (processorName); + processor = (DirectiveProcessor) Activator.CreateInstance (processorType); + break; + } + if (!processor.IsDirectiveSupported (directive.Name)) + throw new InvalidOperationException ("Directive processor '" + processorName + "' does not support directive '" + directive.Name + "'"); + + settings.DirectiveProcessors [processorName] = processor; + } + settings.CustomDirectives.Add (new CustomDirective (processorName, directive)); + } + + static bool ComplainExcessAttributes (Directive dt, ParsedTemplate pt) + { + if (dt.Attributes.Count == 0) + return false; + StringBuilder sb = new StringBuilder ("Unknown attributes "); + bool first = true; + foreach (string key in dt.Attributes.Keys) { + if (!first) { + sb.Append (", "); + } else { + first = false; + } + sb.Append (key); + } + sb.Append (" found in "); + sb.Append (dt.Name); + sb.Append (" directive."); + pt.LogWarning (sb.ToString (), dt.StartLocation); + return false; + } + + static void ProcessDirectives (ITextTemplatingEngineHost host, string content, ParsedTemplate pt, TemplateSettings settings) + { + foreach (var processor in settings.DirectiveProcessors.Values) { + processor.StartProcessingRun (settings.Provider, content, pt.Errors); + } + + foreach (var dt in settings.CustomDirectives) { + var processor = settings.DirectiveProcessors[dt.ProcessorName]; + + if (processor is RequiresProvidesDirectiveProcessor) + throw new NotImplementedException ("RequiresProvidesDirectiveProcessor"); + + processor.ProcessDirective (dt.Directive.Name, dt.Directive.Attributes); + } + + foreach (var processor in settings.DirectiveProcessors.Values) { + processor.FinishProcessingRun (); + + var imports = processor.GetImportsForProcessingRun (); + if (imports != null) + settings.Imports.UnionWith (imports); + var references = processor.GetReferencesForProcessingRun (); + if (references != null) + settings.Assemblies.UnionWith (references); + } + } + + public static CodeCompileUnit GenerateCompileUnit (ITextTemplatingEngineHost host, string content, ParsedTemplate pt, TemplateSettings settings) + { + ProcessDirectives (host, content, pt, settings); + + //prep the compile unit + var ccu = new CodeCompileUnit (); + var namespac = new CodeNamespace (settings.Namespace); + ccu.Namespaces.Add (namespac); + + foreach (string ns in settings.Imports.Union (host.StandardImports)) + namespac.Imports.Add (new CodeNamespaceImport (ns)); + + //prep the type + var type = new CodeTypeDeclaration (settings.Name); + type.IsPartial = true; + if (!string.IsNullOrEmpty (settings.Inherits)) { + type.BaseTypes.Add (new CodeTypeReference (settings.Inherits)); + } else if (!settings.IncludePreprocessingHelpers) { + type.BaseTypes.Add (TypeRef ()); + } else { + type.BaseTypes.Add (new CodeTypeReference (settings.Name + "Base")); + } + namespac.Types.Add (type); + + //prep the transform method + var transformMeth = new CodeMemberMethod () { + Name = "TransformText", + ReturnType = new CodeTypeReference (typeof (String)), + Attributes = MemberAttributes.Public, + }; + if (!settings.IncludePreprocessingHelpers) + transformMeth.Attributes |= MemberAttributes.Override; + + transformMeth.Statements.Add (new CodeAssignStatement ( + new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "GenerationEnvironment"), + new CodePrimitiveExpression (null))); + + CodeExpression toStringHelper; + if (settings.IsPreprocessed) { + toStringHelper = new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "ToStringHelper"); + } else { + toStringHelper = new CodeTypeReferenceExpression ( + new CodeTypeReference (typeof (ToStringHelper), CodeTypeReferenceOptions.GlobalReference)); + } + + //method references that will need to be used multiple times + var writeMeth = new CodeMethodReferenceExpression (new CodeThisReferenceExpression (), "Write"); + var toStringMeth = new CodeMethodReferenceExpression (toStringHelper, "ToStringWithCulture"); + bool helperMode = false; + + //build the code from the segments + foreach (TemplateSegment seg in pt.Content) { + CodeStatement st = null; + var location = new CodeLinePragma (seg.StartLocation.FileName ?? host.TemplateFile, seg.StartLocation.Line); + switch (seg.Type) { + case SegmentType.Block: + if (helperMode) + //TODO: are blocks permitted after helpers? + throw new ParserException ("Blocks are not permitted after helpers", seg.StartLocation); + st = new CodeSnippetStatement (seg.Text); + break; + case SegmentType.Expression: + st = new CodeExpressionStatement ( + new CodeMethodInvokeExpression (writeMeth, + new CodeMethodInvokeExpression (toStringMeth, new CodeSnippetExpression (seg.Text)))); + break; + case SegmentType.Content: + st = new CodeExpressionStatement (new CodeMethodInvokeExpression (writeMeth, new CodePrimitiveExpression (seg.Text))); + break; + case SegmentType.Helper: + type.Members.Add (new CodeSnippetTypeMember (seg.Text) { LinePragma = location }); + helperMode = true; + break; + default: + throw new InvalidOperationException (); + } + if (st != null) { + if (helperMode) { + //convert the statement into a snippet member and attach it to the top level type + //TODO: is there a way to do this for languages that use indentation for blocks, e.g. python? + using (var writer = new StringWriter ()) { + settings.Provider.GenerateCodeFromStatement (st, writer, null); + type.Members.Add (new CodeSnippetTypeMember (writer.ToString ()) { LinePragma = location }); + } + } else { + st.LinePragma = location; + transformMeth.Statements.Add (st); + continue; + } + } + } + + //complete the transform method + transformMeth.Statements.Add (new CodeMethodReturnStatement ( + new CodeMethodInvokeExpression ( + new CodePropertyReferenceExpression ( + new CodeThisReferenceExpression (), + "GenerationEnvironment"), + "ToString"))); + type.Members.Add (transformMeth); + + //class code from processors + foreach (var processor in settings.DirectiveProcessors.Values) { + string classCode = processor.GetClassCodeForProcessingRun (); + if (classCode != null) + type.Members.Add (new CodeSnippetTypeMember (classCode)); + } + + //generate the Host property if needed + if (settings.HostSpecific) { + GenerateHostProperty (type, settings); + } + + GenerateInitializationMethod (type, settings); + + if (settings.IncludePreprocessingHelpers) { + var baseClass = new CodeTypeDeclaration (settings.Name + "Base"); + GenerateProcessingHelpers (baseClass, settings); + AddToStringHelper (baseClass, settings); + namespac.Types.Add (baseClass); + } + return ccu; + } + + static void GenerateHostProperty (CodeTypeDeclaration type, TemplateSettings settings) + { + var hostField = new CodeMemberField (TypeRef (), "hostValue"); + hostField.Attributes = (hostField.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Private; + type.Members.Add (hostField); + + var hostProp = GenerateGetterSetterProperty ("Host", hostField); + hostProp.Attributes = MemberAttributes.Public | MemberAttributes.Final; + type.Members.Add (hostProp); + } + + static void GenerateInitializationMethod (CodeTypeDeclaration type, TemplateSettings settings) + { + //initialization method + var initializeMeth = new CodeMemberMethod () { + Name = "Initialize", + ReturnType = new CodeTypeReference (typeof (void), CodeTypeReferenceOptions.GlobalReference), + Attributes = MemberAttributes.Family + }; + if (!settings.IncludePreprocessingHelpers) + initializeMeth.Attributes |= MemberAttributes.Override; + + //pre-init code from processors + foreach (var processor in settings.DirectiveProcessors.Values) { + string code = processor.GetPreInitializationCodeForProcessingRun (); + if (code != null) + initializeMeth.Statements.Add (new CodeSnippetStatement (code)); + } + + //base call + if (!settings.IncludePreprocessingHelpers) { + initializeMeth.Statements.Add ( + new CodeMethodInvokeExpression ( + new CodeMethodReferenceExpression ( + new CodeBaseReferenceExpression (), + "Initialize"))); + } + + //post-init code from processors + foreach (var processor in settings.DirectiveProcessors.Values) { + string code = processor.GetPostInitializationCodeForProcessingRun (); + if (code != null) + initializeMeth.Statements.Add (new CodeSnippetStatement (code)); + } + + type.Members.Add (initializeMeth); + } + + static void GenerateProcessingHelpers (CodeTypeDeclaration type, TemplateSettings settings) + { + var thisRef = new CodeThisReferenceExpression (); + var sbTypeRef = TypeRef (); + + var sessionField = PrivateField (TypeRef> (), "session"); + var sessionProp = GenerateGetterSetterProperty ("Session", sessionField); + sessionProp.Attributes = MemberAttributes.Public; + + var builderField = PrivateField (sbTypeRef, "builder"); + var builderFieldRef = new CodeFieldReferenceExpression (thisRef, builderField.Name); + + var generationEnvironmentProp = GenerateGetterSetterProperty ("GenerationEnvironment", builderField); + AddPropertyGetterInitializationIfFieldIsNull (generationEnvironmentProp, builderFieldRef, TypeRef ()); + + type.Members.Add (builderField); + type.Members.Add (sessionField); + type.Members.Add (sessionProp); + type.Members.Add (generationEnvironmentProp); + + AddErrorHelpers (type, settings); + AddIndentHelpers (type, settings); + AddWriteHelpers (type, settings); + } + + static void AddPropertyGetterInitializationIfFieldIsNull (CodeMemberProperty property, CodeFieldReferenceExpression fieldRef, CodeTypeReference typeRef) + { + var fieldInit = FieldInitializationIfNull (fieldRef, typeRef); + property.GetStatements.Insert (0, fieldInit); + } + + static CodeConditionStatement FieldInitializationIfNull (CodeFieldReferenceExpression fieldRef, CodeTypeReference typeRef) + { + return new CodeConditionStatement ( + new CodeBinaryOperatorExpression (fieldRef, + CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression (null)), + new CodeAssignStatement (fieldRef, new CodeObjectCreateExpression (typeRef))); + } + + static void AddErrorHelpers (CodeTypeDeclaration type, TemplateSettings settings) + { + var cecTypeRef = TypeRef (); + var thisRef = new CodeThisReferenceExpression (); + var stringTypeRef = TypeRef (); + var nullPrim = new CodePrimitiveExpression (null); + var minusOnePrim = new CodePrimitiveExpression (-1); + + var errorsField = PrivateField (cecTypeRef, "errors"); + var errorsFieldRef = new CodeFieldReferenceExpression (thisRef, errorsField.Name); + + var errorsProp = GenerateGetterProperty ("Errors", errorsField); + errorsProp.Attributes = MemberAttributes.Family | MemberAttributes.Final; + errorsProp.GetStatements.Insert (0, FieldInitializationIfNull (errorsFieldRef, TypeRef())); + + var errorsPropRef = new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "Errors"); + + var compilerErrorTypeRef = TypeRef (); + var errorMeth = new CodeMemberMethod () { + Name = "Error", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + errorMeth.Parameters.Add (new CodeParameterDeclarationExpression (stringTypeRef, "message")); + errorMeth.Statements.Add (new CodeMethodInvokeExpression (errorsPropRef, "Add", + new CodeObjectCreateExpression (compilerErrorTypeRef, nullPrim, minusOnePrim, minusOnePrim, nullPrim, + new CodeArgumentReferenceExpression ("message")))); + + var warningMeth = new CodeMemberMethod () { + Name = "Warning", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + warningMeth.Parameters.Add (new CodeParameterDeclarationExpression (stringTypeRef, "message")); + warningMeth.Statements.Add (new CodeVariableDeclarationStatement (compilerErrorTypeRef, "val", + new CodeObjectCreateExpression (compilerErrorTypeRef, nullPrim, minusOnePrim, minusOnePrim, nullPrim, + new CodeArgumentReferenceExpression ("message")))); + warningMeth.Statements.Add (new CodeAssignStatement (new CodePropertyReferenceExpression ( + new CodeVariableReferenceExpression ("val"), "IsWarning"), new CodePrimitiveExpression (true))); + warningMeth.Statements.Add (new CodeMethodInvokeExpression (errorsPropRef, "Add", + new CodeVariableReferenceExpression ("val"))); + + type.Members.Add (errorsField); + type.Members.Add (errorMeth); + type.Members.Add (warningMeth); + type.Members.Add (errorsProp); + } + + static void AddIndentHelpers (CodeTypeDeclaration type, TemplateSettings settings) + { + var stringTypeRef = TypeRef (); + var thisRef = new CodeThisReferenceExpression (); + var zeroPrim = new CodePrimitiveExpression (0); + var stringEmptyRef = new CodeFieldReferenceExpression (new CodeTypeReferenceExpression (stringTypeRef), "Empty"); + var intTypeRef = TypeRef (); + var stackIntTypeRef = TypeRef> (); + + var indentsField = PrivateField (stackIntTypeRef, "indents"); + var indentsFieldRef = new CodeFieldReferenceExpression (thisRef, indentsField.Name); + + var indentsProp = GenerateGetterProperty ("Indents", indentsField); + indentsProp.Attributes = MemberAttributes.Private; + AddPropertyGetterInitializationIfFieldIsNull (indentsProp, indentsFieldRef, TypeRef> ()); + + var indentsPropRef = new CodeFieldReferenceExpression (thisRef, indentsProp.Name); + + var currentIndentField = PrivateField (stringTypeRef, "currentIndent"); + currentIndentField.InitExpression = stringEmptyRef; + var currentIndentFieldRef = new CodeFieldReferenceExpression (thisRef, currentIndentField.Name); + + var popIndentMeth = new CodeMemberMethod () { + Name = "PopIndent", + ReturnType = stringTypeRef, + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + popIndentMeth.Statements.Add (new CodeConditionStatement ( + new CodeBinaryOperatorExpression (new CodePropertyReferenceExpression (indentsPropRef, "Count"), + CodeBinaryOperatorType.ValueEquality, zeroPrim), + new CodeMethodReturnStatement (stringEmptyRef))); + popIndentMeth.Statements.Add (new CodeVariableDeclarationStatement (intTypeRef, "lastPos", + new CodeBinaryOperatorExpression ( + new CodePropertyReferenceExpression (currentIndentFieldRef, "Length"), + CodeBinaryOperatorType.Subtract, + new CodeMethodInvokeExpression (indentsPropRef, "Pop")))); + popIndentMeth.Statements.Add (new CodeVariableDeclarationStatement (stringTypeRef, "last", + new CodeMethodInvokeExpression (currentIndentFieldRef, "Substring", new CodeVariableReferenceExpression ("lastPos")))); + popIndentMeth.Statements.Add (new CodeAssignStatement (currentIndentFieldRef, + new CodeMethodInvokeExpression (currentIndentFieldRef, "Substring", zeroPrim, new CodeVariableReferenceExpression ("lastPos")))); + popIndentMeth.Statements.Add (new CodeMethodReturnStatement (new CodeVariableReferenceExpression ("last"))); + + var pushIndentMeth = new CodeMemberMethod () { + Name = "PushIndent", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + pushIndentMeth.Parameters.Add (new CodeParameterDeclarationExpression (stringTypeRef, "indent")); + pushIndentMeth.Statements.Add (new CodeMethodInvokeExpression (indentsPropRef, "Push", + new CodePropertyReferenceExpression (new CodeArgumentReferenceExpression ("indent"), "Length"))); + pushIndentMeth.Statements.Add (new CodeAssignStatement (currentIndentFieldRef, + new CodeBinaryOperatorExpression (currentIndentFieldRef, CodeBinaryOperatorType.Add, new CodeArgumentReferenceExpression ("indent")))); + + var clearIndentMeth = new CodeMemberMethod () { + Name = "ClearIndent", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + clearIndentMeth.Statements.Add (new CodeAssignStatement (currentIndentFieldRef, stringEmptyRef)); + clearIndentMeth.Statements.Add (new CodeMethodInvokeExpression (indentsPropRef, "Clear")); + + var currentIndentProp = GenerateGetterProperty ("CurrentIndent", currentIndentField); + type.Members.Add (currentIndentField); + type.Members.Add (indentsField); + type.Members.Add (popIndentMeth); + type.Members.Add (pushIndentMeth); + type.Members.Add (clearIndentMeth); + type.Members.Add (currentIndentProp); + type.Members.Add (indentsProp); + } + + static void AddWriteHelpers (CodeTypeDeclaration type, TemplateSettings settings) + { + var stringTypeRef = TypeRef (); + var thisRef = new CodeThisReferenceExpression (); + var genEnvPropRef = new CodePropertyReferenceExpression (thisRef, "GenerationEnvironment"); + var currentIndentFieldRef = new CodeFieldReferenceExpression (thisRef, "currentIndent"); + + var textToAppendParam = new CodeParameterDeclarationExpression (stringTypeRef, "textToAppend"); + var formatParam = new CodeParameterDeclarationExpression (stringTypeRef, "format"); + var argsParam = new CodeParameterDeclarationExpression (TypeRef (), "args"); + argsParam.CustomAttributes.Add (new CodeAttributeDeclaration (TypeRef ())); + + var textToAppendParamRef = new CodeArgumentReferenceExpression ("textToAppend"); + var formatParamRef = new CodeArgumentReferenceExpression ("format"); + var argsParamRef = new CodeArgumentReferenceExpression ("args"); + + var writeMeth = new CodeMemberMethod () { + Name = "Write", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + writeMeth.Parameters.Add (textToAppendParam); + writeMeth.Statements.Add (new CodeMethodInvokeExpression (genEnvPropRef, "Append", new CodeArgumentReferenceExpression ("textToAppend"))); + + var writeArgsMeth = new CodeMemberMethod () { + Name = "Write", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + writeArgsMeth.Parameters.Add (formatParam); + writeArgsMeth.Parameters.Add (argsParam); + writeArgsMeth.Statements.Add (new CodeMethodInvokeExpression (genEnvPropRef, "AppendFormat", formatParamRef, argsParamRef)); + + var writeLineMeth = new CodeMemberMethod () { + Name = "WriteLine", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + writeLineMeth.Parameters.Add (textToAppendParam); + writeLineMeth.Statements.Add (new CodeMethodInvokeExpression (genEnvPropRef, "Append", currentIndentFieldRef)); + writeLineMeth.Statements.Add (new CodeMethodInvokeExpression (genEnvPropRef, "AppendLine", textToAppendParamRef)); + + var writeLineArgsMeth = new CodeMemberMethod () { + Name = "WriteLine", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + }; + writeLineArgsMeth.Parameters.Add (formatParam); + writeLineArgsMeth.Parameters.Add (argsParam); + writeLineArgsMeth.Statements.Add (new CodeMethodInvokeExpression (genEnvPropRef, "Append", currentIndentFieldRef)); + writeLineArgsMeth.Statements.Add (new CodeMethodInvokeExpression (genEnvPropRef, "AppendFormat", formatParamRef, argsParamRef)); + writeLineArgsMeth.Statements.Add (new CodeMethodInvokeExpression (genEnvPropRef, "AppendLine")); + + type.Members.Add (writeMeth); + type.Members.Add (writeArgsMeth); + type.Members.Add (writeLineMeth); + type.Members.Add (writeLineArgsMeth); + } + + static void AddToStringHelper (CodeTypeDeclaration type, TemplateSettings settings) + { + var helperCls = new CodeTypeDeclaration ("ToStringInstanceHelper") { + IsClass = true, + TypeAttributes = System.Reflection.TypeAttributes.NestedPublic, + }; + + var formatProviderField = PrivateField (TypeRef (), "formatProvider"); + formatProviderField.InitExpression = new CodePropertyReferenceExpression ( + new CodeTypeReferenceExpression (TypeRef ()), "InvariantCulture"); + var formatProviderFieldRef = new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), formatProviderField.Name); + + var formatProviderProp = GenerateGetterSetterProperty ("FormatProvider", formatProviderField); + AddSetterNullCheck (formatProviderProp, formatProviderFieldRef); + + helperCls.Members.Add (formatProviderField); + helperCls.Members.Add (formatProviderProp); + + var meth = new CodeMemberMethod () { + Name = "ToStringWithCulture", + Attributes = MemberAttributes.Public | MemberAttributes.Final, + ReturnType = TypeRef (), + }; + meth.Parameters.Add (new CodeParameterDeclarationExpression (TypeRef (), "objectToConvert")); + var paramRef = new CodeArgumentReferenceExpression ("objectToConvert"); + + meth.Statements.Add (NullCheck (paramRef, paramRef.ParameterName)); + + var typeLocal = new CodeVariableDeclarationStatement (TypeRef (), "type", new CodeMethodInvokeExpression (paramRef, "GetType")); + var typeLocalRef = new CodeVariableReferenceExpression (typeLocal.Name); + meth.Statements.Add (typeLocal); + + var iConvertibleTypeLocal = new CodeVariableDeclarationStatement (TypeRef (), "iConvertibleType", + new CodeTypeOfExpression (TypeRef ())); + var iConvertibleTypeLocalRef = new CodeVariableReferenceExpression (iConvertibleTypeLocal.Name); + meth.Statements.Add (iConvertibleTypeLocal); + + meth.Statements.Add (new CodeConditionStatement ( + new CodeMethodInvokeExpression (iConvertibleTypeLocalRef, "IsAssignableFrom", typeLocalRef), + new CodeMethodReturnStatement (new CodeMethodInvokeExpression ( + new CodeCastExpression (TypeRef (), paramRef), "ToString", formatProviderFieldRef)))); + + var methInfoLocal = new CodeVariableDeclarationStatement (TypeRef (), "methInfo", + new CodeMethodInvokeExpression (typeLocalRef, "GetMethod", + new CodePrimitiveExpression ("ToString"), + new CodeArrayCreateExpression (TypeRef (), new CodeExpression [] { iConvertibleTypeLocalRef }))); + meth.Statements.Add (methInfoLocal); + var methInfoLocalRef = new CodeVariableReferenceExpression (methInfoLocal.Name); + meth.Statements.Add (new CodeConditionStatement (NotNull (methInfoLocalRef), + new CodeMethodReturnStatement (new CodeCastExpression (TypeRef (), + new CodeMethodInvokeExpression ( + methInfoLocalRef, "Invoke", paramRef, + new CodeArrayCreateExpression (TypeRef (), new CodeExpression [] { formatProviderFieldRef } )))))); + + meth.Statements.Add (new CodeMethodReturnStatement (new CodeMethodInvokeExpression (paramRef, "ToString"))); + + helperCls.Members.Add (meth); + + + var helperFieldName = settings.Provider.CreateValidIdentifier ("_toStringHelper"); + var helperField = PrivateField (new CodeTypeReference (helperCls.Name), helperFieldName); + helperField.InitExpression = new CodeObjectCreateExpression (helperField.Type); + type.Members.Add (helperField); + type.Members.Add (GenerateGetterProperty ("ToStringHelper", helperField)); + type.Members.Add (helperCls); + } + + #region CodeDom helpers + + static CodeTypeReference TypeRef () + { + return new CodeTypeReference (typeof (T), CodeTypeReferenceOptions.GlobalReference); + } + + static CodeMemberProperty GenerateGetterSetterProperty (string propertyName, CodeMemberField field) + { + var prop = new CodeMemberProperty () { + Name = propertyName, + Attributes = MemberAttributes.Public | MemberAttributes.Final, + Type = field.Type + }; + var fieldRef = new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), field.Name); + AddGetter (prop, fieldRef); + AddSetter (prop, fieldRef); + return prop; + } + + static CodeMemberProperty GenerateGetterProperty (string propertyName, CodeMemberField field) + { + var prop = new CodeMemberProperty () { + Name = propertyName, + Attributes = MemberAttributes.Public | MemberAttributes.Final, + HasSet = false, + Type = field.Type + }; + var fieldRef = new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), field.Name); + AddGetter (prop, fieldRef); + return prop; + } + + static void AddSetter (CodeMemberProperty property, CodeFieldReferenceExpression fieldRef) + { + property.HasSet = true; + property.SetStatements.Add (new CodeAssignStatement (fieldRef, new CodePropertySetValueReferenceExpression ())); + } + + static void AddGetter (CodeMemberProperty property, CodeFieldReferenceExpression fieldRef) + { + property.HasGet = true; + property.GetStatements.Add (new CodeMethodReturnStatement (fieldRef)); + } + + static void MakeGetterLazy (CodeMemberProperty property, CodeFieldReferenceExpression fieldRef, CodeExpression initExpression) + { + property.GetStatements.Insert (0, new CodeConditionStatement ( + NotNull (fieldRef), + new CodeAssignStatement (fieldRef, initExpression)) + ); + } + + static void AddSetterNullCheck (CodeMemberProperty property, CodeFieldReferenceExpression fieldRef) + { + property.SetStatements.Insert (0, NullCheck (fieldRef, fieldRef.FieldName)); + } + + static CodeStatement NullCheck (CodeExpression expr, string exceptionMessage) + { + return new CodeConditionStatement ( + IsNull (expr), + new CodeThrowExceptionStatement (new CodeObjectCreateExpression ( + new CodeTypeReference (typeof (ArgumentNullException), CodeTypeReferenceOptions.GlobalReference), + new CodePrimitiveExpression (exceptionMessage))) + ); + } + + static CodeBinaryOperatorExpression NotNull (CodeExpression reference) + { + return new CodeBinaryOperatorExpression (reference, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression (null)); + } + + static CodeBinaryOperatorExpression IsNull (CodeExpression reference) + { + return new CodeBinaryOperatorExpression (reference, CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression (null)); + } + + static CodeBinaryOperatorExpression IsFalse (CodeExpression expr) + { + return new CodeBinaryOperatorExpression (expr, CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression (false)); + } + + static CodeBinaryOperatorExpression BooleanAnd (CodeExpression expr1, CodeExpression expr2) + { + return new CodeBinaryOperatorExpression (expr1, CodeBinaryOperatorType.BooleanAnd, expr2); + } + + static CodeStatement ArgNullCheck (CodeExpression value, params CodeExpression[] argNullExcArgs) + { + return new CodeConditionStatement ( + new CodeBinaryOperatorExpression (value, + CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression (null)), + new CodeThrowExceptionStatement (new CodeObjectCreateExpression (typeof (ArgumentNullException), argNullExcArgs))); + } + + static CodeMemberField PrivateField (CodeTypeReference typeRef, string name) + { + return new CodeMemberField (typeRef, name) { + Attributes = MemberAttributes.Private + }; + } + + #endregion + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs new file mode 100644 index 00000000..9da2d4cd --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs @@ -0,0 +1,295 @@ +// +// Tokeniser.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.IO; +using System.Diagnostics; + +namespace Mono.TextTemplating +{ + + public class Tokeniser + { + string content; + int position = 0; + string value; + State nextState = State.Content; + Location nextStateLocation; + Location nextStateTagStartLocation; + + public Tokeniser (string fileName, string content) + { + State = State.Content; + this.content = content; + this.Location = this.nextStateLocation = this.nextStateTagStartLocation = new Location (fileName, 1, 1); + } + + public bool Advance () + { + value = null; + State = nextState; + Location = nextStateLocation; + TagStartLocation = nextStateTagStartLocation; + if (nextState == State.EOF) + return false; + nextState = GetNextStateAndCurrentValue (); + return true; + } + + State GetNextStateAndCurrentValue () + { + switch (State) { + case State.Block: + case State.Expression: + case State.Helper: + return GetBlockEnd (); + + case State.Directive: + return NextStateInDirective (); + + case State.Content: + return NextStateInContent (); + + case State.DirectiveName: + return GetDirectiveName (); + + case State.DirectiveValue: + return GetDirectiveValue (); + + default: + throw new InvalidOperationException ("Unexpected state '" + State.ToString () + "'"); + } + } + + State GetBlockEnd () + { + int start = position; + for (; position < content.Length; position++) { + char c = content[position]; + nextStateTagStartLocation = nextStateLocation; + nextStateLocation = nextStateLocation.AddCol (); + if (c == '\r') { + if (position + 1 < content.Length && content[position + 1] == '\n') + position++; + nextStateLocation = nextStateLocation.AddLine(); + } else if (c == '\n') { + nextStateLocation = nextStateLocation.AddLine(); + } else if (c =='>' && content[position-1] == '#' && content[position-2] != '\\') { + value = content.Substring (start, position - start - 1); + position++; + TagEndLocation = nextStateLocation; + + //skip newlines directly after blocks, unless they're expressions + if (State != State.Expression && (position += IsNewLine()) > 0) { + nextStateLocation = nextStateLocation.AddLine (); + } + return State.Content; + } + } + throw new ParserException ("Unexpected end of file.", nextStateLocation); + } + + State GetDirectiveName () + { + int start = position; + for (; position < content.Length; position++) { + char c = content[position]; + if (!Char.IsLetterOrDigit (c)) { + value = content.Substring (start, position - start); + return State.Directive; + } else { + nextStateLocation = nextStateLocation.AddCol (); + } + } + throw new ParserException ("Unexpected end of file.", nextStateLocation); + } + + State GetDirectiveValue () + { + int start = position; + int delimiter = '\0'; + for (; position < content.Length; position++) { + char c = content[position]; + nextStateLocation = nextStateLocation.AddCol (); + if (c == '\r') { + if (position + 1 < content.Length && content[position + 1] == '\n') + position++; + nextStateLocation = nextStateLocation.AddLine(); + } else if (c == '\n') + nextStateLocation = nextStateLocation.AddLine(); + if (delimiter == '\0') { + if (c == '\'' || c == '"') { + start = position; + delimiter = c; + } else if (!Char.IsWhiteSpace (c)) { + throw new ParserException ("Unexpected character '" + c + "'. Expecting attribute value.", nextStateLocation); + } + continue; + } + if (c == delimiter) { + value = content.Substring (start + 1, position - start - 1); + position++; + return State.Directive; + } + } + throw new ParserException ("Unexpected end of file.", nextStateLocation);; + } + + State NextStateInContent () + { + int start = position; + for (; position < content.Length; position++) { + char c = content[position]; + nextStateTagStartLocation = nextStateLocation; + nextStateLocation = nextStateLocation.AddCol (); + if (c == '\r') { + if (position + 1 < content.Length && content[position + 1] == '\n') + position++; + nextStateLocation = nextStateLocation.AddLine(); + } else if (c == '\n') { + nextStateLocation = nextStateLocation.AddLine(); + } else if (c =='<' && position + 2 < content.Length && content[position+1] == '#') { + TagEndLocation = nextStateLocation; + char type = content[position+2]; + if (type == '@') { + nextStateLocation = nextStateLocation.AddCols (2); + value = content.Substring (start, position - start); + position += 3; + return State.Directive; + } else if (type == '=') { + nextStateLocation = nextStateLocation.AddCols (2); + value = content.Substring (start, position - start); + position += 3; + return State.Expression; + } else if (type == '+') { + nextStateLocation = nextStateLocation.AddCols (2); + value = content.Substring (start, position - start); + position += 3; + return State.Helper; + } else { + value = content.Substring (start, position - start); + nextStateLocation = nextStateLocation.AddCol (); + position += 2; + return State.Block; + } + } + } + //EOF is only valid when we're in content + value = content.Substring (start); + return State.EOF; + } + + int IsNewLine() { + int found = 0; + + if (position < content.Length && content[position] == '\r') { + found++; + } + if (position+found < content.Length && content[position+found] == '\n') { + found++; + } + return found; + } + + State NextStateInDirective () { + for (; position < content.Length; position++) { + char c = content[position]; + if (c == '\r') { + if (position + 1 < content.Length && content[position + 1] == '\n') + position++; + nextStateLocation = nextStateLocation.AddLine(); + } else if (c == '\n') { + nextStateLocation = nextStateLocation.AddLine(); + } else if (Char.IsLetter (c)) { + return State.DirectiveName; + } else if (c == '=') { + nextStateLocation = nextStateLocation.AddCol (); + position++; + return State.DirectiveValue; + } else if (c == '#' && position + 1 < content.Length && content[position+1] == '>') { + position+=2; + TagEndLocation = nextStateLocation.AddCols (2); + nextStateLocation = nextStateLocation.AddCols (3); + + //skip newlines directly after directives + if ((position += IsNewLine()) > 0) { + nextStateLocation = nextStateLocation.AddLine(); + } + + return State.Content; + } else if (!Char.IsWhiteSpace (c)) { + throw new ParserException ("Directive ended unexpectedly with character '" + c + "'", nextStateLocation); + } else { + nextStateLocation = nextStateLocation.AddCol (); + } + } + throw new ParserException ("Unexpected end of file.", nextStateLocation); + } + + public State State { + get; private set; + } + + public int Position { + get { return position; } + } + + public string Content { + get { return content; } + } + + public string Value { + get { return value; } + } + + public Location Location { get; private set; } + public Location TagStartLocation { get; private set; } + public Location TagEndLocation { get; private set; } + } + + public enum State + { + Content = 0, + Directive, + Expression, + Block, + Helper, + DirectiveName, + DirectiveValue, + Name, + EOF + } + + public class ParserException : Exception + { + public ParserException (string message, Location location) : base (message) + { + Location = location; + } + + public Location Location { get; private set; } + } +} diff --git a/SparkleShare/Windows/tools/TextTemplating/README.md b/SparkleShare/Windows/tools/TextTemplating/README.md new file mode 100644 index 00000000..515765a0 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/README.md @@ -0,0 +1,19 @@ +TextTemplating +============== + +This is the TextTemplating tool inluded in MonoDevelop. +The original location of these files is +https://github.com/mono/monodevelop/tree/master/main/src/addins/TextTemplating + +Building on Windows +------------------- + +Run build.cmd or open TextTemplating.sln in visual studio 2010 +Dotnet framework 4 must be installed. + + +License +------- + +Licensed under the MIT/X11 license: http://www.opensource.org/licenses/mit-license.php + diff --git a/SparkleShare/Windows/tools/TextTemplating/TextTemplating.sln b/SparkleShare/Windows/tools/TextTemplating/TextTemplating.sln new file mode 100644 index 00000000..3de6beb6 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/TextTemplating.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.TextTemplating", "Mono.TextTemplating\Mono.TextTemplating.csproj", "{A2364D6A-00EF-417C-80A6-815726C70032}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextTransform", "TextTransform\TextTransform.csproj", "{D1D35409-C814-47F6-B038-B9B5BF0FE490}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Release|Any CPU = Release|Any CPU + Debug|Any CPU = Debug|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A2364D6A-00EF-417C-80A6-815726C70032}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2364D6A-00EF-417C-80A6-815726C70032}.Release|Any CPU.Build.0 = Release|Any CPU + {A2364D6A-00EF-417C-80A6-815726C70032}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2364D6A-00EF-417C-80A6-815726C70032}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Release|Any CPU.Build.0 = Release|Any CPU + {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Debug|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/SparkleShare/Windows/tools/TextTemplating/TextTransform/AssemblyInfo.cs b/SparkleShare/Windows/tools/TextTemplating/TextTransform/AssemblyInfo.cs new file mode 100644 index 00000000..abe1e8b4 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/TextTransform/AssemblyInfo.cs @@ -0,0 +1,39 @@ +// +// AssemblyInfo.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("TextTransform")] +[assembly: AssemblyDescription("T4 text transformation tool")] +[assembly: AssemblyCompany("The Mono Project")] +[assembly: AssemblyProduct("MonoDevelop")] +[assembly: AssemblyCopyright("MIT/X11")] + +//[assembly: AssemblyVersion("1.0.0.0")] + diff --git a/SparkleShare/Windows/tools/TextTemplating/TextTransform/ChangeLog b/SparkleShare/Windows/tools/TextTemplating/TextTransform/ChangeLog new file mode 100644 index 00000000..08db48ec --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/TextTransform/ChangeLog @@ -0,0 +1,25 @@ +2009-08-12 Michael Hutchinson + + * Makefile.am: + * TextTransform.csproj: Include the ASP.NET MVC and + TextTemplating addins in the main solution and build. + +2009-03-13 Michael Hutchinson + + * TextTransform.csproj: Move output dir from ../bin to + ../build. + +2009-03-05 Michael Hutchinson + + * TextTransform.csproj: Updated. + + * TextTransform.cs: Complete the runner implementation. + +2009-03-04 Michael Hutchinson + + * Options.cs: + * AssemblyInfo.cs: + * TextTransform.cs: + * TextTransform.csproj: Stub out the command-line + TextTransform tool. + diff --git a/SparkleShare/Windows/tools/TextTemplating/TextTransform/Makefile.am b/SparkleShare/Windows/tools/TextTemplating/TextTransform/Makefile.am new file mode 100644 index 00000000..bd472254 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/TextTransform/Makefile.am @@ -0,0 +1,35 @@ +ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating +ASSEMBLY = $(ADDIN_BUILD)/TextTransform.exe + +DEPS = $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating/Mono.TextTemplating.dll + +REFS = \ + -r:System \ + -r:System.Core + +FILES = \ + AssemblyInfo.cs \ + Options.cs \ + TextTransform.cs + +RES = + +all: $(ASSEMBLY) $(ASSEMBLY).mdb $(DATA_FILE_BUILD) + +$(ASSEMBLY): $(build_sources) $(build_resources) $(DEPS) + mkdir -p $(ADDIN_BUILD) + $(CSC) $(CSC_FLAGS) -debug -out:$@ -target:exe $(REFS) $(build_deps) \ + $(build_resources:%=/resource:%) $(build_sources) + +$(ASSEMBLY).mdb: $(ASSEMBLY) + +check: all + +assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.TextTemplating +assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb + +CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb +EXTRA_DIST = $(FILES) $(RES) + +include $(top_srcdir)/Makefile.include + diff --git a/SparkleShare/Windows/tools/TextTemplating/TextTransform/Options.cs b/SparkleShare/Windows/tools/TextTemplating/TextTransform/Options.cs new file mode 100644 index 00000000..a64ea4d4 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/TextTransform/Options.cs @@ -0,0 +1,1112 @@ +// +// Options.cs +// +// Authors: +// Jonathan Pryor +// +// Copyright (C) 2008 Novell (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +// Compile With: +// gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll +// gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll +// +// The LINQ version just changes the implementation of +// OptionSet.Parse(IEnumerable), and confers no semantic changes. + +// +// A Getopt::Long-inspired option parsing library for C#. +// +// NDesk.Options.OptionSet is built upon a key/value table, where the +// key is a option format string and the value is a delegate that is +// invoked when the format string is matched. +// +// Option format strings: +// Regex-like BNF Grammar: +// name: .+ +// type: [=:] +// sep: ( [^{}]+ | '{' .+ '}' )? +// aliases: ( name type sep ) ( '|' name type sep )* +// +// Each '|'-delimited name is an alias for the associated action. If the +// format string ends in a '=', it has a required value. If the format +// string ends in a ':', it has an optional value. If neither '=' or ':' +// is present, no value is supported. `=' or `:' need only be defined on one +// alias, but if they are provided on more than one they must be consistent. +// +// Each alias portion may also end with a "key/value separator", which is used +// to split option values if the option accepts > 1 value. If not specified, +// it defaults to '=' and ':'. If specified, it can be any character except +// '{' and '}' OR the *string* between '{' and '}'. If no separator should be +// used (i.e. the separate values should be distinct arguments), then "{}" +// should be used as the separator. +// +// Options are extracted either from the current option by looking for +// the option name followed by an '=' or ':', or is taken from the +// following option IFF: +// - The current option does not contain a '=' or a ':' +// - The current option requires a value (i.e. not a Option type of ':') +// +// The `name' used in the option format string does NOT include any leading +// option indicator, such as '-', '--', or '/'. All three of these are +// permitted/required on any named option. +// +// Option bundling is permitted so long as: +// - '-' is used to start the option group +// - all of the bundled options are a single character +// - at most one of the bundled options accepts a value, and the value +// provided starts from the next character to the end of the string. +// +// This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value' +// as '-Dname=value'. +// +// Option processing is disabled by specifying "--". All options after "--" +// are returned by OptionSet.Parse() unchanged and unprocessed. +// +// Unprocessed options are returned from OptionSet.Parse(). +// +// Examples: +// int verbose = 0; +// OptionSet p = new OptionSet () +// .Add ("v", v => ++verbose) +// .Add ("name=|value=", v => Console.WriteLine (v)); +// p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"}); +// +// The above would parse the argument string array, and would invoke the +// lambda expression three times, setting `verbose' to 3 when complete. +// It would also print out "A" and "B" to standard output. +// The returned array would contain the string "extra". +// +// C# 3.0 collection initializers are supported and encouraged: +// var p = new OptionSet () { +// { "h|?|help", v => ShowHelp () }, +// }; +// +// System.ComponentModel.TypeConverter is also supported, allowing the use of +// custom data types in the callback type; TypeConverter.ConvertFromString() +// is used to convert the value option to an instance of the specified +// type: +// +// var p = new OptionSet () { +// { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) }, +// }; +// +// Random other tidbits: +// - Boolean options (those w/o '=' or ':' in the option format string) +// are explicitly enabled if they are followed with '+', and explicitly +// disabled if they are followed with '-': +// string a = null; +// var p = new OptionSet () { +// { "a", s => a = s }, +// }; +// p.Parse (new string[]{"-a"}); // sets v != null +// p.Parse (new string[]{"-a+"}); // sets v != null +// p.Parse (new string[]{"-a-"}); // sets v == null +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Runtime.Serialization; +using System.Security.Permissions; +using System.Text; +using System.Text.RegularExpressions; + +#if LINQ +using System.Linq; +#endif + +#if TEST +using NDesk.Options; +#endif + +#if NDESK_OPTIONS +namespace NDesk.Options +#else +namespace Mono.Options +#endif +{ + public class OptionValueCollection : IList, IList { + + List values = new List (); + OptionContext c; + + internal OptionValueCollection (OptionContext c) + { + this.c = c; + } + + #region ICollection + void ICollection.CopyTo (Array array, int index) {(values as ICollection).CopyTo (array, index);} + bool ICollection.IsSynchronized {get {return (values as ICollection).IsSynchronized;}} + object ICollection.SyncRoot {get {return (values as ICollection).SyncRoot;}} + #endregion + + #region ICollection + public void Add (string item) {values.Add (item);} + public void Clear () {values.Clear ();} + public bool Contains (string item) {return values.Contains (item);} + public void CopyTo (string[] array, int arrayIndex) {values.CopyTo (array, arrayIndex);} + public bool Remove (string item) {return values.Remove (item);} + public int Count {get {return values.Count;}} + public bool IsReadOnly {get {return false;}} + #endregion + + #region IEnumerable + IEnumerator IEnumerable.GetEnumerator () {return values.GetEnumerator ();} + #endregion + + #region IEnumerable + public IEnumerator GetEnumerator () {return values.GetEnumerator ();} + #endregion + + #region IList + int IList.Add (object value) {return (values as IList).Add (value);} + bool IList.Contains (object value) {return (values as IList).Contains (value);} + int IList.IndexOf (object value) {return (values as IList).IndexOf (value);} + void IList.Insert (int index, object value) {(values as IList).Insert (index, value);} + void IList.Remove (object value) {(values as IList).Remove (value);} + void IList.RemoveAt (int index) {(values as IList).RemoveAt (index);} + bool IList.IsFixedSize {get {return false;}} + object IList.this [int index] {get {return this [index];} set {(values as IList)[index] = value;}} + #endregion + + #region IList + public int IndexOf (string item) {return values.IndexOf (item);} + public void Insert (int index, string item) {values.Insert (index, item);} + public void RemoveAt (int index) {values.RemoveAt (index);} + + private void AssertValid (int index) + { + if (c.Option == null) + throw new InvalidOperationException ("OptionContext.Option is null."); + if (index >= c.Option.MaxValueCount) + throw new ArgumentOutOfRangeException ("index"); + if (c.Option.OptionValueType == OptionValueType.Required && + index >= values.Count) + throw new OptionException (string.Format ( + c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName), + c.OptionName); + } + + public string this [int index] { + get { + AssertValid (index); + return index >= values.Count ? null : values [index]; + } + set { + values [index] = value; + } + } + #endregion + + public List ToList () + { + return new List (values); + } + + public string[] ToArray () + { + return values.ToArray (); + } + + public override string ToString () + { + return string.Join (", ", values.ToArray ()); + } + } + + public class OptionContext { + private Option option; + private string name; + private int index; + private OptionSet set; + private OptionValueCollection c; + + public OptionContext (OptionSet set) + { + this.set = set; + this.c = new OptionValueCollection (this); + } + + public Option Option { + get {return option;} + set {option = value;} + } + + public string OptionName { + get {return name;} + set {name = value;} + } + + public int OptionIndex { + get {return index;} + set {index = value;} + } + + public OptionSet OptionSet { + get {return set;} + } + + public OptionValueCollection OptionValues { + get {return c;} + } + } + + public enum OptionValueType { + None, + Optional, + Required, + } + + public abstract class Option { + string prototype, description; + string[] names; + OptionValueType type; + int count; + string[] separators; + + protected Option (string prototype, string description) + : this (prototype, description, 1) + { + } + + protected Option (string prototype, string description, int maxValueCount) + { + if (prototype == null) + throw new ArgumentNullException ("prototype"); + if (prototype.Length == 0) + throw new ArgumentException ("Cannot be the empty string.", "prototype"); + if (maxValueCount < 0) + throw new ArgumentOutOfRangeException ("maxValueCount"); + + this.prototype = prototype; + this.names = prototype.Split ('|'); + this.description = description; + this.count = maxValueCount; + this.type = ParsePrototype (); + + if (this.count == 0 && type != OptionValueType.None) + throw new ArgumentException ( + "Cannot provide maxValueCount of 0 for OptionValueType.Required or " + + "OptionValueType.Optional.", + "maxValueCount"); + if (this.type == OptionValueType.None && maxValueCount > 1) + throw new ArgumentException ( + string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount), + "maxValueCount"); + if (Array.IndexOf (names, "<>") >= 0 && + ((names.Length == 1 && this.type != OptionValueType.None) || + (names.Length > 1 && this.MaxValueCount > 1))) + throw new ArgumentException ( + "The default option handler '<>' cannot require values.", + "prototype"); + } + + public string Prototype {get {return prototype;}} + public string Description {get {return description;}} + public OptionValueType OptionValueType {get {return type;}} + public int MaxValueCount {get {return count;}} + + public string[] GetNames () + { + return (string[]) names.Clone (); + } + + public string[] GetValueSeparators () + { + if (separators == null) + return new string [0]; + return (string[]) separators.Clone (); + } + + protected static T Parse (string value, OptionContext c) + { + Type tt = typeof (T); + bool nullable = tt.IsValueType && tt.IsGenericType && + !tt.IsGenericTypeDefinition && + tt.GetGenericTypeDefinition () == typeof (Nullable<>); + Type targetType = nullable ? tt.GetGenericArguments () [0] : typeof (T); + TypeConverter conv = TypeDescriptor.GetConverter (targetType); + T t = default (T); + try { + if (value != null) + t = (T) conv.ConvertFromString (value); + } + catch (Exception e) { + throw new OptionException ( + string.Format ( + c.OptionSet.MessageLocalizer ("Could not convert string `{0}' to type {1} for option `{2}'."), + value, targetType.Name, c.OptionName), + c.OptionName, e); + } + return t; + } + + internal string[] Names {get {return names;}} + internal string[] ValueSeparators {get {return separators;}} + + static readonly char[] NameTerminator = new char[]{'=', ':'}; + + private OptionValueType ParsePrototype () + { + char type = '\0'; + List seps = new List (); + for (int i = 0; i < names.Length; ++i) { + string name = names [i]; + if (name.Length == 0) + throw new ArgumentException ("Empty option names are not supported.", "prototype"); + + int end = name.IndexOfAny (NameTerminator); + if (end == -1) + continue; + names [i] = name.Substring (0, end); + if (type == '\0' || type == name [end]) + type = name [end]; + else + throw new ArgumentException ( + string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]), + "prototype"); + AddSeparators (name, end, seps); + } + + if (type == '\0') + return OptionValueType.None; + + if (count <= 1 && seps.Count != 0) + throw new ArgumentException ( + string.Format ("Cannot provide key/value separators for Options taking {0} value(s).", count), + "prototype"); + if (count > 1) { + if (seps.Count == 0) + this.separators = new string[]{":", "="}; + else if (seps.Count == 1 && seps [0].Length == 0) + this.separators = null; + else + this.separators = seps.ToArray (); + } + + return type == '=' ? OptionValueType.Required : OptionValueType.Optional; + } + + private static void AddSeparators (string name, int end, ICollection seps) + { + int start = -1; + for (int i = end+1; i < name.Length; ++i) { + switch (name [i]) { + case '{': + if (start != -1) + throw new ArgumentException ( + string.Format ("Ill-formed name/value separator found in \"{0}\".", name), + "prototype"); + start = i+1; + break; + case '}': + if (start == -1) + throw new ArgumentException ( + string.Format ("Ill-formed name/value separator found in \"{0}\".", name), + "prototype"); + seps.Add (name.Substring (start, i-start)); + start = -1; + break; + default: + if (start == -1) + seps.Add (name [i].ToString ()); + break; + } + } + if (start != -1) + throw new ArgumentException ( + string.Format ("Ill-formed name/value separator found in \"{0}\".", name), + "prototype"); + } + + public void Invoke (OptionContext c) + { + OnParseComplete (c); + c.OptionName = null; + c.Option = null; + c.OptionValues.Clear (); + } + + protected abstract void OnParseComplete (OptionContext c); + + public override string ToString () + { + return Prototype; + } + } + + [Serializable] + public class OptionException : Exception { + private string option; + + public OptionException () + { + } + + public OptionException (string message, string optionName) + : base (message) + { + this.option = optionName; + } + + public OptionException (string message, string optionName, Exception innerException) + : base (message, innerException) + { + this.option = optionName; + } + + protected OptionException (SerializationInfo info, StreamingContext context) + : base (info, context) + { + this.option = info.GetString ("OptionName"); + } + + public string OptionName { + get {return this.option;} + } + + [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)] + public override void GetObjectData (SerializationInfo info, StreamingContext context) + { + base.GetObjectData (info, context); + info.AddValue ("OptionName", option); + } + } + + public delegate void OptionAction (TKey key, TValue value); + + public class OptionSet : KeyedCollection + { + public OptionSet () + : this (delegate (string f) {return f;}) + { + } + + public OptionSet (Converter localizer) + { + this.localizer = localizer; + } + + Converter localizer; + + public Converter MessageLocalizer { + get {return localizer;} + } + + protected override string GetKeyForItem (Option item) + { + if (item == null) + throw new ArgumentNullException ("option"); + if (item.Names != null && item.Names.Length > 0) + return item.Names [0]; + // This should never happen, as it's invalid for Option to be + // constructed w/o any names. + throw new InvalidOperationException ("Option has no names!"); + } + + [Obsolete ("Use KeyedCollection.this[string]")] + protected Option GetOptionForName (string option) + { + if (option == null) + throw new ArgumentNullException ("option"); + try { + return base [option]; + } + catch (KeyNotFoundException) { + return null; + } + } + + protected override void InsertItem (int index, Option item) + { + base.InsertItem (index, item); + AddImpl (item); + } + + protected override void RemoveItem (int index) + { + base.RemoveItem (index); + Option p = Items [index]; + // KeyedCollection.RemoveItem() handles the 0th item + for (int i = 1; i < p.Names.Length; ++i) { + Dictionary.Remove (p.Names [i]); + } + } + + protected override void SetItem (int index, Option item) + { + base.SetItem (index, item); + RemoveItem (index); + AddImpl (item); + } + + private void AddImpl (Option option) + { + if (option == null) + throw new ArgumentNullException ("option"); + List added = new List (option.Names.Length); + try { + // KeyedCollection.InsertItem/SetItem handle the 0th name. + for (int i = 1; i < option.Names.Length; ++i) { + Dictionary.Add (option.Names [i], option); + added.Add (option.Names [i]); + } + } + catch (Exception) { + foreach (string name in added) + Dictionary.Remove (name); + throw; + } + } + + public new OptionSet Add (Option option) + { + base.Add (option); + return this; + } + + sealed class ActionOption : Option { + Action action; + + public ActionOption (string prototype, string description, int count, Action action) + : base (prototype, description, count) + { + if (action == null) + throw new ArgumentNullException ("action"); + this.action = action; + } + + protected override void OnParseComplete (OptionContext c) + { + action (c.OptionValues); + } + } + + public OptionSet Add (string prototype, Action action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, Action action) + { + if (action == null) + throw new ArgumentNullException ("action"); + Option p = new ActionOption (prototype, description, 1, + delegate (OptionValueCollection v) { action (v [0]); }); + base.Add (p); + return this; + } + + public OptionSet Add (string prototype, OptionAction action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, OptionAction action) + { + if (action == null) + throw new ArgumentNullException ("action"); + Option p = new ActionOption (prototype, description, 2, + delegate (OptionValueCollection v) {action (v [0], v [1]);}); + base.Add (p); + return this; + } + + sealed class ActionOption : Option { + Action action; + + public ActionOption (string prototype, string description, Action action) + : base (prototype, description, 1) + { + if (action == null) + throw new ArgumentNullException ("action"); + this.action = action; + } + + protected override void OnParseComplete (OptionContext c) + { + action (Parse (c.OptionValues [0], c)); + } + } + + sealed class ActionOption : Option { + OptionAction action; + + public ActionOption (string prototype, string description, OptionAction action) + : base (prototype, description, 2) + { + if (action == null) + throw new ArgumentNullException ("action"); + this.action = action; + } + + protected override void OnParseComplete (OptionContext c) + { + action ( + Parse (c.OptionValues [0], c), + Parse (c.OptionValues [1], c)); + } + } + + public OptionSet Add (string prototype, Action action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, Action action) + { + return Add (new ActionOption (prototype, description, action)); + } + + public OptionSet Add (string prototype, OptionAction action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, OptionAction action) + { + return Add (new ActionOption (prototype, description, action)); + } + + protected virtual OptionContext CreateOptionContext () + { + return new OptionContext (this); + } + +#if LINQ + public List Parse (IEnumerable arguments) + { + bool process = true; + OptionContext c = CreateOptionContext (); + c.OptionIndex = -1; + var def = GetOptionForName ("<>"); + var unprocessed = + from argument in arguments + where ++c.OptionIndex >= 0 && (process || def != null) + ? process + ? argument == "--" + ? (process = false) + : !Parse (argument, c) + ? def != null + ? Unprocessed (null, def, c, argument) + : true + : false + : def != null + ? Unprocessed (null, def, c, argument) + : true + : true + select argument; + List r = unprocessed.ToList (); + if (c.Option != null) + c.Option.Invoke (c); + return r; + } +#else + public List Parse (IEnumerable arguments) + { + OptionContext c = CreateOptionContext (); + c.OptionIndex = -1; + bool process = true; + List unprocessed = new List (); + Option def = Contains ("<>") ? this ["<>"] : null; + foreach (string argument in arguments) { + ++c.OptionIndex; + if (argument == "--") { + process = false; + continue; + } + if (!process) { + Unprocessed (unprocessed, def, c, argument); + continue; + } + if (!Parse (argument, c)) + Unprocessed (unprocessed, def, c, argument); + } + if (c.Option != null) + c.Option.Invoke (c); + return unprocessed; + } +#endif + + private static bool Unprocessed (ICollection extra, Option def, OptionContext c, string argument) + { + if (def == null) { + extra.Add (argument); + return false; + } + c.OptionValues.Add (argument); + c.Option = def; + c.Option.Invoke (c); + return false; + } + + private readonly Regex ValueOption = new Regex ( + @"^(?--|-|/)(?[^:=]+)((?[:=])(?.*))?$"); + + protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value) + { + if (argument == null) + throw new ArgumentNullException ("argument"); + + flag = name = sep = value = null; + Match m = ValueOption.Match (argument); + if (!m.Success) { + return false; + } + flag = m.Groups ["flag"].Value; + name = m.Groups ["name"].Value; + if (m.Groups ["sep"].Success && m.Groups ["value"].Success) { + sep = m.Groups ["sep"].Value; + value = m.Groups ["value"].Value; + } + return true; + } + + protected virtual bool Parse (string argument, OptionContext c) + { + if (c.Option != null) { + ParseValue (argument, c); + return true; + } + + string f, n, s, v; + if (!GetOptionParts (argument, out f, out n, out s, out v)) + return false; + + Option p; + if (Contains (n)) { + p = this [n]; + c.OptionName = f + n; + c.Option = p; + switch (p.OptionValueType) { + case OptionValueType.None: + c.OptionValues.Add (n); + c.Option.Invoke (c); + break; + case OptionValueType.Optional: + case OptionValueType.Required: + ParseValue (v, c); + break; + } + return true; + } + // no match; is it a bool option? + if (ParseBool (argument, n, c)) + return true; + // is it a bundled option? + if (ParseBundledValue (f, string.Concat (n + s + v), c)) + return true; + + return false; + } + + private void ParseValue (string option, OptionContext c) + { + if (option != null) + foreach (string o in c.Option.ValueSeparators != null + ? option.Split (c.Option.ValueSeparators, StringSplitOptions.None) + : new string[]{option}) { + c.OptionValues.Add (o); + } + if (c.OptionValues.Count == c.Option.MaxValueCount || + c.Option.OptionValueType == OptionValueType.Optional) + c.Option.Invoke (c); + else if (c.OptionValues.Count > c.Option.MaxValueCount) { + throw new OptionException (localizer (string.Format ( + "Error: Found {0} option values when expecting {1}.", + c.OptionValues.Count, c.Option.MaxValueCount)), + c.OptionName); + } + } + + private bool ParseBool (string option, string n, OptionContext c) + { + Option p; + string rn; + if (n.Length >= 1 && (n [n.Length-1] == '+' || n [n.Length-1] == '-') && + Contains ((rn = n.Substring (0, n.Length-1)))) { + p = this [rn]; + string v = n [n.Length-1] == '+' ? option : null; + c.OptionName = option; + c.Option = p; + c.OptionValues.Add (v); + p.Invoke (c); + return true; + } + return false; + } + + private bool ParseBundledValue (string f, string n, OptionContext c) + { + if (f != "-") + return false; + for (int i = 0; i < n.Length; ++i) { + Option p; + string opt = f + n [i].ToString (); + string rn = n [i].ToString (); + if (!Contains (rn)) { + if (i == 0) + return false; + throw new OptionException (string.Format (localizer ( + "Cannot bundle unregistered option '{0}'."), opt), opt); + } + p = this [rn]; + switch (p.OptionValueType) { + case OptionValueType.None: + Invoke (c, opt, n, p); + break; + case OptionValueType.Optional: + case OptionValueType.Required: { + string v = n.Substring (i+1); + c.Option = p; + c.OptionName = opt; + ParseValue (v.Length != 0 ? v : null, c); + return true; + } + default: + throw new InvalidOperationException ("Unknown OptionValueType: " + p.OptionValueType); + } + } + return true; + } + + private static void Invoke (OptionContext c, string name, string value, Option option) + { + c.OptionName = name; + c.Option = option; + c.OptionValues.Add (value); + option.Invoke (c); + } + + private const int OptionWidth = 29; + + public void WriteOptionDescriptions (TextWriter o) + { + foreach (Option p in this) { + int written = 0; + if (!WriteOptionPrototype (o, p, ref written)) + continue; + + if (written < OptionWidth) + o.Write (new string (' ', OptionWidth - written)); + else { + o.WriteLine (); + o.Write (new string (' ', OptionWidth)); + } + + List lines = GetLines (localizer (GetDescription (p.Description))); + o.WriteLine (lines [0]); + string prefix = new string (' ', OptionWidth+2); + for (int i = 1; i < lines.Count; ++i) { + o.Write (prefix); + o.WriteLine (lines [i]); + } + } + } + + bool WriteOptionPrototype (TextWriter o, Option p, ref int written) + { + string[] names = p.Names; + + int i = GetNextOptionIndex (names, 0); + if (i == names.Length) + return false; + + if (names [i].Length == 1) { + Write (o, ref written, " -"); + Write (o, ref written, names [0]); + } + else { + Write (o, ref written, " --"); + Write (o, ref written, names [0]); + } + + for ( i = GetNextOptionIndex (names, i+1); + i < names.Length; i = GetNextOptionIndex (names, i+1)) { + Write (o, ref written, ", "); + Write (o, ref written, names [i].Length == 1 ? "-" : "--"); + Write (o, ref written, names [i]); + } + + if (p.OptionValueType == OptionValueType.Optional || + p.OptionValueType == OptionValueType.Required) { + if (p.OptionValueType == OptionValueType.Optional) { + Write (o, ref written, localizer ("[")); + } + Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description))); + string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0 + ? p.ValueSeparators [0] + : " "; + for (int c = 1; c < p.MaxValueCount; ++c) { + Write (o, ref written, localizer (sep + GetArgumentName (c, p.MaxValueCount, p.Description))); + } + if (p.OptionValueType == OptionValueType.Optional) { + Write (o, ref written, localizer ("]")); + } + } + return true; + } + + static int GetNextOptionIndex (string[] names, int i) + { + while (i < names.Length && names [i] == "<>") { + ++i; + } + return i; + } + + static void Write (TextWriter o, ref int n, string s) + { + n += s.Length; + o.Write (s); + } + + private static string GetArgumentName (int index, int maxIndex, string description) + { + if (description == null) + return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); + string[] nameStart; + if (maxIndex == 1) + nameStart = new string[]{"{0:", "{"}; + else + nameStart = new string[]{"{" + index + ":"}; + for (int i = 0; i < nameStart.Length; ++i) { + int start, j = 0; + do { + start = description.IndexOf (nameStart [i], j); + } while (start >= 0 && j != 0 ? description [j++ - 1] == '{' : false); + if (start == -1) + continue; + int end = description.IndexOf ("}", start); + if (end == -1) + continue; + return description.Substring (start + nameStart [i].Length, end - start - nameStart [i].Length); + } + return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); + } + + private static string GetDescription (string description) + { + if (description == null) + return string.Empty; + StringBuilder sb = new StringBuilder (description.Length); + int start = -1; + for (int i = 0; i < description.Length; ++i) { + switch (description [i]) { + case '{': + if (i == start) { + sb.Append ('{'); + start = -1; + } + else if (start < 0) + start = i + 1; + break; + case '}': + if (start < 0) { + if ((i+1) == description.Length || description [i+1] != '}') + throw new InvalidOperationException ("Invalid option description: " + description); + ++i; + sb.Append ("}"); + } + else { + sb.Append (description.Substring (start, i - start)); + start = -1; + } + break; + case ':': + if (start < 0) + goto default; + start = i + 1; + break; + default: + if (start < 0) + sb.Append (description [i]); + break; + } + } + return sb.ToString (); + } + + private static List GetLines (string description) + { + List lines = new List (); + if (string.IsNullOrEmpty (description)) { + lines.Add (string.Empty); + return lines; + } + int length = 80 - OptionWidth - 2; + int start = 0, end; + do { + end = GetLineEnd (start, length, description); + bool cont = false; + if (end < description.Length) { + char c = description [end]; + if (c == '-' || (char.IsWhiteSpace (c) && c != '\n')) + ++end; + else if (c != '\n') { + cont = true; + --end; + } + } + lines.Add (description.Substring (start, end - start)); + if (cont) { + lines [lines.Count-1] += "-"; + } + start = end; + if (start < description.Length && description [start] == '\n') + ++start; + } while (end < description.Length); + return lines; + } + + private static int GetLineEnd (int start, int length, string description) + { + int end = System.Math.Min (start + length, description.Length); + int sep = -1; + for (int i = start; i < end; ++i) { + switch (description [i]) { + case ' ': + case '\t': + case '\v': + case '-': + case ',': + case '.': + case ';': + sep = i; + break; + case '\n': + return i; + } + } + if (sep == -1 || end == description.Length) + return end; + return sep; + } + } +} + diff --git a/SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.cs b/SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.cs new file mode 100644 index 00000000..1f66bff1 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.cs @@ -0,0 +1,174 @@ +// +// Main.cs +// +// Author: +// Michael Hutchinson +// +// Copyright (c) 2009 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.IO; +using System.Collections.Generic; +using Mono.Options; + +namespace Mono.TextTemplating +{ + class TextTransform + { + static OptionSet optionSet; + const string name ="TextTransform.exe"; + + public static int Main (string[] args) + { + if (args.Length == 0) { + ShowHelp (true); + } + + var generator = new TemplateGenerator (); + string outputFile = null, inputFile = null; + var directives = new List (); + var parameters = new List (); + var session = new Microsoft.VisualStudio.TextTemplating.TextTemplatingSession (); + string preprocess = null; + + optionSet = new OptionSet () { + { "o=|out=", "The name of the output {file}", s => outputFile = s }, + { "r=", "Assemblies to reference", s => generator.Refs.Add (s) }, + { "u=", "Namespaces to import <{0:namespace}>", s => generator.Imports.Add (s) }, + { "I=", "Paths to search for included files", s => generator.IncludePaths.Add (s) }, + { "P=", "Paths to search for referenced assemblies", s => generator.ReferencePaths.Add (s) }, + { "dp=", "Directive processor (name!class!assembly)", s => directives.Add (s) }, + { "a=", "Parameters ([processorName]![directiveName]!name!value)", s => parameters.Add (s) }, + { "h|?|help", "Show help", s => ShowHelp (false) }, + // { "k=,", "Session {key},{value} pairs", (s, t) => session.Add (s, t) }, + { "c=", "Preprocess the template into {0:class}", (s) => preprocess = s }, + }; + + var remainingArgs = optionSet.Parse (args); + + if (string.IsNullOrEmpty (outputFile)) { + Console.Error.WriteLine ("No output file specified."); + return -1; + } + + if (remainingArgs.Count != 1) { + Console.Error.WriteLine ("No input file specified."); + return -1; + } + inputFile = remainingArgs [0]; + + if (!File.Exists (inputFile)) { + Console.Error.WriteLine ("Input file '{0}' does not exist."); + return -1; + } + + //FIXME: implement quoting and escaping for values + foreach (var par in parameters) { + var split = par.Split ('!'); + if (split.Length < 2) { + Console.Error.WriteLine ("Parameter does not have enough values: {0}", par); + return -1; + } + if (split.Length > 2) { + Console.Error.WriteLine ("Parameter has too many values: {0}", par); + return -1; + } + string name = split[split.Length-2]; + string val = split[split.Length-1]; + if (string.IsNullOrEmpty (name)) { + Console.Error.WriteLine ("Parameter has no name: {0}", par); + return -1; + } + generator.AddParameter (split.Length > 3? split[0] : null, split.Length > 2? split[split.Length-3] : null, name, val); + } + + foreach (var dir in directives) { + var split = dir.Split ('!'); + if (split.Length != 3) { + Console.Error.WriteLine ("Directive does not have correct number of values: {0}", dir); + return -1; + } + foreach (var s in split) { + if (string.IsNullOrEmpty (s)) { + Console.Error.WriteLine ("Directive has missing value: {0}", dir); + return -1; + } + } + generator.AddDirectiveProcessor (split[0], split[1], split[2]); + } + + if (preprocess == null) { + Console.Write ("Processing '{0}'... ", inputFile); + generator.ProcessTemplate (inputFile, outputFile); + if (generator.Errors.HasErrors) { + Console.WriteLine ("failed."); + } else { + Console.WriteLine ("completed successfully."); + } + } else { + string className = preprocess; + string classNamespace = null; + int s = preprocess.LastIndexOf ('.'); + if (s > 0) { + classNamespace = preprocess.Substring (0, s); + className = preprocess.Substring (s + 1); + } + + Console.Write ("Preprocessing '{0}' into class '{1}.{2}'... ", inputFile, classNamespace, className); + string language; + string[] references; + generator.PreprocessTemplate (inputFile, className, classNamespace, outputFile, System.Text.Encoding.UTF8, + out language, out references); + if (generator.Errors.HasErrors) { + Console.WriteLine ("failed."); + } else { + Console.WriteLine ("completed successfully:"); + Console.WriteLine (" Language: {0}", language); + if (references != null && references.Length > 0) { + Console.WriteLine (" References:"); + foreach (string r in references) + Console.WriteLine (" {0}", r); + } + } + } + + foreach (System.CodeDom.Compiler.CompilerError err in generator.Errors) + Console.Error.WriteLine ("{0}({1},{2}): {3} {4}", err.FileName, err.Line, err.Column, + err.IsWarning? "WARNING" : "ERROR", err.ErrorText); + + return generator.Errors.HasErrors? -1 : 0; + } + + static void ShowHelp (bool concise) + { + Console.WriteLine ("TextTransform command line T4 processor"); + Console.WriteLine ("Usage: {0} [options] input-file", name); + if (concise) { + Console.WriteLine ("Use --help to display options."); + } else { + Console.WriteLine ("Options:"); + optionSet.WriteOptionDescriptions (System.Console.Out); + } + Console.WriteLine (); + Environment.Exit (0); + } + } +} \ No newline at end of file diff --git a/SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.csproj b/SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.csproj new file mode 100644 index 00000000..5820f5ac --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/TextTransform/TextTransform.csproj @@ -0,0 +1,62 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {D1D35409-C814-47F6-B038-B9B5BF0FE490} + Exe + TextTransform + Mono.TextTemplating + + + true + full + false + ..\bin + DEBUG + prompt + 4 + -o:out.txt in.tt + + + none + false + ..\bin + prompt + 4 + + + + + + + + + + + + + {A2364D6A-00EF-417C-80A6-815726C70032} + Mono.TextTemplating + False + + + + + + + + + + + + + + + + + + + diff --git a/SparkleShare/Windows/tools/TextTemplating/build.cmd b/SparkleShare/Windows/tools/TextTemplating/build.cmd new file mode 100644 index 00000000..8e0ecf30 --- /dev/null +++ b/SparkleShare/Windows/tools/TextTemplating/build.cmd @@ -0,0 +1,5 @@ +@echo off +set WinDirNet=%WinDir%\Microsoft.NET\Framework +set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" + +%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\TextTemplating.sln diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Gettext.Cs.Tests.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Gettext.Cs.Tests.csproj new file mode 100644 index 00000000..1bc30c81 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Gettext.Cs.Tests.csproj @@ -0,0 +1,67 @@ + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {C4B4300B-5B96-4F43-BD7D-517A29693B30} + Library + Properties + Gettext.Cs.Tests + Gettext.Cs.Tests + v3.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + 3.5 + + + + 3.5 + + + + 3.5 + + + + + + + + + {D8869765-AB47-4C03-B2C5-E5498A55CA79} + Gettext.Cs + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/PoParserTest.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/PoParserTest.cs new file mode 100644 index 00000000..57c8e936 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/PoParserTest.cs @@ -0,0 +1,64 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + +using Gettext.Cs; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.IO; +using System.Collections.Generic; +using System; +using System.Linq; + +namespace Gettext.Cs.Tests +{ + /// + ///This is a test class for PoParserTest and is intended + ///to contain all PoParserTest Unit Tests + /// + [TestClass()] + public class PoParserTest + { + /// + /// Tests slashes in parsed strings + /// + /// + [TestMethod()] + public void ParseIntoDictionaryStringWithSlashesTest() + { + string msgid = @"The type of parameter \""${0}\"" is not supported"; + string msgstr = @"Il tipo del parametro \""${0}\"" non è supportato"; + + string parsedMsgid = @"The type of parameter ""${0}"" is not supported"; + string parsedMsgstr = @"Il tipo del parametro ""${0}"" non è supportato"; + + PoParser target = new PoParser(); + TextReader reader = new StringReader(String.Format(@" + msgid ""{0}"" + msgstr ""{1}"" + ", msgid, msgstr)); + + var actual = target.ParseIntoDictionary(reader); + + Assert.AreEqual(1, actual.Count, "Parsed dictionary entries count do not match"); + Assert.AreEqual(parsedMsgid, actual.Keys.ToArray()[0], "Key does not match"); + Assert.AreEqual(parsedMsgstr, actual.Values.ToArray()[0], "Value does not match"); + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Properties/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..ef49090d --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,57 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Gettext.Cs.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Gettext.Cs.Tests")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM componenets. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("532f2d56-549a-474c-b46b-82fc90f1db64")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Controls/AspTranslate.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Controls/AspTranslate.cs new file mode 100644 index 00000000..263e6e8d --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Controls/AspTranslate.cs @@ -0,0 +1,48 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Web.UI; + + +namespace Gettext.Cs.Web +{ + [ParseChildren(false)] + public abstract class AspTranslate : Control + { + string content; + + protected override void AddParsedSubObject(object obj) + { + if (obj is LiteralControl) + { + content = Translate(((LiteralControl)obj).Text); + } + } + + protected override void Render(HtmlTextWriter writer) + { + writer.Write(content); + } + + protected abstract string Translate(string text); + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Gettext.Cs.Web.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Gettext.Cs.Web.csproj new file mode 100644 index 00000000..ac6930a9 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Gettext.Cs.Web.csproj @@ -0,0 +1,60 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {38474466-DA21-4D19-A4D8-E2E7918480D6} + Library + Properties + Gettext.Cs.Web + Gettext.Cs.Web + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + 3.5 + + + 3.5 + + + + + + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Properties/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..510861c0 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Gettext.Cs.Web")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Gettext.Cs.Web")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("efc9a6d8-33cd-4cc5-8984-90847fea390e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Gettext.Cs.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Gettext.Cs.csproj new file mode 100644 index 00000000..b3822e2b --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Gettext.Cs.csproj @@ -0,0 +1,83 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {D8869765-AB47-4C03-B2C5-E5498A55CA79} + Library + Properties + Gettext.Cs + Gettext.Cs + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + + + True + True + Strings.tt + + + + + TextTemplatingFileGenerator + Strings.cs + PreserveNewest + + + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/ParserRequestor.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/ParserRequestor.cs new file mode 100644 index 00000000..d2888cfa --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/ParserRequestor.cs @@ -0,0 +1,55 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Gettext.Cs +{ + /// + /// Interface for retrieving data from the parser. + /// + public interface IGettextParserRequestor + { + /// + /// Handles a key value pair parsed from the po file. + /// + void Handle(string key, string value); + } + + /// + /// Collects data from the parser into a dictionary. + /// + public class DictionaryGettextParserRequestor : Dictionary, IGettextParserRequestor + { + #region IGettextParserRequestor Members + + public void Handle(string key, string value) + { + this[key] = value; + } + + #endregion + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/PoParser.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/PoParser.cs new file mode 100644 index 00000000..b80d0bc9 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Parser/PoParser.cs @@ -0,0 +1,149 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; + +namespace Gettext.Cs +{ + /// + /// Parses standard po files. + /// + public class PoParser + { + /// + /// Parses an input po file. + /// + public void Parse(TextReader reader, IGettextParserRequestor requestor) + { + const int StateWaitingKey = 1; + const int StateConsumingKey = 2; + const int StateConsumingValue = 3; + + int state = StateWaitingKey; + + StringBuilder currentKey = null; + StringBuilder currentValue = null; + + string line; + while(true) { + line = reader.ReadLine(); + line = line == null ? null : line.Trim(); + if (line == null || line.Length == 0) + { + if (state == StateConsumingValue && + currentKey != null && + currentValue != null) + { + requestor.Handle(currentKey.ToString().Replace("\\n", "\n").Replace("\\\"", "\""), + currentValue.ToString().Replace("\\n", "\n").Replace("\\\"", "\"")); + currentKey = null; + currentValue = null; + } + + if (line == null) + break; + + state = StateWaitingKey; + continue; + } + else if (line[0] == '#') + { + continue; + } + + bool isMsgId = line.StartsWith("msgid "); + bool isMsgStr = !isMsgId && line.StartsWith("msgstr "); + + if (isMsgId || isMsgStr) + { + state = isMsgId ? StateConsumingKey : StateConsumingValue; + + int firstQuote = line.IndexOf('"'); + if (firstQuote == -1) + continue; + + int secondQuote = line.IndexOf('"', firstQuote + 1); + while (secondQuote != -1 && line[secondQuote - 1] == '\\') + secondQuote = line.IndexOf('"', secondQuote + 1); + if (secondQuote == -1) + continue; + + string piece = line.Substring(firstQuote + 1, secondQuote - firstQuote - 1); + + if (isMsgId) + { + currentKey = new StringBuilder(); + currentKey.Append(piece); + } + else + { + currentValue = new StringBuilder(); + currentValue.Append(piece); + } + } + else if (line[0] == '"') + { + if (line[line.Length - 1] == '"') + { + line = line.Substring(1, line.Length - 2); + } + else + { + line = line.Substring(1, line.Length - 1); + } + + switch (state) + { + case StateConsumingKey: + currentKey.Append(line); + break; + case StateConsumingValue: + currentValue.Append(line); + break; + } + } + } + } + + /// + /// Parses an input po file. + /// + public void Parse(string text, IGettextParserRequestor requestor) + { + Parse(new StringReader(text), requestor); + } + + /// + /// Parses an input po file into a dictionary. + /// + public Dictionary ParseIntoDictionary(TextReader reader) + { + var requestor = new DictionaryGettextParserRequestor(); + Parse(reader, requestor); + return requestor; + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Properties/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..51d908d2 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Properties/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Gettext.Cs")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Gettext.Cs")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1c3b8e32-0c8d-4d0f-ae9b-d38e4b45690a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceManager.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceManager.cs new file mode 100644 index 00000000..12b224c7 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceManager.cs @@ -0,0 +1,86 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections; +using System.Globalization; +using System.Resources; +using System.Configuration; + +namespace Gettext.Cs +{ + public class DatabaseResourceManager : System.Resources.ResourceManager + { + private string dsn; + private string sp; + + public DatabaseResourceManager() + : base() + { + this.dsn = ConfigurationManager.AppSettings["Gettext.ConnectionString"] ?? ConfigurationManager.ConnectionStrings["Gettext"].ConnectionString; + ResourceSets = new System.Collections.Hashtable(); + } + + public DatabaseResourceManager(string storedProcedure) + : this() + { + this.sp = storedProcedure; + } + + // Hack: kept for compatibility + public DatabaseResourceManager(string name, string path, string fileformat) + : this() + { + } + + protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) + { + DatabaseResourceSet rs = null; + + if (ResourceSets.Contains(culture.Name)) + { + rs = ResourceSets[culture.Name] as DatabaseResourceSet; + } + else + { + lock (ResourceSets) + { + // Check hash table once again after lock is set + if (ResourceSets.Contains(culture.Name)) + { + rs = ResourceSets[culture.Name] as DatabaseResourceSet; + } + else + { + rs = new DatabaseResourceSet(dsn, culture, sp); + ResourceSets.Add(culture.Name, rs); + } + } + } + + return rs; + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceReader.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceReader.cs new file mode 100644 index 00000000..eab8fcc7 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceReader.cs @@ -0,0 +1,121 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Resources; +using System.Collections; +using System.Data.SqlClient; +using System.Globalization; +using System.Configuration; + +namespace Gettext.Cs +{ + public class DatabaseResourceReader : IResourceReader + { + private string dsn; + private string language; + private string sp; + + public DatabaseResourceReader(string dsn, CultureInfo culture) + { + this.dsn = dsn; + this.language = culture.Name; + } + + public DatabaseResourceReader(string dsn, CultureInfo culture, string sp) + { + this.sp = sp; + this.dsn = dsn; + this.language = culture.Name; + } + + public System.Collections.IDictionaryEnumerator GetEnumerator() + { + Hashtable dict = new Hashtable(); + + SqlConnection connection = new SqlConnection(dsn); + SqlCommand command = connection.CreateCommand(); + + if (language == "") + language = CultureInfo.InvariantCulture.Name; + + // Use stored procedure or plain text + if (sp == null) + { + command.CommandText = string.Format("SELECT MessageKey, MessageValue FROM Message WHERE Culture = '{0}'", language); + } + else + { + command.CommandText = sp; + command.CommandType = System.Data.CommandType.StoredProcedure; + command.Parameters.AddWithValue("@culture", language); + } + + try + { + connection.Open(); + + using (SqlDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + if (reader.GetValue(1) != System.DBNull.Value) + { + dict[reader.GetString(0)] = reader.GetString(1); + } + } + } + + } + catch + { + bool raise = false; + if (bool.TryParse(ConfigurationManager.AppSettings["Gettext.Throw"], out raise) && raise) + { + throw; + } + } + finally + { + connection.Close(); + } + + return dict.GetEnumerator(); + } + + public void Close() + { + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + void IDisposable.Dispose() + { + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceSet.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceSet.cs new file mode 100644 index 00000000..c55b50a2 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/DatabaseResourceSet.cs @@ -0,0 +1,50 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Resources; +using System.Globalization; + +namespace Gettext.Cs +{ + public class DatabaseResourceSet : ResourceSet + { + internal DatabaseResourceSet(string dsn, CultureInfo culture) + : base (new DatabaseResourceReader(dsn, culture)) + { + } + + internal DatabaseResourceSet(string dsn, CultureInfo culture, string sp) + : base(new DatabaseResourceReader(dsn, culture, sp)) + { + } + + public override Type GetDefaultReader() + { + return typeof(DatabaseResourceReader); + } + } + +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/FileBasedResourceManager.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/FileBasedResourceManager.cs new file mode 100644 index 00000000..ec6c38b9 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/FileBasedResourceManager.cs @@ -0,0 +1,295 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Reflection; +using System.IO; +using System.Collections; + +namespace Gettext.Cs +{ + /// + /// Extendable file based resource manager. + /// + public class FileBasedResourceManager : System.Resources.ResourceManager + { + #region Properties + + string path; + string fileformat; + + /// + /// Path to retrieve the files from. + /// + public string Path + { + get { return path; } + set { path = value; } + } + + /// + /// Format of the resource set po file based on {{culture}} and {{resource}} placeholders. + /// + public string FileFormat + { + get { return fileformat; } + set { fileformat = value; } + } + + #endregion + + #region Notification Events + + /// + /// Arguments for events related to the creation, successful or not, of a resource set. + /// + public class ResourceSetCreationEventArgs : EventArgs + { + /// + /// Exception in case of error, null on success. + /// + public Exception Exception { get; set; } + + /// + /// FileName from where the resource set was loaded. + /// + public String FileName { get; set; } + + /// + /// Type of the resource set being initialized. + /// + public Type ResourceSetType { get; set; } + + /// + /// Instance of the resource set created, may be null on error. + /// + public System.Resources.ResourceSet ResourceSet { get; set; } + + /// + /// Whether the creation was successful. + /// + public bool Success { get; set; } + } + + /// + /// Event that notifies the successful creation of a resource set. + /// + public event EventHandler CreatedResourceSet; + + /// + /// Event that notifies an error creating a resource set. + /// + public event EventHandler FailedResourceSet; + + protected void RaiseCreatedResourceSet(string filename, System.Resources.ResourceSet set) + { + var handler = CreatedResourceSet; + if (handler != null) + { + handler(this, new ResourceSetCreationEventArgs + { + FileName = filename, + ResourceSet = set, + ResourceSetType = this.ResourceSetType, + Success = true + }); + } + } + + protected void RaiseFailedResourceSet(string filename, Exception ex) + { + var handler = FailedResourceSet; + if (handler != null) + { + handler(this, new ResourceSetCreationEventArgs + { + FileName = filename, + ResourceSet = null, + ResourceSetType = this.ResourceSetType, + Success = false, + Exception = ex + }); + } + } + + #endregion + + /// + /// Creates a new instance. + /// + /// Name of the resource + /// Path to retrieve the files from + /// Format of the file name using {{resource}} and {{culture}} placeholders. + public FileBasedResourceManager(string name, string path, string fileformat) + : base() + { + this.path = path; + this.fileformat = fileformat; + this.BaseNameField = name; + + base.IgnoreCase = false; + base.ResourceSets = new System.Collections.Hashtable(); + } + + protected override string GetResourceFileName(System.Globalization.CultureInfo culture) + { + return fileformat.Replace("{{culture}}", culture.Name).Replace("{{resource}}", BaseNameField); + } + + protected override System.Resources.ResourceSet InternalGetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents) + { + if (path == null && fileformat == null) return null; + if (culture == null || culture.Equals(CultureInfo.InvariantCulture)) return null; + + System.Resources.ResourceSet rs = null; + Hashtable resourceSets = this.ResourceSets; + + if (!TryFetchResourceSet(resourceSets, culture, out rs)) + { + string resourceFileName = this.FindResourceFile(culture); + if (resourceFileName == null) + { + if (tryParents) + { + CultureInfo parent = culture.Parent; + rs = this.InternalGetResourceSet(parent, createIfNotExists, tryParents); + AddResourceSet(resourceSets, culture, ref rs); + return rs; + } + } + else + { + rs = this.CreateResourceSet(resourceFileName); + AddResourceSet(resourceSets, culture, ref rs); + return rs; + } + } + + return rs; + } + + protected virtual System.Resources.ResourceSet InternalCreateResourceSet(string resourceFileName) + { + object[] args = new object[] { resourceFileName }; + return (System.Resources.ResourceSet)Activator.CreateInstance(this.ResourceSetType, args); + } + + private System.Resources.ResourceSet CreateResourceSet(string resourceFileName) + { + System.Resources.ResourceSet set = null; + + try + { + set = InternalCreateResourceSet(resourceFileName); + RaiseCreatedResourceSet(resourceFileName, set); + } + catch (Exception ex) + { + RaiseFailedResourceSet(resourceFileName, ex); + } + + return set; + } + + private string FindResourceFile(CultureInfo culture) + { + string resourceFileName = this.GetResourceFileName(culture); + string path = this.path ?? String.Empty; + + // Try with simple path + filename combination + string fullpath = System.IO.Path.Combine(path, resourceFileName); + if (File.Exists(fullpath)) return fullpath; + + // If path is relative, attempt different directories + if (path == String.Empty || !System.IO.Path.IsPathRooted(path)) + { + // Try the entry assembly dir + if (Assembly.GetEntryAssembly() != null) + { + string dir = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), path); + fullpath = System.IO.Path.Combine(dir, resourceFileName); + if (File.Exists(fullpath)) return fullpath; + } + + // Else try the executing assembly dir + if (Assembly.GetExecutingAssembly() != null) + { + if (Assembly.GetEntryAssembly() == null || System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) != System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) + { + string dir = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), path); + fullpath = System.IO.Path.Combine(dir, resourceFileName); + if (File.Exists(fullpath)) return fullpath; + } + } + } + + return null; + } + + private void AddResourceSet(Hashtable localResourceSets, CultureInfo culture, ref System.Resources.ResourceSet rs) + { + lock (localResourceSets) + { + if (localResourceSets.Contains(culture)) + { + var existing = (System.Resources.ResourceSet)localResourceSets[culture]; + + if (existing != null && !object.Equals(existing, rs)) + { + rs.Dispose(); + rs = existing; + var a = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings"); + } + } + else + { + localResourceSets.Add(culture, rs); + } + } + } + + private bool TryFetchResourceSet(Hashtable localResourceSets, CultureInfo culture, out System.Resources.ResourceSet set) + { + lock (localResourceSets) + { + if (ResourceSets.Contains(culture)) + { + set = (System.Resources.ResourceSet)ResourceSets[culture]; + return true; + } + + set = null; + return false; + } + } + + private bool ValidateGetResourceSet(CultureInfo culture) + { + return !(culture == null || culture.Equals(CultureInfo.InvariantCulture) || String.IsNullOrEmpty(culture.Name)); + } + + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceManager.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceManager.cs new file mode 100644 index 00000000..3d62b376 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceManager.cs @@ -0,0 +1,150 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using System.Reflection; +using System.Diagnostics; +using System.Globalization; +using System.Configuration; +using System.Collections.Specialized; +using System.Security.Permissions; +using System.Collections; + +namespace Gettext.Cs +{ + /// + /// Gettext based resource manager that reads from po files. + /// + public class GettextResourceManager : FileBasedResourceManager + { + #region Defaults + + const string defaultFileFormat = "{{culture}}\\{{resource}}.po"; + const string defaultPath = ""; + + #endregion + + #region Properties + + /// + /// Returns the Gettext resource set type used. + /// + public override Type ResourceSetType + { + get { return typeof(GettextResourceSet); } + } + + #endregion + + #region Constructos + + /// + /// Creates a new instance. + /// + /// Name of the resource + /// Path to retrieve the files from + /// Format of the file name using {{resource}} and {{culture}} placeholders. + public GettextResourceManager(string name, string path, string fileformat) + : base(name, path, fileformat) + { + } + + /// + /// Creates a new instance using local path and "{{culture}}\{{resource}}.po" file format. + /// + /// Name of the resource + public GettextResourceManager(string name) + : base(name, defaultPath, defaultFileFormat) + { + } + + #endregion + + #region Configuration + + /// + /// Loads the named configuration section and retrieves file format and path from "fileformat" and "path" settings. + /// + /// Name of the section to retrieve. + /// True if the configuration section was loaded. + public bool LoadConfiguration(string section) + { + var config = ConfigurationManager.GetSection(section) as NameValueCollection; + + if (config == null) return false; + + this.FileFormat = config["fileformat"] ?? FileFormat; + this.Path = config["path"] ?? Path; + + return true; + } + + /// + /// Creates a new instance retrieving path and fileformat from the specified configuration section. + /// + /// Name of the resource + /// Name of the configuration section + /// New instance of ResourceManager + public static FileBasedResourceManager CreateFromConfiguration(string name, string section) + { + return CreateFromConfiguration(name, section, defaultFileFormat, defaultPath); + } + + /// + /// Creates a new instance retrieving path and fileformat from the specified configuration section. + /// + /// Name of the resource + /// Name of the configuration section with fileformat and path settings + /// File format to be used if configuration could not be retrieved + /// Path to be used if configuration could not be retrieved + /// New instance of ResourceManager + public static FileBasedResourceManager CreateFromConfiguration(string name, string section, string fallbackFileFormat, string fallbackPath) + { + var config = ConfigurationManager.GetSection(section) as NameValueCollection; + + string fileformat = null; + string path = null; + + if (config == null) + { + fileformat = fallbackFileFormat; + path = fallbackPath; + } + else + { + fileformat = config["fileformat"] ?? fallbackFileFormat; + path = config["path"] ?? fallbackPath; + } + + return new FileBasedResourceManager(name, path, fileformat); + } + + #endregion + + } + + +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceReader.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceReader.cs new file mode 100644 index 00000000..dc3a0b7e --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceReader.cs @@ -0,0 +1,87 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Resources; +using System.IO; + +namespace Gettext.Cs +{ + public class GettextResourceReader : IResourceReader + { + Stream stream; + + public GettextResourceReader(Stream stream) + { + this.stream = stream; + } + + #region IResourceReader Members + + public void Close() + { + if (stream != null) + { + this.stream.Close(); + } + } + + public System.Collections.IDictionaryEnumerator GetEnumerator() + { + if (stream == null) + { + throw new ArgumentNullException("Input stream cannot be null"); + } + + using (var reader = new StreamReader(stream)) + { + return new PoParser().ParseIntoDictionary(reader).GetEnumerator(); + } + } + + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + #endregion + + #region IDisposable Members + + public void Dispose() + { + if (stream != null) + { + stream.Dispose(); + } + } + + #endregion + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceSet.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceSet.cs new file mode 100644 index 00000000..614eb9c8 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Resource/GettextResourceSet.cs @@ -0,0 +1,49 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using System.Globalization; + +namespace Gettext.Cs +{ + public class GettextResourceSet : System.Resources.ResourceSet + { + public GettextResourceSet(string filename) + : base(new GettextResourceReader(File.OpenRead(filename))) + { + } + + public GettextResourceSet(Stream stream) + : base(new GettextResourceReader(stream)) + { + } + + public override Type GetDefaultReader() + { + return typeof(Gettext.Cs.GettextResourceReader); + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.cs new file mode 100644 index 00000000..64c9ec22 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.cs @@ -0,0 +1,166 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Threading; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace Gettext +{ + public class Strings + { + private static Object resourceManLock = new Object(); + private static System.Resources.ResourceManager resourceMan; + private static System.Globalization.CultureInfo resourceCulture; + + public const string ResourceName = "Strings"; + + private static string resourcesDir = GetSetting("ResourcesDir", "Po"); + private static string fileFormat = GetSetting("ResourcesFileFormat", "{{culture}}/{{resource}}.po"); + + private static string GetSetting(string setting, string defaultValue) + { + var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings"); + if (section == null) return defaultValue; + else return section[setting] ?? defaultValue; + } + + + /// + /// Resources directory used to retrieve files from. + /// + public static string ResourcesDirectory + { + get { return resourcesDir; } + set { resourcesDir = value; } + } + + /// + /// Format of the file based on culture and resource name. + /// + public static string FileFormat + { + get { return fileFormat; } + set { fileFormat = value; } + } + + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + public static System.Resources.ResourceManager ResourceManager + { + get + { + + if (object.ReferenceEquals(resourceMan, null)) + { + lock (resourceManLock) + { + if (object.ReferenceEquals(resourceMan, null)) + { + var directory = resourcesDir; + var mgr = new global::Gettext.Cs.GettextResourceManager(ResourceName, directory, fileFormat); + resourceMan = mgr; + } + } + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + public static System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(string t) + { + return T(null, t); + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t) + { + if (String.IsNullOrEmpty(t)) return t; + var translated = ResourceManager.GetString(t, info ?? resourceCulture); + return String.IsNullOrEmpty(translated) ? t : translated; + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(string t, params object[] parameters) + { + return T(null, t, parameters); + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t, params object[] parameters) + { + if (String.IsNullOrEmpty(t)) return t; + return String.Format(T(info, t), parameters); + } + + /// + /// Marks a string for future translation, does not translate it now. + /// + public static string M(string t) + { + return t; + } + + /// + /// Returns the resource set available for the specified culture. + /// + public static System.Resources.ResourceSet GetResourceSet(CultureInfo culture) + { + return ResourceManager.GetResourceSet(culture, true, true); + } + } +} + diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.tt b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.tt new file mode 100644 index 00000000..88ff36c8 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Core/Gettext.Cs/Templates/Strings.tt @@ -0,0 +1,196 @@ +<#@ template language="C#v3.5" hostspecific="True" #> +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Threading; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace <#= this.NamespaceName #> +{ + public class <#= this.ClassName #> + { + private static Object resourceManLock = new Object(); + private static System.Resources.ResourceManager resourceMan; + private static System.Globalization.CultureInfo resourceCulture; + + public const string ResourceName = "<#= this.ResourceName #>"; + +<# if (!UseDatabase) { #> + private static string resourcesDir = GetSetting("ResourcesDir", "<#= this.DefaultResourceDir #>"); + private static string fileFormat = GetSetting("ResourcesFileFormat", "<#= this.DefaultFileFormat #>"); +<# } #> + + private static string GetSetting(string setting, string defaultValue) + { + var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("<#= this.ConfigurationSection #>"); + if (section == null) return defaultValue; + else return section[setting] ?? defaultValue; + } + +<# if (!UseDatabase) { #> + /// + /// Resources directory used to retrieve files from. + /// + public static string ResourcesDirectory + { + get { return resourcesDir; } + set { resourcesDir = value; } + } + + /// + /// Format of the file based on culture and resource name. + /// + public static string FileFormat + { + get { return fileFormat; } + set { fileFormat = value; } + } +<# } #> + +<# if (ResourceManagerExpires) { #> + private static DateTime resourceManagerLoadedAt = DateTime.Now; +<# } #> + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + public static System.Resources.ResourceManager ResourceManager + { + get + { +<# if (ResourceManagerExpires) { #> + if (resourceMan != null && DateTime.Now.Subtract(resourceManagerLoadedAt).TotalMinutes >= <#= ResourceManagerTTL #>) + { + lock (resourceManLock) + { + if (resourceMan != null && DateTime.Now.Subtract(resourceManagerLoadedAt).TotalMinutes >= <#= ResourceManagerTTL #>) + { + resourceMan.ReleaseAllResources(); + resourceMan = null; + } + } + } +<# } #> + + if (object.ReferenceEquals(resourceMan, null)) + { + lock (resourceManLock) + { + if (object.ReferenceEquals(resourceMan, null)) + { +<# if (UseDatabase) { #> + var mgr = new global::Gettext.Cs.DatabaseResourceManager("<#= this.StoredProcedureName #>"); +<# } else { #> + var directory = resourcesDir; + <# if (ServerMapPath) { #> + if (System.Web.HttpContext.Current != null) + directory = System.Web.HttpContext.Current.Server.MapPath(directory); + <# } #> + var mgr = <#= String.Format(this.ResourceManagerCtor, this.ResourceManagerType) #>; + <# if (ResourceManagerExpires) { #> + resourceManagerLoadedAt = DateTime.Now; + <# } #> +<# } #> + resourceMan = mgr; + } + } + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + public static System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(string t) + { + return T(null, t); + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t) + { + if (String.IsNullOrEmpty(t)) return t; + var translated = ResourceManager.GetString(t, info ?? resourceCulture); + return String.IsNullOrEmpty(translated) ? t : translated; + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(string t, params object[] parameters) + { + return T(null, t, parameters); + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t, params object[] parameters) + { + if (String.IsNullOrEmpty(t)) return t; + return String.Format(T(info, t), parameters); + } + + /// + /// Marks a string for future translation, does not translate it now. + /// + public static string M(string t) + { + return t; + } + + /// + /// Returns the resource set available for the specified culture. + /// + public static System.Resources.ResourceSet GetResourceSet(CultureInfo culture) + { + return ResourceManager.GetResourceSet(culture, true, true); + } + } +} + +<#+ + // Template parameters + + string ClassName = "Strings"; + string ResourceName = "Strings"; + string NamespaceName = "Gettext"; + + string ResourceManagerType = "global::Gettext.Cs.GettextResourceManager"; + string ResourceManagerCtor = "new {0}(ResourceName, directory, fileFormat)"; + string DefaultResourceDir = "Po"; + string DefaultFileFormat = "{{culture}}/{{resource}}.po"; + + string ConfigurationSection = "appSettings"; + bool ServerMapPath = false; + + bool ResourceManagerExpires = false; + int ResourceManagerTTL = 0; + + bool UseDatabase = false; + string StoredProcedureName = "GettextGetResourceSet"; +#> diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Gettext.CsUtils.sln b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Gettext.CsUtils.sln new file mode 100644 index 00000000..b1d2c6bd --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Gettext.CsUtils.sln @@ -0,0 +1,125 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{FD8EF9F6-9B97-456A-98E0-E94DB2BD3EED}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{64737816-54EF-4891-A58D-0642F07F09AD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gnu.Getopt", "Lib\Gnu.Getopt\Gnu.Getopt.csproj", "{379BC478-7D84-4E0E-A4B8-197905C824AE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.AspExtract", "Tools\Gettext.AspExtract\Gettext.AspExtract.csproj", "{88A09FE2-5DE0-4C6E-9C4C-BB5E8A490CF5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Msgfmt", "Tools\Gettext.Msgfmt\Gettext.Msgfmt.csproj", "{F72A7CBA-E656-4ECA-97F9-2B601E0BCDF9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.ResourcesReplacer", "Tools\Gettext.ResourcesReplacer\Gettext.ResourcesReplacer.csproj", "{11BDD346-EDFA-439D-A42D-A1D4FDB64C9A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{380A3584-88CB-4153-9BC1-C18CFAE9EF26}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Cs", "Core\Gettext.Cs\Gettext.Cs.csproj", "{D8869765-AB47-4C03-B2C5-E5498A55CA79}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gnu.Gettext", "Lib\Gnu.Gettext\Gnu.Gettext.csproj", "{859A653A-7728-4F02-BAF2-A5CD8F991916}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Cs.Web", "Core\Gettext.Cs.Web\Gettext.Cs.Web.csproj", "{38474466-DA21-4D19-A4D8-E2E7918480D6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.DatabaseResourceGenerator", "Tools\Gettext.DatabaseResourceGenerator\Gettext.DatabaseResourceGenerator.csproj", "{B19D8863-C5C2-4A13-B24A-566EB7498D17}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{DF21B331-8022-4958-AEF7-D7897814038A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Samples.Console", "Samples\Gettext.Samples.Console\Gettext.Samples.Console.csproj", "{470FDBA5-04E5-4A9F-80EA-987D1F8D9074}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Cs.Tests", "Core\Gettext.Cs.Tests\Gettext.Cs.Tests.csproj", "{C4B4300B-5B96-4F43-BD7D-517A29693B30}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Iconv", "Tools\Gettext.Iconv\Gettext.Iconv.csproj", "{7578444A-E104-4D72-94B5-DDCB1DA0D63F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Samples.Mvc", "Samples\Gettext.Samples.Mvc\Gettext.Samples.Mvc.csproj", "{208D43F3-84E6-45B9-B6CC-6E3F48E42A82}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Samples.Database", "Samples\Gettext.Samples.Database\Gettext.Samples.Database.csproj", "{9FBD5BA7-BCE6-48FE-9FB7-396F377D1313}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gettext.Samples.Spanish", "Samples\Gettext.Samples.Spanish\Gettext.Samples.Spanish.csproj", "{7404A86D-53FA-4B1B-B6FC-D84EB6F5E2D5}" +EndProject +Global + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = Gettext.CsUtils.vsmdi + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {379BC478-7D84-4E0E-A4B8-197905C824AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {379BC478-7D84-4E0E-A4B8-197905C824AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {379BC478-7D84-4E0E-A4B8-197905C824AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {379BC478-7D84-4E0E-A4B8-197905C824AE}.Release|Any CPU.Build.0 = Release|Any CPU + {88A09FE2-5DE0-4C6E-9C4C-BB5E8A490CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88A09FE2-5DE0-4C6E-9C4C-BB5E8A490CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88A09FE2-5DE0-4C6E-9C4C-BB5E8A490CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88A09FE2-5DE0-4C6E-9C4C-BB5E8A490CF5}.Release|Any CPU.Build.0 = Release|Any CPU + {F72A7CBA-E656-4ECA-97F9-2B601E0BCDF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F72A7CBA-E656-4ECA-97F9-2B601E0BCDF9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F72A7CBA-E656-4ECA-97F9-2B601E0BCDF9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F72A7CBA-E656-4ECA-97F9-2B601E0BCDF9}.Release|Any CPU.Build.0 = Release|Any CPU + {11BDD346-EDFA-439D-A42D-A1D4FDB64C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {11BDD346-EDFA-439D-A42D-A1D4FDB64C9A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {11BDD346-EDFA-439D-A42D-A1D4FDB64C9A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11BDD346-EDFA-439D-A42D-A1D4FDB64C9A}.Release|Any CPU.Build.0 = Release|Any CPU + {D8869765-AB47-4C03-B2C5-E5498A55CA79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D8869765-AB47-4C03-B2C5-E5498A55CA79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D8869765-AB47-4C03-B2C5-E5498A55CA79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D8869765-AB47-4C03-B2C5-E5498A55CA79}.Release|Any CPU.Build.0 = Release|Any CPU + {859A653A-7728-4F02-BAF2-A5CD8F991916}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {859A653A-7728-4F02-BAF2-A5CD8F991916}.Debug|Any CPU.Build.0 = Debug|Any CPU + {859A653A-7728-4F02-BAF2-A5CD8F991916}.Release|Any CPU.ActiveCfg = Release|Any CPU + {859A653A-7728-4F02-BAF2-A5CD8F991916}.Release|Any CPU.Build.0 = Release|Any CPU + {38474466-DA21-4D19-A4D8-E2E7918480D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38474466-DA21-4D19-A4D8-E2E7918480D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38474466-DA21-4D19-A4D8-E2E7918480D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38474466-DA21-4D19-A4D8-E2E7918480D6}.Release|Any CPU.Build.0 = Release|Any CPU + {B19D8863-C5C2-4A13-B24A-566EB7498D17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B19D8863-C5C2-4A13-B24A-566EB7498D17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B19D8863-C5C2-4A13-B24A-566EB7498D17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B19D8863-C5C2-4A13-B24A-566EB7498D17}.Release|Any CPU.Build.0 = Release|Any CPU + {470FDBA5-04E5-4A9F-80EA-987D1F8D9074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {470FDBA5-04E5-4A9F-80EA-987D1F8D9074}.Debug|Any CPU.Build.0 = Debug|Any CPU + {470FDBA5-04E5-4A9F-80EA-987D1F8D9074}.Release|Any CPU.ActiveCfg = Release|Any CPU + {470FDBA5-04E5-4A9F-80EA-987D1F8D9074}.Release|Any CPU.Build.0 = Release|Any CPU + {C4B4300B-5B96-4F43-BD7D-517A29693B30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4B4300B-5B96-4F43-BD7D-517A29693B30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4B4300B-5B96-4F43-BD7D-517A29693B30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4B4300B-5B96-4F43-BD7D-517A29693B30}.Release|Any CPU.Build.0 = Release|Any CPU + {7578444A-E104-4D72-94B5-DDCB1DA0D63F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7578444A-E104-4D72-94B5-DDCB1DA0D63F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7578444A-E104-4D72-94B5-DDCB1DA0D63F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7578444A-E104-4D72-94B5-DDCB1DA0D63F}.Release|Any CPU.Build.0 = Release|Any CPU + {208D43F3-84E6-45B9-B6CC-6E3F48E42A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {208D43F3-84E6-45B9-B6CC-6E3F48E42A82}.Debug|Any CPU.Build.0 = Debug|Any CPU + {208D43F3-84E6-45B9-B6CC-6E3F48E42A82}.Release|Any CPU.ActiveCfg = Release|Any CPU + {208D43F3-84E6-45B9-B6CC-6E3F48E42A82}.Release|Any CPU.Build.0 = Release|Any CPU + {9FBD5BA7-BCE6-48FE-9FB7-396F377D1313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FBD5BA7-BCE6-48FE-9FB7-396F377D1313}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FBD5BA7-BCE6-48FE-9FB7-396F377D1313}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FBD5BA7-BCE6-48FE-9FB7-396F377D1313}.Release|Any CPU.Build.0 = Release|Any CPU + {7404A86D-53FA-4B1B-B6FC-D84EB6F5E2D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7404A86D-53FA-4B1B-B6FC-D84EB6F5E2D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7404A86D-53FA-4B1B-B6FC-D84EB6F5E2D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7404A86D-53FA-4B1B-B6FC-D84EB6F5E2D5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {88A09FE2-5DE0-4C6E-9C4C-BB5E8A490CF5} = {FD8EF9F6-9B97-456A-98E0-E94DB2BD3EED} + {F72A7CBA-E656-4ECA-97F9-2B601E0BCDF9} = {FD8EF9F6-9B97-456A-98E0-E94DB2BD3EED} + {11BDD346-EDFA-439D-A42D-A1D4FDB64C9A} = {FD8EF9F6-9B97-456A-98E0-E94DB2BD3EED} + {B19D8863-C5C2-4A13-B24A-566EB7498D17} = {FD8EF9F6-9B97-456A-98E0-E94DB2BD3EED} + {7578444A-E104-4D72-94B5-DDCB1DA0D63F} = {FD8EF9F6-9B97-456A-98E0-E94DB2BD3EED} + {379BC478-7D84-4E0E-A4B8-197905C824AE} = {64737816-54EF-4891-A58D-0642F07F09AD} + {859A653A-7728-4F02-BAF2-A5CD8F991916} = {64737816-54EF-4891-A58D-0642F07F09AD} + {D8869765-AB47-4C03-B2C5-E5498A55CA79} = {380A3584-88CB-4153-9BC1-C18CFAE9EF26} + {38474466-DA21-4D19-A4D8-E2E7918480D6} = {380A3584-88CB-4153-9BC1-C18CFAE9EF26} + {C4B4300B-5B96-4F43-BD7D-517A29693B30} = {380A3584-88CB-4153-9BC1-C18CFAE9EF26} + {470FDBA5-04E5-4A9F-80EA-987D1F8D9074} = {DF21B331-8022-4958-AEF7-D7897814038A} + {208D43F3-84E6-45B9-B6CC-6E3F48E42A82} = {DF21B331-8022-4958-AEF7-D7897814038A} + {9FBD5BA7-BCE6-48FE-9FB7-396F377D1313} = {DF21B331-8022-4958-AEF7-D7897814038A} + {7404A86D-53FA-4B1B-B6FC-D84EB6F5E2D5} = {DF21B331-8022-4958-AEF7-D7897814038A} + EndGlobalSection +EndGlobal diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/AssemblyInfo.cs new file mode 100644 index 00000000..c22a6b26 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/AssemblyInfo.cs @@ -0,0 +1,88 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("GNU Getopt Argument Parser")] +[assembly: AssemblyDescription("This is a C# port of a Java port of GNU " + + "Getopt, a class for parsing command line arguments passed to programs. " + + "It is based on the C getopt() functions in glibc 2.0.6 and should " + + "parse options in a 100% compatible manner.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Free Software Foundation, Inc.")] +[assembly: AssemblyProduct("GNU Getopt")] +[assembly: AssemblyCopyright("Copyright (c) 1987-1997 Free Software " + + "Foundation, Inc., Java Port Copyright (c) 1998 by Aaron M. Renn " + + "(arenn@urbanophile.com), C#.NET Port of the Java Port Copyright (c) " + + "2004 by Klaus Prckl (klaus.prueckl@aon.at)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("0.9.1.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly:CLSCompliant(true)] +[assembly:ComVisible(true)] \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Getopt.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Getopt.cs new file mode 100644 index 00000000..b159a172 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Getopt.cs @@ -0,0 +1,1417 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +/************************************************************************** +/* Getopt.cs -- C#.NET port of Java port of GNU getopt from glibc 2.0.6 +/* +/* Copyright (c) 1987-1997 Free Software Foundation, Inc. +/* Java Port Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com) +/* C#.NET Port Copyright (c) 2004 by Klaus Prckl (klaus.prueckl@aon.at) +/* +/* This program is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation; either version 2 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this program; see the file COPYING.LIB. If not, write to +/* the Free Software Foundation Inc., 59 Temple Place - Suite 330, +/* Boston, MA 02111-1307 USA +/**************************************************************************/ + +using System; +using System.Configuration; +using System.Globalization; +using System.Reflection; +using System.Resources; + +namespace Gnu.Getopt +{ + /// + /// This is a C# port of a Java port of GNU getopt, a class for parsing + /// command line arguments passed to programs. It it based on the C + /// getopt() functions in glibc 2.0.6 and should parse options in a 100% + /// compatible manner. If it does not, that is a bug. The programmer's + /// interface is also very compatible. + /// + /// + /// To use Getopt, create a Getopt object with a args array passed to the + /// main method, then call the method in a loop. It + /// will return an that contains the value of the option + /// character parsed from the command line. When there are no more options + /// to be parsed, it returns -1. + /// + /// A command line option can be defined to take an argument. If an option + /// has an argument, the value of that argument is stored in an instance + /// variable called optarg, which can be accessed using the + /// property. + /// If an option that requires an argument is found, but there is no + /// argument present, then an error message is printed. Normally + /// returns a '?' in this situation, but that + /// can be changed as described below. + /// + /// + /// If an invalid option is encountered, an error message is printed to + /// the standard error and returns a '?'. + /// The value of the invalid option encountered is stored in the instance + /// variable optopt which can be retrieved using the + /// property. + /// To suppress the printing of error messages for this or any other error, + /// set the value of the opterr instance variable to false using the + /// property. + /// + /// + /// Between calls to , the instance variable + /// optind is used to keep track of where the object is in the + /// parsing process. After all options have been returned, optind + /// is the index in argv of the first non-option argument. + /// This variable can be accessed with the property. + /// + /// + /// Note that this object expects command line options to be passed in the + /// traditional Unix manner. That is, proceeded by a '-' character. + /// Multiple options can follow the '-'. For example "-abc" + /// is equivalent to "-a -b -c". If an option takes a required + /// argument, the value of the argument can immediately follow the option + /// character or be present in the next argv element. For example, + /// "-cfoo" and "-c foo" both represent an option character + /// of 'c' with an argument of "foo" assuming c takes + /// a required argument. + /// If an option takes an argument that is not required, then any argument + /// must immediately follow the option character in the same argv element. + /// For example, if c takes a non-required argument, then "-cfoo" + /// represents option character 'c' with an argument of "foo" + /// while "-c foo" represents the option character 'c' with + /// no argument, and a first non-option argv element of "foo". + /// + /// + /// The user can stop from scanning any further into + /// a command line by using the special argument "--" by itself. + /// For example: + /// "-a -- -d" would return an option character of 'a', then + /// return -1. + /// The "--" is discarded and "-d" is pointed to by + /// optind as the first non-option argv element. + /// + /// + /// Here is a basic example of using Getopt: + /// + /// Getopt g = new Getopt("testprog", args, "ab:c::d"); + /// + /// int c; + /// string arg; + /// while ((c = g.getopt()) != -1) + /// { + /// switch(c) + /// { + /// case 'a': + /// case 'd': + /// Console.WriteLine("You picked " + (char)c ); + /// break; + /// + /// case 'b': + /// case 'c': + /// arg = g.Optarg; + /// Console.WriteLine("You picked " + (char)c + + /// " with an argument of " + + /// ((arg != null) ? arg : "null") ); + /// break; + /// + /// case '?': + /// break; // getopt() already printed an error + /// + /// default: + /// Console.WriteLine("getopt() returned " + c); + /// break; + /// } + /// } + /// + /// In this example, a new Getopt object is created with three params. The + /// first param is the program name. This is for printing error messages in + /// the form "program: error message". In the C version, this value is + /// taken from argv[0], but in .NET the program name is not passed in that + /// element, thus the need for this parameter. The second param is the + /// argument list that was passed to the main() method. The third param is + /// the list of valid options. Each character represents a valid option. If + /// the character is followed by a single colon, then that option has a + /// required argument. If the character is followed by two colons, then + /// that option has an argument that is not required. + /// + /// Note in this example that the value returned from + /// is cast to a char prior to printing. This is required in order to make + /// the value display correctly as a character instead of an integer. + /// + /// + /// If the first character in the option string is a colon, for example + /// ":abc::d", then will return a ':' + /// instead of a '?' when it encounters an option with a missing + /// required argument. This allows the caller to distinguish between + /// invalid options and valid options that are simply incomplete. + /// + /// In the traditional Unix getopt(), -1 is returned when the first + /// non-option charcter is encountered. In GNU getopt(), the default + /// behavior is to allow options to appear anywhere on the command line. + /// The method permutes the argument to make it appear + /// to the caller that all options were at the beginning of the command + /// line, and all non-options were at the end. For example, calling + /// with command line argv of "-a foo bar -d" + /// returns options 'a' and 'd', then sets optind to point to + /// "foo". The program would read the last two argv elements as + /// "foo" and "bar", just as if the user had typed + /// "-a -d foo bar". + /// + /// + /// The user can force to stop scanning the command + /// line with the special argument "--" by itself. Any elements + /// occuring before the "--" are scanned and permuted as normal. Any + /// elements after the "--" are returned as is as non-option argv + /// elements. For example, "foo -a -- bar -d" would return option + /// 'a' then -1. optind would point to "foo", + /// "bar" and "-d" as the non-option argv elements. The + /// "--" is discarded by . + /// + /// + /// There are two ways this default behavior can be modified. The first is + /// to specify traditional Unix getopt() behavior (which is also POSIX + /// behavior) in which scanning stops when the first non-option argument + /// encountered. (Thus "-a foo bar -d" would return 'a' as an + /// option and have "foo", "bar", and "-d" as + /// non-option elements). + /// The second is to allow options anywhere, but to return all elements in + /// the order they occur on the command line. + /// When a non-option element is ecountered, an integer 1 is returned and + /// the value of the non-option element is stored in optarg is if + /// it were the argument to that option. + /// For example, "-a foo -d", returns first 'a', then 1 (with + /// optarg set to "foo") then 'd' then -1. + /// When this "return in order" functionality is enabled, the only way to + /// stop getopt from scanning all command line elements is to + /// use the special "--" string by itself as described above. An + /// example is "-a foo -b -- bar", which would return 'a', + /// then integer 1 with optarg set to "foo", then 'b', + /// then -1. + /// optind would then point to "bar" as the first non-option + /// argv element. The "--" is discarded. + /// + /// + /// The POSIX/traditional behavior is enabled by either setting the + /// application setting "Gnu.PosixlyCorrect" or by putting a '+' + /// sign as the first character of the option string. + /// The difference between the two methods is that setting the + /// "Gnu.PosixlyCorrect" application setting also forces certain error + /// messages to be displayed in POSIX format. + /// To enable the "return in order" functionality, put a '-' as the + /// first character of the option string. Note that after determining the + /// proper behavior, Getopt strips this leading '+' or '-', + /// meaning that a ':' placed as the second character after one of + /// those two will still cause to return a ':' + /// instead of a '?' if a required option argument is missing. + /// + /// + /// In addition to traditional single character options, GNU Getopt also + /// supports long options. These are preceeded by a "--" sequence + /// and can be as long as desired. Long options provide a more + /// user-friendly way of entering command line options. + /// For example, in addition to a "-h" for help, a program could + /// support also "--help". + /// + /// + /// Like short options, long options can also take a required or + /// non-required argument. Required arguments can either be specified by + /// placing an equals sign after the option name, then the argument, or by + /// putting the argument in the next argv element. For example: + /// "--outputdir=foo" and "--outputdir foo" both represent an + /// option of "outputdir" with an argument of "foo", assuming + /// that outputdir takes a required argument. If a long option takes a + /// non-required argument, then the equals sign form must be used to + /// specify the argument. In this case, "--outputdir=foo" would + /// represent option outputdir with an argument of foo while + /// "--outputdir foo" would represent the option outputdir with no + /// argument and a first non-option argv element of "foo". + /// + /// + /// Long options can also be specified using a special POSIX argument + /// format (one that I highly discourage). This form of entry is enabled by + /// placing a "W;" (yes, 'W' then a semi-colon) in the valid + /// option string. + /// This causes getopt to treat the name following the "-W" as the + /// name of the long option. For example, "-W outputdir=foo" would + /// be equivalent to "--outputdir=foo". The name can immediately + /// follow the "-W" like so: "-Woutputdir=foo". + /// Option arguments are handled identically to normal long options. If a + /// string follows the "-W" that does not represent a + /// valid long option, then returns 'W' and + /// the caller must decide what to do. Otherwise + /// returns a long option value as described below. + /// + /// + /// While long options offer convenience, they can also be tedious to type + /// in full. So it is permissible to abbreviate the option name to as few + /// characters as required to uniquely identify it. If the name can + /// represent multiple long options, then an error message is printed and + /// returns a '?'. + /// + /// + /// If an invalid option is specified or a required option argument is + /// missing, prints an error and returns a '?' + /// or ':' exactly as for short options. + /// Note that when an invalid long option is encountered, the optopt + /// variable is set to integer 0 and so cannot be used to identify the + /// incorrect option the user entered. + /// + /// + /// Long options are defined by objects. These + /// objects are created with a contructor that takes four params: a string + /// representing the object name, a integer specifying what arguments the + /// option takes (the value is one of the + /// enumeration: , + /// , or ), + /// a flag object (described + /// below), and an integer value (described below). + /// + /// + /// To enable long option parsing, create an array of + /// 's representing the legal options and pass it to + /// the Getopt() constructor. + /// WARNING: If all elements of the array are not populated with + /// objects, the method will + /// throw a . + /// + /// + /// When is called and a long option is encountered, + /// one of two things can be returned. + /// If the flag field in the object representing the + /// long option is non-null, then the integer value field is stored there + /// and an integer 0 is returned to the caller. + /// The val field can then be retrieved from the flag field. + /// Note that since the flag field is a + /// , the appropriate string to + /// integer converions must be performed in order to get the actual int + /// value stored there. + /// If the flag field in the object is null, + /// then the value field of the is returned. + /// This can be the character of a short option. + /// This allows an app to have both a long and short option sequence (say, + /// "-h" and "--help") that do the exact same thing. + /// + /// + /// With long options, there is an alternative method of determining which + /// option was selected. The property Longind will return the index in the + /// long option array (NOT argv) of the long option found. So if multiple + /// long options are configured to return the same value, the application + /// can use to distinguish between them. + /// + /// + /// Here is an expanded Getopt example using long options and various + /// techniques described above: + /// + /// int c; + /// string arg; + /// LongOpt[] longopts = new LongOpt[3]; + /// + /// StringBuffer sb = new StringBuffer(); + /// longopts[0] = new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'); + /// longopts[1] = new LongOpt("outputdir", LongOpt.REQUIRED_ARGUMENT, sb, 'o'); + /// longopts[2] = new LongOpt("maximum", LongOpt.OPTIONAL_ARGUMENT, null, 2); + /// + /// Getopt g = new Getopt("testprog", argv, "-:bc::d:hW;", longopts); + /// g.Opterr = false; // We'll do our own error handling + /// + /// while ((c = g.getopt()) != -1) + /// switch (c) + /// { + /// case 0: + /// arg = g.getOptarg(); + /// Console.WriteLine("Got long option with value '" + + /// (char)(new Integer(sb.toString())).intValue() + /// + "' with argument " + + /// ((arg != null) ? arg : "null")); + /// break; + /// + /// case 1: + /// Console.WriteLine("I see you have return in order set and that " + + /// "a non-option argv element was just found " + + /// "with the value '" + g.Optarg + "'"); + /// break; + /// + /// case 2: + /// arg = g.getOptarg(); + /// Console.WriteLine("I know this, but pretend I didn't"); + /// Console.WriteLine("We picked option " + + /// longopts[g.Longind].getName() + + /// " with value " + + /// ((arg != null) ? arg : "null")); + /// break; + /// + /// case 'b': + /// Console.WriteLine("You picked plain old option " + (char)c); + /// break; + /// + /// case 'c': + /// case 'd': + /// arg = g.getOptarg(); + /// Console.WriteLine("You picked option '" + (char)c + + /// "' with argument " + + /// ((arg != null) ? arg : "null")); + /// break; + /// + /// case 'h': + /// Console.WriteLine("I see you asked for help"); + /// break; + /// + /// case 'W': + /// Console.WriteLine("Hmmm. You tried a -W with an incorrect long " + + /// "option name"); + /// break; + /// + /// case ':': + /// Console.WriteLine("Doh! You need an argument for option " + + /// (char)g.getOptopt()); + /// break; + /// + /// case '?': + /// Console.WriteLine("The option '" + (char)g.getOptopt() + + /// "' is not valid"); + /// break; + /// + /// default: + /// Console.WriteLine("getopt() returned " + c); + /// break; + /// } + /// + /// for (int i = g.getOptind(); i < argv.length ; i++) + /// Console.WriteLine("Non option argv element: " + argv[i] ); + /// + /// + /// There is an alternative form of the constructor used for long options + /// above. This takes a trailing boolean flag. If set to false, Getopt + /// performs identically to the example, but if the boolean flag is true + /// then long options are allowed to start with a single '-' instead + /// of "--". If the first character of the option is a valid short + /// option character, then the option is treated as if it were the short + /// option. Otherwise it behaves as if the option is a long option. + /// Note that the name given to this option - longOnly - is very + /// counter-intuitive. + /// It does not cause only long options to be parsed but instead enables + /// the behavior described above. + /// + /// + /// + /// Note that the functionality and variable names used are driven from the + /// C lib version as this object is a port of the C code, not a new + /// implementation. This should aid in porting existing C/C++ code, as well + /// as helping programmers familiar with the glibc version to adapt to the + /// C#.NET version. + /// + /// + /// Roland McGrath (roland@gnu.ai.mit.edu) + /// Ulrich Drepper (drepper@cygnus.com) + /// Aaron M. Renn (arenn@urbanophile.com) + /// Klaus Prckl (klaus.prueckl@aon.at) + /// LongOpt + public class Getopt + { + /// + /// Describe how to deal with options that follow non-option + /// ARGV-elements. + /// + /// If the caller did not specify anything, the default is RequireOrder + /// if the application setting Gnu.PosixlyCorrect is defined, Permute + /// otherwise. + /// + /// The special argument "--" forces an end of option-scanning + /// regardless of the value of ordering. In the case of + /// ReturnInOrder, only -- can cause to + /// return -1 with optind != argv.Length. + /// + private enum Order + { + /// + /// RequireOrder means don't recognize them as options; stop option + /// processing when the first non-option is seen. This is what Unix + /// does. This mode of operation is selected by either setting the + /// application setting Gnu.PosixlyCorrect, or using '+' as + /// the first character of the list of option characters. + /// + RequireOrder = 1, + /// + /// Permute is the default. We permute the contents of ARGV as we + /// scan, so that eventually all the non-options are at the end. + /// This allows options to be given in any order, even with + /// programs that were not written to expect this. + /// + Permute = 2, + /// + /// ReturnInOrder is an option available to programs that were + /// written to expect options and other ARGV-elements in any order + /// and that care about the ordering of the two. We describe each + /// non-option ARGV-element as if it were the argument of an option + /// with character code 1. Using '-' as the first character + /// of the list of option characters selects this mode of + /// operation. + /// + ReturnInOrder = 3 + } + + #region Instance Variables + /// + /// For communication from to the caller. When + /// finds an option that takes an argument, the + /// argument value is returned here. Also, when ordering is + /// , each non-option ARGV-element is + /// returned here. + /// + private string optarg; + + /// + /// Index in ARGV of the next element to be scanned. This is used for + /// communication to and from the caller and for communication between + /// successive calls to . + /// + /// On entry to , zero means this is the first + /// call; initialize. + /// + /// When returns -1, this is the index of the + /// first of the non-option elements that the caller should itself + /// scan. + /// + /// Otherwise, communicates from one call to the + /// next how much of ARGV has been scanned so far. + /// + private int optind = 0; + + /// + /// Callers store false here to inhibit the error message for + /// unrecognized options. + /// + private bool opterr = true; + + /// + /// When an unrecognized option is encountered, getopt will return a + /// '?' and store the value of the invalid option here. + /// + private int optopt = '?'; + + /// + /// The next char to be scanned in the option-element in which the last + /// option character we returned was found. This allows us to pick up + /// the scan where we left off. + /// + /// If this is zero, or a null string, it means resume the scan by + /// advancing to the next ARGV-element. + /// + private string nextchar; + + /// + /// This is the string describing the valid short options. + /// + private string optstring; + + /// + /// This is an array of objects which describ the + /// valid long options. + /// + private LongOpt[] longOptions; + + /// + /// This flag determines whether or not we are parsing only long args. + /// + private bool longOnly; + + /// + /// Stores the index into the longOptions array of the long + /// option found. + /// + private int longind; + + /// + /// The flag determines whether or not we operate in strict POSIX + /// compliance. + /// + private bool posixlyCorrect; + + /// + /// A flag which communicates whether or not + /// did all necessary processing for the + /// current option. + /// + private bool longoptHandled; + + /// + /// The index of the first non-option in argv[]. + /// + private int firstNonopt = 1; + + /// + /// The index of the last non-option in argv[]. + /// + private int lastNonopt = 1; + + /// + /// Flag to tell to immediately return -1 the next + /// time it is called. + /// + private bool endparse = false; + + /// + /// Saved argument list passed to the program. + /// + private string[] argv; + + /// + /// Determines whether we permute arguments or not. + /// + private Order ordering; + + /// + /// Name to print as the program name in error messages. This is + /// necessary since .NET does not place the program name in args[0]. + /// + private string progname; + + /// + /// The localized strings are kept in the resources, which can be + /// accessed by the class. + /// + private ResourceManager resManager = new ResourceManager( + "Gnu.Getopt.MessagesBundle", Assembly.GetExecutingAssembly()); + + /// + /// The current UI culture (set to en-US when posixly correctness is + /// enabled). + /// + private CultureInfo cultureInfo = CultureInfo.CurrentUICulture; + + #endregion + + #region Constructors + /// + /// Construct a basic Getopt instance with the given input data. Note + /// that this handles short options only. + /// + /// + /// The name to display as the program name when printing errors. + /// + /// + /// The string array passed as the command line to the program. + /// + /// + /// A string containing a description of the valid args for this + /// program. + /// + public Getopt(string progname, string[] argv, string optstring) : + this(progname, argv, optstring, null, false) + { + } + + /// + /// Construct a Getopt instance with given input data that is capable + /// of parsing long options as well as short. + /// + /// + /// The name to display as the program name when printing errors. + /// + /// + /// The string array passed as the command ilne to the program. + /// + /// + /// A string containing a description of the valid short args for this + /// program. + /// + /// + /// An array of objects that describes the valid + /// long args for this program. + /// + public Getopt(string progname, string[] argv, string optstring, + LongOpt[] longOptions) : this(progname, argv, optstring, + longOptions, false) + { + } + + /// + /// Construct a Getopt instance with given input data that is capable + /// of parsing long options and short options. Contrary to what you + /// might think, the flag does not + /// determine whether or not we scan for only long arguments. Instead, + /// a value of true here allows long arguments to start with a + /// '-' instead of "--" unless there is a conflict with + /// a short option name. + /// + /// + /// The name to display as the program name when printing errors + /// + /// + /// The string array passed as the command ilne to the program. + /// + /// + /// A string containing a description of the valid short args for this + /// program. + /// + /// + /// An array of objects that describes the valid + /// long args for this program. + /// + /// + /// true if long options that do not conflict with short options can + /// start with a '-' as well as "--". + /// + public Getopt(string progname, string[] argv, string optstring, + LongOpt[] longOptions, bool longOnly) + { + if (optstring.Length == 0) + optstring = " "; + + // This function is essentially _getopt_initialize from GNU getopt + this.progname = progname; + this.argv = argv; + this.optstring = optstring; + this.longOptions = longOptions; + this.longOnly = longOnly; + + // Check for application setting "Gnu.PosixlyCorrect" to determine + // whether to strictly follow the POSIX standard. This replaces the + // "POSIXLY_CORRECT" environment variable in the C version + try + { + if((bool) new AppSettingsReader().GetValue( + "Gnu.PosixlyCorrect", typeof(bool))) + { + this.posixlyCorrect = true; + this.cultureInfo = new CultureInfo("en-US"); + } + else + this.posixlyCorrect = false; + } + catch(Exception) + { + this.posixlyCorrect = false; + } + + // Determine how to handle the ordering of options and non-options + if (optstring[0] == '-') + { + this.ordering = Order.ReturnInOrder; + if (optstring.Length > 1) + this.optstring = optstring.Substring(1); + } + else if (optstring[0] == '+') + { + this.ordering = Order.RequireOrder; + if (optstring.Length > 1) + this.optstring = optstring.Substring(1); + } + else if (this.posixlyCorrect) + { + this.ordering = Order.RequireOrder; + } + else + { + this.ordering = Order.Permute; // The normal default case + } + } + #endregion + + #region Instance Methods + /// + /// In GNU getopt, it is possible to change the string containg valid + /// options on the fly because it is passed as an argument to + /// each time. + /// In this version we do not pass the string on every call. + /// In order to allow dynamic option string changing, this method is + /// provided. + /// + public string Optstring + { + get { return this.optstring; } + set + { + if (value.Length == 0) + value = " "; + + this.optstring = value; + } + } + + /// + /// optind is the index in ARGV of the next element to be + /// scanned. This is used for communication to and from the caller and + /// for communication between successive calls to . + /// + /// When returns -1, this is the index of the + /// first of the non-option elements that the caller should itself + /// scan. + /// + /// Otherwise, optind communicates from one call to the next how + /// much of ARGV has been scanned so far. + /// + /// + /// This method allows the optind index to be set manually. + /// Normally this is not necessary (and incorrect usage of this method + /// can lead to serious lossage), but optind is a public symbol + /// in GNU getopt, so this method was added to allow it to be modified + /// by the caller if desired. + /// + public int Optind + { + get { return this.optind; } + set { this.optind = value; } + } + + /// + /// Since in GNU getopt() the argument vector is passed back in to the + /// function every time, the caller can swap out argv on the + /// fly. Since passing argv is not required in the .NET version, this + /// method allows the user to override argv. Note that incorrect use of + /// this method can lead to serious lossage. + /// + public string[] Argv + { + get { return this.argv; } + set { this.argv = value; } + } + + /// + /// For communication from to the caller. When + /// finds an option that takes an argument, the + /// argument value is returned here. Also, when ordering is + /// , each non-option ARGV-element is + /// returned here. No set method is provided because setting this + /// variable has no effect. + /// + public string Optarg + { + get { return this.optarg; } + } + + /// + /// Normally will print a message to the standard + /// error when an invalid option is encountered. This can be suppressed + /// (or re-enabled) by calling this method. + /// + public bool Opterr + { + get { return this.opterr; } + set { this.opterr = value; } + } + + /// + /// When encounters an invalid option, it stores + /// the value of that option in optopt which can be retrieved + /// with this method. There is no corresponding set method because + /// setting this variable has no effect. + /// + public int Optopt + { + get { return this.optopt; } + } + + /// + /// Returns the index into the array of long options (NOT argv) + /// representing the long option that was found. + /// + public int Longind + { + get { return this.longind; } + } + + /// + /// Exchange the shorter segment with the far end of the longer + /// segment. That puts the shorter segment into the right place. It + /// leaves the longer segment in the right place overall, but it + /// consists of two parts that need to be swapped next. This method is + /// used by for argument permutation. + /// + private void exchange(string[] argv) + { + int bottom = this.firstNonopt; + int middle = this.lastNonopt; + int top = this.optind; + string tem; + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + // Bottom segment is the short one. + int len = middle - bottom; + int i; + + // Swap it with the top part of the top segment. + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + // Exclude the moved bottom segment from further swapping. + top -= len; + } + else + { + // Top segment is the short one. + int len = top - middle; + int i; + + // Swap it with the bottom part of the bottom segment. + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + // Exclude the moved top segment from further swapping. + bottom += len; + } + } + + // Update records for the slots the non-options now occupy. + + this.firstNonopt += (this.optind - this.lastNonopt); + this.lastNonopt = this.optind; + } + + /// + /// Check to see if an option is a valid long option. Called by + /// . Put in a separate method because this needs + /// to be done twice. (The C getopt authors just copy-pasted the + /// code!). + /// + /// + /// Various things depending on circumstances + /// + private int checkLongOption() + { + LongOpt pfound = null; + int nameend; + bool ambig; + bool exact; + + this.longoptHandled = true; + ambig = false; + exact = false; + this.longind = - 1; + + nameend = this.nextchar.IndexOf("="); + if (nameend == - 1) + nameend = this.nextchar.Length; + + // Test all long options for either exact match or abbreviated + // matches + for (int i = 0; i < this.longOptions.Length; i++) + { + if (this.longOptions[i].Name.StartsWith( + this.nextchar.Substring(0, nameend))) + { + if (this.longOptions[i].Name.Equals( + this.nextchar.Substring(0, nameend))) + { + // Exact match found + pfound = this.longOptions[i]; + this.longind = i; + exact = true; + break; + } + else if (pfound == null) + { + // First nonexact match found + pfound = this.longOptions[i]; + this.longind = i; + } + else + { + // Second or later nonexact match found + ambig = true; + } + } + } // for + + // Print out an error if the option specified was ambiguous + if (ambig && !exact) + { + if (this.opterr) + { + object[] msgArgs = new object[]{ + this.progname, this.argv[optind] }; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.ambigious", + this.cultureInfo), msgArgs); + } + + this.nextchar = ""; + this.optopt = 0; + ++this.optind; + + return '?'; + } + + if (pfound != null) + { + ++this.optind; + + if (nameend != this.nextchar.Length) + { + if (pfound.HasArg != Argument.No) + { + if (this.nextchar.Substring(nameend).Length > 1) + this.optarg = this.nextchar.Substring(nameend + 1); + else + this.optarg = ""; + } + else + { + if (this.opterr) + { + // -- option + if (argv[this.optind - 1].StartsWith("--")) + { + object[] msgArgs = new object[]{ + this.progname, pfound.Name }; + System.Console.Error.WriteLine( + this.resManager.GetString( + "getopt.arguments1", this.cultureInfo), + msgArgs); + } + // +option or -option + else + { + object[] msgArgs = new object[]{ this.progname, + this.argv[optind - 1][0], pfound.Name}; + System.Console.Error.WriteLine( + this.resManager.GetString( + "getopt.arguments2", this.cultureInfo), + msgArgs); + } + } + + this.nextchar = ""; + this.optopt = pfound.Val; + + return '?'; + } + } // if (nameend) + else if (pfound.HasArg == Argument.Required) + { + if (this.optind < this.argv.Length) + { + this.optarg = this.argv[this.optind]; + ++this.optind; + } + else + { + if (this.opterr) + { + object[] msgArgs = new object[]{ + this.progname, this.argv[this.optind - 1]}; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.requires", + this.cultureInfo), msgArgs); + } + + this.nextchar = ""; + this.optopt = pfound.Val; + if (this.optstring[0] == ':') + return ':'; + else + return '?'; + } + } // else if (pfound) + + this.nextchar = ""; + + if (pfound.Flag != null) + { + pfound.Flag.Length = 0; + pfound.Flag.Append(pfound.Val); + + return 0; + } + + return pfound.Val; + } // if (pfound != null) + + this.longoptHandled = false; + + return 0; + } + + /// + /// This method returns a char that is the current option that has been + /// parsed from the command line. If the option takes an argument, then + /// the internal variable optarg is set which is a string + /// representing the the value of the argument. This value can be + /// retrieved by the caller using the property. If + /// an invalid option is found, an error message is printed and a + /// '?' is returned. + /// The name of the invalid option character can be retrieved by + /// calling the Optopt property. When there are no more options + /// to be scanned, this method returns -1. The index of first + /// non-option element in argv can be retrieved with the + /// property. + /// + /// + /// Various things as described above. + /// + public int getopt() // not capitalized because of an compiler error + { + this.optarg = null; + + if (this.endparse == true) + return -1; + + if ((this.nextchar == null) || (this.nextchar.Length == 0)) + { + // If we have just processed some options following some + // non-options, exchange them so that the options come first. + if (this.lastNonopt > this.optind) + this.lastNonopt = this.optind; + if (this.firstNonopt > this.optind) + this.firstNonopt = this.optind; + + if (this.ordering == Order.Permute) + { + // If we have just processed some options following some + // non-options, exchange them so that the options come + // first. + if ((this.firstNonopt != this.lastNonopt) && + (this.lastNonopt != this.optind)) + this.exchange(this.argv); + else if (this.lastNonopt != this.optind) + this.firstNonopt = this.optind; + + // Skip any additional non-options + // and extend the range of non-options previously skipped. + while ((this.optind < this.argv.Length) && + ((this.argv[optind].Length == 0) || + (this.argv[this.optind][0] != '-') || + this.argv[optind].Equals("-"))) + this.optind++; + + this.lastNonopt = this.optind; + } + + // The special ARGV-element "--" means premature end of + // options. Skip it like a null option, then exchange with + // previous non-options as if it were an option, then skip + // everything else like a non-option. + if ((this.optind != this.argv.Length) && + this.argv[this.optind].Equals("--")) + { + this.optind++; + + if ((this.firstNonopt != this.lastNonopt) && + (this.lastNonopt != this.optind)) + this.exchange(this.argv); + else if (this.firstNonopt == this.lastNonopt) + this.firstNonopt = this.optind; + + this.lastNonopt = this.argv.Length; + + this.optind = this.argv.Length; + } + + // If we have done all the ARGV-elements, stop the scan + // and back over any non-options that we skipped and permuted. + if (this.optind == this.argv.Length) + { + // Set the next-arg-index to point at the non-options that + // we previously skipped, so the caller will digest them. + if (this.firstNonopt != this.lastNonopt) + this.optind = this.firstNonopt; + + return -1; + } + + // If we have come to a non-option and did not permute it, + // either stop the scan or describe it to the caller and pass + // it by. + if ((this.argv[this.optind].Length == 0) || + (this.argv[this.optind][0] != '-') || + this.argv[this.optind].Equals("-")) + { + if (this.ordering == Order.RequireOrder) + return -1; + + this.optarg = this.argv[optind++]; + return 1; + } + + // We have found another option-ARGV-element. + // Skip the initial punctuation. + if (this.argv[optind].StartsWith("--")) + this.nextchar = this.argv[this.optind].Substring(2); + else + this.nextchar = this.argv[this.optind].Substring(1); + } + + // Decode the current option-ARGV-element. + + /* Check whether the ARGV-element is a long option. + + If longOnly and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and the + ARGV-element is "-fu", do consider that an abbreviation of the + long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. + */ + if ((this.longOptions != null) && + (this.argv[this.optind].StartsWith("--") || (this.longOnly && + ((this.argv[this.optind].Length > 2) || + (this.optstring.IndexOf(this.argv[this.optind][1]) == -1))))) + { + int c = this.checkLongOption(); + + if (this.longoptHandled) + return c; + + // Can't find it as a long option. If this is not + // getopt_long_only, or the option starts with "--" or is not a + // valid short option, then it's an error. Otherwise interpret + // it as a short option. + if (!this.longOnly || this.argv[this.optind].StartsWith("--") + || (this.optstring.IndexOf(this.nextchar[0]) == - 1)) + { + if (this.opterr) + { + if (this.argv[this.optind].StartsWith("--")) + { + object[] msgArgs = new object[]{ + this.progname, this.nextchar }; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.unrecognized", + this.cultureInfo), msgArgs); + } + else + { + object[] msgArgs = new object[]{ this.progname, + this.argv[optind][0], this.nextchar}; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.unrecognized2", + this.cultureInfo), msgArgs); + } + } + + this.nextchar = ""; + ++this.optind; + this.optopt = 0; + + return '?'; + } + } // if (longopts) + + // Look at and handle the next short option-character */ + int c2 = this.nextchar[0]; //**** Do we need to check for empty str? + if (this.nextchar.Length > 1) + this.nextchar = this.nextchar.Substring(1); + else + this.nextchar = ""; + + string temp = null; + if (this.optstring.IndexOf((char) c2) != - 1) + temp = this.optstring.Substring( + this.optstring.IndexOf((char) c2)); + + if (this.nextchar.Length == 0) + ++this.optind; + + if ((temp == null) || (c2 == ':')) + { + if (this.opterr) + { + if (this.posixlyCorrect) + { + // 1003.2 specifies the format of this message + object[] msgArgs = new object[]{ + this.progname, (char) c2 }; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.illegal", + this.cultureInfo), msgArgs); + } + else + { + object[] msgArgs = new object[]{ + this.progname, (char) c2 }; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.invalid", + this.cultureInfo), msgArgs); + } + } + + this.optopt = c2; + + return '?'; + } + + // Convenience. Treat POSIX -W foo same as long option --foo + if ((temp[0] == 'W') && (temp.Length > 1) && (temp[1] == ';')) + { + if (this.nextchar.Length != 0) + { + this.optarg = this.nextchar; + } + // No further cars in this argv element and no more argv + // elements + else if (this.optind == this.argv.Length) + { + if (this.opterr) + { + // 1003.2 specifies the format of this message. + object[] msgArgs = new object[]{ + this.progname, (char) c2 }; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.requires2", + this.cultureInfo), msgArgs); + } + + this.optopt = c2; + if (this.optstring[0] == ':') + return ':'; + else + return '?'; + } + else + { + // We already incremented `optind' once; increment it again + // when taking next ARGV-elt as argument. + this.nextchar = this.argv[this.optind]; + this.optarg = this.argv[this.optind]; + } + + c2 = this.checkLongOption(); + + if (this.longoptHandled) + return c2; + // Let the application handle it + else + { + this.nextchar = null; + ++this.optind; + return 'W'; + } + } + + if ((temp.Length > 1) && (temp[1] == ':')) + { + if ((temp.Length > 2) && (temp[2] == ':')) + // This is an option that accepts and argument optionally + { + if (this.nextchar.Length != 0) + { + this.optarg = this.nextchar; + ++this.optind; + } + else + { + this.optarg = null; + } + + this.nextchar = null; + } + else + { + if (this.nextchar.Length != 0) + { + this.optarg = this.nextchar; + ++this.optind; + } + else if (this.optind == this.argv.Length) + { + if (this.opterr) + { + // 1003.2 specifies the format of this message + object[] msgArgs = new object[]{ + this.progname, (char) c2}; + System.Console.Error.WriteLine( + this.resManager.GetString("getopt.requires2", + this.cultureInfo), msgArgs); + } + + this.optopt = c2; + + if (this.optstring[0] == ':') + return ':'; + else + return '?'; + } + else + { + this.optarg = this.argv[this.optind]; + ++this.optind; + + // Ok, here's an obscure Posix case. If we have o:, + // and we get -o -- foo, then we're supposed to skip + // the --, end parsing of options, and make foo an + // operand to -o. Only do this in Posix mode. + if (this.posixlyCorrect && this.optarg.Equals("--")) + { + // If end of argv, error out + if (this.optind == this.argv.Length) + { + if (this.opterr) + { + // 1003.2 specifies the format of this + // message + object[] msgArgs = new object[]{ + this.progname, (char) c2}; + System.Console.Error.WriteLine( + this.resManager.GetString( + "getopt.requires2", this.cultureInfo), + msgArgs); + } + + this.optopt = c2; + + if (this.optstring[0] == ':') + return ':'; + else + return '?'; + } + + // Set new optarg and set to end. Don't permute as + // we do on -- up above since we know we aren't in + // permute mode because of Posix. + this.optarg = this.argv[this.optind]; + ++this.optind; + this.firstNonopt = this.optind; + this.lastNonopt = this.argv.Length; + this.endparse = true; + } + } + + this.nextchar = null; + } + } + + return c2; + } + #endregion + } // Class Getopt +} \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Gnu.Getopt.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Gnu.Getopt.csproj new file mode 100644 index 00000000..4a285aa7 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/Gnu.Getopt.csproj @@ -0,0 +1,122 @@ + + + Local + 9.0.21022 + 2.0 + {379BC478-7D84-4E0E-A4B8-197905C824AE} + Debug + AnyCPU + + + + + Gnu.Getopt + + + JScript + Grid + IE50 + false + Library + Gnu.Getopt + OnBuildSuccess + + + + + 0.0 + + + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + bin\Debug\Gnu.Getopt.XML + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + bin\Release\Gnu.Getopt.XML + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + + + Code + + + Code + + + Code + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + + + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/LongOpt.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/LongOpt.cs new file mode 100644 index 00000000..b961b19c --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/LongOpt.cs @@ -0,0 +1,239 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +/************************************************************************** +/* LongOpt.cs -- C#.NET port of Long option object for Getopt +/* +/* Copyright (c) 1998 by Aaron M. Renn (arenn@urbanophile.com) +/* C#.NET Port Copyright (c) 2004 by Klaus Prckl (klaus.prueckl@aon.at) +/* +/* This program is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation; either version 2 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this program; see the file COPYING.LIB. If not, write to +/* the Free Software Foundation Inc., 59 Temple Place - Suite 330, +/* Boston, MA 02111-1307 USA +/**************************************************************************/ + +using System; +using System.Configuration; +using System.Globalization; +using System.Reflection; +using System.Resources; +using System.Text; + +namespace Gnu.Getopt +{ + /// + /// Constant enumeration values used for the LongOpt hasArg + /// constructor argument. + /// + public enum Argument + { + /// + /// This value indicates that the option takes no argument. + /// + No = 0, + /// + /// This value indicates that the option takes an argument that is + /// required. + /// + Required = 1, + /// + /// This value indicates that the option takes an argument that is + /// optional. + /// + Optional = 2 + } + + /// + /// This object represents the definition of a long option in the C# port + /// of GNU getopt. An array of LongOpt objects is passed to the + /// object to define the list of valid long options + /// for a given parsing session. Refer to the + /// documentation for details on the format of long options. + /// + /// Getopt + /// Aaron M. Renn (arenn@urbanophile.com) + /// Klaus Prckl (klaus.prueckl@aon.at) + public class LongOpt + { + #region Instance Variables + /// + /// The name of the long option. + /// + private string name; + + /// + /// Indicates whether the option has no argument, a required argument, + /// or an optional argument. + /// + private Argument hasArg; + + /// + /// If this variable is not null, then the value stored in val + /// is stored here when this long option is encountered. If this is + /// null, the value stored in val is treated as the name of an + /// equivalent short option. + /// + private StringBuilder flag; + + /// + /// The value to store in flag if flag is not null, otherwise + /// the equivalent short option character for this long option. + /// + private int val; + + /// + /// The localized strings are kept in the resources, which can be + /// accessed by the class. + /// + private ResourceManager resManager = new ResourceManager( + "Gnu.Getopt.MessagesBundle", Assembly.GetExecutingAssembly()); + + /// + /// The current UI culture (set to en-US when posixly correctness is + /// enabled). + /// + private CultureInfo cultureInfo = CultureInfo.CurrentUICulture; + #endregion + + #region Constructors + /// + /// Create a new LongOpt object with the given parameter values. If the + /// value passed as is not valid, then an + /// is thrown. + /// + /// + /// The long option string. + /// + /// + /// Indicates whether the option has no argument + /// (), a required argument + /// () or an optional argument + /// (). + /// + /// + /// If non-null, this is a location to store the value of + /// when this option is encountered, otherwise + /// is treated as the equivalent short option + /// character. + /// + /// + /// The value to return for this long option, or the equivalent single + /// letter option to emulate if flag is null. + /// + /// + /// Is thrown if the param is not one of + /// , or + /// . + /// + public LongOpt(string name, Argument hasArg, StringBuilder flag, + int val) + { + // Check for application setting "Gnu.PosixlyCorrect" to determine + // whether to strictly follow the POSIX standard. This replaces the + // "POSIXLY_CORRECT" environment variable in the C version + try + { + if((bool) new AppSettingsReader().GetValue( + "Gnu.PosixlyCorrect", typeof(bool))) + { + this.cultureInfo = new CultureInfo("en-US"); + } + } + catch(Exception) + { + } + + // Validate hasArg + if ((hasArg != Argument.No) && (hasArg != Argument.Required) && + (hasArg != Argument.Optional)) + { + object[] msgArgs = new object[]{hasArg}; + throw new System.ArgumentException(string.Format( + this.resManager.GetString("getopt.invalidValue", + this.cultureInfo), msgArgs)); + } + + // Store off values + this.name = name; + this.hasArg = hasArg; + this.flag = flag; + this.val = val; + } + #endregion + + /// + /// Returns the name of this LongOpt as a string + /// + /// + /// The name of the long option + /// + public string Name + { + get { return this.name; } + } + + /// + /// Returns the value set for the hasArg field for this long + /// option. + /// + /// + /// The value of hasArg. + /// + public Argument HasArg + { + get { return this.hasArg; } + } + + /// + /// Returns the value of the flag field for this long option. + /// + /// + /// The value of flag. + /// + public StringBuilder Flag + { + get { return this.flag; } + } + + /// + /// Returns the value of the val field for this long option. + /// + /// + /// The value of val. + /// + public int Val + { + get { return this.val; } + } + } // Class LongOpt +} \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.cs.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.cs.resx new file mode 100644 index 00000000..fd15ec82 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.cs.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: volba ''{1}'' je nejednoznaèná + + + {0}: volba ''--{1}'' nepøipou¹tí argument + + + {0}: volba ''{1}{2}'' nepøipou¹tí argument + + + {0}: volba ''{1}'' vy¾aduje argument + + + {0}: nepøípustná volba ''--{1}'' + + + {0}: nepøípustná volba ''{1}{2}'' + + + {0}: nepøípustná volba -- {1} + + + {0}: neplatná volba -- {1} + + + {0}: volba vy¾aduje argument -- {1} + + + Neplatná hodnota {0} parameteru 'has_arg' + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.de.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.de.resx new file mode 100644 index 00000000..df5fe386 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.de.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: Option ''{1}'' ist zweideutig + + + {0}: Option ''--{1}'' erlaubt kein Argument + + + {0}: Option ''{1}{2}'' erlaubt kein Argument + + + {0}: Option ''{1}'' benötigt ein Argument + + + {0}: Unbekannte Option ''--{1}'' + + + {0}: Unbekannte Option ''{1}{2}'' + + + {0}: Verbotene Option -- {1} + + + {0}: Ungültige Option -- {1} + + + {0}: Option benötigt ein Argument -- {1} + + + Ungültiger Wert {0} für Parameter 'has_arg' + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.fr.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.fr.resx new file mode 100644 index 00000000..4271026b --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.fr.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: l'option ''{1}'' est ambiguë + + + {0}: l'option ''--{1}'' ne permet pas de paramètre + + + {0}: l'option ''{1}{2}'' ne permet pas de paramètre + + + {0}: l'option ''{1}'' requiert un paramètre + + + {0}: option non reconnue ''--{1}'' + + + {0}: option non reconnue ''{1}{2}'' + + + {0}: option illégale -- {1} + + + {0}: option invalide -- {1} + + + {0}: cette option requiert un paramètre -- {1} + + + Valeur invalide {0} pour le paramètre 'has_arg' + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.hu.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.hu.resx new file mode 100644 index 00000000..d813d976 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.hu.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: opció ''{1}'' félreérthetõ + + + {0}: opció ''--{1}'' nem enged meg argumentumot + + + {0}: opció ''{1}{2}'' nem enged meg argumentumot + + + {0}: opció ''{1}'' argumentumot igényel + + + {0}: ismeretlen opció ''--{1}'' + + + {0}: ismeretlen opció ''{1}{2}'' + + + {0}: illegális opció -- {1} + + + {0}: érvénytelen opció -- {1} + + + {0}: az opció argumentumot igényel -- {1} + + + Érvénytelen érték {0} a következõ paraméterhez 'has_arg' + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.ja.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.ja.resx new file mode 100644 index 00000000..85032b7a --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.ja.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: ''{1}'' \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u66d6\u6627\u3067\u3059\u3002 + + + {0}: ''--{1}'' \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u3082\u3061\u307e\u305b\u3093\u3002 + + + {0}: ''{1}{2}'' \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u3082\u3061\u307e\u305b\u3093\u3002 + + + {0}: ''{1}'' \u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5fc5\u8981\u3067\u3059\u3002 + + + {0}: ''--{1}'' \u306f\u7121\u52b9\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002 + + + {0}: ''{1}{2}'' \u306f\u7121\u52b9\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002 + + + {0}: -- {1} \u306f\u4e0d\u6b63\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002 + + + {0}: -- {1} \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002 + + + {0}: -- {1} \u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5fc5\u8981\u3067\u3059\u3002 + + + {0} \u306f\u3001'has_arg' \u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u4e0d\u6b63\u306a\u5024\u3067\u3059\u3002 + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.nl.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.nl.resx new file mode 100644 index 00000000..e22fdc41 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.nl.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: optie ''{1}'' is ambigue + + + {0}: optie ''--{1}'' staat geen argumenten toe + + + {0}: optie ''{1}{2}'' staat geen argumenten toe + + + {0}: optie ''{1}'' heeft een argument nodig + + + {0}: onbekende optie ''--{1}'' + + + {0}: onbekende optie ''{1}{2}'' + + + {0}: niet-toegestane optie -- {1} + + + {0}: onjuiste optie -- {1} + + + {0}: optie heeft een argument nodig -- {1} + + + Ongeldige waarde {0} voor parameter 'has_arg' + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.no.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.no.resx new file mode 100644 index 00000000..822479d1 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.no.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: flagget ''{1}'' er flertydig + + + {0}: flagget ''--{1}'' tillater ikke et argument + + + {0}: flagget ''{1}{2}'' tillater ikke et argument + + + {0}: flagget ''{1}'' krever et argument + + + {0}: ukjent flagg ''--{1}'' + + + {0}: ukjent flagg ''{1}{2}'' + + + {0}: ugyldig flagg -- {1} + + + {0}: ugyldig flagg -- {1} + + + {0}: flagget krever et argument -- {1} + + + Ugyldig verdi {0} for parameter 'has_arg' + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.resx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.resx new file mode 100644 index 00000000..d4ec148a --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Getopt/MessagesBundle.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0}: option ''{1}'' is ambiguous + + + {0}: option ''--{1}'' doesn't allow an argument + + + {0}: option ''{1}{2}'' doesn't allow an argument + + + {0}: option ''{1}'' requires an argument + + + {0}: unrecognized option ''--{1}'' + + + {0}: unrecognized option ''{1}{2}'' + + + {0}: invalid option -- {1} + + + {0}: illegal option -- {1} + + + {0}: option requires an argument -- {1} + + + Invalid value {0} for parameter 'has_arg' + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Gnu.Gettext.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Gnu.Gettext.csproj new file mode 100644 index 00000000..e8e1779e --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Gnu.Gettext.csproj @@ -0,0 +1,61 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {859A653A-7728-4F02-BAF2-A5CD8F991916} + Library + Properties + GNU.Gettext + GNU.Gettext + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Properties/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..23a9c5b7 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/Properties/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Gettext")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Gettext")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3be71b7d-867c-46de-bb4d-d12215f0ae67")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/intl.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/intl.cs new file mode 100644 index 00000000..e3408993 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/intl.cs @@ -0,0 +1,520 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +/* GNU gettext for C# + * Copyright (C) 2003 Free Software Foundation, Inc. + * Written by Bruno Haible , 2003. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2, 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +/* + * Using the GNU gettext approach, compiled message catalogs are assemblies + * containing just one class, a subclass of GettextResourceSet. They are thus + * interoperable with standard ResourceManager based code. + * + * The main differences between the common .NET resources approach and the + * GNU gettext approach are: + * - In the .NET resource approach, the keys are abstract textual shortcuts. + * In the GNU gettext approach, the keys are the English/ASCII version + * of the messages. + * - In the .NET resource approach, the translation files are called + * "Resource.locale.resx" and are UTF-8 encoded XML files. In the GNU gettext + * approach, the translation files are called "Resource.locale.po" and are + * in the encoding the translator has chosen. There are at least three GUI + * translating tools (Emacs PO mode, KDE KBabel, GNOME gtranslator). + * - In the .NET resource approach, the function ResourceManager.GetString + * returns an empty string or throws an InvalidOperationException when no + * translation is found. In the GNU gettext approach, the GetString function + * returns the (English) message key in that case. + * - In the .NET resource approach, there is no support for plural handling. + * In the GNU gettext approach, we have the GetPluralString function. + * + * To compile GNU gettext message catalogs into C# assemblies, the msgfmt + * program can be used. + */ + +using System; /* String, InvalidOperationException, Console */ +using System.Globalization; /* CultureInfo */ +using System.Resources; /* ResourceManager, ResourceSet, IResourceReader */ +using System.Reflection; /* Assembly, ConstructorInfo */ +using System.Collections; /* Hashtable, ICollection, IEnumerator, IDictionaryEnumerator */ +using System.IO; /* Path, FileNotFoundException, Stream */ +using System.Text; /* StringBuilder */ + +namespace GNU.Gettext { + + /// + /// Each instance of this class can be used to lookup translations for a + /// given resource name. For each CultureInfo, it performs the lookup + /// in several assemblies, from most specific over territory-neutral to + /// language-neutral. + /// + public class GettextResourceManager : ResourceManager { + + // ======================== Public Constructors ======================== + + /// + /// Constructor. + /// + /// the resource name, also the assembly base + /// name + public GettextResourceManager (String baseName) + : base (baseName, Assembly.GetCallingAssembly(), typeof (GettextResourceSet)) { + } + + /// + /// Constructor. + /// + /// the resource name, also the assembly base + /// name + public GettextResourceManager (String baseName, Assembly assembly) + : base (baseName, assembly, typeof (GettextResourceSet)) { + } + + // ======================== Implementation ======================== + + /// + /// Loads and returns a satellite assembly. + /// + // This is like Assembly.GetSatelliteAssembly, but uses resourceName + // instead of assembly.GetName().Name, and works around a bug in + // mono-0.28. + private static Assembly GetSatelliteAssembly (Assembly assembly, String resourceName, CultureInfo culture) { + String satelliteExpectedLocation = + Path.GetDirectoryName(assembly.Location) + + Path.DirectorySeparatorChar + culture.Name + + Path.DirectorySeparatorChar + resourceName + ".resources.dll"; + return Assembly.LoadFrom(satelliteExpectedLocation); + } + + /// + /// Loads and returns the satellite assembly for a given culture. + /// + private Assembly MySatelliteAssembly (CultureInfo culture) { + return GetSatelliteAssembly(MainAssembly, BaseName, culture); + } + + /// + /// Converts a resource name to a class name. + /// + /// a nonempty string consisting of alphanumerics and underscores + /// and starting with a letter or underscore + private static String ConstructClassName (String resourceName) { + // We could just return an arbitrary fixed class name, like "Messages", + // assuming that every assembly will only ever contain one + // GettextResourceSet subclass, but this assumption would break the day + // we want to support multi-domain PO files in the same format... + bool valid = (resourceName.Length > 0); + for (int i = 0; valid && i < resourceName.Length; i++) { + char c = resourceName[i]; + if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_') + || (i > 0 && c >= '0' && c <= '9'))) + valid = false; + } + if (valid) + return resourceName; + else { + // Use hexadecimal escapes, using the underscore as escape character. + String hexdigit = "0123456789abcdef"; + StringBuilder b = new StringBuilder(); + b.Append("__UESCAPED__"); + for (int i = 0; i < resourceName.Length; i++) { + char c = resourceName[i]; + if (c >= 0xd800 && c < 0xdc00 + && i+1 < resourceName.Length + && resourceName[i+1] >= 0xdc00 && resourceName[i+1] < 0xe000) { + // Combine two UTF-16 words to a character. + char c2 = resourceName[i+1]; + int uc = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + b.Append('_'); + b.Append('U'); + b.Append(hexdigit[(uc >> 28) & 0x0f]); + b.Append(hexdigit[(uc >> 24) & 0x0f]); + b.Append(hexdigit[(uc >> 20) & 0x0f]); + b.Append(hexdigit[(uc >> 16) & 0x0f]); + b.Append(hexdigit[(uc >> 12) & 0x0f]); + b.Append(hexdigit[(uc >> 8) & 0x0f]); + b.Append(hexdigit[(uc >> 4) & 0x0f]); + b.Append(hexdigit[uc & 0x0f]); + i++; + } else if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') + || (c >= '0' && c <= '9'))) { + int uc = c; + b.Append('_'); + b.Append('u'); + b.Append(hexdigit[(uc >> 12) & 0x0f]); + b.Append(hexdigit[(uc >> 8) & 0x0f]); + b.Append(hexdigit[(uc >> 4) & 0x0f]); + b.Append(hexdigit[uc & 0x0f]); + } else + b.Append(c); + } + return b.ToString(); + } + } + + /// + /// Instantiates a resource set for a given culture. + /// + /// + /// The expected type name is not valid. + /// + /// + /// satelliteAssembly does not contain the expected type. + /// + /// + /// The type has no no-arguments constructor. + /// + private static GettextResourceSet InstantiateResourceSet (Assembly satelliteAssembly, String resourceName, CultureInfo culture) { + // We expect a class with a culture dependent class name. + Type clazz = satelliteAssembly.GetType(ConstructClassName(resourceName)+"_"+culture.Name.Replace('-','_')); + // We expect it has a no-argument constructor, and invoke it. + ConstructorInfo constructor = clazz.GetConstructor(Type.EmptyTypes); + return constructor.Invoke(null) as GettextResourceSet; + } + + private static GettextResourceSet[] EmptyResourceSetArray = new GettextResourceSet[0]; + + // Cache for already loaded GettextResourceSet cascades. + private Hashtable /* CultureInfo -> GettextResourceSet[] */ Loaded = new Hashtable(); + + /// + /// Returns the array of GettextResourceSets for a given culture, + /// loading them if necessary, and maintaining the cache. + /// + private GettextResourceSet[] GetResourceSetsFor (CultureInfo culture) { + //Console.WriteLine(">> GetResourceSetsFor "+culture); + // Look up in the cache. + GettextResourceSet[] result = Loaded[culture] as GettextResourceSet[]; + if (result == null) { + lock(this) { + // Look up again - maybe another thread has filled in the entry + // while we slept waiting for the lock. + result = Loaded[culture] as GettextResourceSet[]; + if (result == null) { + // Determine the GettextResourceSets for the given culture. + if (culture.Parent == null || culture.Equals(CultureInfo.InvariantCulture)) + // Invariant culture. + result = EmptyResourceSetArray; + else { + // Use a satellite assembly as primary GettextResourceSet, and + // the result for the parent culture as fallback. + GettextResourceSet[] parentResult = GetResourceSetsFor(culture.Parent); + Assembly satelliteAssembly; + try { + satelliteAssembly = MySatelliteAssembly(culture); + } catch (FileNotFoundException e) { + satelliteAssembly = null; + } + if (satelliteAssembly != null) { + GettextResourceSet satelliteResourceSet; + try { + satelliteResourceSet = InstantiateResourceSet(satelliteAssembly, BaseName, culture); + } catch (Exception e) { + Console.Error.WriteLine(e); + Console.Error.WriteLine(e.StackTrace); + satelliteResourceSet = null; + } + if (satelliteResourceSet != null) { + result = new GettextResourceSet[1+parentResult.Length]; + result[0] = satelliteResourceSet; + Array.Copy(parentResult, 0, result, 1, parentResult.Length); + } else + result = parentResult; + } else + result = parentResult; + } + // Put the result into the cache. + Loaded.Add(culture, result); + } + } + } + //Console.WriteLine("<< GetResourceSetsFor "+culture); + return result; + } + + /* + /// + /// Releases all loaded GettextResourceSets and their assemblies. + /// + // TODO: No way to release an Assembly? + public override void ReleaseAllResources () { + ... + } + */ + + /// + /// Returns the translation of in a given culture. + /// + /// the key string to be translated, an ASCII + /// string + /// the translation of , or + /// if none is found + public override String GetString (String msgid, CultureInfo culture) { + foreach (GettextResourceSet rs in GetResourceSetsFor(culture)) { + String translation = rs.GetString(msgid); + if (translation != null) + return translation; + } + // Fallback. + return msgid; + } + + /// + /// Returns the translation of and + /// in a given culture, choosing the right + /// plural form depending on the number . + /// + /// the key string to be translated, an ASCII + /// string + /// the English plural of , + /// an ASCII string + /// the number, should be >= 0 + /// the translation, or or + /// if none is found + public virtual String GetPluralString (String msgid, String msgidPlural, long n, CultureInfo culture) { + foreach (GettextResourceSet rs in GetResourceSetsFor(culture)) { + String translation = rs.GetPluralString(msgid, msgidPlural, n); + if (translation != null) + return translation; + } + // Fallback: Germanic plural form. + return (n == 1 ? msgid : msgidPlural); + } + + // ======================== Public Methods ======================== + + /// + /// Returns the translation of in the current + /// culture. + /// + /// the key string to be translated, an ASCII + /// string + /// the translation of , or + /// if none is found + public override String GetString (String msgid) { + return GetString(msgid, CultureInfo.CurrentUICulture); + } + + /// + /// Returns the translation of and + /// in the current culture, choosing the + /// right plural form depending on the number . + /// + /// the key string to be translated, an ASCII + /// string + /// the English plural of , + /// an ASCII string + /// the number, should be >= 0 + /// the translation, or or + /// if none is found + public virtual String GetPluralString (String msgid, String msgidPlural, long n) { + return GetPluralString(msgid, msgidPlural, n, CultureInfo.CurrentUICulture); + } + + } + + /// + /// + /// Each instance of this class encapsulates a single PO file. + /// + /// + /// This API of this class is not meant to be used directly; use + /// GettextResourceManager instead. + /// + /// + // We need this subclass of ResourceSet, because the plural formula must come + // from the same ResourceSet as the object containing the plural forms. + public class GettextResourceSet : ResourceSet { + + /// + /// Creates a new message catalog. When using this constructor, you + /// must override the ReadResources method, in order to initialize + /// the Table property. The message catalog will support plural + /// forms only if the ReadResources method installs values of type + /// String[] and if the PluralEval method is overridden. + /// + protected GettextResourceSet () + : base (DummyResourceReader) { + } + + /// + /// Creates a new message catalog, by reading the string/value pairs from + /// the given . The message catalog will support + /// plural forms only if the reader can produce values of type + /// String[] and if the PluralEval method is overridden. + /// + public GettextResourceSet (IResourceReader reader) + : base (reader) { + } + + /// + /// Creates a new message catalog, by reading the string/value pairs from + /// the given , which should have the format of + /// a .resources file. The message catalog will not support plural + /// forms. + /// + public GettextResourceSet (Stream stream) + : base (stream) { + } + + /// + /// Creates a new message catalog, by reading the string/value pairs from + /// the file with the given . The file should + /// be in the format of a .resources file. The message catalog will + /// not support plural forms. + /// + public GettextResourceSet (String fileName) + : base (fileName) { + } + + /// + /// Returns the translation of . + /// + /// the key string to be translated, an ASCII + /// string + /// the translation of , or null if + /// none is found + // The default implementation essentially does (String)Table[msgid]. + // Here we also catch the plural form case. + public override String GetString (String msgid) { + Object value = GetObject(msgid); + if (value == null || value is String) + return (String)value; + else if (value is String[]) + // A plural form, but no number is given. + // Like the C implementation, return the first plural form. + return (value as String[])[0]; + else + throw new InvalidOperationException("resource for \""+msgid+"\" in "+GetType().FullName+" is not a string"); + } + + /// + /// Returns the translation of , with possibly + /// case-insensitive lookup. + /// + /// the key string to be translated, an ASCII + /// string + /// the translation of , or null if + /// none is found + // The default implementation essentially does (String)Table[msgid]. + // Here we also catch the plural form case. + public override String GetString (String msgid, bool ignoreCase) { + Object value = GetObject(msgid, ignoreCase); + if (value == null || value is String) + return (String)value; + else if (value is String[]) + // A plural form, but no number is given. + // Like the C implementation, return the first plural form. + return (value as String[])[0]; + else + throw new InvalidOperationException("resource for \""+msgid+"\" in "+GetType().FullName+" is not a string"); + } + + /// + /// Returns the translation of and + /// , choosing the right plural form + /// depending on the number . + /// + /// the key string to be translated, an ASCII + /// string + /// the English plural of , + /// an ASCII string + /// the number, should be >= 0 + /// the translation, or null if none is found + public virtual String GetPluralString (String msgid, String msgidPlural, long n) { + Object value = GetObject(msgid); + if (value == null || value is String) + return (String)value; + else if (value is String[]) { + String[] choices = value as String[]; + long index = PluralEval(n); + return choices[index >= 0 && index < choices.Length ? index : 0]; + } else + throw new InvalidOperationException("resource for \""+msgid+"\" in "+GetType().FullName+" is not a string"); + } + + /// + /// Returns the index of the plural form to be chosen for a given number. + /// The default implementation is the Germanic plural formula: + /// zero for == 1, one for != 1. + /// + protected virtual long PluralEval (long n) { + return (n == 1 ? 0 : 1); + } + + /// + /// Returns the keys of this resource set, i.e. the strings for which + /// GetObject() can return a non-null value. + /// + public virtual ICollection Keys { + get { + return Table.Keys; + } + } + + /// + /// A trivial instance of IResourceReader that does nothing. + /// + // Needed by the no-arguments constructor. + private static IResourceReader DummyResourceReader = new DummyIResourceReader(); + + } + + /// + /// A trivial IResourceReader implementation. + /// + class DummyIResourceReader : IResourceReader { + + // Implementation of IDisposable. + void System.IDisposable.Dispose () { + } + + // Implementation of IEnumerable. + IEnumerator System.Collections.IEnumerable.GetEnumerator () { + return null; + } + + // Implementation of IResourceReader. + void System.Resources.IResourceReader.Close () { + } + IDictionaryEnumerator System.Resources.IResourceReader.GetEnumerator () { + return null; + } + + } + +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgfmt.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgfmt.cs new file mode 100644 index 00000000..037ccd38 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgfmt.cs @@ -0,0 +1,142 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +/* GNU gettext for C# + * Copyright (C) 2003 Free Software Foundation, Inc. + * Written by Bruno Haible , 2003. + * + * 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 2, 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, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * This program creates a .resources file from a set of key/value pairs given + * on standard input. + */ + +using System; /* String, Console, Exception */ +using System.IO; /* Stream, BufferedStream, StreamReader */ +using System.Text; /* StringBuilder, UTF8Encoding */ +using System.Resources; /* ResourceWriter */ + +namespace GNU.Gettext { + public class WriteResource { + private StreamReader reader; + // Read a NUL-terminated UTF-8 encoded string. + private String ReadString () { + StringBuilder b = new StringBuilder(); + for (;;) { + int c = reader.Read(); + if (c < 0) // EOF? + return null; + if (c == 0) // End of String? + break; + b.Append((char)c); + } + return b.ToString(); + } + // Read all msgid/msgstr pairs, register them in the ResourceWriter, + // and write the binary contents to the output stream. + private void ReadAllInput (ResourceWriter rw) { + for (;;) { + String msgid = ReadString(); + if (msgid == null) + break; + String msgstr = ReadString(); + if (msgstr == null) + break; + rw.AddResource(msgid, msgstr); + } + rw.Generate(); + } + // Read all msgid/msgstr pairs (each string being NUL-terminated and + // UTF-8 encoded) and write the .resources file to the given filename. + WriteResource (String filename) { + Stream input = new BufferedStream(Console.OpenStandardInput()); + reader = new StreamReader(input, new UTF8Encoding()); + if (filename.Equals("-")) { + BufferedStream output = new BufferedStream(Console.OpenStandardOutput()); + // A temporary output stream is needed because ResourceWriter.Generate + // expects to be able to seek in the Stream. + MemoryStream tmpoutput = new MemoryStream(); + ResourceWriter rw = new ResourceWriter(tmpoutput); + ReadAllInput(rw); +#if __CSCC__ + // Use the ResourceReader to check against pnet-0.6.0 ResourceWriter + // bug. + try { + ResourceReader rr = new ResourceReader(new MemoryStream(tmpoutput.ToArray())); + foreach (System.Collections.DictionaryEntry entry in rr); + } catch (IOException e) { + throw new Exception("class ResourceWriter is buggy", e); + } +#endif + tmpoutput.WriteTo(output); + rw.Close(); + output.Close(); + } else { +#if __CSCC__ + MemoryStream tmpoutput = new MemoryStream(); + ResourceWriter rw = new ResourceWriter(tmpoutput); + ReadAllInput(rw); + // Use the ResourceReader to check against pnet-0.6.0 ResourceWriter + // bug. + try { + ResourceReader rr = new ResourceReader(new MemoryStream(tmpoutput.ToArray())); + foreach (System.Collections.DictionaryEntry entry in rr); + } catch (IOException e) { + throw new Exception("class ResourceWriter is buggy", e); + } + BufferedStream output = new BufferedStream(new FileStream(filename, FileMode.Create, FileAccess.Write)); + tmpoutput.WriteTo(output); + rw.Close(); + output.Close(); +#else + ResourceWriter rw = new ResourceWriter(filename); + ReadAllInput(rw); + rw.Close(); +#endif + } + } + public static int Main (String[] args) { + try { + new WriteResource(args[0]); + } catch (Exception e) { + Console.Error.WriteLine(e); + Console.Error.WriteLine(e.StackTrace); + return 1; + } + return 0; + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgunfmt.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgunfmt.cs new file mode 100644 index 00000000..d4985881 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Lib/Gnu.Gettext/msgunfmt.cs @@ -0,0 +1,258 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +/* GNU gettext for C# + * Copyright (C) 2003-2004 Free Software Foundation, Inc. + * Written by Bruno Haible , 2003. + * + * 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 2, 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, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * This program dumps a GettextResourceSet subclass (in a satellite assembly) + * or a .resources file as a PO file. + */ + +using System; /* Object, String, Type, Console, Exception */ +using System.Reflection; /* Assembly, MethodInfo, ConstructorInfo */ +using System.Collections; /* Hashtable, DictionaryEntry */ +using System.IO; /* BufferedStream, StreamWriter, TextWriter, FileNotFoundException, Path */ +using System.Text; /* StringBuilder, UTF8Encoding */ +using System.Resources; /* ResourceReader */ +using GNU.Gettext; /* GettextResourceSet */ + +namespace GNU.Gettext { + public class DumpResource { + private TextWriter Out; + private void DumpString (String str) { + int n = str.Length; + Out.Write('"'); + for (int i = 0; i < n; i++) { + char c = str[i]; + if (c == 0x0008) { + Out.Write('\\'); Out.Write('b'); + } else if (c == 0x000c) { + Out.Write('\\'); Out.Write('f'); + } else if (c == 0x000a) { + Out.Write('\\'); Out.Write('n'); + } else if (c == 0x000d) { + Out.Write('\\'); Out.Write('r'); + } else if (c == 0x0009) { + Out.Write('\\'); Out.Write('t'); + } else if (c == '\\' || c == '"') { + Out.Write('\\'); Out.Write(c); + } else + Out.Write(c); + } + Out.Write('"'); + } + private void DumpMessage (String msgid, String msgid_plural, Object msgstr) { + Out.Write("msgid "); DumpString(msgid); Out.Write('\n'); + if (msgid_plural != null) { + Out.Write("msgid_plural "); DumpString(msgid_plural); Out.Write('\n'); + for (int i = 0; i < (msgstr as String[]).Length; i++) { + Out.Write("msgstr[" + i + "] "); + DumpString((msgstr as String[])[i]); + Out.Write('\n'); + } + } else { + Out.Write("msgstr "); DumpString(msgstr as String); Out.Write('\n'); + } + Out.Write('\n'); + } + + // ---------------- Dumping a GettextResourceSet ---------------- + + private void Dump (GettextResourceSet catalog) { + MethodInfo pluralMethod = + catalog.GetType().GetMethod("GetMsgidPluralTable", Type.EmptyTypes); + // Search for the header entry. + { + Object header_entry = catalog.GetObject(""); + // If there is no header entry, fake one. + // FIXME: This is not needed; right after po_lex_charset_init set + // the PO charset to UTF-8. + if (header_entry == null) + header_entry = "Content-Type: text/plain; charset=UTF-8\n"; + DumpMessage("", null, header_entry); + } + // Now the other messages. + { + Hashtable plural = null; + if (pluralMethod != null) + plural = pluralMethod.Invoke(catalog, new Object[0]) as Hashtable; + foreach (String key in catalog.Keys) + if (!"".Equals(key)) { + Object value = catalog.GetObject(key); + String key_plural = + (plural != null && value is String[] ? plural[key] as String : null); + DumpMessage(key, key_plural, value); + } + } + } + // Essentially taken from class GettextResourceManager. + private static Assembly GetSatelliteAssembly (String baseDirectory, String resourceName, String cultureName) { + String satelliteExpectedLocation = + baseDirectory + + Path.DirectorySeparatorChar + cultureName + + Path.DirectorySeparatorChar + resourceName + ".resources.dll"; + return Assembly.LoadFrom(satelliteExpectedLocation); + } + // Taken from class GettextResourceManager. + private static String ConstructClassName (String resourceName) { + // We could just return an arbitrary fixed class name, like "Messages", + // assuming that every assembly will only ever contain one + // GettextResourceSet subclass, but this assumption would break the day + // we want to support multi-domain PO files in the same format... + bool valid = (resourceName.Length > 0); + for (int i = 0; valid && i < resourceName.Length; i++) { + char c = resourceName[i]; + if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_') + || (i > 0 && c >= '0' && c <= '9'))) + valid = false; + } + if (valid) + return resourceName; + else { + // Use hexadecimal escapes, using the underscore as escape character. + String hexdigit = "0123456789abcdef"; + StringBuilder b = new StringBuilder(); + b.Append("__UESCAPED__"); + for (int i = 0; i < resourceName.Length; i++) { + char c = resourceName[i]; + if (c >= 0xd800 && c < 0xdc00 + && i+1 < resourceName.Length + && resourceName[i+1] >= 0xdc00 && resourceName[i+1] < 0xe000) { + // Combine two UTF-16 words to a character. + char c2 = resourceName[i+1]; + int uc = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + b.Append('_'); + b.Append('U'); + b.Append(hexdigit[(uc >> 28) & 0x0f]); + b.Append(hexdigit[(uc >> 24) & 0x0f]); + b.Append(hexdigit[(uc >> 20) & 0x0f]); + b.Append(hexdigit[(uc >> 16) & 0x0f]); + b.Append(hexdigit[(uc >> 12) & 0x0f]); + b.Append(hexdigit[(uc >> 8) & 0x0f]); + b.Append(hexdigit[(uc >> 4) & 0x0f]); + b.Append(hexdigit[uc & 0x0f]); + i++; + } else if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') + || (c >= '0' && c <= '9'))) { + int uc = c; + b.Append('_'); + b.Append('u'); + b.Append(hexdigit[(uc >> 12) & 0x0f]); + b.Append(hexdigit[(uc >> 8) & 0x0f]); + b.Append(hexdigit[(uc >> 4) & 0x0f]); + b.Append(hexdigit[uc & 0x0f]); + } else + b.Append(c); + } + return b.ToString(); + } + } + // Essentially taken from class GettextResourceManager. + private static GettextResourceSet InstantiateResourceSet (Assembly satelliteAssembly, String resourceName, String cultureName) { + Type clazz = satelliteAssembly.GetType(ConstructClassName(resourceName)+"_"+cultureName.Replace('-','_')); + ConstructorInfo constructor = clazz.GetConstructor(Type.EmptyTypes); + return constructor.Invoke(null) as GettextResourceSet; + } + public DumpResource (String baseDirectory, String resourceName, String cultureName) { + // We are only interested in the messages belonging to the locale + // itself, not in the inherited messages. Therefore we instantiate just + // the GettextResourceSet, not a GettextResourceManager. + Assembly satelliteAssembly = + GetSatelliteAssembly(baseDirectory, resourceName, cultureName); + GettextResourceSet catalog = + InstantiateResourceSet(satelliteAssembly, resourceName, cultureName); + BufferedStream stream = new BufferedStream(Console.OpenStandardOutput()); + Out = new StreamWriter(stream, new UTF8Encoding()); + Dump(catalog); + Out.Close(); + stream.Close(); + } + + // ----------------- Dumping a .resources file ------------------ + + public DumpResource (String filename) { + BufferedStream stream = new BufferedStream(Console.OpenStandardOutput()); + Out = new StreamWriter(stream, new UTF8Encoding()); + ResourceReader rr; + if (filename.Equals("-")) { + BufferedStream input = new BufferedStream(Console.OpenStandardInput()); + // A temporary output stream is needed because ResourceReader expects + // to be able to seek in the Stream. + byte[] contents; + { + MemoryStream tmpstream = new MemoryStream(); + byte[] buf = new byte[1024]; + for (;;) { + int n = input.Read(buf, 0, 1024); + if (n == 0) + break; + tmpstream.Write(buf, 0, n); + } + contents = tmpstream.ToArray(); + tmpstream.Close(); + } + MemoryStream tmpinput = new MemoryStream(contents); + rr = new ResourceReader(tmpinput); + } else { + rr = new ResourceReader(filename); + } + foreach (DictionaryEntry entry in rr) // uses rr.GetEnumerator() + DumpMessage(entry.Key as String, null, entry.Value as String); + rr.Close(); + Out.Close(); + stream.Close(); + } + + // -------------------------------------------------------------- + + public static int Main (String[] args) { + try { + if (args.Length > 1) + new DumpResource(args[0], args[1], args[2]); + else + new DumpResource(args[0]); + } catch (Exception e) { + Console.Error.WriteLine(e); + Console.Error.WriteLine(e.StackTrace); + return 1; + } + return 0; + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Gettext.Samples.Console.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Gettext.Samples.Console.csproj new file mode 100644 index 00000000..79e7a4fe --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Gettext.Samples.Console.csproj @@ -0,0 +1,92 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {470FDBA5-04E5-4A9F-80EA-987D1F8D9074} + Exe + Properties + Gettext.Samples.Console + Gettext.Samples.Console + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + True + True + Strings.tt + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + TextTemplatingFileGenerator + Strings.cs + + + + + {D8869765-AB47-4C03-B2C5-E5498A55CA79} + Gettext.Cs + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Program.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Program.cs new file mode 100644 index 00000000..92fbf725 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Program.cs @@ -0,0 +1,76 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; + +namespace Gettext.Samples.Console +{ + class Program + { + static void Main(string[] args) + { + if (SetCultureFromArgs(args)) + { + string translated = Strings.T("Hello world"); + System.Console.Out.WriteLine(translated); + } + } + + private static bool SetCultureFromArgs(string[] args) + { + if (args.Length == 0 || args[0].Contains("?")) + { + PrintUsage(); + return false; + } + else + { + try + { + var culture = CultureInfo.GetCultureInfo(args[0]); + System.Threading.Thread.CurrentThread.CurrentUICulture = culture; + return true; + } + catch (Exception ex) + { + System.Console.Error.WriteLine("Error setting culture from argument {0}:\n{1}", args[0], ex.Message); + return false; + } + } + } + + private static void PrintUsage() + { + System.Console.Out.WriteLine("Use culture short code as only parameter to view message in that language. Choose from one of the available cultures; localized cultures will fall back to neutral ones, and not available ones will fall back to english."); + System.Console.Out.WriteLine(); + System.Console.Out.WriteLine("Available cultures:"); + System.Console.Out.WriteLine(" en"); + System.Console.Out.WriteLine(" es"); + System.Console.Out.WriteLine(" pt"); + System.Console.Out.WriteLine(" fr"); + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Properties/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..a1fdc131 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Properties/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Gettext.Samples.Console")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Gettext.Samples.Console")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b773169f-8efd-4d1c-b873-625eb1f90c26")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/en/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/en/Strings.po new file mode 100644 index 00000000..dec6eeac --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/en/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/es/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/es/Strings.po new file mode 100644 index 00000000..8e7edd51 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/es/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "Hola mundo" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/fr/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/fr/Strings.po new file mode 100644 index 00000000..ffdf43ca --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/fr/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "Bonjour tout le monde" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/pt/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/pt/Strings.po new file mode 100644 index 00000000..0e647052 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Resources/pt/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "Olá mundo" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.cs new file mode 100644 index 00000000..63569620 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.cs @@ -0,0 +1,168 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + + +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Threading; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace Gettext.Samples.Console +{ + public class Strings + { + private static Object resourceManLock = new Object(); + private static System.Resources.ResourceManager resourceMan; + private static System.Globalization.CultureInfo resourceCulture; + + public const string ResourceName = "Strings"; + + private static string resourcesDir = GetSetting("ResourcesDir", "Resources"); + private static string fileFormat = GetSetting("ResourcesFileFormat", "{{culture}}/{{resource}}.po"); + + private static string GetSetting(string setting, string defaultValue) + { + var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings"); + if (section == null) return defaultValue; + else return section[setting] ?? defaultValue; + } + + + /// + /// Resources directory used to retrieve files from. + /// + public static string ResourcesDirectory + { + get { return resourcesDir; } + set { resourcesDir = value; } + } + + /// + /// Format of the file based on culture and resource name. + /// + public static string FileFormat + { + get { return fileFormat; } + set { fileFormat = value; } + } + + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + public static System.Resources.ResourceManager ResourceManager + { + get + { + + if (object.ReferenceEquals(resourceMan, null)) + { + lock (resourceManLock) + { + if (object.ReferenceEquals(resourceMan, null)) + { + var directory = resourcesDir; + var mgr = new global::Gettext.Cs.GettextResourceManager(ResourceName, directory, fileFormat); + resourceMan = mgr; + } + } + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + public static System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(string t) + { + return T(null, t); + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t) + { + if (String.IsNullOrEmpty(t)) return t; + var translated = ResourceManager.GetString(t, info ?? resourceCulture); + return String.IsNullOrEmpty(translated) ? t : translated; + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(string t, params object[] parameters) + { + return T(null, t, parameters); + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t, params object[] parameters) + { + if (String.IsNullOrEmpty(t)) return t; + return String.Format(T(info, t), parameters); + } + + /// + /// Marks a string for future translation, does not translate it now. + /// + public static string M(string t) + { + return t; + } + + /// + /// Returns the resource set available for the specified culture. + /// + public static System.Resources.ResourceSet GetResourceSet(CultureInfo culture) + { + return ResourceManager.GetResourceSet(culture, true, true); + } + } +} + + diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.tt b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.tt new file mode 100644 index 00000000..fb3c2dc6 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Strings.tt @@ -0,0 +1,9 @@ +<#@ assembly name="System.Configuration" #> + +<# + this.ClassName = "Strings"; + this.ResourceName = "Strings"; + this.NamespaceName = "Gettext.Samples.Console"; + this.DefaultResourceDir = "Resources"; +#> +<#@ include file="..\..\Core\Gettext.Cs\Templates\Strings.tt" #> diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Templates/Strings.pot b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Templates/Strings.pot new file mode 100644 index 00000000..dec6eeac --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/Templates/Strings.pot @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/scripts/Extract.bat b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/scripts/Extract.bat new file mode 100644 index 00000000..732363d0 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Console/scripts/Extract.bat @@ -0,0 +1,30 @@ +rem gettext-cs-utils +rem +rem Copyright 2011 Manas Technology Solutions +rem http://www.manas.com.ar/ +rem +rem This library is free software; you can redistribute it and/or +rem modify it under the terms of the GNU Lesser General Public +rem License as published by the Free Software Foundation; either +rem version 2.1 of the License, or (at your option) any later version. +rem +rem This library is distributed in the hope that it will be useful, +rem but WITHOUT ANY WARRANTY; without even the implied warranty of +rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +rem Lesser General Public License for more details. +rem +rem You should have received a copy of the GNU Lesser General Public +rem License along with this library. If not, see . + + +@ECHO OFF + +echo. +echo Setting up global variables... +SET path_xgettext=..\..\..\Bin\Gnu.Gettext.Win32\xgettext.exe +SET path_output=..\Templates +SET file_list=.\..\*.cs + +echo. +echo Generating strings po file... +CALL ..\..\..\Scripts\ExtractStrings.bat Strings \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/App.config b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/App.config new file mode 100644 index 00000000..ebb2dc86 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/App.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Gettext.Samples.Database.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Gettext.Samples.Database.csproj new file mode 100644 index 00000000..37fb0dca --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Gettext.Samples.Database.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {9FBD5BA7-BCE6-48FE-9FB7-396F377D1313} + Exe + Properties + Gettext.Samples.Database + Gettext.Samples.Database + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + Strings.tt + True + True + + + + + {D8869765-AB47-4C03-B2C5-E5498A55CA79} + Gettext.Cs + + + + + + TextTemplatingFileGenerator + Strings.cs + + + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Program.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Program.cs new file mode 100644 index 00000000..27b69fc6 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Program.cs @@ -0,0 +1,77 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; + +namespace Gettext.Samples.Database +{ + class Program + { + static void Main(string[] args) + { + if (SetCultureFromArgs(args)) + { + string translated = Strings.T("Hello world"); + System.Console.Out.WriteLine(translated); + } + } + + private static bool SetCultureFromArgs(string[] args) + { + if (args.Length == 0 || args[0].Contains("?")) + { + PrintUsage(); + return false; + } + else + { + try + { + var culture = CultureInfo.GetCultureInfo(args[0]); + System.Threading.Thread.CurrentThread.CurrentUICulture = culture; + return true; + } + catch (Exception ex) + { + System.Console.Error.WriteLine("Error setting culture from argument {0}:\n{1}", args[0], ex.Message); + return false; + } + } + } + + private static void PrintUsage() + { + System.Console.Out.WriteLine("Use culture short code as only parameter to view message in that language. Choose from one of the available cultures; localized cultures will fall back to neutral ones, and not available ones will fall back to english."); + System.Console.Out.WriteLine(); + System.Console.Out.WriteLine("Available cultures:"); + System.Console.Out.WriteLine(" en"); + System.Console.Out.WriteLine(" es"); + System.Console.Out.WriteLine(" pt"); + System.Console.Out.WriteLine(" fr"); + } + + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Properties/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..df55236f --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Properties/AssemblyInfo.cs @@ -0,0 +1,58 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Gettext.Samples.Database")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Gettext.Samples.Database")] +[assembly: AssemblyCopyright("Copyright © 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4aee2ac6-27d5-4d59-a695-53778e5d56c0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.cs new file mode 100644 index 00000000..80a35301 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.cs @@ -0,0 +1,147 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + + +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Threading; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace Gettext.Samples.Database +{ + public class Strings + { + private static Object resourceManLock = new Object(); + private static System.Resources.ResourceManager resourceMan; + private static System.Globalization.CultureInfo resourceCulture; + + public const string ResourceName = "Strings"; + + + private static string GetSetting(string setting, string defaultValue) + { + var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings"); + if (section == null) return defaultValue; + else return section[setting] ?? defaultValue; + } + + + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + public static System.Resources.ResourceManager ResourceManager + { + get + { + + if (object.ReferenceEquals(resourceMan, null)) + { + lock (resourceManLock) + { + if (object.ReferenceEquals(resourceMan, null)) + { + var mgr = new global::Gettext.Cs.DatabaseResourceManager("GettextGetResourceSet"); + resourceMan = mgr; + } + } + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + public static System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(string t) + { + return T(null, t); + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t) + { + if (String.IsNullOrEmpty(t)) return t; + var translated = ResourceManager.GetString(t, info ?? resourceCulture); + return String.IsNullOrEmpty(translated) ? t : translated; + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(string t, params object[] parameters) + { + return T(null, t, parameters); + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t, params object[] parameters) + { + if (String.IsNullOrEmpty(t)) return t; + return String.Format(T(info, t), parameters); + } + + /// + /// Marks a string for future translation, does not translate it now. + /// + public static string M(string t) + { + return t; + } + + /// + /// Returns the resource set available for the specified culture. + /// + public static System.Resources.ResourceSet GetResourceSet(CultureInfo culture) + { + return ResourceManager.GetResourceSet(culture, true, true); + } + } +} + + diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.tt b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.tt new file mode 100644 index 00000000..cff4cd06 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Strings.tt @@ -0,0 +1,10 @@ +<#@ assembly name="System.Configuration" #> + +<# + this.ClassName = "Strings"; + this.ResourceName = "Strings"; + this.NamespaceName = "Gettext.Samples.Database"; + this.StoredProcedureName = "GettextGetResourceSet"; + this.UseDatabase = true; +#> +<#@ include file="..\..\Core\Gettext.Cs\Templates\Strings.tt" #> diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/en/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/en/Strings.po new file mode 100644 index 00000000..dec6eeac --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/en/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/es/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/es/Strings.po new file mode 100644 index 00000000..8e7edd51 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/es/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "Hola mundo" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/fr/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/fr/Strings.po new file mode 100644 index 00000000..ffdf43ca --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/fr/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "Bonjour tout le monde" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/pt/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/pt/Strings.po new file mode 100644 index 00000000..0e647052 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/Translated/pt/Strings.po @@ -0,0 +1,3 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Console\Program.cs:15 +msgid "Hello world" +msgstr "Olá mundo" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/scripts/DBDump.bat b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/scripts/DBDump.bat new file mode 100644 index 00000000..7cfc8f20 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Database/scripts/DBDump.bat @@ -0,0 +1,39 @@ +rem gettext-cs-utils +rem +rem Copyright 2011 Manas Technology Solutions +rem http://www.manas.com.ar/ +rem +rem This library is free software; you can redistribute it and/or +rem modify it under the terms of the GNU Lesser General Public +rem License as published by the Free Software Foundation; either +rem version 2.1 of the License, or (at your option) any later version. +rem +rem This library is distributed in the hope that it will be useful, +rem but WITHOUT ANY WARRANTY; without even the implied warranty of +rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +rem Lesser General Public License for more details. +rem +rem You should have received a copy of the GNU Lesser General Public +rem License along with this library. If not, see . + + +@ECHO OFF + +SET dbrsgen=..\..\..\Tools\Gettext.DatabaseResourceGenerator\bin\Debug\DatabaseResourceGenerator.exe + +echo. +echo Dumping culture sets into DB... + +echo Culture es +CALL %dbrsgen% -i ..\Translated\es\Strings.po -c es -a + +echo Culture en +CALL %dbrsgen% -i ..\Translated\en\Strings.po -c en -a + +echo Culture pt +CALL %dbrsgen% -i ..\Translated\pt\Strings.po -c pt -a + +echo Culture fr +CALL %dbrsgen% -i ..\Translated\fr\Strings.po -c fr -a + +pause \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Content/Site.css b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Content/Site.css new file mode 100644 index 00000000..59aeb2e8 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Content/Site.css @@ -0,0 +1,317 @@ +/*---------------------------------------------------------- +The base color for this template is #5c87b2. If you'd like +to use a different color start by replacing all instances of +#5c87b2 with your new color. +----------------------------------------------------------*/ +body +{ + background-color: #5c87b2; + font-size: .75em; + font-family: Verdana, Helvetica, Sans-Serif; + margin: 0; + padding: 0; + color: #696969; +} + +a:link +{ + color: #034af3; + text-decoration: underline; +} +a:visited +{ + color: #505abc; +} +a:hover +{ + color: #1d60ff; + text-decoration: none; +} +a:active +{ + color: #12eb87; +} + +p, ul +{ + margin-bottom: 20px; + line-height: 1.6em; +} + +/* HEADINGS +----------------------------------------------------------*/ +h1, h2, h3, h4, h5, h6 +{ + font-size: 1.5em; + color: #000; + font-family: Arial, Helvetica, sans-serif; +} + +h1 +{ + font-size: 2em; + padding-bottom: 0; + margin-bottom: 0; +} +h2 +{ + padding: 0 0 10px 0; +} +h3 +{ + font-size: 1.2em; +} +h4 +{ + font-size: 1.1em; +} +h5, h6 +{ + font-size: 1em; +} + +/* this rule styles

tags that are the +first child of the left and right table columns */ +.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2 +{ + margin-top: 0; +} + +/* PRIMARY LAYOUT ELEMENTS +----------------------------------------------------------*/ + +/* you can specify a greater or lesser percentage for the +page width. Or, you can specify an exact pixel width. */ +.page +{ + width: 90%; + margin-left: auto; + margin-right: auto; +} + +#header +{ + position: relative; + margin-bottom: 0px; + color: #000; + padding: 0; +} + +#header h1 +{ + font-weight: bold; + padding: 5px 0; + margin: 0; + color: #fff; + border: none; + line-height: 2em; + font-family: Arial, Helvetica, sans-serif; + font-size: 32px !important; +} + +#main +{ + padding: 30px 30px 15px 30px; + background-color: #fff; + margin-bottom: 30px; + _height: 1px; /* only IE6 applies CSS properties starting with an underscrore */ +} + +#footer +{ + color: #999; + padding: 10px 0; + text-align: center; + line-height: normal; + margin: 0; + font-size: .9em; +} + +/* TAB MENU +----------------------------------------------------------*/ +ul#menu +{ + border-bottom: 1px #5C87B2 solid; + padding: 0 0 2px; + position: relative; + margin: 0; + text-align: right; +} + +ul#menu li +{ + display: inline; + list-style: none; +} + +ul#menu li#greeting +{ + padding: 10px 20px; + font-weight: bold; + text-decoration: none; + line-height: 2.8em; + color: #fff; +} + +ul#menu li a +{ + padding: 10px 20px; + font-weight: bold; + text-decoration: none; + line-height: 2.8em; + background-color: #e8eef4; + color: #034af3; +} + +ul#menu li a:hover +{ + background-color: #fff; + text-decoration: none; +} + +ul#menu li a:active +{ + background-color: #a6e2a6; + text-decoration: none; +} + +ul#menu li.selected a +{ + background-color: #fff; + color: #000; +} + +/* FORM LAYOUT ELEMENTS +----------------------------------------------------------*/ + +fieldset +{ + margin: 1em 0; + padding: 1em; + border: 1px solid #CCC; +} + +fieldset p +{ + margin: 2px 12px 10px 10px; +} + +fieldset label +{ + display: block; +} + +fieldset label.inline +{ + display: inline; +} + +legend +{ + font-size: 1.1em; + font-weight: 600; + padding: 2px 4px 8px 4px; +} + +input[type="text"] +{ + width: 200px; + border: 1px solid #CCC; +} + +input[type="password"] +{ + width: 200px; + border: 1px solid #CCC; +} + +/* TABLE +----------------------------------------------------------*/ + +table +{ + border: solid 1px #e8eef4; + border-collapse: collapse; +} + +table td +{ + padding: 5px; + border: solid 1px #e8eef4; +} + +table th +{ + padding: 6px 5px; + text-align: left; + background-color: #e8eef4; + border: solid 1px #e8eef4; +} + +/* MISC +----------------------------------------------------------*/ +.clear +{ + clear: both; +} + +.error +{ + color:Red; +} + +#menucontainer +{ + margin-top:40px; +} + +div#title +{ + display:block; + float:left; + text-align:left; +} + +#logindisplay +{ + font-size:1.1em; + display:block; + text-align:right; + margin:10px; + color:White; +} + +#logindisplay a:link +{ + color: white; + text-decoration: underline; +} + +#logindisplay a:visited +{ + color: white; + text-decoration: underline; +} + +#logindisplay a:hover +{ + color: white; + text-decoration: none; +} + +.field-validation-error +{ + color: #ff0000; +} + +.input-validation-error +{ + border: 1px solid #ff0000; + background-color: #ffeeee; +} + +.validation-summary-errors +{ + font-weight: bold; + color: #ff0000; +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/AccountController.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/AccountController.cs new file mode 100644 index 00000000..0e85fd37 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/AccountController.cs @@ -0,0 +1,373 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Security.Principal; +using System.Web; +using System.Web.Mvc; +using System.Web.Security; +using System.Web.UI; + +namespace Gettext.Samples.Mvc.Controllers +{ + + [HandleError] + public class AccountController : Controller + { + + // This constructor is used by the MVC framework to instantiate the controller using + // the default forms authentication and membership providers. + + public AccountController() + : this(null, null) + { + } + + // This constructor is not used by the MVC framework but is instead provided for ease + // of unit testing this type. See the comments at the end of this file for more + // information. + public AccountController(IFormsAuthentication formsAuth, IMembershipService service) + { + FormsAuth = formsAuth ?? new FormsAuthenticationService(); + MembershipService = service ?? new AccountMembershipService(); + } + + public IFormsAuthentication FormsAuth + { + get; + private set; + } + + public IMembershipService MembershipService + { + get; + private set; + } + + public ActionResult LogOn() + { + + return View(); + } + + [AcceptVerbs(HttpVerbs.Post)] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", + Justification = "Needs to take same parameter type as Controller.Redirect()")] + public ActionResult LogOn(string userName, string password, bool rememberMe, string returnUrl) + { + + if (!ValidateLogOn(userName, password)) + { + return View(); + } + + FormsAuth.SignIn(userName, rememberMe); + if (!String.IsNullOrEmpty(returnUrl)) + { + return Redirect(returnUrl); + } + else + { + return RedirectToAction("Index", "Home"); + } + } + + public ActionResult LogOff() + { + + FormsAuth.SignOut(); + + return RedirectToAction("Index", "Home"); + } + + public ActionResult Register() + { + + ViewData["PasswordLength"] = MembershipService.MinPasswordLength; + + return View(); + } + + [AcceptVerbs(HttpVerbs.Post)] + public ActionResult Register(string userName, string email, string password, string confirmPassword) + { + + ViewData["PasswordLength"] = MembershipService.MinPasswordLength; + + if (ValidateRegistration(userName, email, password, confirmPassword)) + { + // Attempt to register the user + MembershipCreateStatus createStatus = MembershipService.CreateUser(userName, password, email); + + if (createStatus == MembershipCreateStatus.Success) + { + FormsAuth.SignIn(userName, false /* createPersistentCookie */); + return RedirectToAction("Index", "Home"); + } + else + { + ModelState.AddModelError("_FORM", ErrorCodeToString(createStatus)); + } + } + + // If we got this far, something failed, redisplay form + return View(); + } + + [Authorize] + public ActionResult ChangePassword() + { + + ViewData["PasswordLength"] = MembershipService.MinPasswordLength; + + return View(); + } + + [Authorize] + [AcceptVerbs(HttpVerbs.Post)] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", + Justification = "Exceptions result in password not being changed.")] + public ActionResult ChangePassword(string currentPassword, string newPassword, string confirmPassword) + { + + ViewData["PasswordLength"] = MembershipService.MinPasswordLength; + + if (!ValidateChangePassword(currentPassword, newPassword, confirmPassword)) + { + return View(); + } + + try + { + if (MembershipService.ChangePassword(User.Identity.Name, currentPassword, newPassword)) + { + return RedirectToAction("ChangePasswordSuccess"); + } + else + { + ModelState.AddModelError("_FORM", "The current password is incorrect or the new password is invalid."); + return View(); + } + } + catch + { + ModelState.AddModelError("_FORM", "The current password is incorrect or the new password is invalid."); + return View(); + } + } + + public ActionResult ChangePasswordSuccess() + { + + return View(); + } + + protected override void OnActionExecuting(ActionExecutingContext filterContext) + { + if (filterContext.HttpContext.User.Identity is WindowsIdentity) + { + throw new InvalidOperationException("Windows authentication is not supported."); + } + } + + #region Validation Methods + + private bool ValidateChangePassword(string currentPassword, string newPassword, string confirmPassword) + { + if (String.IsNullOrEmpty(currentPassword)) + { + ModelState.AddModelError("currentPassword", "You must specify a current password."); + } + if (newPassword == null || newPassword.Length < MembershipService.MinPasswordLength) + { + ModelState.AddModelError("newPassword", + String.Format(CultureInfo.CurrentCulture, + "You must specify a new password of {0} or more characters.", + MembershipService.MinPasswordLength)); + } + + if (!String.Equals(newPassword, confirmPassword, StringComparison.Ordinal)) + { + ModelState.AddModelError("_FORM", "The new password and confirmation password do not match."); + } + + return ModelState.IsValid; + } + + private bool ValidateLogOn(string userName, string password) + { + if (String.IsNullOrEmpty(userName)) + { + ModelState.AddModelError("username", "You must specify a username."); + } + if (String.IsNullOrEmpty(password)) + { + ModelState.AddModelError("password", "You must specify a password."); + } + if (!MembershipService.ValidateUser(userName, password)) + { + ModelState.AddModelError("_FORM", "The username or password provided is incorrect."); + } + + return ModelState.IsValid; + } + + private bool ValidateRegistration(string userName, string email, string password, string confirmPassword) + { + if (String.IsNullOrEmpty(userName)) + { + ModelState.AddModelError("username", "You must specify a username."); + } + if (String.IsNullOrEmpty(email)) + { + ModelState.AddModelError("email", "You must specify an email address."); + } + if (password == null || password.Length < MembershipService.MinPasswordLength) + { + ModelState.AddModelError("password", + String.Format(CultureInfo.CurrentCulture, + "You must specify a password of {0} or more characters.", + MembershipService.MinPasswordLength)); + } + if (!String.Equals(password, confirmPassword, StringComparison.Ordinal)) + { + ModelState.AddModelError("_FORM", "The new password and confirmation password do not match."); + } + return ModelState.IsValid; + } + + private static string ErrorCodeToString(MembershipCreateStatus createStatus) + { + // See http://msdn.microsoft.com/en-us/library/system.web.security.membershipcreatestatus.aspx for + // a full list of status codes. + switch (createStatus) + { + case MembershipCreateStatus.DuplicateUserName: + return "Username already exists. Please enter a different user name."; + + case MembershipCreateStatus.DuplicateEmail: + return "A username for that e-mail address already exists. Please enter a different e-mail address."; + + case MembershipCreateStatus.InvalidPassword: + return "The password provided is invalid. Please enter a valid password value."; + + case MembershipCreateStatus.InvalidEmail: + return "The e-mail address provided is invalid. Please check the value and try again."; + + case MembershipCreateStatus.InvalidAnswer: + return "The password retrieval answer provided is invalid. Please check the value and try again."; + + case MembershipCreateStatus.InvalidQuestion: + return "The password retrieval question provided is invalid. Please check the value and try again."; + + case MembershipCreateStatus.InvalidUserName: + return "The user name provided is invalid. Please check the value and try again."; + + case MembershipCreateStatus.ProviderError: + return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator."; + + case MembershipCreateStatus.UserRejected: + return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator."; + + default: + return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator."; + } + } + #endregion + } + + // The FormsAuthentication type is sealed and contains static members, so it is difficult to + // unit test code that calls its members. The interface and helper class below demonstrate + // how to create an abstract wrapper around such a type in order to make the AccountController + // code unit testable. + + public interface IFormsAuthentication + { + void SignIn(string userName, bool createPersistentCookie); + void SignOut(); + } + + public class FormsAuthenticationService : IFormsAuthentication + { + public void SignIn(string userName, bool createPersistentCookie) + { + FormsAuthentication.SetAuthCookie(userName, createPersistentCookie); + } + public void SignOut() + { + FormsAuthentication.SignOut(); + } + } + + public interface IMembershipService + { + int MinPasswordLength { get; } + + bool ValidateUser(string userName, string password); + MembershipCreateStatus CreateUser(string userName, string password, string email); + bool ChangePassword(string userName, string oldPassword, string newPassword); + } + + public class AccountMembershipService : IMembershipService + { + private MembershipProvider _provider; + + public AccountMembershipService() + : this(null) + { + } + + public AccountMembershipService(MembershipProvider provider) + { + _provider = provider ?? Membership.Provider; + } + + public int MinPasswordLength + { + get + { + return _provider.MinRequiredPasswordLength; + } + } + + public bool ValidateUser(string userName, string password) + { + return _provider.ValidateUser(userName, password); + } + + public MembershipCreateStatus CreateUser(string userName, string password, string email) + { + MembershipCreateStatus status; + _provider.CreateUser(userName, password, email, null, null, true, null, out status); + return status; + } + + public bool ChangePassword(string userName, string oldPassword, string newPassword) + { + MembershipUser currentUser = _provider.GetUser(userName, true /* userIsOnline */); + return currentUser.ChangePassword(oldPassword, newPassword); + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/HomeController.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/HomeController.cs new file mode 100644 index 00000000..2428c197 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Controllers/HomeController.cs @@ -0,0 +1,46 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace Gettext.Samples.Mvc.Controllers +{ + [HandleError] + public class HomeController : Controller + { + public ActionResult Index() + { + ViewData["Message"] = Strings.T("Welcome to internationalized ASP.NET MVC!"); + + return View(); + } + + public ActionResult About() + { + return View(); + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx new file mode 100644 index 00000000..62532012 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx @@ -0,0 +1,3 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Gettext.Samples.Mvc._Default" %> + +<%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%> diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx.cs new file mode 100644 index 00000000..ce36e0bc --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Default.aspx.cs @@ -0,0 +1,44 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Web; +using System.Web.Mvc; +using System.Web.UI; + +namespace Gettext.Samples.Mvc +{ + public partial class _Default : Page + { + public void Page_Load(object sender, System.EventArgs e) + { + // Change the current path so that the Routing handler can correctly interpret + // the request, then restore the original path so that the OutputCache module + // can correctly process the response (if caching is enabled). + + string originalPath = Request.Path; + HttpContext.Current.RewritePath(Request.ApplicationPath, false); + IHttpHandler httpHandler = new MvcHttpHandler(); + httpHandler.ProcessRequest(HttpContext.Current); + HttpContext.Current.RewritePath(originalPath, false); + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.Publish.xml b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.Publish.xml new file mode 100644 index 00000000..3fd6762b --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.Publish.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.csproj b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.csproj new file mode 100644 index 00000000..152631ee --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext.Samples.Mvc.csproj @@ -0,0 +1,155 @@ + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {208D43F3-84E6-45B9-B6CC-6E3F48E42A82} + {603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Gettext.Samples.Mvc + Gettext.Samples.Mvc + v3.5 + false + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + 3.5 + + + 3.5 + + + + 3.5 + + + + + + + + + + + + + + + + + Default.aspx + ASPXCodeBehind + + + Code + + + Strings.tt + True + True + + + Global.asax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {38474466-DA21-4D19-A4D8-E2E7918480D6} + Gettext.Cs.Web + + + {D8869765-AB47-4C03-B2C5-E5498A55CA79} + Gettext.Cs + + + + + PreserveNewest + + + PreserveNewest + + + TextTemplatingFileGenerator + Strings.cs + + + + + + + + + + + + + + + + + + + + False + True + 6237 + / + + + False + False + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/AspTranslateControl.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/AspTranslateControl.cs new file mode 100644 index 00000000..bc437214 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/AspTranslateControl.cs @@ -0,0 +1,44 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Data; +using System.Configuration; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Xml.Linq; + +namespace Gettext.Samples.Mvc.Controls +{ + public class t : Gettext.Cs.Web.AspTranslate + { + protected override string Translate(string text) + { + return Strings.T(text); + } + } +} diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Extract.bat b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Extract.bat new file mode 100644 index 00000000..63634a3c --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Extract.bat @@ -0,0 +1,32 @@ +rem gettext-cs-utils +rem +rem Copyright 2011 Manas Technology Solutions +rem http://www.manas.com.ar/ +rem +rem This library is free software; you can redistribute it and/or +rem modify it under the terms of the GNU Lesser General Public +rem License as published by the Free Software Foundation; either +rem version 2.1 of the License, or (at your option) any later version. +rem +rem This library is distributed in the hope that it will be useful, +rem but WITHOUT ANY WARRANTY; without even the implied warranty of +rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +rem Lesser General Public License for more details. +rem +rem You should have received a copy of the GNU Lesser General Public +rem License along with this library. If not, see . + + +@ECHO OFF + +echo. +echo Setting up global variables... +SET path_xgettext=..\..\..\Bin\Gnu.Gettext.Win32\xgettext.exe +SET path_aspextract=..\..\..\Tools\Gettext.AspExtract\bin\Debug\AspExtract.exe +SET path_output=.\Templates +SET file_list=..\*.cs +SET asp_files_root=.. + +echo. +echo Generating strings po file... +CALL ..\..\..\Scripts\ExtractAspNetStrings.bat Strings \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/en/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/en/Strings.po new file mode 100644 index 00000000..13efaae9 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/en/Strings.po @@ -0,0 +1,16 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Controllers\HomeController.cs:14 +msgid "Welcome to internationalized ASP.NET MVC!" +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:1 +msgid "Hello world" +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:2 +#, csharp-format +msgid "Go to the {0} page." +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:3 +msgid "home" +msgstr "" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/es/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/es/Strings.po new file mode 100644 index 00000000..ce7c4d3a --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Po/es/Strings.po @@ -0,0 +1,16 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Controllers\HomeController.cs:14 +msgid "Welcome to internationalized ASP.NET MVC!" +msgstr "Bienvenido a ASP.NET MVC internacionalizado!" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:1 +msgid "Hello world" +msgstr "Hola mundo" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:2 +#, csharp-format +msgid "Go to the {0} page." +msgstr "Ir a la página de {0}." + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:3 +msgid "home" +msgstr "inicio" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.cs new file mode 100644 index 00000000..40bbcc34 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.cs @@ -0,0 +1,170 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + + +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Threading; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace Gettext.Samples.Mvc +{ + public class Strings + { + private static Object resourceManLock = new Object(); + private static System.Resources.ResourceManager resourceMan; + private static System.Globalization.CultureInfo resourceCulture; + + public const string ResourceName = "Strings"; + + private static string resourcesDir = GetSetting("ResourcesDir", "Po"); + private static string fileFormat = GetSetting("ResourcesFileFormat", "{{culture}}/{{resource}}.po"); + + private static string GetSetting(string setting, string defaultValue) + { + var section = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("appSettings"); + if (section == null) return defaultValue; + else return section[setting] ?? defaultValue; + } + + + /// + /// Resources directory used to retrieve files from. + /// + public static string ResourcesDirectory + { + get { return resourcesDir; } + set { resourcesDir = value; } + } + + /// + /// Format of the file based on culture and resource name. + /// + public static string FileFormat + { + get { return fileFormat; } + set { fileFormat = value; } + } + + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + public static System.Resources.ResourceManager ResourceManager + { + get + { + + if (object.ReferenceEquals(resourceMan, null)) + { + lock (resourceManLock) + { + if (object.ReferenceEquals(resourceMan, null)) + { + var directory = resourcesDir; + if (System.Web.HttpContext.Current != null) + directory = System.Web.HttpContext.Current.Server.MapPath(directory); + var mgr = new global::Gettext.Cs.GettextResourceManager(ResourceName, directory, fileFormat); + resourceMan = mgr; + } + } + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + public static System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(string t) + { + return T(null, t); + } + + /// + /// Looks up a localized string; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t) + { + if (String.IsNullOrEmpty(t)) return t; + var translated = ResourceManager.GetString(t, info ?? resourceCulture); + return String.IsNullOrEmpty(translated) ? t : translated; + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(string t, params object[] parameters) + { + return T(null, t, parameters); + } + + /// + /// Looks up a localized string and formats it with the parameters provided; used to mark string for translation as well. + /// + public static string T(CultureInfo info, string t, params object[] parameters) + { + if (String.IsNullOrEmpty(t)) return t; + return String.Format(T(info, t), parameters); + } + + /// + /// Marks a string for future translation, does not translate it now. + /// + public static string M(string t) + { + return t; + } + + /// + /// Returns the resource set available for the specified culture. + /// + public static System.Resources.ResourceSet GetResourceSet(CultureInfo culture) + { + return ResourceManager.GetResourceSet(culture, true, true); + } + } +} + + diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.tt b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.tt new file mode 100644 index 00000000..7fc214f6 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Strings.tt @@ -0,0 +1,9 @@ +<#@ assembly name="System.Configuration" #> + +<# + this.ClassName = "Strings"; + this.ResourceName = "Strings"; + this.NamespaceName = "Gettext.Samples.Mvc"; + this.ServerMapPath = true; +#> +<#@ include file="..\..\..\Core\Gettext.Cs\Templates\Strings.tt" #> diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Templates/Strings.pot b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Templates/Strings.pot new file mode 100644 index 00000000..4ee25a70 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Gettext/Templates/Strings.pot @@ -0,0 +1,16 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Controllers\HomeController.cs:14 +msgid "Welcome to internationalized ASP.NET MVC!" +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:1 +msgid "Hello world" +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:2 +#, csharp-format +msgid "Go to the {0} page." +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:3 +msgid "home" +msgstr "" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax new file mode 100644 index 00000000..d41d5e66 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="Gettext.Samples.Mvc.MvcApplication" Language="C#" %> diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax.cs new file mode 100644 index 00000000..8865a049 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Global.asax.cs @@ -0,0 +1,54 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; + +namespace Gettext.Samples.Mvc +{ + // Note: For instructions on enabling IIS6 or IIS7 classic mode, + // visit http://go.microsoft.com/?LinkId=9394801 + + public class MvcApplication : System.Web.HttpApplication + { + public static void RegisterRoutes(RouteCollection routes) + { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapRoute( + "Default", // Route name + "{controller}/{action}/{id}", // URL with parameters + new { controller = "Home", action = "Index", id = "" } // Parameter defaults + ); + + } + + protected void Application_Start() + { + RegisterRoutes(RouteTable.Routes); + } + } +} \ No newline at end of file diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/en/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/en/Strings.po new file mode 100644 index 00000000..4ee25a70 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/en/Strings.po @@ -0,0 +1,16 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Controllers\HomeController.cs:14 +msgid "Welcome to internationalized ASP.NET MVC!" +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:1 +msgid "Hello world" +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:2 +#, csharp-format +msgid "Go to the {0} page." +msgstr "" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:3 +msgid "home" +msgstr "" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/es/Strings.po b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/es/Strings.po new file mode 100644 index 00000000..40c75ac8 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Po/es/Strings.po @@ -0,0 +1,16 @@ +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Controllers\HomeController.cs:14 +msgid "Welcome to internationalized ASP.NET MVC!" +msgstr "Bienvenido a ASP.NET MVC internacionalizado!" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:1 +msgid "Hello world" +msgstr "Hola mundo" + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:2 +#, csharp-format +msgid "Go to the {0} page." +msgstr "Ir a la pgina de {0}." + +#: E:\Gettext\cs-utils\Gettext.CsUtils\Samples\Gettext.Samples.Mvc\Views\Home\Index.aspx.postrings:3 +msgid "home" +msgstr "inicio" diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Properties/AssemblyInfo.cs b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..350925c2 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Properties/AssemblyInfo.cs @@ -0,0 +1,57 @@ +/** + * gettext-cs-utils + * + * Copyright 2011 Manas Technology Solutions + * http://www.manas.com.ar/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + **/ + + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Gettext.Samples.Mvc")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Gettext.Samples.Mvc")] +[assembly: AssemblyCopyright("Copyright © 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f196ad9a-551e-4a6d-8635-413e36224086")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.debug.js b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.debug.js new file mode 100644 index 00000000..7b7de621 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.debug.js @@ -0,0 +1,6850 @@ +// Name: MicrosoftAjax.debug.js +// Assembly: System.Web.Extensions +// Version: 3.5.0.0 +// FileVersion: 3.5.30729.1 +//----------------------------------------------------------------------- +// Copyright (C) Microsoft Corporation. All rights reserved. +//----------------------------------------------------------------------- +// MicrosoftAjax.js +// Microsoft AJAX Framework. + +Function.__typeName = 'Function'; +Function.__class = true; +Function.createCallback = function Function$createCallback(method, context) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "method", type: Function}, + {name: "context", mayBeNull: true} + ]); + if (e) throw e; + return function() { + var l = arguments.length; + if (l > 0) { + var args = []; + for (var i = 0; i < l; i++) { + args[i] = arguments[i]; + } + args[l] = context; + return method.apply(this, args); + } + return method.call(this, context); + } +} +Function.createDelegate = function Function$createDelegate(instance, method) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance", mayBeNull: true}, + {name: "method", type: Function} + ]); + if (e) throw e; + return function() { + return method.apply(instance, arguments); + } +} +Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); +} +Function._validateParams = function Function$_validateParams(params, expectedParams) { + var e; + e = Function._validateParameterCount(params, expectedParams); + if (e) { + e.popStackFrame(); + return e; + } + for (var i=0; i < params.length; i++) { + var expectedParam = expectedParams[Math.min(i, expectedParams.length - 1)]; + var paramName = expectedParam.name; + if (expectedParam.parameterArray) { + paramName += "[" + (i - expectedParams.length + 1) + "]"; + } + e = Function._validateParameter(params[i], expectedParam, paramName); + if (e) { + e.popStackFrame(); + return e; + } + } + return null; +} +Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams) { + var maxParams = expectedParams.length; + var minParams = 0; + for (var i=0; i < expectedParams.length; i++) { + if (expectedParams[i].parameterArray) { + maxParams = Number.MAX_VALUE; + } + else if (!expectedParams[i].optional) { + minParams++; + } + } + if (params.length < minParams || params.length > maxParams) { + var e = Error.parameterCount(); + e.popStackFrame(); + return e; + } + return null; +} +Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) { + var e; + var expectedType = expectedParam.type; + var expectedInteger = !!expectedParam.integer; + var expectedDomElement = !!expectedParam.domElement; + var mayBeNull = !!expectedParam.mayBeNull; + e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName); + if (e) { + e.popStackFrame(); + return e; + } + var expectedElementType = expectedParam.elementType; + var elementMayBeNull = !!expectedParam.elementMayBeNull; + if (expectedType === Array && typeof(param) !== "undefined" && param !== null && + (expectedElementType || !elementMayBeNull)) { + var expectedElementInteger = !!expectedParam.elementInteger; + var expectedElementDomElement = !!expectedParam.elementDomElement; + for (var i=0; i < param.length; i++) { + var elem = param[i]; + e = Function._validateParameterType(elem, expectedElementType, + expectedElementInteger, expectedElementDomElement, elementMayBeNull, + paramName + "[" + i + "]"); + if (e) { + e.popStackFrame(); + return e; + } + } + } + return null; +} +Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) { + var e; + if (typeof(param) === "undefined") { + if (mayBeNull) { + return null; + } + else { + e = Error.argumentUndefined(paramName); + e.popStackFrame(); + return e; + } + } + if (param === null) { + if (mayBeNull) { + return null; + } + else { + e = Error.argumentNull(paramName); + e.popStackFrame(); + return e; + } + } + if (expectedType && expectedType.__enum) { + if (typeof(param) !== 'number') { + e = Error.argumentType(paramName, Object.getType(param), expectedType); + e.popStackFrame(); + return e; + } + if ((param % 1) === 0) { + var values = expectedType.prototype; + if (!expectedType.__flags || (param === 0)) { + for (var i in values) { + if (values[i] === param) return null; + } + } + else { + var v = param; + for (var i in values) { + var vali = values[i]; + if (vali === 0) continue; + if ((vali & param) === vali) { + v -= vali; + } + if (v === 0) return null; + } + } + } + e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName())); + e.popStackFrame(); + return e; + } + if (expectedDomElement) { + var val; + if (typeof(param.nodeType) !== 'number') { + var doc = param.ownerDocument || param.document || param; + if (doc != param) { + var w = doc.defaultView || doc.parentWindow; + val = (w != param) && !(w.document && param.document && (w.document === param.document)); + } + else { + val = (typeof(doc.body) === 'undefined'); + } + } + else { + val = (param.nodeType === 3); + } + if (val) { + e = Error.argument(paramName, Sys.Res.argumentDomElement); + e.popStackFrame(); + return e; + } + } + if (expectedType && !expectedType.isInstanceOfType(param)) { + e = Error.argumentType(paramName, Object.getType(param), expectedType); + e.popStackFrame(); + return e; + } + if (expectedType === Number && expectedInteger) { + if ((param % 1) !== 0) { + e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger); + e.popStackFrame(); + return e; + } + } + return null; +} + +Error.__typeName = 'Error'; +Error.__class = true; +Error.create = function Error$create(message, errorInfo) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "message", type: String, mayBeNull: true, optional: true}, + {name: "errorInfo", mayBeNull: true, optional: true} + ]); + if (e) throw e; + var e = new Error(message); + e.message = message; + if (errorInfo) { + for (var v in errorInfo) { + e[v] = errorInfo[v]; + } + } + e.popStackFrame(); + return e; +} +Error.argument = function Error$argument(paramName, message) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "paramName", type: String, mayBeNull: true, optional: true}, + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.Res.argument); + if (paramName) { + displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); + } + var e = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName }); + e.popStackFrame(); + return e; +} +Error.argumentNull = function Error$argumentNull(paramName, message) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "paramName", type: String, mayBeNull: true, optional: true}, + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.Res.argumentNull); + if (paramName) { + displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); + } + var e = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName }); + e.popStackFrame(); + return e; +} +Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "paramName", type: String, mayBeNull: true, optional: true}, + {name: "actualValue", mayBeNull: true, optional: true}, + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ? message : Sys.Res.argumentOutOfRange); + if (paramName) { + displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); + } + if (typeof(actualValue) !== "undefined" && actualValue !== null) { + displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue); + } + var e = Error.create(displayMessage, { + name: "Sys.ArgumentOutOfRangeException", + paramName: paramName, + actualValue: actualValue + }); + e.popStackFrame(); + return e; +} +Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) { + /// + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "paramName", type: String, mayBeNull: true, optional: true}, + {name: "actualType", type: Type, mayBeNull: true, optional: true}, + {name: "expectedType", type: Type, mayBeNull: true, optional: true}, + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.ArgumentTypeException: "; + if (message) { + displayMessage += message; + } + else if (actualType && expectedType) { + displayMessage += + String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(), expectedType.getName()); + } + else { + displayMessage += Sys.Res.argumentType; + } + if (paramName) { + displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); + } + var e = Error.create(displayMessage, { + name: "Sys.ArgumentTypeException", + paramName: paramName, + actualType: actualType, + expectedType: expectedType + }); + e.popStackFrame(); + return e; +} +Error.argumentUndefined = function Error$argumentUndefined(paramName, message) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "paramName", type: String, mayBeNull: true, optional: true}, + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.Res.argumentUndefined); + if (paramName) { + displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); + } + var e = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName }); + e.popStackFrame(); + return e; +} +Error.format = function Error$format(message) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.FormatException: " + (message ? message : Sys.Res.format); + var e = Error.create(displayMessage, {name: 'Sys.FormatException'}); + e.popStackFrame(); + return e; +} +Error.invalidOperation = function Error$invalidOperation(message) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.Res.invalidOperation); + var e = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'}); + e.popStackFrame(); + return e; +} +Error.notImplemented = function Error$notImplemented(message) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.Res.notImplemented); + var e = Error.create(displayMessage, {name: 'Sys.NotImplementedException'}); + e.popStackFrame(); + return e; +} +Error.parameterCount = function Error$parameterCount(message) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "message", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.Res.parameterCount); + var e = Error.create(displayMessage, {name: 'Sys.ParameterCountException'}); + e.popStackFrame(); + return e; +} +Error.prototype.popStackFrame = function Error$popStackFrame() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (typeof(this.stack) === "undefined" || this.stack === null || + typeof(this.fileName) === "undefined" || this.fileName === null || + typeof(this.lineNumber) === "undefined" || this.lineNumber === null) { + return; + } + var stackFrames = this.stack.split("\n"); + var currentFrame = stackFrames[0]; + var pattern = this.fileName + ":" + this.lineNumber; + while(typeof(currentFrame) !== "undefined" && + currentFrame !== null && + currentFrame.indexOf(pattern) === -1) { + stackFrames.shift(); + currentFrame = stackFrames[0]; + } + var nextFrame = stackFrames[1]; + if (typeof(nextFrame) === "undefined" || nextFrame === null) { + return; + } + var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/); + if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) { + return; + } + this.fileName = nextFrameParts[1]; + this.lineNumber = parseInt(nextFrameParts[2]); + stackFrames.shift(); + this.stack = stackFrames.join("\n"); +} + +Object.__typeName = 'Object'; +Object.__class = true; +Object.getType = function Object$getType(instance) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance"} + ]); + if (e) throw e; + var ctor = instance.constructor; + if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName || (ctor.__typeName === 'Object')) { + return Object; + } + return ctor; +} +Object.getTypeName = function Object$getTypeName(instance) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance"} + ]); + if (e) throw e; + return Object.getType(instance).getName(); +} + +String.__typeName = 'String'; +String.__class = true; +String.prototype.endsWith = function String$endsWith(suffix) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "suffix", type: String} + ]); + if (e) throw e; + return (this.substr(this.length - suffix.length) === suffix); +} +String.prototype.startsWith = function String$startsWith(prefix) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "prefix", type: String} + ]); + if (e) throw e; + return (this.substr(0, prefix.length) === prefix); +} +String.prototype.trim = function String$trim() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this.replace(/^\s+|\s+$/g, ''); +} +String.prototype.trimEnd = function String$trimEnd() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this.replace(/\s+$/, ''); +} +String.prototype.trimStart = function String$trimStart() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this.replace(/^\s+/, ''); +} +String.format = function String$format(format, args) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "format", type: String}, + {name: "args", mayBeNull: true, parameterArray: true} + ]); + if (e) throw e; + return String._toFormattedString(false, arguments); +} +String.localeFormat = function String$localeFormat(format, args) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "format", type: String}, + {name: "args", mayBeNull: true, parameterArray: true} + ]); + if (e) throw e; + return String._toFormattedString(true, arguments); +} +String._toFormattedString = function String$_toFormattedString(useLocale, args) { + var result = ''; + var format = args[0]; + for (var i=0;;) { + var open = format.indexOf('{', i); + var close = format.indexOf('}', i); + if ((open < 0) && (close < 0)) { + result += format.slice(i); + break; + } + if ((close > 0) && ((close < open) || (open < 0))) { + if (format.charAt(close + 1) !== '}') { + throw Error.argument('format', Sys.Res.stringFormatBraceMismatch); + } + result += format.slice(i, close + 1); + i = close + 2; + continue; + } + result += format.slice(i, open); + i = open + 1; + if (format.charAt(i) === '{') { + result += '{'; + i++; + continue; + } + if (close < 0) throw Error.argument('format', Sys.Res.stringFormatBraceMismatch); + var brace = format.substring(i, close); + var colonIndex = brace.indexOf(':'); + var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0, colonIndex), 10) + 1; + if (isNaN(argNumber)) throw Error.argument('format', Sys.Res.stringFormatInvalid); + var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1); + var arg = args[argNumber]; + if (typeof(arg) === "undefined" || arg === null) { + arg = ''; + } + if (arg.toFormattedString) { + result += arg.toFormattedString(argFormat); + } + else if (useLocale && arg.localeFormat) { + result += arg.localeFormat(argFormat); + } + else if (arg.format) { + result += arg.format(argFormat); + } + else + result += arg.toString(); + i = close + 1; + } + return result; +} + +Boolean.__typeName = 'Boolean'; +Boolean.__class = true; +Boolean.parse = function Boolean$parse(value) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String} + ]); + if (e) throw e; + var v = value.trim().toLowerCase(); + if (v === 'false') return false; + if (v === 'true') return true; + throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse); +} + +Date.__typeName = 'Date'; +Date.__class = true; +Date._appendPreOrPostMatch = function Date$_appendPreOrPostMatch(preMatch, strBuilder) { + var quoteCount = 0; + var escaped = false; + for (var i = 0, il = preMatch.length; i < il; i++) { + var c = preMatch.charAt(i); + switch (c) { + case '\'': + if (escaped) strBuilder.append("'"); + else quoteCount++; + escaped = false; + break; + case '\\': + if (escaped) strBuilder.append("\\"); + escaped = !escaped; + break; + default: + strBuilder.append(c); + escaped = false; + break; + } + } + return quoteCount; +} +Date._expandFormat = function Date$_expandFormat(dtf, format) { + if (!format) { + format = "F"; + } + if (format.length === 1) { + switch (format) { + case "d": + return dtf.ShortDatePattern; + case "D": + return dtf.LongDatePattern; + case "t": + return dtf.ShortTimePattern; + case "T": + return dtf.LongTimePattern; + case "F": + return dtf.FullDateTimePattern; + case "M": case "m": + return dtf.MonthDayPattern; + case "s": + return dtf.SortableDateTimePattern; + case "Y": case "y": + return dtf.YearMonthPattern; + default: + throw Error.format(Sys.Res.formatInvalidString); + } + } + return format; +} +Date._expandYear = function Date$_expandYear(dtf, year) { + if (year < 100) { + var curr = new Date().getFullYear(); + year += curr - (curr % 100); + if (year > dtf.Calendar.TwoDigitYearMax) { + return year - 100; + } + } + return year; +} +Date._getParseRegExp = function Date$_getParseRegExp(dtf, format) { + if (!dtf._parseRegExp) { + dtf._parseRegExp = {}; + } + else if (dtf._parseRegExp[format]) { + return dtf._parseRegExp[format]; + } + var expFormat = Date._expandFormat(dtf, format); + expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1"); + var regexp = new Sys.StringBuilder("^"); + var groups = []; + var index = 0; + var quoteCount = 0; + var tokenRegExp = Date._getTokenRegExp(); + var match; + while ((match = tokenRegExp.exec(expFormat)) !== null) { + var preMatch = expFormat.slice(index, match.index); + index = tokenRegExp.lastIndex; + quoteCount += Date._appendPreOrPostMatch(preMatch, regexp); + if ((quoteCount%2) === 1) { + regexp.append(match[0]); + continue; + } + switch (match[0]) { + case 'dddd': case 'ddd': + case 'MMMM': case 'MMM': + regexp.append("(\\D+)"); + break; + case 'tt': case 't': + regexp.append("(\\D*)"); + break; + case 'yyyy': + regexp.append("(\\d{4})"); + break; + case 'fff': + regexp.append("(\\d{3})"); + break; + case 'ff': + regexp.append("(\\d{2})"); + break; + case 'f': + regexp.append("(\\d)"); + break; + case 'dd': case 'd': + case 'MM': case 'M': + case 'yy': case 'y': + case 'HH': case 'H': + case 'hh': case 'h': + case 'mm': case 'm': + case 'ss': case 's': + regexp.append("(\\d\\d?)"); + break; + case 'zzz': + regexp.append("([+-]?\\d\\d?:\\d{2})"); + break; + case 'zz': case 'z': + regexp.append("([+-]?\\d\\d?)"); + break; + } + Array.add(groups, match[0]); + } + Date._appendPreOrPostMatch(expFormat.slice(index), regexp); + regexp.append("$"); + var regexpStr = regexp.toString().replace(/\s+/g, "\\s+"); + var parseRegExp = {'regExp': regexpStr, 'groups': groups}; + dtf._parseRegExp[format] = parseRegExp; + return parseRegExp; +} +Date._getTokenRegExp = function Date$_getTokenRegExp() { + return /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g; +} +Date.parseLocale = function Date$parseLocale(value, formats) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String}, + {name: "formats", mayBeNull: true, optional: true, parameterArray: true} + ]); + if (e) throw e; + return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments); +} +Date.parseInvariant = function Date$parseInvariant(value, formats) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String}, + {name: "formats", mayBeNull: true, optional: true, parameterArray: true} + ]); + if (e) throw e; + return Date._parse(value, Sys.CultureInfo.InvariantCulture, arguments); +} +Date._parse = function Date$_parse(value, cultureInfo, args) { + var custom = false; + for (var i = 1, il = args.length; i < il; i++) { + var format = args[i]; + if (format) { + custom = true; + var date = Date._parseExact(value, format, cultureInfo); + if (date) return date; + } + } + if (! custom) { + var formats = cultureInfo._getDateTimeFormats(); + for (var i = 0, il = formats.length; i < il; i++) { + var date = Date._parseExact(value, formats[i], cultureInfo); + if (date) return date; + } + } + return null; +} +Date._parseExact = function Date$_parseExact(value, format, cultureInfo) { + value = value.trim(); + var dtf = cultureInfo.dateTimeFormat; + var parseInfo = Date._getParseRegExp(dtf, format); + var match = new RegExp(parseInfo.regExp).exec(value); + if (match === null) return null; + + var groups = parseInfo.groups; + var year = null, month = null, date = null, weekDay = null; + var hour = 0, min = 0, sec = 0, msec = 0, tzMinOffset = null; + var pmHour = false; + for (var j = 0, jl = groups.length; j < jl; j++) { + var matchGroup = match[j+1]; + if (matchGroup) { + switch (groups[j]) { + case 'dd': case 'd': + date = parseInt(matchGroup, 10); + if ((date < 1) || (date > 31)) return null; + break; + case 'MMMM': + month = cultureInfo._getMonthIndex(matchGroup); + if ((month < 0) || (month > 11)) return null; + break; + case 'MMM': + month = cultureInfo._getAbbrMonthIndex(matchGroup); + if ((month < 0) || (month > 11)) return null; + break; + case 'M': case 'MM': + var month = parseInt(matchGroup, 10) - 1; + if ((month < 0) || (month > 11)) return null; + break; + case 'y': case 'yy': + year = Date._expandYear(dtf,parseInt(matchGroup, 10)); + if ((year < 0) || (year > 9999)) return null; + break; + case 'yyyy': + year = parseInt(matchGroup, 10); + if ((year < 0) || (year > 9999)) return null; + break; + case 'h': case 'hh': + hour = parseInt(matchGroup, 10); + if (hour === 12) hour = 0; + if ((hour < 0) || (hour > 11)) return null; + break; + case 'H': case 'HH': + hour = parseInt(matchGroup, 10); + if ((hour < 0) || (hour > 23)) return null; + break; + case 'm': case 'mm': + min = parseInt(matchGroup, 10); + if ((min < 0) || (min > 59)) return null; + break; + case 's': case 'ss': + sec = parseInt(matchGroup, 10); + if ((sec < 0) || (sec > 59)) return null; + break; + case 'tt': case 't': + var upperToken = matchGroup.toUpperCase(); + pmHour = (upperToken === dtf.PMDesignator.toUpperCase()); + if (!pmHour && (upperToken !== dtf.AMDesignator.toUpperCase())) return null; + break; + case 'f': + msec = parseInt(matchGroup, 10) * 100; + if ((msec < 0) || (msec > 999)) return null; + break; + case 'ff': + msec = parseInt(matchGroup, 10) * 10; + if ((msec < 0) || (msec > 999)) return null; + break; + case 'fff': + msec = parseInt(matchGroup, 10); + if ((msec < 0) || (msec > 999)) return null; + break; + case 'dddd': + weekDay = cultureInfo._getDayIndex(matchGroup); + if ((weekDay < 0) || (weekDay > 6)) return null; + break; + case 'ddd': + weekDay = cultureInfo._getAbbrDayIndex(matchGroup); + if ((weekDay < 0) || (weekDay > 6)) return null; + break; + case 'zzz': + var offsets = matchGroup.split(/:/); + if (offsets.length !== 2) return null; + var hourOffset = parseInt(offsets[0], 10); + if ((hourOffset < -12) || (hourOffset > 13)) return null; + var minOffset = parseInt(offsets[1], 10); + if ((minOffset < 0) || (minOffset > 59)) return null; + tzMinOffset = (hourOffset * 60) + (matchGroup.startsWith('-')? -minOffset : minOffset); + break; + case 'z': case 'zz': + var hourOffset = parseInt(matchGroup, 10); + if ((hourOffset < -12) || (hourOffset > 13)) return null; + tzMinOffset = hourOffset * 60; + break; + } + } + } + var result = new Date(); + if (year === null) { + year = result.getFullYear(); + } + if (month === null) { + month = result.getMonth(); + } + if (date === null) { + date = result.getDate(); + } + result.setFullYear(year, month, date); + if (result.getDate() !== date) return null; + if ((weekDay !== null) && (result.getDay() !== weekDay)) { + return null; + } + if (pmHour && (hour < 12)) { + hour += 12; + } + result.setHours(hour, min, sec, msec); + if (tzMinOffset !== null) { + var adjustedMin = result.getMinutes() - (tzMinOffset + result.getTimezoneOffset()); + result.setHours(result.getHours() + parseInt(adjustedMin/60, 10), adjustedMin%60); + } + return result; +} +Date.prototype.format = function Date$format(format) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "format", type: String} + ]); + if (e) throw e; + return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture); +} +Date.prototype.localeFormat = function Date$localeFormat(format) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "format", type: String} + ]); + if (e) throw e; + return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture); +} +Date.prototype._toFormattedString = function Date$_toFormattedString(format, cultureInfo) { + if (!format || (format.length === 0) || (format === 'i')) { + if (cultureInfo && (cultureInfo.name.length > 0)) { + return this.toLocaleString(); + } + else { + return this.toString(); + } + } + var dtf = cultureInfo.dateTimeFormat; + format = Date._expandFormat(dtf, format); + var ret = new Sys.StringBuilder(); + var hour; + function addLeadingZero(num) { + if (num < 10) { + return '0' + num; + } + return num.toString(); + } + function addLeadingZeros(num) { + if (num < 10) { + return '00' + num; + } + if (num < 100) { + return '0' + num; + } + return num.toString(); + } + var quoteCount = 0; + var tokenRegExp = Date._getTokenRegExp(); + for (;;) { + var index = tokenRegExp.lastIndex; + var ar = tokenRegExp.exec(format); + var preMatch = format.slice(index, ar ? ar.index : format.length); + quoteCount += Date._appendPreOrPostMatch(preMatch, ret); + if (!ar) break; + if ((quoteCount%2) === 1) { + ret.append(ar[0]); + continue; + } + switch (ar[0]) { + case "dddd": + ret.append(dtf.DayNames[this.getDay()]); + break; + case "ddd": + ret.append(dtf.AbbreviatedDayNames[this.getDay()]); + break; + case "dd": + ret.append(addLeadingZero(this.getDate())); + break; + case "d": + ret.append(this.getDate()); + break; + case "MMMM": + ret.append(dtf.MonthNames[this.getMonth()]); + break; + case "MMM": + ret.append(dtf.AbbreviatedMonthNames[this.getMonth()]); + break; + case "MM": + ret.append(addLeadingZero(this.getMonth() + 1)); + break; + case "M": + ret.append(this.getMonth() + 1); + break; + case "yyyy": + ret.append(this.getFullYear()); + break; + case "yy": + ret.append(addLeadingZero(this.getFullYear() % 100)); + break; + case "y": + ret.append(this.getFullYear() % 100); + break; + case "hh": + hour = this.getHours() % 12; + if (hour === 0) hour = 12; + ret.append(addLeadingZero(hour)); + break; + case "h": + hour = this.getHours() % 12; + if (hour === 0) hour = 12; + ret.append(hour); + break; + case "HH": + ret.append(addLeadingZero(this.getHours())); + break; + case "H": + ret.append(this.getHours()); + break; + case "mm": + ret.append(addLeadingZero(this.getMinutes())); + break; + case "m": + ret.append(this.getMinutes()); + break; + case "ss": + ret.append(addLeadingZero(this.getSeconds())); + break; + case "s": + ret.append(this.getSeconds()); + break; + case "tt": + ret.append((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator); + break; + case "t": + ret.append(((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator).charAt(0)); + break; + case "f": + ret.append(addLeadingZeros(this.getMilliseconds()).charAt(0)); + break; + case "ff": + ret.append(addLeadingZeros(this.getMilliseconds()).substr(0, 2)); + break; + case "fff": + ret.append(addLeadingZeros(this.getMilliseconds())); + break; + case "z": + hour = this.getTimezoneOffset() / 60; + ret.append(((hour <= 0) ? '+' : '-') + Math.floor(Math.abs(hour))); + break; + case "zz": + hour = this.getTimezoneOffset() / 60; + ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour)))); + break; + case "zzz": + hour = this.getTimezoneOffset() / 60; + ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))) + + dtf.TimeSeparator + addLeadingZero(Math.abs(this.getTimezoneOffset() % 60))); + break; + } + } + return ret.toString(); +} + +Number.__typeName = 'Number'; +Number.__class = true; +Number.parseLocale = function Number$parseLocale(value) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String} + ]); + if (e) throw e; + return Number._parse(value, Sys.CultureInfo.CurrentCulture); +} +Number.parseInvariant = function Number$parseInvariant(value) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String} + ]); + if (e) throw e; + return Number._parse(value, Sys.CultureInfo.InvariantCulture); +} +Number._parse = function Number$_parse(value, cultureInfo) { + value = value.trim(); + + if (value.match(/^[+-]?infinity$/i)) { + return parseFloat(value); + } + if (value.match(/^0x[a-f0-9]+$/i)) { + return parseInt(value); + } + var numFormat = cultureInfo.numberFormat; + var signInfo = Number._parseNumberNegativePattern(value, numFormat, numFormat.NumberNegativePattern); + var sign = signInfo[0]; + var num = signInfo[1]; + + if ((sign === '') && (numFormat.NumberNegativePattern !== 1)) { + signInfo = Number._parseNumberNegativePattern(value, numFormat, 1); + sign = signInfo[0]; + num = signInfo[1]; + } + if (sign === '') sign = '+'; + + var exponent; + var intAndFraction; + var exponentPos = num.indexOf('e'); + if (exponentPos < 0) exponentPos = num.indexOf('E'); + if (exponentPos < 0) { + intAndFraction = num; + exponent = null; + } + else { + intAndFraction = num.substr(0, exponentPos); + exponent = num.substr(exponentPos + 1); + } + + var integer; + var fraction; + var decimalPos = intAndFraction.indexOf(numFormat.NumberDecimalSeparator); + if (decimalPos < 0) { + integer = intAndFraction; + fraction = null; + } + else { + integer = intAndFraction.substr(0, decimalPos); + fraction = intAndFraction.substr(decimalPos + numFormat.NumberDecimalSeparator.length); + } + + integer = integer.split(numFormat.NumberGroupSeparator).join(''); + var altNumGroupSeparator = numFormat.NumberGroupSeparator.replace(/\u00A0/g, " "); + if (numFormat.NumberGroupSeparator !== altNumGroupSeparator) { + integer = integer.split(altNumGroupSeparator).join(''); + } + + var p = sign + integer; + if (fraction !== null) { + p += '.' + fraction; + } + if (exponent !== null) { + var expSignInfo = Number._parseNumberNegativePattern(exponent, numFormat, 1); + if (expSignInfo[0] === '') { + expSignInfo[0] = '+'; + } + p += 'e' + expSignInfo[0] + expSignInfo[1]; + } + if (p.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) { + return parseFloat(p); + } + return Number.NaN; +} +Number._parseNumberNegativePattern = function Number$_parseNumberNegativePattern(value, numFormat, numberNegativePattern) { + var neg = numFormat.NegativeSign; + var pos = numFormat.PositiveSign; + switch (numberNegativePattern) { + case 4: + neg = ' ' + neg; + pos = ' ' + pos; + case 3: + if (value.endsWith(neg)) { + return ['-', value.substr(0, value.length - neg.length)]; + } + else if (value.endsWith(pos)) { + return ['+', value.substr(0, value.length - pos.length)]; + } + break; + case 2: + neg += ' '; + pos += ' '; + case 1: + if (value.startsWith(neg)) { + return ['-', value.substr(neg.length)]; + } + else if (value.startsWith(pos)) { + return ['+', value.substr(pos.length)]; + } + break; + case 0: + if (value.startsWith('(') && value.endsWith(')')) { + return ['-', value.substr(1, value.length - 2)]; + } + break; + } + return ['', value]; +} +Number.prototype.format = function Number$format(format) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "format", type: String} + ]); + if (e) throw e; + return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture); +} +Number.prototype.localeFormat = function Number$localeFormat(format) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "format", type: String} + ]); + if (e) throw e; + return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture); +} +Number.prototype._toFormattedString = function Number$_toFormattedString(format, cultureInfo) { + if (!format || (format.length === 0) || (format === 'i')) { + if (cultureInfo && (cultureInfo.name.length > 0)) { + return this.toLocaleString(); + } + else { + return this.toString(); + } + } + + var _percentPositivePattern = ["n %", "n%", "%n" ]; + var _percentNegativePattern = ["-n %", "-n%", "-%n"]; + var _numberNegativePattern = ["(n)","-n","- n","n-","n -"]; + var _currencyPositivePattern = ["$n","n$","$ n","n $"]; + var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"]; + function zeroPad(str, count, left) { + for (var l=str.length; l < count; l++) { + str = (left ? ('0' + str) : (str + '0')); + } + return str; + } + + function expandNumber(number, precision, groupSizes, sep, decimalChar) { + + var curSize = groupSizes[0]; + var curGroupIndex = 1; + var factor = Math.pow(10, precision); + var rounded = (Math.round(number * factor) / factor); + if (!isFinite(rounded)) { + rounded = number; + } + number = rounded; + + var numberString = number.toString(); + var right = ""; + var exponent; + + + var split = numberString.split(/e/i); + numberString = split[0]; + exponent = (split.length > 1 ? parseInt(split[1]) : 0); + split = numberString.split('.'); + numberString = split[0]; + right = split.length > 1 ? split[1] : ""; + + var l; + if (exponent > 0) { + right = zeroPad(right, exponent, false); + numberString += right.slice(0, exponent); + right = right.substr(exponent); + } + else if (exponent < 0) { + exponent = -exponent; + numberString = zeroPad(numberString, exponent+1, true); + right = numberString.slice(-exponent, numberString.length) + right; + numberString = numberString.slice(0, -exponent); + } + if (precision > 0) { + if (right.length > precision) { + right = right.slice(0, precision); + } + else { + right = zeroPad(right, precision, false); + } + right = decimalChar + right; + } + else { + right = ""; + } + var stringIndex = numberString.length-1; + var ret = ""; + while (stringIndex >= 0) { + if (curSize === 0 || curSize > stringIndex) { + if (ret.length > 0) + return numberString.slice(0, stringIndex + 1) + sep + ret + right; + else + return numberString.slice(0, stringIndex + 1) + right; + } + if (ret.length > 0) + ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1) + sep + ret; + else + ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1); + stringIndex -= curSize; + if (curGroupIndex < groupSizes.length) { + curSize = groupSizes[curGroupIndex]; + curGroupIndex++; + } + } + return numberString.slice(0, stringIndex + 1) + sep + ret + right; + } + var nf = cultureInfo.numberFormat; + var number = Math.abs(this); + if (!format) + format = "D"; + var precision = -1; + if (format.length > 1) precision = parseInt(format.slice(1), 10); + var pattern; + switch (format.charAt(0)) { + case "d": + case "D": + pattern = 'n'; + if (precision !== -1) { + number = zeroPad(""+number, precision, true); + } + if (this < 0) number = -number; + break; + case "c": + case "C": + if (this < 0) pattern = _currencyNegativePattern[nf.CurrencyNegativePattern]; + else pattern = _currencyPositivePattern[nf.CurrencyPositivePattern]; + if (precision === -1) precision = nf.CurrencyDecimalDigits; + number = expandNumber(Math.abs(this), precision, nf.CurrencyGroupSizes, nf.CurrencyGroupSeparator, nf.CurrencyDecimalSeparator); + break; + case "n": + case "N": + if (this < 0) pattern = _numberNegativePattern[nf.NumberNegativePattern]; + else pattern = 'n'; + if (precision === -1) precision = nf.NumberDecimalDigits; + number = expandNumber(Math.abs(this), precision, nf.NumberGroupSizes, nf.NumberGroupSeparator, nf.NumberDecimalSeparator); + break; + case "p": + case "P": + if (this < 0) pattern = _percentNegativePattern[nf.PercentNegativePattern]; + else pattern = _percentPositivePattern[nf.PercentPositivePattern]; + if (precision === -1) precision = nf.PercentDecimalDigits; + number = expandNumber(Math.abs(this) * 100, precision, nf.PercentGroupSizes, nf.PercentGroupSeparator, nf.PercentDecimalSeparator); + break; + default: + throw Error.format(Sys.Res.formatBadFormatSpecifier); + } + var regex = /n|\$|-|%/g; + var ret = ""; + for (;;) { + var index = regex.lastIndex; + var ar = regex.exec(pattern); + ret += pattern.slice(index, ar ? ar.index : pattern.length); + if (!ar) + break; + switch (ar[0]) { + case "n": + ret += number; + break; + case "$": + ret += nf.CurrencySymbol; + break; + case "-": + ret += nf.NegativeSign; + break; + case "%": + ret += nf.PercentSymbol; + break; + } + } + return ret; +} + +RegExp.__typeName = 'RegExp'; +RegExp.__class = true; + +Array.__typeName = 'Array'; +Array.__class = true; +Array.add = Array.enqueue = function Array$enqueue(array, item) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "item", mayBeNull: true} + ]); + if (e) throw e; + array[array.length] = item; +} +Array.addRange = function Array$addRange(array, items) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "items", type: Array, elementMayBeNull: true} + ]); + if (e) throw e; + array.push.apply(array, items); +} +Array.clear = function Array$clear(array) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true} + ]); + if (e) throw e; + array.length = 0; +} +Array.clone = function Array$clone(array) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true} + ]); + if (e) throw e; + if (array.length === 1) { + return [array[0]]; + } + else { + return Array.apply(null, array); + } +} +Array.contains = function Array$contains(array, item) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "item", mayBeNull: true} + ]); + if (e) throw e; + return (Array.indexOf(array, item) >= 0); +} +Array.dequeue = function Array$dequeue(array) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true} + ]); + if (e) throw e; + return array.shift(); +} +Array.forEach = function Array$forEach(array, method, instance) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "method", type: Function}, + {name: "instance", mayBeNull: true, optional: true} + ]); + if (e) throw e; + for (var i = 0, l = array.length; i < l; i++) { + var elt = array[i]; + if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array); + } +} +Array.indexOf = function Array$indexOf(array, item, start) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "item", mayBeNull: true, optional: true}, + {name: "start", mayBeNull: true, optional: true} + ]); + if (e) throw e; + if (typeof(item) === "undefined") return -1; + var length = array.length; + if (length !== 0) { + start = start - 0; + if (isNaN(start)) { + start = 0; + } + else { + if (isFinite(start)) { + start = start - (start % 1); + } + if (start < 0) { + start = Math.max(0, length + start); + } + } + for (var i = start; i < length; i++) { + if ((typeof(array[i]) !== "undefined") && (array[i] === item)) { + return i; + } + } + } + return -1; +} +Array.insert = function Array$insert(array, index, item) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "index", mayBeNull: true}, + {name: "item", mayBeNull: true} + ]); + if (e) throw e; + array.splice(index, 0, item); +} +Array.parse = function Array$parse(value) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String, mayBeNull: true} + ]); + if (e) throw e; + if (!value) return []; + var v = eval(value); + if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.Res.arrayParseBadFormat); + return v; +} +Array.remove = function Array$remove(array, item) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "item", mayBeNull: true} + ]); + if (e) throw e; + var index = Array.indexOf(array, item); + if (index >= 0) { + array.splice(index, 1); + } + return (index >= 0); +} +Array.removeAt = function Array$removeAt(array, index) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "array", type: Array, elementMayBeNull: true}, + {name: "index", mayBeNull: true} + ]); + if (e) throw e; + array.splice(index, 1); +} + +if (!window) this.window = this; +window.Type = Function; +Type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i"); +Type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i"); +Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance"}, + {name: "name", type: String}, + {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true} + ]); + if (e) throw e; + var baseMethod = this.getBaseMethod(instance, name); + if (!baseMethod) throw Error.invalidOperation(String.format(Sys.Res.methodNotFound, name)); + if (!baseArguments) { + return baseMethod.apply(instance); + } + else { + return baseMethod.apply(instance, baseArguments); + } +} +Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance"}, + {name: "name", type: String} + ]); + if (e) throw e; + if (!this.isInstanceOfType(instance)) throw Error.argumentType('instance', Object.getType(instance), this); + var baseType = this.getBaseType(); + if (baseType) { + var baseMethod = baseType.prototype[name]; + return (baseMethod instanceof Function) ? baseMethod : null; + } + return null; +} +Type.prototype.getBaseType = function Type$getBaseType() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return (typeof(this.__baseType) === "undefined") ? null : this.__baseType; +} +Type.prototype.getInterfaces = function Type$getInterfaces() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var result = []; + var type = this; + while(type) { + var interfaces = type.__interfaces; + if (interfaces) { + for (var i = 0, l = interfaces.length; i < l; i++) { + var interfaceType = interfaces[i]; + if (!Array.contains(result, interfaceType)) { + result[result.length] = interfaceType; + } + } + } + type = type.__baseType; + } + return result; +} +Type.prototype.getName = function Type$getName() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName; +} +Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "interfaceType", type: Type} + ]); + if (e) throw e; + this.resolveInheritance(); + var interfaceName = interfaceType.getName(); + var cache = this.__interfaceCache; + if (cache) { + var cacheEntry = cache[interfaceName]; + if (typeof(cacheEntry) !== 'undefined') return cacheEntry; + } + else { + cache = this.__interfaceCache = {}; + } + var baseType = this; + while (baseType) { + var interfaces = baseType.__interfaces; + if (interfaces) { + if (Array.indexOf(interfaces, interfaceType) !== -1) { + return cache[interfaceName] = true; + } + } + baseType = baseType.__baseType; + } + return cache[interfaceName] = false; +} +Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "parentType", type: Type} + ]); + if (e) throw e; + this.resolveInheritance(); + var baseType = this.__baseType; + while (baseType) { + if (baseType === parentType) { + return true; + } + baseType = baseType.__baseType; + } + return false; +} +Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance"}, + {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true} + ]); + if (e) throw e; + if (!this.isInstanceOfType(instance)) throw Error.argumentType('instance', Object.getType(instance), this); + this.resolveInheritance(); + if (this.__baseType) { + if (!baseArguments) { + this.__baseType.apply(instance); + } + else { + this.__baseType.apply(instance, baseArguments); + } + } + return instance; +} +Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance", mayBeNull: true} + ]); + if (e) throw e; + if (typeof(instance) === "undefined" || instance === null) return false; + var instanceType = Object.getType(instance); + return !!(instanceType.implementsInterface && instanceType.implementsInterface(this)); +} +Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "instance", mayBeNull: true} + ]); + if (e) throw e; + if (typeof(instance) === "undefined" || instance === null) return false; + if (instance instanceof this) return true; + var instanceType = Object.getType(instance); + return !!(instanceType === this) || + (instanceType.inheritsFrom && instanceType.inheritsFrom(this)) || + (instanceType.implementsInterface && instanceType.implementsInterface(this)); +} +Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "typeName", type: String}, + {name: "baseType", type: Type, mayBeNull: true, optional: true}, + {name: "interfaceTypes", type: Type, parameterArray: true} + ]); + if (e) throw e; + if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName); + var parsedName; + try { + parsedName = eval(typeName); + } + catch(e) { + throw Error.argument('typeName', Sys.Res.argumentTypeName); + } + if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName); + if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName)); + if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType'); + if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.Res.baseNotAClass); + this.prototype.constructor = this; + this.__typeName = typeName; + this.__class = true; + if (baseType) { + this.__baseType = baseType; + this.__basePrototypePending = true; + } + Sys.__upperCaseTypes[typeName.toUpperCase()] = this; + if (interfaceTypes) { + this.__interfaces = []; + this.resolveInheritance(); + for (var i = 2, l = arguments.length; i < l; i++) { + var interfaceType = arguments[i]; + if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.Res.notAnInterface); + for (var methodName in interfaceType.prototype) { + var method = interfaceType.prototype[methodName]; + if (!this.prototype[methodName]) { + this.prototype[methodName] = method; + } + } + this.__interfaces.push(interfaceType); + } + } + Sys.__registeredTypes[typeName] = true; + return this; +} +Type.prototype.registerInterface = function Type$registerInterface(typeName) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "typeName", type: String} + ]); + if (e) throw e; + if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName); + var parsedName; + try { + parsedName = eval(typeName); + } + catch(e) { + throw Error.argument('typeName', Sys.Res.argumentTypeName); + } + if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName); + if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName)); + Sys.__upperCaseTypes[typeName.toUpperCase()] = this; + this.prototype.constructor = this; + this.__typeName = typeName; + this.__interface = true; + Sys.__registeredTypes[typeName] = true; + return this; +} +Type.prototype.resolveInheritance = function Type$resolveInheritance() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this.__basePrototypePending) { + var baseType = this.__baseType; + baseType.resolveInheritance(); + for (var memberName in baseType.prototype) { + var memberValue = baseType.prototype[memberName]; + if (!this.prototype[memberName]) { + this.prototype[memberName] = memberValue; + } + } + delete this.__basePrototypePending; + } +} +Type.getRootNamespaces = function Type$getRootNamespaces() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return Array.clone(Sys.__rootNamespaces); +} +Type.isClass = function Type$isClass(type) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "type", mayBeNull: true} + ]); + if (e) throw e; + if ((typeof(type) === 'undefined') || (type === null)) return false; + return !!type.__class; +} +Type.isInterface = function Type$isInterface(type) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "type", mayBeNull: true} + ]); + if (e) throw e; + if ((typeof(type) === 'undefined') || (type === null)) return false; + return !!type.__interface; +} +Type.isNamespace = function Type$isNamespace(object) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "object", mayBeNull: true} + ]); + if (e) throw e; + if ((typeof(object) === 'undefined') || (object === null)) return false; + return !!object.__namespace; +} +Type.parse = function Type$parse(typeName, ns) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "typeName", type: String, mayBeNull: true}, + {name: "ns", mayBeNull: true, optional: true} + ]); + if (e) throw e; + var fn; + if (ns) { + fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()]; + return fn || null; + } + if (!typeName) return null; + if (!Type.__htClasses) { + Type.__htClasses = {}; + } + fn = Type.__htClasses[typeName]; + if (!fn) { + fn = eval(typeName); + if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.Res.notATypeName); + Type.__htClasses[typeName] = fn; + } + return fn; +} +Type.registerNamespace = function Type$registerNamespace(namespacePath) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "namespacePath", type: String} + ]); + if (e) throw e; + if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.Res.invalidNameSpace); + var rootObject = window; + var namespaceParts = namespacePath.split('.'); + for (var i = 0; i < namespaceParts.length; i++) { + var currentPart = namespaceParts[i]; + var ns = rootObject[currentPart]; + if (ns && !ns.__namespace) { + throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsObject, namespaceParts.splice(0, i + 1).join('.'))); + } + if (!ns) { + ns = rootObject[currentPart] = { + __namespace: true, + __typeName: namespaceParts.slice(0, i + 1).join('.') + }; + if (i === 0) { + Sys.__rootNamespaces[Sys.__rootNamespaces.length] = ns; + } + var parsedName; + try { + parsedName = eval(ns.__typeName); + } + catch(e) { + parsedName = null; + } + if (parsedName !== ns) { + delete rootObject[currentPart]; + throw Error.argument('namespacePath', Sys.Res.invalidNameSpace); + } + ns.getName = function ns$getName() {return this.__typeName;} + } + rootObject = ns; + } +} +window.Sys = { + __namespace: true, + __typeName: "Sys", + getName: function() {return "Sys";}, + __upperCaseTypes: {} +}; +Sys.__rootNamespaces = [Sys]; +Sys.__registeredTypes = {}; + +Sys.IDisposable = function Sys$IDisposable() { + throw Error.notImplemented(); +} + function Sys$IDisposable$dispose() { + throw Error.notImplemented(); + } +Sys.IDisposable.prototype = { + dispose: Sys$IDisposable$dispose +} +Sys.IDisposable.registerInterface('Sys.IDisposable'); + +Sys.StringBuilder = function Sys$StringBuilder(initialText) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "initialText", mayBeNull: true, optional: true} + ]); + if (e) throw e; + this._parts = (typeof(initialText) !== 'undefined' && initialText !== null && initialText !== '') ? + [initialText.toString()] : []; + this._value = {}; + this._len = 0; +} + function Sys$StringBuilder$append(text) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "text", mayBeNull: true} + ]); + if (e) throw e; + this._parts[this._parts.length] = text; + } + function Sys$StringBuilder$appendLine(text) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "text", mayBeNull: true, optional: true} + ]); + if (e) throw e; + this._parts[this._parts.length] = + ((typeof(text) === 'undefined') || (text === null) || (text === '')) ? + '\r\n' : text + '\r\n'; + } + function Sys$StringBuilder$clear() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._parts = []; + this._value = {}; + this._len = 0; + } + function Sys$StringBuilder$isEmpty() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this._parts.length === 0) return true; + return this.toString() === ''; + } + function Sys$StringBuilder$toString(separator) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "separator", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + separator = separator || ''; + var parts = this._parts; + if (this._len !== parts.length) { + this._value = {}; + this._len = parts.length; + } + var val = this._value; + if (typeof(val[separator]) === 'undefined') { + if (separator !== '') { + for (var i = 0; i < parts.length;) { + if ((typeof(parts[i]) === 'undefined') || (parts[i] === '') || (parts[i] === null)) { + parts.splice(i, 1); + } + else { + i++; + } + } + } + val[separator] = this._parts.join(separator); + } + return val[separator]; + } +Sys.StringBuilder.prototype = { + append: Sys$StringBuilder$append, + appendLine: Sys$StringBuilder$appendLine, + clear: Sys$StringBuilder$clear, + isEmpty: Sys$StringBuilder$isEmpty, + toString: Sys$StringBuilder$toString +} +Sys.StringBuilder.registerClass('Sys.StringBuilder'); + +if (!window.XMLHttpRequest) { + window.XMLHttpRequest = function window$XMLHttpRequest() { + var progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ]; + for (var i = 0, l = progIDs.length; i < l; i++) { + try { + return new ActiveXObject(progIDs[i]); + } + catch (ex) { + } + } + return null; + } +} + +Sys.Browser = {}; +Sys.Browser.InternetExplorer = {}; +Sys.Browser.Firefox = {}; +Sys.Browser.Safari = {}; +Sys.Browser.Opera = {}; +Sys.Browser.agent = null; +Sys.Browser.hasDebuggerStatement = false; +Sys.Browser.name = navigator.appName; +Sys.Browser.version = parseFloat(navigator.appVersion); +Sys.Browser.documentMode = 0; +if (navigator.userAgent.indexOf(' MSIE ') > -1) { + Sys.Browser.agent = Sys.Browser.InternetExplorer; + Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]); + if (Sys.Browser.version >= 8) { + if (document.documentMode >= 7) { + Sys.Browser.documentMode = document.documentMode; + } + } + Sys.Browser.hasDebuggerStatement = true; +} +else if (navigator.userAgent.indexOf(' Firefox/') > -1) { + Sys.Browser.agent = Sys.Browser.Firefox; + Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]); + Sys.Browser.name = 'Firefox'; + Sys.Browser.hasDebuggerStatement = true; +} +else if (navigator.userAgent.indexOf(' AppleWebKit/') > -1) { + Sys.Browser.agent = Sys.Browser.Safari; + Sys.Browser.version = parseFloat(navigator.userAgent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]); + Sys.Browser.name = 'Safari'; +} +else if (navigator.userAgent.indexOf('Opera/') > -1) { + Sys.Browser.agent = Sys.Browser.Opera; +} +Type.registerNamespace('Sys.UI'); + +Sys._Debug = function Sys$_Debug() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); +} + function Sys$_Debug$_appendConsole(text) { + if ((typeof(Debug) !== 'undefined') && Debug.writeln) { + Debug.writeln(text); + } + if (window.console && window.console.log) { + window.console.log(text); + } + if (window.opera) { + window.opera.postError(text); + } + if (window.debugService) { + window.debugService.trace(text); + } + } + function Sys$_Debug$_appendTrace(text) { + var traceElement = document.getElementById('TraceConsole'); + if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) { + traceElement.value += text + '\n'; + } + } + function Sys$_Debug$assert(condition, message, displayCaller) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "condition", type: Boolean}, + {name: "message", type: String, mayBeNull: true, optional: true}, + {name: "displayCaller", type: Boolean, optional: true} + ]); + if (e) throw e; + if (!condition) { + message = (displayCaller && this.assert.caller) ? + String.format(Sys.Res.assertFailedCaller, message, this.assert.caller) : + String.format(Sys.Res.assertFailed, message); + if (confirm(String.format(Sys.Res.breakIntoDebugger, message))) { + this.fail(message); + } + } + } + function Sys$_Debug$clearTrace() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var traceElement = document.getElementById('TraceConsole'); + if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) { + traceElement.value = ''; + } + } + function Sys$_Debug$fail(message) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "message", type: String, mayBeNull: true} + ]); + if (e) throw e; + this._appendConsole(message); + if (Sys.Browser.hasDebuggerStatement) { + eval('debugger'); + } + } + function Sys$_Debug$trace(text) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "text"} + ]); + if (e) throw e; + this._appendConsole(text); + this._appendTrace(text); + } + function Sys$_Debug$traceDump(object, name) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "object", mayBeNull: true}, + {name: "name", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + var text = this._traceDump(object, name, true); + } + function Sys$_Debug$_traceDump(object, name, recursive, indentationPadding, loopArray) { + name = name? name : 'traceDump'; + indentationPadding = indentationPadding? indentationPadding : ''; + if (object === null) { + this.trace(indentationPadding + name + ': null'); + return; + } + switch(typeof(object)) { + case 'undefined': + this.trace(indentationPadding + name + ': Undefined'); + break; + case 'number': case 'string': case 'boolean': + this.trace(indentationPadding + name + ': ' + object); + break; + default: + if (Date.isInstanceOfType(object) || RegExp.isInstanceOfType(object)) { + this.trace(indentationPadding + name + ': ' + object.toString()); + break; + } + if (!loopArray) { + loopArray = []; + } + else if (Array.contains(loopArray, object)) { + this.trace(indentationPadding + name + ': ...'); + return; + } + Array.add(loopArray, object); + if ((object == window) || (object === document) || + (window.HTMLElement && (object instanceof HTMLElement)) || + (typeof(object.nodeName) === 'string')) { + var tag = object.tagName? object.tagName : 'DomElement'; + if (object.id) { + tag += ' - ' + object.id; + } + this.trace(indentationPadding + name + ' {' + tag + '}'); + } + else { + var typeName = Object.getTypeName(object); + this.trace(indentationPadding + name + (typeof(typeName) === 'string' ? ' {' + typeName + '}' : '')); + if ((indentationPadding === '') || recursive) { + indentationPadding += " "; + var i, length, properties, p, v; + if (Array.isInstanceOfType(object)) { + length = object.length; + for (i = 0; i < length; i++) { + this._traceDump(object[i], '[' + i + ']', recursive, indentationPadding, loopArray); + } + } + else { + for (p in object) { + v = object[p]; + if (!Function.isInstanceOfType(v)) { + this._traceDump(v, p, recursive, indentationPadding, loopArray); + } + } + } + } + } + Array.remove(loopArray, object); + } + } +Sys._Debug.prototype = { + _appendConsole: Sys$_Debug$_appendConsole, + _appendTrace: Sys$_Debug$_appendTrace, + assert: Sys$_Debug$assert, + clearTrace: Sys$_Debug$clearTrace, + fail: Sys$_Debug$fail, + trace: Sys$_Debug$trace, + traceDump: Sys$_Debug$traceDump, + _traceDump: Sys$_Debug$_traceDump +} +Sys._Debug.registerClass('Sys._Debug'); +Sys.Debug = new Sys._Debug(); + Sys.Debug.isDebug = true; + +function Sys$Enum$parse(value, ignoreCase) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String}, + {name: "ignoreCase", type: Boolean, optional: true} + ]); + if (e) throw e; + var values, parsed, val; + if (ignoreCase) { + values = this.__lowerCaseValues; + if (!values) { + this.__lowerCaseValues = values = {}; + var prototype = this.prototype; + for (var name in prototype) { + values[name.toLowerCase()] = prototype[name]; + } + } + } + else { + values = this.prototype; + } + if (!this.__flags) { + val = (ignoreCase ? value.toLowerCase() : value); + parsed = values[val.trim()]; + if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName)); + return parsed; + } + else { + var parts = (ignoreCase ? value.toLowerCase() : value).split(','); + var v = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var part = parts[i].trim(); + parsed = values[part]; + if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value.split(',')[i].trim(), this.__typeName)); + v |= parsed; + } + return v; + } +} +function Sys$Enum$toString(value) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", mayBeNull: true, optional: true} + ]); + if (e) throw e; + if ((typeof(value) === 'undefined') || (value === null)) return this.__string; + if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw Error.argumentType('value', Object.getType(value), this); + var values = this.prototype; + var i; + if (!this.__flags || (value === 0)) { + for (i in values) { + if (values[i] === value) { + return i; + } + } + } + else { + var sorted = this.__sortedValues; + if (!sorted) { + sorted = []; + for (i in values) { + sorted[sorted.length] = {key: i, value: values[i]}; + } + sorted.sort(function(a, b) { + return a.value - b.value; + }); + this.__sortedValues = sorted; + } + var parts = []; + var v = value; + for (i = sorted.length - 1; i >= 0; i--) { + var kvp = sorted[i]; + var vali = kvp.value; + if (vali === 0) continue; + if ((vali & value) === vali) { + parts[parts.length] = kvp.key; + v -= vali; + if (v === 0) break; + } + } + if (parts.length && v === 0) return parts.reverse().join(', '); + } + throw Error.argumentOutOfRange('value', value, String.format(Sys.Res.enumInvalidValue, value, this.__typeName)); +} +Type.prototype.registerEnum = function Type$registerEnum(name, flags) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "name", type: String}, + {name: "flags", type: Boolean, optional: true} + ]); + if (e) throw e; + if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw Error.argument('name', Sys.Res.notATypeName); + var parsedName; + try { + parsedName = eval(name); + } + catch(e) { + throw Error.argument('name', Sys.Res.argumentTypeName); + } + if (parsedName !== this) throw Error.argument('name', Sys.Res.badTypeName); + if (Sys.__registeredTypes[name]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, name)); + for (var i in this.prototype) { + var val = this.prototype[i]; + if (!Type.__identifierRegExp.test(i)) throw Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, i)); + if (typeof(val) !== 'number' || (val % 1) !== 0) throw Error.invalidOperation(Sys.Res.enumValueNotInteger); + if (typeof(this[i]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.enumReservedName, i)); + } + Sys.__upperCaseTypes[name.toUpperCase()] = this; + for (var i in this.prototype) { + this[i] = this.prototype[i]; + } + this.__typeName = name; + this.parse = Sys$Enum$parse; + this.__string = this.toString(); + this.toString = Sys$Enum$toString; + this.__flags = flags; + this.__enum = true; + Sys.__registeredTypes[name] = true; +} +Type.isEnum = function Type$isEnum(type) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "type", mayBeNull: true} + ]); + if (e) throw e; + if ((typeof(type) === 'undefined') || (type === null)) return false; + return !!type.__enum; +} +Type.isFlags = function Type$isFlags(type) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "type", mayBeNull: true} + ]); + if (e) throw e; + if ((typeof(type) === 'undefined') || (type === null)) return false; + return !!type.__flags; +} + +Sys.EventHandlerList = function Sys$EventHandlerList() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._list = {}; +} + function Sys$EventHandlerList$addHandler(id, handler) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "id", type: String}, + {name: "handler", type: Function} + ]); + if (e) throw e; + Array.add(this._getEvent(id, true), handler); + } + function Sys$EventHandlerList$removeHandler(id, handler) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "id", type: String}, + {name: "handler", type: Function} + ]); + if (e) throw e; + var evt = this._getEvent(id); + if (!evt) return; + Array.remove(evt, handler); + } + function Sys$EventHandlerList$getHandler(id) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "id", type: String} + ]); + if (e) throw e; + var evt = this._getEvent(id); + if (!evt || (evt.length === 0)) return null; + evt = Array.clone(evt); + return function(source, args) { + for (var i = 0, l = evt.length; i < l; i++) { + evt[i](source, args); + } + }; + } + function Sys$EventHandlerList$_getEvent(id, create) { + if (!this._list[id]) { + if (!create) return null; + this._list[id] = []; + } + return this._list[id]; + } +Sys.EventHandlerList.prototype = { + addHandler: Sys$EventHandlerList$addHandler, + removeHandler: Sys$EventHandlerList$removeHandler, + getHandler: Sys$EventHandlerList$getHandler, + _getEvent: Sys$EventHandlerList$_getEvent +} +Sys.EventHandlerList.registerClass('Sys.EventHandlerList'); + +Sys.EventArgs = function Sys$EventArgs() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); +} +Sys.EventArgs.registerClass('Sys.EventArgs'); +Sys.EventArgs.Empty = new Sys.EventArgs(); + +Sys.CancelEventArgs = function Sys$CancelEventArgs() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + Sys.CancelEventArgs.initializeBase(this); + this._cancel = false; +} + function Sys$CancelEventArgs$get_cancel() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._cancel; + } + function Sys$CancelEventArgs$set_cancel(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); + if (e) throw e; + this._cancel = value; + } +Sys.CancelEventArgs.prototype = { + get_cancel: Sys$CancelEventArgs$get_cancel, + set_cancel: Sys$CancelEventArgs$set_cancel +} +Sys.CancelEventArgs.registerClass('Sys.CancelEventArgs', Sys.EventArgs); + +Sys.INotifyPropertyChange = function Sys$INotifyPropertyChange() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); +} + function Sys$INotifyPropertyChange$add_propertyChanged(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + throw Error.notImplemented(); + } + function Sys$INotifyPropertyChange$remove_propertyChanged(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + throw Error.notImplemented(); + } +Sys.INotifyPropertyChange.prototype = { + add_propertyChanged: Sys$INotifyPropertyChange$add_propertyChanged, + remove_propertyChanged: Sys$INotifyPropertyChange$remove_propertyChanged +} +Sys.INotifyPropertyChange.registerInterface('Sys.INotifyPropertyChange'); + +Sys.PropertyChangedEventArgs = function Sys$PropertyChangedEventArgs(propertyName) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "propertyName", type: String} + ]); + if (e) throw e; + Sys.PropertyChangedEventArgs.initializeBase(this); + this._propertyName = propertyName; +} + + function Sys$PropertyChangedEventArgs$get_propertyName() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._propertyName; + } +Sys.PropertyChangedEventArgs.prototype = { + get_propertyName: Sys$PropertyChangedEventArgs$get_propertyName +} +Sys.PropertyChangedEventArgs.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs); + +Sys.INotifyDisposing = function Sys$INotifyDisposing() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); +} + function Sys$INotifyDisposing$add_disposing(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + throw Error.notImplemented(); + } + function Sys$INotifyDisposing$remove_disposing(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + throw Error.notImplemented(); + } +Sys.INotifyDisposing.prototype = { + add_disposing: Sys$INotifyDisposing$add_disposing, + remove_disposing: Sys$INotifyDisposing$remove_disposing +} +Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing"); + +Sys.Component = function Sys$Component() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (Sys.Application) Sys.Application.registerDisposableObject(this); +} + function Sys$Component$get_events() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._events) { + this._events = new Sys.EventHandlerList(); + } + return this._events; + } + function Sys$Component$get_id() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._id; + } + function Sys$Component$set_id(value) { + var e = Function._validateParams(arguments, [{name: "value", type: String}]); + if (e) throw e; + if (this._idSet) throw Error.invalidOperation(Sys.Res.componentCantSetIdTwice); + this._idSet = true; + var oldId = this.get_id(); + if (oldId && Sys.Application.findComponent(oldId)) throw Error.invalidOperation(Sys.Res.componentCantSetIdAfterAddedToApp); + this._id = value; + } + function Sys$Component$get_isInitialized() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._initialized; + } + function Sys$Component$get_isUpdating() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._updating; + } + function Sys$Component$add_disposing(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().addHandler("disposing", handler); + } + function Sys$Component$remove_disposing(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().removeHandler("disposing", handler); + } + function Sys$Component$add_propertyChanged(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().addHandler("propertyChanged", handler); + } + function Sys$Component$remove_propertyChanged(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().removeHandler("propertyChanged", handler); + } + function Sys$Component$beginUpdate() { + this._updating = true; + } + function Sys$Component$dispose() { + if (this._events) { + var handler = this._events.getHandler("disposing"); + if (handler) { + handler(this, Sys.EventArgs.Empty); + } + } + delete this._events; + Sys.Application.unregisterDisposableObject(this); + Sys.Application.removeComponent(this); + } + function Sys$Component$endUpdate() { + this._updating = false; + if (!this._initialized) this.initialize(); + this.updated(); + } + function Sys$Component$initialize() { + this._initialized = true; + } + function Sys$Component$raisePropertyChanged(propertyName) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "propertyName", type: String} + ]); + if (e) throw e; + if (!this._events) return; + var handler = this._events.getHandler("propertyChanged"); + if (handler) { + handler(this, new Sys.PropertyChangedEventArgs(propertyName)); + } + } + function Sys$Component$updated() { + } +Sys.Component.prototype = { + _id: null, + _idSet: false, + _initialized: false, + _updating: false, + get_events: Sys$Component$get_events, + get_id: Sys$Component$get_id, + set_id: Sys$Component$set_id, + get_isInitialized: Sys$Component$get_isInitialized, + get_isUpdating: Sys$Component$get_isUpdating, + add_disposing: Sys$Component$add_disposing, + remove_disposing: Sys$Component$remove_disposing, + add_propertyChanged: Sys$Component$add_propertyChanged, + remove_propertyChanged: Sys$Component$remove_propertyChanged, + beginUpdate: Sys$Component$beginUpdate, + dispose: Sys$Component$dispose, + endUpdate: Sys$Component$endUpdate, + initialize: Sys$Component$initialize, + raisePropertyChanged: Sys$Component$raisePropertyChanged, + updated: Sys$Component$updated +} +Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing); +function Sys$Component$_setProperties(target, properties) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "target"}, + {name: "properties"} + ]); + if (e) throw e; + var current; + var targetType = Object.getType(target); + var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement); + var isComponent = Sys.Component.isInstanceOfType(target) && !target.get_isUpdating(); + if (isComponent) target.beginUpdate(); + for (var name in properties) { + var val = properties[name]; + var getter = isObject ? null : target["get_" + name]; + if (isObject || typeof(getter) !== 'function') { + var targetVal = target[name]; + if (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name)); + if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) { + target[name] = val; + } + else { + Sys$Component$_setProperties(targetVal, val); + } + } + else { + var setter = target["set_" + name]; + if (typeof(setter) === 'function') { + setter.apply(target, [val]); + } + else if (val instanceof Array) { + current = getter.apply(target); + if (!(current instanceof Array)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name)); + for (var i = 0, j = current.length, l= val.length; i < l; i++, j++) { + current[j] = val[i]; + } + } + else if ((typeof(val) === 'object') && (Object.getType(val) === Object)) { + current = getter.apply(target); + if ((typeof(current) === 'undefined') || (current === null)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name)); + Sys$Component$_setProperties(current, val); + } + else { + throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name)); + } + } + } + if (isComponent) target.endUpdate(); +} +function Sys$Component$_setReferences(component, references) { + for (var name in references) { + var setter = component["set_" + name]; + var reference = $find(references[name]); + if (typeof(setter) !== 'function') throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name)); + if (!reference) throw Error.invalidOperation(String.format(Sys.Res.referenceNotFound, references[name])); + setter.apply(component, [reference]); + } +} +var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) { + /// + /// + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "type", type: Type}, + {name: "properties", mayBeNull: true, optional: true}, + {name: "events", mayBeNull: true, optional: true}, + {name: "references", mayBeNull: true, optional: true}, + {name: "element", mayBeNull: true, domElement: true, optional: true} + ]); + if (e) throw e; + if (!type.inheritsFrom(Sys.Component)) { + throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName())); + } + if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) { + if (!element) throw Error.argument('element', Sys.Res.createNoDom); + } + else if (element) throw Error.argument('element', Sys.Res.createComponentOnDom); + var component = (element ? new type(element): new type()); + var app = Sys.Application; + var creatingComponents = app.get_isCreatingComponents(); + component.beginUpdate(); + if (properties) { + Sys$Component$_setProperties(component, properties); + } + if (events) { + for (var name in events) { + if (!(component["add_" + name] instanceof Function)) throw new Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name)); + if (!(events[name] instanceof Function)) throw new Error.invalidOperation(Sys.Res.eventHandlerNotFunction); + component["add_" + name](events[name]); + } + } + if (component.get_id()) { + app.addComponent(component); + } + if (creatingComponents) { + app._createdComponents[app._createdComponents.length] = component; + if (references) { + app._addComponentToSecondPass(component, references); + } + else { + component.endUpdate(); + } + } + else { + if (references) { + Sys$Component$_setReferences(component, references); + } + component.endUpdate(); + } + return component; +} + +Sys.UI.MouseButton = function Sys$UI$MouseButton() { + /// + /// + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); +} +Sys.UI.MouseButton.prototype = { + leftButton: 0, + middleButton: 1, + rightButton: 2 +} +Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton"); + +Sys.UI.Key = function Sys$UI$Key() { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); +} +Sys.UI.Key.prototype = { + backspace: 8, + tab: 9, + enter: 13, + esc: 27, + space: 32, + pageUp: 33, + pageDown: 34, + end: 35, + home: 36, + left: 37, + up: 38, + right: 39, + down: 40, + del: 127 +} +Sys.UI.Key.registerEnum("Sys.UI.Key"); + +Sys.UI.Point = function Sys$UI$Point(x, y) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "x", type: Number, integer: true}, + {name: "y", type: Number, integer: true} + ]); + if (e) throw e; + this.x = x; + this.y = y; +} +Sys.UI.Point.registerClass('Sys.UI.Point'); + +Sys.UI.Bounds = function Sys$UI$Bounds(x, y, width, height) { + /// + /// + /// + /// + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "x", type: Number, integer: true}, + {name: "y", type: Number, integer: true}, + {name: "height", type: Number, integer: true}, + {name: "width", type: Number, integer: true} + ]); + if (e) throw e; + this.x = x; + this.y = y; + this.height = height; + this.width = width; +} +Sys.UI.Bounds.registerClass('Sys.UI.Bounds'); + +Sys.UI.DomEvent = function Sys$UI$DomEvent(eventObject) { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "eventObject"} + ]); + if (e) throw e; + var e = eventObject; + var etype = this.type = e.type.toLowerCase(); + this.rawEvent = e; + this.altKey = e.altKey; + if (typeof(e.button) !== 'undefined') { + this.button = (typeof(e.which) !== 'undefined') ? e.button : + (e.button === 4) ? Sys.UI.MouseButton.middleButton : + (e.button === 2) ? Sys.UI.MouseButton.rightButton : + Sys.UI.MouseButton.leftButton; + } + if (etype === 'keypress') { + this.charCode = e.charCode || e.keyCode; + } + else if (e.keyCode && (e.keyCode === 46)) { + this.keyCode = 127; + } + else { + this.keyCode = e.keyCode; + } + this.clientX = e.clientX; + this.clientY = e.clientY; + this.ctrlKey = e.ctrlKey; + this.target = e.target ? e.target : e.srcElement; + if (!etype.startsWith('key')) { + if ((typeof(e.offsetX) !== 'undefined') && (typeof(e.offsetY) !== 'undefined')) { + this.offsetX = e.offsetX; + this.offsetY = e.offsetY; + } + else if (this.target && (this.target.nodeType !== 3) && (typeof(e.clientX) === 'number')) { + var loc = Sys.UI.DomElement.getLocation(this.target); + var w = Sys.UI.DomElement._getWindow(this.target); + this.offsetX = (w.pageXOffset || 0) + e.clientX - loc.x; + this.offsetY = (w.pageYOffset || 0) + e.clientY - loc.y; + } + } + this.screenX = e.screenX; + this.screenY = e.screenY; + this.shiftKey = e.shiftKey; +} + function Sys$UI$DomEvent$preventDefault() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this.rawEvent.preventDefault) { + this.rawEvent.preventDefault(); + } + else if (window.event) { + this.rawEvent.returnValue = false; + } + } + function Sys$UI$DomEvent$stopPropagation() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this.rawEvent.stopPropagation) { + this.rawEvent.stopPropagation(); + } + else if (window.event) { + this.rawEvent.cancelBubble = true; + } + } +Sys.UI.DomEvent.prototype = { + preventDefault: Sys$UI$DomEvent$preventDefault, + stopPropagation: Sys$UI$DomEvent$stopPropagation +} +Sys.UI.DomEvent.registerClass('Sys.UI.DomEvent'); +var $addHandler = Sys.UI.DomEvent.addHandler = function Sys$UI$DomEvent$addHandler(element, eventName, handler) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element"}, + {name: "eventName", type: String}, + {name: "handler", type: Function} + ]); + if (e) throw e; + Sys.UI.DomEvent._ensureDomNode(element); + if (eventName === "error") throw Error.invalidOperation(Sys.Res.addHandlerCantBeUsedForError); + if (!element._events) { + element._events = {}; + } + var eventCache = element._events[eventName]; + if (!eventCache) { + element._events[eventName] = eventCache = []; + } + var browserHandler; + if (element.addEventListener) { + browserHandler = function(e) { + return handler.call(element, new Sys.UI.DomEvent(e)); + } + element.addEventListener(eventName, browserHandler, false); + } + else if (element.attachEvent) { + browserHandler = function() { + var e = {}; + try {e = Sys.UI.DomElement._getWindow(element).event} catch(ex) {} + return handler.call(element, new Sys.UI.DomEvent(e)); + } + element.attachEvent('on' + eventName, browserHandler); + } + eventCache[eventCache.length] = {handler: handler, browserHandler: browserHandler}; +} +var $addHandlers = Sys.UI.DomEvent.addHandlers = function Sys$UI$DomEvent$addHandlers(element, events, handlerOwner) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element"}, + {name: "events", type: Object}, + {name: "handlerOwner", optional: true} + ]); + if (e) throw e; + Sys.UI.DomEvent._ensureDomNode(element); + for (var name in events) { + var handler = events[name]; + if (typeof(handler) !== 'function') throw Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler); + if (handlerOwner) { + handler = Function.createDelegate(handlerOwner, handler); + } + $addHandler(element, name, handler); + } +} +var $clearHandlers = Sys.UI.DomEvent.clearHandlers = function Sys$UI$DomEvent$clearHandlers(element) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element"} + ]); + if (e) throw e; + Sys.UI.DomEvent._ensureDomNode(element); + if (element._events) { + var cache = element._events; + for (var name in cache) { + var handlers = cache[name]; + for (var i = handlers.length - 1; i >= 0; i--) { + $removeHandler(element, name, handlers[i].handler); + } + } + element._events = null; + } +} +var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element"}, + {name: "eventName", type: String}, + {name: "handler", type: Function} + ]); + if (e) throw e; + Sys.UI.DomEvent._ensureDomNode(element); + var browserHandler = null; + if ((typeof(element._events) !== 'object') || (element._events == null)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid); + var cache = element._events[eventName]; + if (!(cache instanceof Array)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid); + for (var i = 0, l = cache.length; i < l; i++) { + if (cache[i].handler === handler) { + browserHandler = cache[i].browserHandler; + break; + } + } + if (typeof(browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid); + if (element.removeEventListener) { + element.removeEventListener(eventName, browserHandler, false); + } + else if (element.detachEvent) { + element.detachEvent('on' + eventName, browserHandler); + } + cache.splice(i, 1); +} +Sys.UI.DomEvent._ensureDomNode = function Sys$UI$DomEvent$_ensureDomNode(element) { + if (element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return; + + var doc = element.ownerDocument || element.document || element; + if ((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number')) { + throw Error.argument("element", Sys.Res.argumentDomNode); + } +} + +Sys.UI.DomElement = function Sys$UI$DomElement() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); +} +Sys.UI.DomElement.registerClass('Sys.UI.DomElement'); +Sys.UI.DomElement.addCssClass = function Sys$UI$DomElement$addCssClass(element, className) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "className", type: String} + ]); + if (e) throw e; + if (!Sys.UI.DomElement.containsCssClass(element, className)) { + if (element.className === '') { + element.className = className; + } + else { + element.className += ' ' + className; + } + } +} +Sys.UI.DomElement.containsCssClass = function Sys$UI$DomElement$containsCssClass(element, className) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "className", type: String} + ]); + if (e) throw e; + return Array.contains(element.className.split(' '), className); +} +Sys.UI.DomElement.getBounds = function Sys$UI$DomElement$getBounds(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + var offset = Sys.UI.DomElement.getLocation(element); + return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0); +} +var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "id", type: String}, + {name: "element", mayBeNull: true, domElement: true, optional: true} + ]); + if (e) throw e; + if (!element) return document.getElementById(id); + if (element.getElementById) return element.getElementById(id); + var nodeQueue = []; + var childNodes = element.childNodes; + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (node.nodeType == 1) { + nodeQueue[nodeQueue.length] = node; + } + } + while (nodeQueue.length) { + node = nodeQueue.shift(); + if (node.id == id) { + return node; + } + childNodes = node.childNodes; + for (i = 0; i < childNodes.length; i++) { + node = childNodes[i]; + if (node.nodeType == 1) { + nodeQueue[nodeQueue.length] = node; + } + } + } + return null; +} +switch(Sys.Browser.agent) { + case Sys.Browser.InternetExplorer: + Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0); + var clientRect = element.getBoundingClientRect(); + if (!clientRect) { + return new Sys.UI.Point(0,0); + } + var documentElement = element.ownerDocument.documentElement; + var offsetX = clientRect.left - 2 + documentElement.scrollLeft, + offsetY = clientRect.top - 2 + documentElement.scrollTop; + + try { + var f = element.ownerDocument.parentWindow.frameElement || null; + if (f) { + var offset = (f.frameBorder === "0" || f.frameBorder === "no") ? 2 : 0; + offsetX += offset; + offsetY += offset; + } + } + catch(ex) { + } + + return new Sys.UI.Point(offsetX, offsetY); + } + break; + case Sys.Browser.Safari: + Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0); + var offsetX = 0; + var offsetY = 0; + var previous = null; + var previousStyle = null; + var currentStyle; + for (var parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) { + currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); + var tagName = parent.tagName ? parent.tagName.toUpperCase() : null; + if ((parent.offsetLeft || parent.offsetTop) && + ((tagName !== "BODY") || (!previousStyle || previousStyle.position !== "absolute"))) { + offsetX += parent.offsetLeft; + offsetY += parent.offsetTop; + } + } + currentStyle = Sys.UI.DomElement._getCurrentStyle(element); + var elementPosition = currentStyle ? currentStyle.position : null; + if (!elementPosition || (elementPosition !== "absolute")) { + for (var parent = element.parentNode; parent; parent = parent.parentNode) { + tagName = parent.tagName ? parent.tagName.toUpperCase() : null; + if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) { + offsetX -= (parent.scrollLeft || 0); + offsetY -= (parent.scrollTop || 0); + } + currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); + var parentPosition = currentStyle ? currentStyle.position : null; + if (parentPosition && (parentPosition === "absolute")) break; + } + } + return new Sys.UI.Point(offsetX, offsetY); + } + break; + case Sys.Browser.Opera: + Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0); + var offsetX = 0; + var offsetY = 0; + var previous = null; + for (var parent = element; parent; previous = parent, parent = parent.offsetParent) { + var tagName = parent.tagName; + offsetX += parent.offsetLeft || 0; + offsetY += parent.offsetTop || 0; + } + var elementPosition = element.style.position; + var elementPositioned = elementPosition && (elementPosition !== "static"); + for (var parent = element.parentNode; parent; parent = parent.parentNode) { + tagName = parent.tagName ? parent.tagName.toUpperCase() : null; + if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop) && + ((elementPositioned && + ((parent.style.overflow === "scroll") || (parent.style.overflow === "auto"))))) { + offsetX -= (parent.scrollLeft || 0); + offsetY -= (parent.scrollTop || 0); + } + var parentPosition = (parent && parent.style) ? parent.style.position : null; + elementPositioned = elementPositioned || (parentPosition && (parentPosition !== "static")); + } + return new Sys.UI.Point(offsetX, offsetY); + } + break; + default: + Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0); + var offsetX = 0; + var offsetY = 0; + var previous = null; + var previousStyle = null; + var currentStyle = null; + for (var parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) { + var tagName = parent.tagName ? parent.tagName.toUpperCase() : null; + currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); + if ((parent.offsetLeft || parent.offsetTop) && + !((tagName === "BODY") && + (!previousStyle || previousStyle.position !== "absolute"))) { + offsetX += parent.offsetLeft; + offsetY += parent.offsetTop; + } + if (previous !== null && currentStyle) { + if ((tagName !== "TABLE") && (tagName !== "TD") && (tagName !== "HTML")) { + offsetX += parseInt(currentStyle.borderLeftWidth) || 0; + offsetY += parseInt(currentStyle.borderTopWidth) || 0; + } + if (tagName === "TABLE" && + (currentStyle.position === "relative" || currentStyle.position === "absolute")) { + offsetX += parseInt(currentStyle.marginLeft) || 0; + offsetY += parseInt(currentStyle.marginTop) || 0; + } + } + } + currentStyle = Sys.UI.DomElement._getCurrentStyle(element); + var elementPosition = currentStyle ? currentStyle.position : null; + if (!elementPosition || (elementPosition !== "absolute")) { + for (var parent = element.parentNode; parent; parent = parent.parentNode) { + tagName = parent.tagName ? parent.tagName.toUpperCase() : null; + if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) { + offsetX -= (parent.scrollLeft || 0); + offsetY -= (parent.scrollTop || 0); + currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); + if (currentStyle) { + offsetX += parseInt(currentStyle.borderLeftWidth) || 0; + offsetY += parseInt(currentStyle.borderTopWidth) || 0; + } + } + } + } + return new Sys.UI.Point(offsetX, offsetY); + } + break; +} +Sys.UI.DomElement.removeCssClass = function Sys$UI$DomElement$removeCssClass(element, className) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "className", type: String} + ]); + if (e) throw e; + var currentClassName = ' ' + element.className + ' '; + var index = currentClassName.indexOf(' ' + className + ' '); + if (index >= 0) { + element.className = (currentClassName.substr(0, index) + ' ' + + currentClassName.substring(index + className.length + 1, currentClassName.length)).trim(); + } +} +Sys.UI.DomElement.setLocation = function Sys$UI$DomElement$setLocation(element, x, y) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "x", type: Number, integer: true}, + {name: "y", type: Number, integer: true} + ]); + if (e) throw e; + var style = element.style; + style.position = 'absolute'; + style.left = x + "px"; + style.top = y + "px"; +} +Sys.UI.DomElement.toggleCssClass = function Sys$UI$DomElement$toggleCssClass(element, className) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "className", type: String} + ]); + if (e) throw e; + if (Sys.UI.DomElement.containsCssClass(element, className)) { + Sys.UI.DomElement.removeCssClass(element, className); + } + else { + Sys.UI.DomElement.addCssClass(element, className); + } +} +Sys.UI.DomElement.getVisibilityMode = function Sys$UI$DomElement$getVisibilityMode(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + return (element._visibilityMode === Sys.UI.VisibilityMode.hide) ? + Sys.UI.VisibilityMode.hide : + Sys.UI.VisibilityMode.collapse; +} +Sys.UI.DomElement.setVisibilityMode = function Sys$UI$DomElement$setVisibilityMode(element, value) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "value", type: Sys.UI.VisibilityMode} + ]); + if (e) throw e; + Sys.UI.DomElement._ensureOldDisplayMode(element); + if (element._visibilityMode !== value) { + element._visibilityMode = value; + if (Sys.UI.DomElement.getVisible(element) === false) { + if (element._visibilityMode === Sys.UI.VisibilityMode.hide) { + element.style.display = element._oldDisplayMode; + } + else { + element.style.display = 'none'; + } + } + element._visibilityMode = value; + } +} +Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element); + if (!style) return true; + return (style.visibility !== 'hidden') && (style.display !== 'none'); +} +Sys.UI.DomElement.setVisible = function Sys$UI$DomElement$setVisible(element, value) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "value", type: Boolean} + ]); + if (e) throw e; + if (value !== Sys.UI.DomElement.getVisible(element)) { + Sys.UI.DomElement._ensureOldDisplayMode(element); + element.style.visibility = value ? 'visible' : 'hidden'; + if (value || (element._visibilityMode === Sys.UI.VisibilityMode.hide)) { + element.style.display = element._oldDisplayMode; + } + else { + element.style.display = 'none'; + } + } +} +Sys.UI.DomElement._ensureOldDisplayMode = function Sys$UI$DomElement$_ensureOldDisplayMode(element) { + if (!element._oldDisplayMode) { + var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element); + element._oldDisplayMode = style ? style.display : null; + if (!element._oldDisplayMode || element._oldDisplayMode === 'none') { + switch(element.tagName.toUpperCase()) { + case 'DIV': case 'P': case 'ADDRESS': case 'BLOCKQUOTE': case 'BODY': case 'COL': + case 'COLGROUP': case 'DD': case 'DL': case 'DT': case 'FIELDSET': case 'FORM': + case 'H1': case 'H2': case 'H3': case 'H4': case 'H5': case 'H6': case 'HR': + case 'IFRAME': case 'LEGEND': case 'OL': case 'PRE': case 'TABLE': case 'TD': + case 'TH': case 'TR': case 'UL': + element._oldDisplayMode = 'block'; + break; + case 'LI': + element._oldDisplayMode = 'list-item'; + break; + default: + element._oldDisplayMode = 'inline'; + } + } + } +} +Sys.UI.DomElement._getWindow = function Sys$UI$DomElement$_getWindow(element) { + var doc = element.ownerDocument || element.document || element; + return doc.defaultView || doc.parentWindow; +} +Sys.UI.DomElement._getCurrentStyle = function Sys$UI$DomElement$_getCurrentStyle(element) { + if (element.nodeType === 3) return null; + var w = Sys.UI.DomElement._getWindow(element); + if (element.documentElement) element = element.documentElement; + var computedStyle = (w && (element !== w) && w.getComputedStyle) ? + w.getComputedStyle(element, null) : + element.currentStyle || element.style; + if (!computedStyle && (Sys.Browser.agent === Sys.Browser.Safari) && element.style) { + var oldDisplay = element.style.display; + var oldPosition = element.style.position; + element.style.position = 'absolute'; + element.style.display = 'block'; + var style = w.getComputedStyle(element, null); + element.style.display = oldDisplay; + element.style.position = oldPosition; + computedStyle = {}; + for (var n in style) { + computedStyle[n] = style[n]; + } + computedStyle.display = 'none'; + } + return computedStyle; +} + +Sys.IContainer = function Sys$IContainer() { + throw Error.notImplemented(); +} + function Sys$IContainer$addComponent(component) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "component", type: Sys.Component} + ]); + if (e) throw e; + throw Error.notImplemented(); + } + function Sys$IContainer$removeComponent(component) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "component", type: Sys.Component} + ]); + if (e) throw e; + throw Error.notImplemented(); + } + function Sys$IContainer$findComponent(id) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "id", type: String} + ]); + if (e) throw e; + throw Error.notImplemented(); + } + function Sys$IContainer$getComponents() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } +Sys.IContainer.prototype = { + addComponent: Sys$IContainer$addComponent, + removeComponent: Sys$IContainer$removeComponent, + findComponent: Sys$IContainer$findComponent, + getComponents: Sys$IContainer$getComponents +} +Sys.IContainer.registerInterface("Sys.IContainer"); + +Sys._ScriptLoader = function Sys$_ScriptLoader() { + this._scriptsToLoad = null; + this._sessions = []; + this._scriptLoadedDelegate = Function.createDelegate(this, this._scriptLoadedHandler); +} + function Sys$_ScriptLoader$dispose() { + this._stopSession(); + this._loading = false; + if(this._events) { + delete this._events; + } + this._sessions = null; + this._currentSession = null; + this._scriptLoadedDelegate = null; + } + function Sys$_ScriptLoader$loadScripts(scriptTimeout, allScriptsLoadedCallback, scriptLoadFailedCallback, scriptLoadTimeoutCallback) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "scriptTimeout", type: Number, integer: true}, + {name: "allScriptsLoadedCallback", type: Function, mayBeNull: true}, + {name: "scriptLoadFailedCallback", type: Function, mayBeNull: true}, + {name: "scriptLoadTimeoutCallback", type: Function, mayBeNull: true} + ]); + if (e) throw e; + var session = { + allScriptsLoadedCallback: allScriptsLoadedCallback, + scriptLoadFailedCallback: scriptLoadFailedCallback, + scriptLoadTimeoutCallback: scriptLoadTimeoutCallback, + scriptsToLoad: this._scriptsToLoad, + scriptTimeout: scriptTimeout }; + this._scriptsToLoad = null; + this._sessions[this._sessions.length] = session; + + if (!this._loading) { + this._nextSession(); + } + } + function Sys$_ScriptLoader$notifyScriptLoaded() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + + if(!this._loading) { + return; + } + this._currentTask._notified++; + + if(Sys.Browser.agent === Sys.Browser.Safari) { + if(this._currentTask._notified === 1) { + window.setTimeout(Function.createDelegate(this, function() { + this._scriptLoadedHandler(this._currentTask.get_scriptElement(), true); + }), 0); + } + } + } + function Sys$_ScriptLoader$queueCustomScriptTag(scriptAttributes) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "scriptAttributes"} + ]); + if (e) throw e; + if(!this._scriptsToLoad) { + this._scriptsToLoad = []; + } + Array.add(this._scriptsToLoad, scriptAttributes); + } + function Sys$_ScriptLoader$queueScriptBlock(scriptContent) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "scriptContent", type: String} + ]); + if (e) throw e; + if(!this._scriptsToLoad) { + this._scriptsToLoad = []; + } + Array.add(this._scriptsToLoad, {text: scriptContent}); + } + function Sys$_ScriptLoader$queueScriptReference(scriptUrl) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "scriptUrl", type: String} + ]); + if (e) throw e; + if(!this._scriptsToLoad) { + this._scriptsToLoad = []; + } + Array.add(this._scriptsToLoad, {src: scriptUrl}); + } + function Sys$_ScriptLoader$_createScriptElement(queuedScript) { + var scriptElement = document.createElement('script'); + scriptElement.type = 'text/javascript'; + for (var attr in queuedScript) { + scriptElement[attr] = queuedScript[attr]; + } + + return scriptElement; + } + function Sys$_ScriptLoader$_loadScriptsInternal() { + var session = this._currentSession; + if (session.scriptsToLoad && session.scriptsToLoad.length > 0) { + var nextScript = Array.dequeue(session.scriptsToLoad); + var scriptElement = this._createScriptElement(nextScript); + + if (scriptElement.text && Sys.Browser.agent === Sys.Browser.Safari) { + scriptElement.innerHTML = scriptElement.text; + delete scriptElement.text; + } + if (typeof(nextScript.src) === "string") { + this._currentTask = new Sys._ScriptLoaderTask(scriptElement, this._scriptLoadedDelegate); + this._currentTask.execute(); + } + else { + var headElements = document.getElementsByTagName('head'); + if (headElements.length === 0) { + throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead); + } + else { + headElements[0].appendChild(scriptElement); + } + + + Sys._ScriptLoader._clearScript(scriptElement); + this._loadScriptsInternal(); + } + } + else { + this._stopSession(); + var callback = session.allScriptsLoadedCallback; + if(callback) { + callback(this); + } + this._nextSession(); + } + } + function Sys$_ScriptLoader$_nextSession() { + if (this._sessions.length === 0) { + this._loading = false; + this._currentSession = null; + return; + } + this._loading = true; + + var session = Array.dequeue(this._sessions); + this._currentSession = session; + this._loadScriptsInternal(); + } + function Sys$_ScriptLoader$_raiseError(multipleCallbacks) { + var callback = this._currentSession.scriptLoadFailedCallback; + var scriptElement = this._currentTask.get_scriptElement(); + this._stopSession(); + + if(callback) { + callback(this, scriptElement, multipleCallbacks); + this._nextSession(); + } + else { + this._loading = false; + throw Sys._ScriptLoader._errorScriptLoadFailed(scriptElement.src, multipleCallbacks); + } + } + function Sys$_ScriptLoader$_scriptLoadedHandler(scriptElement, loaded) { + if(loaded && this._currentTask._notified) { + if(this._currentTask._notified > 1) { + this._raiseError(true); + } + else { + Array.add(Sys._ScriptLoader._getLoadedScripts(), scriptElement.src); + this._currentTask.dispose(); + this._currentTask = null; + this._loadScriptsInternal(); + } + } + else { + this._raiseError(false); + } + } + function Sys$_ScriptLoader$_scriptLoadTimeoutHandler() { + var callback = this._currentSession.scriptLoadTimeoutCallback; + this._stopSession(); + if(callback) { + callback(this); + } + this._nextSession(); + } + function Sys$_ScriptLoader$_stopSession() { + if(this._currentTask) { + this._currentTask.dispose(); + this._currentTask = null; + } + } +Sys._ScriptLoader.prototype = { + dispose: Sys$_ScriptLoader$dispose, + loadScripts: Sys$_ScriptLoader$loadScripts, + notifyScriptLoaded: Sys$_ScriptLoader$notifyScriptLoaded, + queueCustomScriptTag: Sys$_ScriptLoader$queueCustomScriptTag, + queueScriptBlock: Sys$_ScriptLoader$queueScriptBlock, + queueScriptReference: Sys$_ScriptLoader$queueScriptReference, + _createScriptElement: Sys$_ScriptLoader$_createScriptElement, + _loadScriptsInternal: Sys$_ScriptLoader$_loadScriptsInternal, + _nextSession: Sys$_ScriptLoader$_nextSession, + _raiseError: Sys$_ScriptLoader$_raiseError, + _scriptLoadedHandler: Sys$_ScriptLoader$_scriptLoadedHandler, + _scriptLoadTimeoutHandler: Sys$_ScriptLoader$_scriptLoadTimeoutHandler, + _stopSession: Sys$_ScriptLoader$_stopSession +} +Sys._ScriptLoader.registerClass('Sys._ScriptLoader', null, Sys.IDisposable); +Sys._ScriptLoader.getInstance = function Sys$_ScriptLoader$getInstance() { + var sl = Sys._ScriptLoader._activeInstance; + if(!sl) { + sl = Sys._ScriptLoader._activeInstance = new Sys._ScriptLoader(); + } + return sl; +} +Sys._ScriptLoader.isScriptLoaded = function Sys$_ScriptLoader$isScriptLoaded(scriptSrc) { + var dummyScript = document.createElement('script'); + dummyScript.src = scriptSrc; + return Array.contains(Sys._ScriptLoader._getLoadedScripts(), dummyScript.src); +} +Sys._ScriptLoader.readLoadedScripts = function Sys$_ScriptLoader$readLoadedScripts() { + if(!Sys._ScriptLoader._referencedScripts) { + var referencedScripts = Sys._ScriptLoader._referencedScripts = []; + var existingScripts = document.getElementsByTagName('script'); + for (i = existingScripts.length - 1; i >= 0; i--) { + var scriptNode = existingScripts[i]; + var scriptSrc = scriptNode.src; + if (scriptSrc.length) { + if (!Array.contains(referencedScripts, scriptSrc)) { + Array.add(referencedScripts, scriptSrc); + } + } + } + } +} +Sys._ScriptLoader._clearScript = function Sys$_ScriptLoader$_clearScript(scriptElement) { + if (!Sys.Debug.isDebug) { + scriptElement.parentNode.removeChild(scriptElement); + } +} +Sys._ScriptLoader._errorScriptLoadFailed = function Sys$_ScriptLoader$_errorScriptLoadFailed(scriptUrl, multipleCallbacks) { + var errorMessage; + if(multipleCallbacks) { + errorMessage = Sys.Res.scriptLoadMultipleCallbacks; + } + else { + errorMessage = Sys.Res.scriptLoadFailedDebug; + } + var displayMessage = "Sys.ScriptLoadFailedException: " + String.format(errorMessage, scriptUrl); + var e = Error.create(displayMessage, {name: 'Sys.ScriptLoadFailedException', 'scriptUrl': scriptUrl }); + e.popStackFrame(); + return e; +} +Sys._ScriptLoader._getLoadedScripts = function Sys$_ScriptLoader$_getLoadedScripts() { + if(!Sys._ScriptLoader._referencedScripts) { + Sys._ScriptLoader._referencedScripts = []; + Sys._ScriptLoader.readLoadedScripts(); + } + return Sys._ScriptLoader._referencedScripts; +} + +Sys._ScriptLoaderTask = function Sys$_ScriptLoaderTask(scriptElement, completedCallback) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "scriptElement", domElement: true}, + {name: "completedCallback", type: Function} + ]); + if (e) throw e; + this._scriptElement = scriptElement; + this._completedCallback = completedCallback; + this._notified = 0; +} + function Sys$_ScriptLoaderTask$get_scriptElement() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._scriptElement; + } + function Sys$_ScriptLoaderTask$dispose() { + if(this._disposed) { + return; + } + this._disposed = true; + this._removeScriptElementHandlers(); + Sys._ScriptLoader._clearScript(this._scriptElement); + this._scriptElement = null; + } + function Sys$_ScriptLoaderTask$execute() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._addScriptElementHandlers(); + var headElements = document.getElementsByTagName('head'); + if (headElements.length === 0) { + throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead); + } + else { + headElements[0].appendChild(this._scriptElement); + } + } + function Sys$_ScriptLoaderTask$_addScriptElementHandlers() { + this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler); + + if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) { + this._scriptElement.readyState = 'loaded'; + $addHandler(this._scriptElement, 'load', this._scriptLoadDelegate); + } + else { + $addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate); + } + if (this._scriptElement.addEventListener) { + this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler); + this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false); + } + } + function Sys$_ScriptLoaderTask$_removeScriptElementHandlers() { + if(this._scriptLoadDelegate) { + var scriptElement = this.get_scriptElement(); + if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) { + $removeHandler(scriptElement, 'load', this._scriptLoadDelegate); + } + else { + $removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate); + } + if (this._scriptErrorDelegate) { + this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false); + this._scriptErrorDelegate = null; + } + this._scriptLoadDelegate = null; + } + } + function Sys$_ScriptLoaderTask$_scriptErrorHandler() { + if(this._disposed) { + return; + } + + this._completedCallback(this.get_scriptElement(), false); + } + function Sys$_ScriptLoaderTask$_scriptLoadHandler() { + if(this._disposed) { + return; + } + var scriptElement = this.get_scriptElement(); + if ((scriptElement.readyState !== 'loaded') && + (scriptElement.readyState !== 'complete')) { + return; + } + + var _this = this; + window.setTimeout(function() { + _this._completedCallback(scriptElement, true); + }, 0); + } +Sys._ScriptLoaderTask.prototype = { + get_scriptElement: Sys$_ScriptLoaderTask$get_scriptElement, + dispose: Sys$_ScriptLoaderTask$dispose, + execute: Sys$_ScriptLoaderTask$execute, + _addScriptElementHandlers: Sys$_ScriptLoaderTask$_addScriptElementHandlers, + _removeScriptElementHandlers: Sys$_ScriptLoaderTask$_removeScriptElementHandlers, + _scriptErrorHandler: Sys$_ScriptLoaderTask$_scriptErrorHandler, + _scriptLoadHandler: Sys$_ScriptLoaderTask$_scriptLoadHandler +} +Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable); + +Sys.ApplicationLoadEventArgs = function Sys$ApplicationLoadEventArgs(components, isPartialLoad) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "components", type: Array, elementType: Sys.Component}, + {name: "isPartialLoad", type: Boolean} + ]); + if (e) throw e; + Sys.ApplicationLoadEventArgs.initializeBase(this); + this._components = components; + this._isPartialLoad = isPartialLoad; +} + + function Sys$ApplicationLoadEventArgs$get_components() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._components; + } + function Sys$ApplicationLoadEventArgs$get_isPartialLoad() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._isPartialLoad; + } +Sys.ApplicationLoadEventArgs.prototype = { + get_components: Sys$ApplicationLoadEventArgs$get_components, + get_isPartialLoad: Sys$ApplicationLoadEventArgs$get_isPartialLoad +} +Sys.ApplicationLoadEventArgs.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs); +Sys.HistoryEventArgs = function Sys$HistoryEventArgs(state) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "state", type: Object} + ]); + if (e) throw e; + Sys.HistoryEventArgs.initializeBase(this); + this._state = state; +} + function Sys$HistoryEventArgs$get_state() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._state; + } +Sys.HistoryEventArgs.prototype = { + get_state: Sys$HistoryEventArgs$get_state +} +Sys.HistoryEventArgs.registerClass('Sys.HistoryEventArgs', Sys.EventArgs); + +Sys._Application = function Sys$_Application() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + Sys._Application.initializeBase(this); + this._disposableObjects = []; + this._components = {}; + this._createdComponents = []; + this._secondPassComponents = []; + this._appLoadHandler = null; + this._beginRequestHandler = null; + this._clientId = null; + this._currentEntry = ''; + this._endRequestHandler = null; + this._history = null; + this._enableHistory = false; + this._historyEnabledInScriptManager = false; + this._historyFrame = null; + this._historyInitialized = false; + this._historyInitialLength = 0; + this._historyLength = 0; + this._historyPointIsNew = false; + this._ignoreTimer = false; + this._initialState = null; + this._state = {}; + this._timerCookie = 0; + this._timerHandler = null; + this._uniqueId = null; + this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler); + this._loadHandlerDelegate = Function.createDelegate(this, this._loadHandler); + Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate); + Sys.UI.DomEvent.addHandler(window, "load", this._loadHandlerDelegate); +} + function Sys$_Application$get_isCreatingComponents() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._creatingComponents; + } + function Sys$_Application$get_stateString() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var hash = window.location.hash; + if (this._isSafari2()) { + var history = this._getHistory(); + if (history) { + hash = history[window.history.length - this._historyInitialLength]; + } + } + if ((hash.length > 0) && (hash.charAt(0) === '#')) { + hash = hash.substring(1); + } + if (Sys.Browser.agent === Sys.Browser.Firefox) { + hash = this._serializeState(this._deserializeState(hash, true)); + } + return hash; + } + function Sys$_Application$get_enableHistory() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._enableHistory; + } + function Sys$_Application$set_enableHistory(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); + if (e) throw e; + if (this._initialized && !this._initializing) { + throw Error.invalidOperation(Sys.Res.historyCannotEnableHistory); + } + else if (this._historyEnabledInScriptManager && !value) { + throw Error.invalidOperation(Sys.Res.invalidHistorySettingCombination); + } + this._enableHistory = value; + } + function Sys$_Application$add_init(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + if (this._initialized) { + handler(this, Sys.EventArgs.Empty); + } + else { + this.get_events().addHandler("init", handler); + } + } + function Sys$_Application$remove_init(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().removeHandler("init", handler); + } + function Sys$_Application$add_load(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().addHandler("load", handler); + } + function Sys$_Application$remove_load(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().removeHandler("load", handler); + } + function Sys$_Application$add_navigate(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().addHandler("navigate", handler); + } + function Sys$_Application$remove_navigate(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().removeHandler("navigate", handler); + } + function Sys$_Application$add_unload(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().addHandler("unload", handler); + } + function Sys$_Application$remove_unload(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this.get_events().removeHandler("unload", handler); + } + function Sys$_Application$addComponent(component) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "component", type: Sys.Component} + ]); + if (e) throw e; + var id = component.get_id(); + if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId); + if (typeof(this._components[id]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id)); + this._components[id] = component; + } + function Sys$_Application$addHistoryPoint(state, title) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "state", type: Object}, + {name: "title", type: String, mayBeNull: true, optional: true} + ]); + if (e) throw e; + if (!this._enableHistory) throw Error.invalidOperation(Sys.Res.historyCannotAddHistoryPointWithHistoryDisabled); + for (var n in state) { + var v = state[n]; + var t = typeof(v); + if ((v !== null) && ((t === 'object') || (t === 'function') || (t === 'undefined'))) { + throw Error.argument('state', Sys.Res.stateMustBeStringDictionary); + } + } + this._ensureHistory(); + var initialState = this._state; + for (var key in state) { + var value = state[key]; + if (value === null) { + if (typeof(initialState[key]) !== 'undefined') { + delete initialState[key]; + } + } + else { + initialState[key] = value; + } + } + var entry = this._serializeState(initialState); + this._historyPointIsNew = true; + this._setState(entry, title); + this._raiseNavigate(); + } + function Sys$_Application$beginCreateComponents() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._creatingComponents = true; + } + function Sys$_Application$dispose() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._disposing) { + this._disposing = true; + if (this._timerCookie) { + window.clearTimeout(this._timerCookie); + delete this._timerCookie; + } + if (this._endRequestHandler) { + Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler); + delete this._endRequestHandler; + } + if (this._beginRequestHandler) { + Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler); + delete this._beginRequestHandler; + } + if (window.pageUnload) { + window.pageUnload(this, Sys.EventArgs.Empty); + } + var unloadHandler = this.get_events().getHandler("unload"); + if (unloadHandler) { + unloadHandler(this, Sys.EventArgs.Empty); + } + var disposableObjects = Array.clone(this._disposableObjects); + for (var i = 0, l = disposableObjects.length; i < l; i++) { + disposableObjects[i].dispose(); + } + Array.clear(this._disposableObjects); + Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate); + if(this._loadHandlerDelegate) { + Sys.UI.DomEvent.removeHandler(window, "load", this._loadHandlerDelegate); + this._loadHandlerDelegate = null; + } + var sl = Sys._ScriptLoader.getInstance(); + if(sl) { + sl.dispose(); + } + Sys._Application.callBaseMethod(this, 'dispose'); + } + } + function Sys$_Application$endCreateComponents() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var components = this._secondPassComponents; + for (var i = 0, l = components.length; i < l; i++) { + var component = components[i].component; + Sys$Component$_setReferences(component, components[i].references); + component.endUpdate(); + } + this._secondPassComponents = []; + this._creatingComponents = false; + } + function Sys$_Application$findComponent(id, parent) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "id", type: String}, + {name: "parent", mayBeNull: true, optional: true} + ]); + if (e) throw e; + return (parent ? + ((Sys.IContainer.isInstanceOfType(parent)) ? + parent.findComponent(id) : + parent[id] || null) : + Sys.Application._components[id] || null); + } + function Sys$_Application$getComponents() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var res = []; + var components = this._components; + for (var name in components) { + res[res.length] = components[name]; + } + return res; + } + function Sys$_Application$initialize() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if(!this._initialized && !this._initializing) { + this._initializing = true; + window.setTimeout(Function.createDelegate(this, this._doInitialize), 0); + } + } + function Sys$_Application$notifyScriptLoaded() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var sl = Sys._ScriptLoader.getInstance(); + if(sl) { + sl.notifyScriptLoaded(); + } + } + function Sys$_Application$registerDisposableObject(object) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "object", type: Sys.IDisposable} + ]); + if (e) throw e; + if (!this._disposing) { + this._disposableObjects[this._disposableObjects.length] = object; + } + } + function Sys$_Application$raiseLoad() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var h = this.get_events().getHandler("load"); + var args = new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !this._initializing); + if (h) { + h(this, args); + } + if (window.pageLoad) { + window.pageLoad(this, args); + } + this._createdComponents = []; + } + function Sys$_Application$removeComponent(component) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "component", type: Sys.Component} + ]); + if (e) throw e; + var id = component.get_id(); + if (id) delete this._components[id]; + } + function Sys$_Application$setServerId(clientId, uniqueId) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "clientId", type: String}, + {name: "uniqueId", type: String} + ]); + if (e) throw e; + this._clientId = clientId; + this._uniqueId = uniqueId; + } + function Sys$_Application$setServerState(value) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "value", type: String} + ]); + if (e) throw e; + this._ensureHistory(); + this._state.__s = value; + this._updateHiddenField(value); + } + function Sys$_Application$unregisterDisposableObject(object) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "object", type: Sys.IDisposable} + ]); + if (e) throw e; + if (!this._disposing) { + Array.remove(this._disposableObjects, object); + } + } + function Sys$_Application$_addComponentToSecondPass(component, references) { + this._secondPassComponents[this._secondPassComponents.length] = {component: component, references: references}; + } + function Sys$_Application$_deserializeState(entry, skipDecodeUri) { + var result = {}; + entry = entry || ''; + var serverSeparator = entry.indexOf('&&'); + if ((serverSeparator !== -1) && (serverSeparator + 2 < entry.length)) { + result.__s = entry.substr(serverSeparator + 2); + entry = entry.substr(0, serverSeparator); + } + var tokens = entry.split('&'); + for (var i = 0, l = tokens.length; i < l; i++) { + var token = tokens[i]; + var equal = token.indexOf('='); + if ((equal !== -1) && (equal + 1 < token.length)) { + var name = token.substr(0, equal); + var value = token.substr(equal + 1); + result[name] = skipDecodeUri ? value : decodeURIComponent(value); + } + } + return result; + } + function Sys$_Application$_doInitialize() { + Sys._Application.callBaseMethod(this, 'initialize'); + + var handler = this.get_events().getHandler("init"); + if (handler) { + this.beginCreateComponents(); + handler(this, Sys.EventArgs.Empty); + this.endCreateComponents(); + } + if (Sys.WebForms) { + this._beginRequestHandler = Function.createDelegate(this, this._onPageRequestManagerBeginRequest); + Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler); + this._endRequestHandler = Function.createDelegate(this, this._onPageRequestManagerEndRequest); + Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler); + } + + var loadedEntry = this.get_stateString(); + if (loadedEntry !== this._currentEntry) { + this._navigate(loadedEntry); + } + + this.raiseLoad(); + this._initializing = false; + } + function Sys$_Application$_enableHistoryInScriptManager() { + this._enableHistory = true; + this._historyEnabledInScriptManager = true; + } + function Sys$_Application$_ensureHistory() { + if (!this._historyInitialized && this._enableHistory) { + if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.documentMode < 8)) { + this._historyFrame = document.getElementById('__historyFrame'); + if (!this._historyFrame) throw Error.invalidOperation(Sys.Res.historyMissingFrame); + this._ignoreIFrame = true; + } + if (this._isSafari2()) { + var historyElement = document.getElementById('__history'); + if (!historyElement) throw Error.invalidOperation(Sys.Res.historyMissingHiddenInput); + this._setHistory([window.location.hash]); + this._historyInitialLength = window.history.length; + } + + this._timerHandler = Function.createDelegate(this, this._onIdle); + this._timerCookie = window.setTimeout(this._timerHandler, 100); + + try { + this._initialState = this._deserializeState(this.get_stateString()); + } catch(e) {} + + this._historyInitialized = true; + } + } + function Sys$_Application$_getHistory() { + var historyElement = document.getElementById('__history'); + if (!historyElement) return ''; + var v = historyElement.value; + return v ? Sys.Serialization.JavaScriptSerializer.deserialize(v, true) : ''; + } + function Sys$_Application$_isSafari2() { + return (Sys.Browser.agent === Sys.Browser.Safari) && + (Sys.Browser.version <= 419.3); + } + function Sys$_Application$_loadHandler() { + if(this._loadHandlerDelegate) { + Sys.UI.DomEvent.removeHandler(window, "load", this._loadHandlerDelegate); + this._loadHandlerDelegate = null; + } + this.initialize(); + } + function Sys$_Application$_navigate(entry) { + this._ensureHistory(); + var state = this._deserializeState(entry); + + if (this._uniqueId) { + var oldServerEntry = this._state.__s || ''; + var newServerEntry = state.__s || ''; + if (newServerEntry !== oldServerEntry) { + this._updateHiddenField(newServerEntry); + __doPostBack(this._uniqueId, newServerEntry); + this._state = state; + return; + } + } + this._setState(entry); + this._state = state; + this._raiseNavigate(); + } + function Sys$_Application$_onIdle() { + delete this._timerCookie; + + var entry = this.get_stateString(); + if (entry !== this._currentEntry) { + if (!this._ignoreTimer) { + this._historyPointIsNew = false; + this._navigate(entry); + this._historyLength = window.history.length; + } + } + else { + this._ignoreTimer = false; + } + this._timerCookie = window.setTimeout(this._timerHandler, 100); + } + function Sys$_Application$_onIFrameLoad(entry) { + this._ensureHistory(); + if (!this._ignoreIFrame) { + this._historyPointIsNew = false; + this._navigate(entry); + } + this._ignoreIFrame = false; + } + function Sys$_Application$_onPageRequestManagerBeginRequest(sender, args) { + this._ignoreTimer = true; + } + function Sys$_Application$_onPageRequestManagerEndRequest(sender, args) { + var dataItem = args.get_dataItems()[this._clientId]; + var eventTarget = document.getElementById("__EVENTTARGET"); + if (eventTarget && eventTarget.value === this._uniqueId) { + eventTarget.value = ''; + } + if (typeof(dataItem) !== 'undefined') { + this.setServerState(dataItem); + this._historyPointIsNew = true; + } + else { + this._ignoreTimer = false; + } + var entry = this._serializeState(this._state); + if (entry !== this._currentEntry) { + this._ignoreTimer = true; + this._setState(entry); + this._raiseNavigate(); + } + } + function Sys$_Application$_raiseNavigate() { + var h = this.get_events().getHandler("navigate"); + var stateClone = {}; + for (var key in this._state) { + if (key !== '__s') { + stateClone[key] = this._state[key]; + } + } + var args = new Sys.HistoryEventArgs(stateClone); + if (h) { + h(this, args); + } + } + function Sys$_Application$_serializeState(state) { + var serialized = []; + for (var key in state) { + var value = state[key]; + if (key === '__s') { + var serverState = value; + } + else { + if (key.indexOf('=') !== -1) throw Error.argument('state', Sys.Res.stateFieldNameInvalid); + serialized[serialized.length] = key + '=' + encodeURIComponent(value); + } + } + return serialized.join('&') + (serverState ? '&&' + serverState : ''); + } + function Sys$_Application$_setHistory(historyArray) { + var historyElement = document.getElementById('__history'); + if (historyElement) { + historyElement.value = Sys.Serialization.JavaScriptSerializer.serialize(historyArray); + } + } + function Sys$_Application$_setState(entry, title) { + entry = entry || ''; + if (entry !== this._currentEntry) { + if (window.theForm) { + var action = window.theForm.action; + var hashIndex = action.indexOf('#'); + window.theForm.action = ((hashIndex !== -1) ? action.substring(0, hashIndex) : action) + '#' + entry; + } + + if (this._historyFrame && this._historyPointIsNew) { + this._ignoreIFrame = true; + this._historyPointIsNew = false; + var frameDoc = this._historyFrame.contentWindow.document; + frameDoc.open("javascript:''"); + frameDoc.write("" + (title || document.title) + + "parent.Sys.Application._onIFrameLoad('" + + entry + "');"); + frameDoc.close(); + } + this._ignoreTimer = false; + var currentHash = this.get_stateString(); + this._currentEntry = entry; + if (entry !== currentHash) { + var loc = document.location; + if (loc.href.length - loc.hash.length + entry.length > 1024) { + throw Error.invalidOperation(Sys.Res.urlMustBeLessThan1024chars); + } + if (this._isSafari2()) { + var history = this._getHistory(); + history[window.history.length - this._historyInitialLength + 1] = entry; + this._setHistory(history); + this._historyLength = window.history.length + 1; + var form = document.createElement('form'); + form.method = 'get'; + form.action = '#' + entry; + document.appendChild(form); + form.submit(); + document.removeChild(form); + } + else { + window.location.hash = entry; + } + if ((typeof(title) !== 'undefined') && (title !== null)) { + document.title = title; + } + } + } + } + function Sys$_Application$_unloadHandler(event) { + this.dispose(); + } + function Sys$_Application$_updateHiddenField(value) { + if (this._clientId) { + var serverStateField = document.getElementById(this._clientId); + if (serverStateField) { + serverStateField.value = value; + } + } + } +Sys._Application.prototype = { + _creatingComponents: false, + _disposing: false, + get_isCreatingComponents: Sys$_Application$get_isCreatingComponents, + get_stateString: Sys$_Application$get_stateString, + get_enableHistory: Sys$_Application$get_enableHistory, + set_enableHistory: Sys$_Application$set_enableHistory, + add_init: Sys$_Application$add_init, + remove_init: Sys$_Application$remove_init, + add_load: Sys$_Application$add_load, + remove_load: Sys$_Application$remove_load, + add_navigate: Sys$_Application$add_navigate, + remove_navigate: Sys$_Application$remove_navigate, + add_unload: Sys$_Application$add_unload, + remove_unload: Sys$_Application$remove_unload, + addComponent: Sys$_Application$addComponent, + addHistoryPoint: Sys$_Application$addHistoryPoint, + beginCreateComponents: Sys$_Application$beginCreateComponents, + dispose: Sys$_Application$dispose, + endCreateComponents: Sys$_Application$endCreateComponents, + findComponent: Sys$_Application$findComponent, + getComponents: Sys$_Application$getComponents, + initialize: Sys$_Application$initialize, + notifyScriptLoaded: Sys$_Application$notifyScriptLoaded, + registerDisposableObject: Sys$_Application$registerDisposableObject, + raiseLoad: Sys$_Application$raiseLoad, + removeComponent: Sys$_Application$removeComponent, + setServerId: Sys$_Application$setServerId, + setServerState: Sys$_Application$setServerState, + unregisterDisposableObject: Sys$_Application$unregisterDisposableObject, + _addComponentToSecondPass: Sys$_Application$_addComponentToSecondPass, + _deserializeState: Sys$_Application$_deserializeState, + _doInitialize: Sys$_Application$_doInitialize, + _enableHistoryInScriptManager: Sys$_Application$_enableHistoryInScriptManager, + _ensureHistory: Sys$_Application$_ensureHistory, + _getHistory: Sys$_Application$_getHistory, + _isSafari2: Sys$_Application$_isSafari2, + _loadHandler: Sys$_Application$_loadHandler, + _navigate: Sys$_Application$_navigate, + _onIdle: Sys$_Application$_onIdle, + _onIFrameLoad: Sys$_Application$_onIFrameLoad, + _onPageRequestManagerBeginRequest: Sys$_Application$_onPageRequestManagerBeginRequest, + _onPageRequestManagerEndRequest: Sys$_Application$_onPageRequestManagerEndRequest, + _raiseNavigate: Sys$_Application$_raiseNavigate, + _serializeState: Sys$_Application$_serializeState, + _setHistory: Sys$_Application$_setHistory, + _setState: Sys$_Application$_setState, + _unloadHandler: Sys$_Application$_unloadHandler, + _updateHiddenField: Sys$_Application$_updateHiddenField +} +Sys._Application.registerClass('Sys._Application', Sys.Component, Sys.IContainer); +Sys.Application = new Sys._Application(); +var $find = Sys.Application.findComponent; +Type.registerNamespace('Sys.Net'); + +Sys.Net.WebRequestExecutor = function Sys$Net$WebRequestExecutor() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._webRequest = null; + this._resultObject = null; +} + function Sys$Net$WebRequestExecutor$get_webRequest() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._webRequest; + } + function Sys$Net$WebRequestExecutor$_set_webRequest(value) { + if (this.get_started()) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest')); + } + this._webRequest = value; + } + function Sys$Net$WebRequestExecutor$get_started() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_responseAvailable() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_timedOut() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_aborted() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_responseData() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_statusCode() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_statusText() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_xml() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$get_object() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._resultObject) { + this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData()); + } + return this._resultObject; + } + function Sys$Net$WebRequestExecutor$executeRequest() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$abort() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$getResponseHeader(header) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "header", type: String} + ]); + if (e) throw e; + throw Error.notImplemented(); + } + function Sys$Net$WebRequestExecutor$getAllResponseHeaders() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); + } +Sys.Net.WebRequestExecutor.prototype = { + get_webRequest: Sys$Net$WebRequestExecutor$get_webRequest, + _set_webRequest: Sys$Net$WebRequestExecutor$_set_webRequest, + get_started: Sys$Net$WebRequestExecutor$get_started, + get_responseAvailable: Sys$Net$WebRequestExecutor$get_responseAvailable, + get_timedOut: Sys$Net$WebRequestExecutor$get_timedOut, + get_aborted: Sys$Net$WebRequestExecutor$get_aborted, + get_responseData: Sys$Net$WebRequestExecutor$get_responseData, + get_statusCode: Sys$Net$WebRequestExecutor$get_statusCode, + get_statusText: Sys$Net$WebRequestExecutor$get_statusText, + get_xml: Sys$Net$WebRequestExecutor$get_xml, + get_object: Sys$Net$WebRequestExecutor$get_object, + executeRequest: Sys$Net$WebRequestExecutor$executeRequest, + abort: Sys$Net$WebRequestExecutor$abort, + getResponseHeader: Sys$Net$WebRequestExecutor$getResponseHeader, + getAllResponseHeaders: Sys$Net$WebRequestExecutor$getAllResponseHeaders +} +Sys.Net.WebRequestExecutor.registerClass('Sys.Net.WebRequestExecutor'); + +Sys.Net.XMLDOM = function Sys$Net$XMLDOM(markup) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "markup", type: String} + ]); + if (e) throw e; + if (!window.DOMParser) { + var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ]; + for (var i = 0, l = progIDs.length; i < l; i++) { + try { + var xmlDOM = new ActiveXObject(progIDs[i]); + xmlDOM.async = false; + xmlDOM.loadXML(markup); + xmlDOM.setProperty('SelectionLanguage', 'XPath'); + return xmlDOM; + } + catch (ex) { + } + } + } + else { + try { + var domParser = new window.DOMParser(); + return domParser.parseFromString(markup, 'text/xml'); + } + catch (ex) { + } + } + return null; +} +Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + Sys.Net.XMLHttpExecutor.initializeBase(this); + var _this = this; + this._xmlHttpRequest = null; + this._webRequest = null; + this._responseAvailable = false; + this._timedOut = false; + this._timer = null; + this._aborted = false; + this._started = false; + this._onReadyStateChange = (function () { + + if (_this._xmlHttpRequest.readyState === 4 ) { + try { + if (typeof(_this._xmlHttpRequest.status) === "undefined") { + return; + } + } + catch(ex) { + return; + } + + _this._clearTimer(); + _this._responseAvailable = true; + try { + _this._webRequest.completed(Sys.EventArgs.Empty); + } + finally { + if (_this._xmlHttpRequest != null) { + _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; + _this._xmlHttpRequest = null; + } + } + } + }); + this._clearTimer = (function() { + if (_this._timer != null) { + window.clearTimeout(_this._timer); + _this._timer = null; + } + }); + this._onTimeout = (function() { + if (!_this._responseAvailable) { + _this._clearTimer(); + _this._timedOut = true; + _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; + _this._xmlHttpRequest.abort(); + _this._webRequest.completed(Sys.EventArgs.Empty); + _this._xmlHttpRequest = null; + } + }); +} + function Sys$Net$XMLHttpExecutor$get_timedOut() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._timedOut; + } + function Sys$Net$XMLHttpExecutor$get_started() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._started; + } + function Sys$Net$XMLHttpExecutor$get_responseAvailable() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._responseAvailable; + } + function Sys$Net$XMLHttpExecutor$get_aborted() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._aborted; + } + function Sys$Net$XMLHttpExecutor$executeRequest() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._webRequest = this.get_webRequest(); + if (this._started) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest')); + } + if (this._webRequest === null) { + throw Error.invalidOperation(Sys.Res.nullWebRequest); + } + var body = this._webRequest.get_body(); + var headers = this._webRequest.get_headers(); + this._xmlHttpRequest = new XMLHttpRequest(); + this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange; + var verb = this._webRequest.get_httpVerb(); + this._xmlHttpRequest.open(verb, this._webRequest.getResolvedUrl(), true ); + if (headers) { + for (var header in headers) { + var val = headers[header]; + if (typeof(val) !== "function") + this._xmlHttpRequest.setRequestHeader(header, val); + } + } + if (verb.toLowerCase() === "post") { + if ((headers === null) || !headers['Content-Type']) { + this._xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'); + } + if (!body) { + body = ""; + } + } + var timeout = this._webRequest.get_timeout(); + if (timeout > 0) { + this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout); + } + this._xmlHttpRequest.send(body); + this._started = true; + } + function Sys$Net$XMLHttpExecutor$getResponseHeader(header) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "header", type: String} + ]); + if (e) throw e; + if (!this._responseAvailable) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getResponseHeader')); + } + if (!this._xmlHttpRequest) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getResponseHeader')); + } + var result; + try { + result = this._xmlHttpRequest.getResponseHeader(header); + } catch (e) { + } + if (!result) result = ""; + return result; + } + function Sys$Net$XMLHttpExecutor$getAllResponseHeaders() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._responseAvailable) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getAllResponseHeaders')); + } + if (!this._xmlHttpRequest) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getAllResponseHeaders')); + } + return this._xmlHttpRequest.getAllResponseHeaders(); + } + function Sys$Net$XMLHttpExecutor$get_responseData() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._responseAvailable) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData')); + } + if (!this._xmlHttpRequest) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData')); + } + return this._xmlHttpRequest.responseText; + } + function Sys$Net$XMLHttpExecutor$get_statusCode() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._responseAvailable) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusCode')); + } + if (!this._xmlHttpRequest) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusCode')); + } + var result = 0; + try { + result = this._xmlHttpRequest.status; + } + catch(ex) { + } + return result; + } + function Sys$Net$XMLHttpExecutor$get_statusText() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._responseAvailable) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusText')); + } + if (!this._xmlHttpRequest) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusText')); + } + return this._xmlHttpRequest.statusText; + } + function Sys$Net$XMLHttpExecutor$get_xml() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._responseAvailable) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml')); + } + if (!this._xmlHttpRequest) { + throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml')); + } + var xml = this._xmlHttpRequest.responseXML; + if (!xml || !xml.documentElement) { + xml = Sys.Net.XMLDOM(this._xmlHttpRequest.responseText); + if (!xml || !xml.documentElement) + return null; + } + else if (navigator.userAgent.indexOf('MSIE') !== -1) { + xml.setProperty('SelectionLanguage', 'XPath'); + } + if (xml.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" && + xml.documentElement.tagName === "parsererror") { + return null; + } + + if (xml.documentElement.firstChild && xml.documentElement.firstChild.tagName === "parsererror") { + return null; + } + + return xml; + } + function Sys$Net$XMLHttpExecutor$abort() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._started) { + throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart); + } + if (this._aborted || this._responseAvailable || this._timedOut) + return; + this._aborted = true; + this._clearTimer(); + if (this._xmlHttpRequest && !this._responseAvailable) { + this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; + this._xmlHttpRequest.abort(); + + this._xmlHttpRequest = null; + this._webRequest.completed(Sys.EventArgs.Empty); + } + } +Sys.Net.XMLHttpExecutor.prototype = { + get_timedOut: Sys$Net$XMLHttpExecutor$get_timedOut, + get_started: Sys$Net$XMLHttpExecutor$get_started, + get_responseAvailable: Sys$Net$XMLHttpExecutor$get_responseAvailable, + get_aborted: Sys$Net$XMLHttpExecutor$get_aborted, + executeRequest: Sys$Net$XMLHttpExecutor$executeRequest, + getResponseHeader: Sys$Net$XMLHttpExecutor$getResponseHeader, + getAllResponseHeaders: Sys$Net$XMLHttpExecutor$getAllResponseHeaders, + get_responseData: Sys$Net$XMLHttpExecutor$get_responseData, + get_statusCode: Sys$Net$XMLHttpExecutor$get_statusCode, + get_statusText: Sys$Net$XMLHttpExecutor$get_statusText, + get_xml: Sys$Net$XMLHttpExecutor$get_xml, + abort: Sys$Net$XMLHttpExecutor$abort +} +Sys.Net.XMLHttpExecutor.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor); + +Sys.Net._WebRequestManager = function Sys$Net$_WebRequestManager() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._defaultTimeout = 0; + this._defaultExecutorType = "Sys.Net.XMLHttpExecutor"; +} + function Sys$Net$_WebRequestManager$add_invokingRequest(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this._get_eventHandlerList().addHandler("invokingRequest", handler); + } + function Sys$Net$_WebRequestManager$remove_invokingRequest(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this._get_eventHandlerList().removeHandler("invokingRequest", handler); + } + function Sys$Net$_WebRequestManager$add_completedRequest(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this._get_eventHandlerList().addHandler("completedRequest", handler); + } + function Sys$Net$_WebRequestManager$remove_completedRequest(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this._get_eventHandlerList().removeHandler("completedRequest", handler); + } + function Sys$Net$_WebRequestManager$_get_eventHandlerList() { + if (!this._events) { + this._events = new Sys.EventHandlerList(); + } + return this._events; + } + function Sys$Net$_WebRequestManager$get_defaultTimeout() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._defaultTimeout; + } + function Sys$Net$_WebRequestManager$set_defaultTimeout(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Number}]); + if (e) throw e; + if (value < 0) { + throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout); + } + this._defaultTimeout = value; + } + function Sys$Net$_WebRequestManager$get_defaultExecutorType() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._defaultExecutorType; + } + function Sys$Net$_WebRequestManager$set_defaultExecutorType(value) { + var e = Function._validateParams(arguments, [{name: "value", type: String}]); + if (e) throw e; + this._defaultExecutorType = value; + } + function Sys$Net$_WebRequestManager$executeRequest(webRequest) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "webRequest", type: Sys.Net.WebRequest} + ]); + if (e) throw e; + var executor = webRequest.get_executor(); + if (!executor) { + var failed = false; + try { + var executorType = eval(this._defaultExecutorType); + executor = new executorType(); + } catch (e) { + failed = true; + } + if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor) || !executor) { + throw Error.argument("defaultExecutorType", String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType)); + } + webRequest.set_executor(executor); + } + if (executor.get_aborted()) { + return; + } + var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest); + var handler = this._get_eventHandlerList().getHandler("invokingRequest"); + if (handler) { + handler(this, evArgs); + } + if (!evArgs.get_cancel()) { + executor.executeRequest(); + } + } +Sys.Net._WebRequestManager.prototype = { + add_invokingRequest: Sys$Net$_WebRequestManager$add_invokingRequest, + remove_invokingRequest: Sys$Net$_WebRequestManager$remove_invokingRequest, + add_completedRequest: Sys$Net$_WebRequestManager$add_completedRequest, + remove_completedRequest: Sys$Net$_WebRequestManager$remove_completedRequest, + _get_eventHandlerList: Sys$Net$_WebRequestManager$_get_eventHandlerList, + get_defaultTimeout: Sys$Net$_WebRequestManager$get_defaultTimeout, + set_defaultTimeout: Sys$Net$_WebRequestManager$set_defaultTimeout, + get_defaultExecutorType: Sys$Net$_WebRequestManager$get_defaultExecutorType, + set_defaultExecutorType: Sys$Net$_WebRequestManager$set_defaultExecutorType, + executeRequest: Sys$Net$_WebRequestManager$executeRequest +} +Sys.Net._WebRequestManager.registerClass('Sys.Net._WebRequestManager'); +Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager(); + +Sys.Net.NetworkRequestEventArgs = function Sys$Net$NetworkRequestEventArgs(webRequest) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "webRequest", type: Sys.Net.WebRequest} + ]); + if (e) throw e; + Sys.Net.NetworkRequestEventArgs.initializeBase(this); + this._webRequest = webRequest; +} + function Sys$Net$NetworkRequestEventArgs$get_webRequest() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._webRequest; + } +Sys.Net.NetworkRequestEventArgs.prototype = { + get_webRequest: Sys$Net$NetworkRequestEventArgs$get_webRequest +} +Sys.Net.NetworkRequestEventArgs.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs); + +Sys.Net.WebRequest = function Sys$Net$WebRequest() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + this._url = ""; + this._headers = { }; + this._body = null; + this._userContext = null; + this._httpVerb = null; + this._executor = null; + this._invokeCalled = false; + this._timeout = 0; +} + function Sys$Net$WebRequest$add_completed(handler) { + /// + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this._get_eventHandlerList().addHandler("completed", handler); + } + function Sys$Net$WebRequest$remove_completed(handler) { + var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); + if (e) throw e; + this._get_eventHandlerList().removeHandler("completed", handler); + } + function Sys$Net$WebRequest$completed(eventArgs) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "eventArgs", type: Sys.EventArgs} + ]); + if (e) throw e; + var handler = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest"); + if (handler) { + handler(this._executor, eventArgs); + } + handler = this._get_eventHandlerList().getHandler("completed"); + if (handler) { + handler(this._executor, eventArgs); + } + } + function Sys$Net$WebRequest$_get_eventHandlerList() { + if (!this._events) { + this._events = new Sys.EventHandlerList(); + } + return this._events; + } + function Sys$Net$WebRequest$get_url() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._url; + } + function Sys$Net$WebRequest$set_url(value) { + var e = Function._validateParams(arguments, [{name: "value", type: String}]); + if (e) throw e; + this._url = value; + } + function Sys$Net$WebRequest$get_headers() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._headers; + } + function Sys$Net$WebRequest$get_httpVerb() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this._httpVerb === null) { + if (this._body === null) { + return "GET"; + } + return "POST"; + } + return this._httpVerb; + } + function Sys$Net$WebRequest$set_httpVerb(value) { + var e = Function._validateParams(arguments, [{name: "value", type: String}]); + if (e) throw e; + if (value.length === 0) { + throw Error.argument('value', Sys.Res.invalidHttpVerb); + } + this._httpVerb = value; + } + function Sys$Net$WebRequest$get_body() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._body; + } + function Sys$Net$WebRequest$set_body(value) { + var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]); + if (e) throw e; + this._body = value; + } + function Sys$Net$WebRequest$get_userContext() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._userContext; + } + function Sys$Net$WebRequest$set_userContext(value) { + var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]); + if (e) throw e; + this._userContext = value; + } + function Sys$Net$WebRequest$get_executor() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._executor; + } + function Sys$Net$WebRequest$set_executor(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]); + if (e) throw e; + if (this._executor !== null && this._executor.get_started()) { + throw Error.invalidOperation(Sys.Res.setExecutorAfterActive); + } + this._executor = value; + this._executor._set_webRequest(this); + } + function Sys$Net$WebRequest$get_timeout() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this._timeout === 0) { + return Sys.Net.WebRequestManager.get_defaultTimeout(); + } + return this._timeout; + } + function Sys$Net$WebRequest$set_timeout(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Number}]); + if (e) throw e; + if (value < 0) { + throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout); + } + this._timeout = value; + } + function Sys$Net$WebRequest$getResolvedUrl() { + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return Sys.Net.WebRequest._resolveUrl(this._url); + } + function Sys$Net$WebRequest$invoke() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this._invokeCalled) { + throw Error.invalidOperation(Sys.Res.invokeCalledTwice); + } + Sys.Net.WebRequestManager.executeRequest(this); + this._invokeCalled = true; + } +Sys.Net.WebRequest.prototype = { + add_completed: Sys$Net$WebRequest$add_completed, + remove_completed: Sys$Net$WebRequest$remove_completed, + completed: Sys$Net$WebRequest$completed, + _get_eventHandlerList: Sys$Net$WebRequest$_get_eventHandlerList, + get_url: Sys$Net$WebRequest$get_url, + set_url: Sys$Net$WebRequest$set_url, + get_headers: Sys$Net$WebRequest$get_headers, + get_httpVerb: Sys$Net$WebRequest$get_httpVerb, + set_httpVerb: Sys$Net$WebRequest$set_httpVerb, + get_body: Sys$Net$WebRequest$get_body, + set_body: Sys$Net$WebRequest$set_body, + get_userContext: Sys$Net$WebRequest$get_userContext, + set_userContext: Sys$Net$WebRequest$set_userContext, + get_executor: Sys$Net$WebRequest$get_executor, + set_executor: Sys$Net$WebRequest$set_executor, + get_timeout: Sys$Net$WebRequest$get_timeout, + set_timeout: Sys$Net$WebRequest$set_timeout, + getResolvedUrl: Sys$Net$WebRequest$getResolvedUrl, + invoke: Sys$Net$WebRequest$invoke +} +Sys.Net.WebRequest._resolveUrl = function Sys$Net$WebRequest$_resolveUrl(url, baseUrl) { + if (url && url.indexOf('://') !== -1) { + return url; + } + if (!baseUrl || baseUrl.length === 0) { + var baseElement = document.getElementsByTagName('base')[0]; + if (baseElement && baseElement.href && baseElement.href.length > 0) { + baseUrl = baseElement.href; + } + else { + baseUrl = document.URL; + } + } + var qsStart = baseUrl.indexOf('?'); + if (qsStart !== -1) { + baseUrl = baseUrl.substr(0, qsStart); + } + qsStart = baseUrl.indexOf('#'); + if (qsStart !== -1) { + baseUrl = baseUrl.substr(0, qsStart); + } + baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1); + if (!url || url.length === 0) { + return baseUrl; + } + if (url.charAt(0) === '/') { + var slashslash = baseUrl.indexOf('://'); + if (slashslash === -1) { + throw Error.argument("baseUrl", Sys.Res.badBaseUrl1); + } + var nextSlash = baseUrl.indexOf('/', slashslash + 3); + if (nextSlash === -1) { + throw Error.argument("baseUrl", Sys.Res.badBaseUrl2); + } + return baseUrl.substr(0, nextSlash) + url; + } + else { + var lastSlash = baseUrl.lastIndexOf('/'); + if (lastSlash === -1) { + throw Error.argument("baseUrl", Sys.Res.badBaseUrl3); + } + return baseUrl.substr(0, lastSlash+1) + url; + } +} +Sys.Net.WebRequest._createQueryString = function Sys$Net$WebRequest$_createQueryString(queryString, encodeMethod) { + if (!encodeMethod) + encodeMethod = encodeURIComponent; + var sb = new Sys.StringBuilder(); + var i = 0; + for (var arg in queryString) { + var obj = queryString[arg]; + if (typeof(obj) === "function") continue; + var val = Sys.Serialization.JavaScriptSerializer.serialize(obj); + if (i !== 0) { + sb.append('&'); + } + sb.append(arg); + sb.append('='); + sb.append(encodeMethod(val)); + i++; + } + return sb.toString(); +} +Sys.Net.WebRequest._createUrl = function Sys$Net$WebRequest$_createUrl(url, queryString) { + if (!queryString) { + return url; + } + var qs = Sys.Net.WebRequest._createQueryString(queryString); + if (qs.length > 0) { + var sep = '?'; + if (url && url.indexOf('?') !== -1) + sep = '&'; + return url + sep + qs; + } else { + return url; + } +} +Sys.Net.WebRequest.registerClass('Sys.Net.WebRequest'); + +Sys.Net.WebServiceProxy = function Sys$Net$WebServiceProxy() { +} + function Sys$Net$WebServiceProxy$get_timeout() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._timeout; + } + function Sys$Net$WebServiceProxy$set_timeout(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Number}]); + if (e) throw e; + if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); } + this._timeout = value; + } + function Sys$Net$WebServiceProxy$get_defaultUserContext() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._userContext; + } + function Sys$Net$WebServiceProxy$set_defaultUserContext(value) { + var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]); + if (e) throw e; + this._userContext = value; + } + function Sys$Net$WebServiceProxy$get_defaultSucceededCallback() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._succeeded; + } + function Sys$Net$WebServiceProxy$set_defaultSucceededCallback(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); + if (e) throw e; + this._succeeded = value; + } + function Sys$Net$WebServiceProxy$get_defaultFailedCallback() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._failed; + } + function Sys$Net$WebServiceProxy$set_defaultFailedCallback(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); + if (e) throw e; + this._failed = value; + } + function Sys$Net$WebServiceProxy$get_path() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._path; + } + function Sys$Net$WebServiceProxy$set_path(value) { + var e = Function._validateParams(arguments, [{name: "value", type: String}]); + if (e) throw e; + this._path = value; + } + function Sys$Net$WebServiceProxy$_invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext) { + /// + /// + /// + /// + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "servicePath", type: String}, + {name: "methodName", type: String}, + {name: "useGet", type: Boolean}, + {name: "params"}, + {name: "onSuccess", type: Function, mayBeNull: true, optional: true}, + {name: "onFailure", type: Function, mayBeNull: true, optional: true}, + {name: "userContext", mayBeNull: true, optional: true} + ]); + if (e) throw e; + if (onSuccess === null || typeof onSuccess === 'undefined') onSuccess = this.get_defaultSucceededCallback(); + if (onFailure === null || typeof onFailure === 'undefined') onFailure = this.get_defaultFailedCallback(); + if (userContext === null || typeof userContext === 'undefined') userContext = this.get_defaultUserContext(); + + return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout()); + } +Sys.Net.WebServiceProxy.prototype = { + get_timeout: Sys$Net$WebServiceProxy$get_timeout, + set_timeout: Sys$Net$WebServiceProxy$set_timeout, + get_defaultUserContext: Sys$Net$WebServiceProxy$get_defaultUserContext, + set_defaultUserContext: Sys$Net$WebServiceProxy$set_defaultUserContext, + get_defaultSucceededCallback: Sys$Net$WebServiceProxy$get_defaultSucceededCallback, + set_defaultSucceededCallback: Sys$Net$WebServiceProxy$set_defaultSucceededCallback, + get_defaultFailedCallback: Sys$Net$WebServiceProxy$get_defaultFailedCallback, + set_defaultFailedCallback: Sys$Net$WebServiceProxy$set_defaultFailedCallback, + get_path: Sys$Net$WebServiceProxy$get_path, + set_path: Sys$Net$WebServiceProxy$set_path, + _invoke: Sys$Net$WebServiceProxy$_invoke +} +Sys.Net.WebServiceProxy.registerClass('Sys.Net.WebServiceProxy'); +Sys.Net.WebServiceProxy.invoke = function Sys$Net$WebServiceProxy$invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, timeout) { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "servicePath", type: String}, + {name: "methodName", type: String}, + {name: "useGet", type: Boolean, optional: true}, + {name: "params", mayBeNull: true, optional: true}, + {name: "onSuccess", type: Function, mayBeNull: true, optional: true}, + {name: "onFailure", type: Function, mayBeNull: true, optional: true}, + {name: "userContext", mayBeNull: true, optional: true}, + {name: "timeout", type: Number, optional: true} + ]); + if (e) throw e; + var request = new Sys.Net.WebRequest(); + request.get_headers()['Content-Type'] = 'application/json; charset=utf-8'; + if (!params) params = {}; + var urlParams = params; + if (!useGet || !urlParams) urlParams = {}; + request.set_url(Sys.Net.WebRequest._createUrl(servicePath+"/"+encodeURIComponent(methodName), urlParams)); + var body = null; + if (!useGet) { + body = Sys.Serialization.JavaScriptSerializer.serialize(params); + if (body === "{}") body = ""; + } + request.set_body(body); + request.add_completed(onComplete); + if (timeout && timeout > 0) request.set_timeout(timeout); + request.invoke(); + function onComplete(response, eventArgs) { + if (response.get_responseAvailable()) { + var statusCode = response.get_statusCode(); + var result = null; + + try { + var contentType = response.getResponseHeader("Content-Type"); + if (contentType.startsWith("application/json")) { + result = response.get_object(); + } + else if (contentType.startsWith("text/xml")) { + result = response.get_xml(); + } + else { + result = response.get_responseData(); + } + } catch (ex) { + } + var error = response.getResponseHeader("jsonerror"); + var errorObj = (error === "true"); + if (errorObj) { + if (result) { + result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType); + } + } + else if (contentType.startsWith("application/json")) { + if (!result || typeof(result.d) === "undefined") { + throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceInvalidJsonWrapper, methodName)); + } + result = result.d; + } + if (((statusCode < 200) || (statusCode >= 300)) || errorObj) { + if (onFailure) { + if (!result || !errorObj) { + result = new Sys.Net.WebServiceError(false , String.format(Sys.Res.webServiceFailedNoMsg, methodName), "", ""); + } + result._statusCode = statusCode; + onFailure(result, userContext, methodName); + } + else { + var error; + if (result && errorObj) { + error = result.get_exceptionType() + "-- " + result.get_message(); + } + else { + error = response.get_responseData(); + } + throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error)); + } + } + else if (onSuccess) { + onSuccess(result, userContext, methodName); + } + } + else { + var msg; + if (response.get_timedOut()) { + msg = String.format(Sys.Res.webServiceTimedOut, methodName); + } + else { + msg = String.format(Sys.Res.webServiceFailedNoMsg, methodName) + } + if (onFailure) { + onFailure(new Sys.Net.WebServiceError(response.get_timedOut(), msg, "", ""), userContext, methodName); + } + else { + throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg); + } + } + } + return request; +} +Sys.Net.WebServiceProxy._createFailedError = function Sys$Net$WebServiceProxy$_createFailedError(methodName, errorMessage) { + var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage; + var e = Error.create(displayMessage, { 'name': 'Sys.Net.WebServiceFailedException', 'methodName': methodName }); + e.popStackFrame(); + return e; +} +Sys.Net.WebServiceProxy._defaultFailedCallback = function Sys$Net$WebServiceProxy$_defaultFailedCallback(err, methodName) { + var error = err.get_exceptionType() + "-- " + err.get_message(); + throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error)); +} +Sys.Net.WebServiceProxy._generateTypedConstructor = function Sys$Net$WebServiceProxy$_generateTypedConstructor(type) { + return function(properties) { + if (properties) { + for (var name in properties) { + this[name] = properties[name]; + } + } + this.__type = type; + } +} + +Sys.Net.WebServiceError = function Sys$Net$WebServiceError(timedOut, message, stackTrace, exceptionType) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "timedOut", type: Boolean}, + {name: "message", type: String, mayBeNull: true}, + {name: "stackTrace", type: String, mayBeNull: true}, + {name: "exceptionType", type: String, mayBeNull: true} + ]); + if (e) throw e; + this._timedOut = timedOut; + this._message = message; + this._stackTrace = stackTrace; + this._exceptionType = exceptionType; + this._statusCode = -1; +} + function Sys$Net$WebServiceError$get_timedOut() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._timedOut; + } + function Sys$Net$WebServiceError$get_statusCode() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._statusCode; + } + function Sys$Net$WebServiceError$get_message() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._message; + } + function Sys$Net$WebServiceError$get_stackTrace() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._stackTrace; + } + function Sys$Net$WebServiceError$get_exceptionType() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._exceptionType; + } +Sys.Net.WebServiceError.prototype = { + get_timedOut: Sys$Net$WebServiceError$get_timedOut, + get_statusCode: Sys$Net$WebServiceError$get_statusCode, + get_message: Sys$Net$WebServiceError$get_message, + get_stackTrace: Sys$Net$WebServiceError$get_stackTrace, + get_exceptionType: Sys$Net$WebServiceError$get_exceptionType +} +Sys.Net.WebServiceError.registerClass('Sys.Net.WebServiceError'); +Type.registerNamespace('Sys.Services'); +Sys.Services._ProfileService = function Sys$Services$_ProfileService() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + Sys.Services._ProfileService.initializeBase(this); + this.properties = {}; +} +Sys.Services._ProfileService.DefaultWebServicePath = ''; + function Sys$Services$_ProfileService$get_defaultLoadCompletedCallback() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._defaultLoadCompletedCallback; + } + function Sys$Services$_ProfileService$set_defaultLoadCompletedCallback(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); + if (e) throw e; + this._defaultLoadCompletedCallback = value; + } + function Sys$Services$_ProfileService$get_defaultSaveCompletedCallback() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._defaultSaveCompletedCallback; + } + function Sys$Services$_ProfileService$set_defaultSaveCompletedCallback(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); + if (e) throw e; + this._defaultSaveCompletedCallback = value; + } + function Sys$Services$_ProfileService$get_path() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._path || ''; + } + function Sys$Services$_ProfileService$load(propertyNames, loadCompletedCallback, failedCallback, userContext) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "propertyNames", type: Array, mayBeNull: true, optional: true, elementType: String}, + {name: "loadCompletedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "failedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "userContext", mayBeNull: true, optional: true} + ]); + if (e) throw e; + var parameters; + var methodName; + if (!propertyNames) { + methodName = "GetAllPropertiesForCurrentUser"; + parameters = { authenticatedUserOnly: false }; + } + else { + methodName = "GetPropertiesForCurrentUser"; + parameters = { properties: this._clonePropertyNames(propertyNames), authenticatedUserOnly: false }; + } + this._invoke(this._get_path(), + methodName, + false, + parameters, + Function.createDelegate(this, this._onLoadComplete), + Function.createDelegate(this, this._onLoadFailed), + [loadCompletedCallback, failedCallback, userContext]); + } + function Sys$Services$_ProfileService$save(propertyNames, saveCompletedCallback, failedCallback, userContext) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "propertyNames", type: Array, mayBeNull: true, optional: true, elementType: String}, + {name: "saveCompletedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "failedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "userContext", mayBeNull: true, optional: true} + ]); + if (e) throw e; + var flattenedProperties = this._flattenProperties(propertyNames, this.properties); + this._invoke(this._get_path(), + "SetPropertiesForCurrentUser", + false, + { values: flattenedProperties.value, authenticatedUserOnly: false }, + Function.createDelegate(this, this._onSaveComplete), + Function.createDelegate(this, this._onSaveFailed), + [saveCompletedCallback, failedCallback, userContext, flattenedProperties.count]); + } + function Sys$Services$_ProfileService$_clonePropertyNames(arr) { + var nodups = []; + var seen = {}; + for (var i=0; i < arr.length; i++) { + var prop = arr[i]; + if(!seen[prop]) { Array.add(nodups, prop); seen[prop]=true; }; + } + return nodups; + } + function Sys$Services$_ProfileService$_flattenProperties(propertyNames, properties, groupName) { + var flattenedProperties = {}; + var val; + var key; + var count = 0; + if (propertyNames && propertyNames.length === 0) { + return { value: flattenedProperties, count: 0 }; + } + for (var property in properties) { + val = properties[property]; + key = groupName ? groupName + "." + property : property; + if(Sys.Services.ProfileGroup.isInstanceOfType(val)) { + var obj = this._flattenProperties(propertyNames, val, key); + var groupProperties = obj.value; + count += obj.count; + for(var subKey in groupProperties) { + var subVal = groupProperties[subKey]; + flattenedProperties[subKey] = subVal; + } + } + else { + if(!propertyNames || Array.indexOf(propertyNames, key) !== -1) { + flattenedProperties[key] = val; + count++; + } + } + } + return { value: flattenedProperties, count: count }; + } + function Sys$Services$_ProfileService$_get_path() { + var path = this.get_path(); + if (!path.length) { + path = Sys.Services._ProfileService.DefaultWebServicePath; + } + if (!path || !path.length) { + throw Error.invalidOperation(Sys.Res.servicePathNotSet); + } + return path; + } + function Sys$Services$_ProfileService$_onLoadComplete(result, context, methodName) { + if (typeof(result) !== "object") { + throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType, methodName, "Object")); + } + var unflattened = this._unflattenProperties(result); + for (var name in unflattened) { + this.properties[name] = unflattened[name]; + } + + var callback = context[0] || this.get_defaultLoadCompletedCallback() || this.get_defaultSucceededCallback(); + if (callback) { + var userContext = context[2] || this.get_defaultUserContext(); + callback(result.length, userContext, "Sys.Services.ProfileService.load"); + } + } + function Sys$Services$_ProfileService$_onLoadFailed(err, context, methodName) { + var callback = context[1] || this.get_defaultFailedCallback(); + if (callback) { + var userContext = context[2] || this.get_defaultUserContext(); + callback(err, userContext, "Sys.Services.ProfileService.load"); + } + else { + Sys.Net.WebServiceProxy._defaultFailedCallback(err, methodName); + } + } + function Sys$Services$_ProfileService$_onSaveComplete(result, context, methodName) { + var count = context[3]; + if (result !== null) { + if (result instanceof Array) { + count -= result.length; + } + else if (typeof(result) === 'number') { + count = result; + } + else { + throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType, methodName, "Array")); + } + } + + var callback = context[0] || this.get_defaultSaveCompletedCallback() || this.get_defaultSucceededCallback(); + if (callback) { + var userContext = context[2] || this.get_defaultUserContext(); + callback(count, userContext, "Sys.Services.ProfileService.save"); + } + } + function Sys$Services$_ProfileService$_onSaveFailed(err, context, methodName) { + var callback = context[1] || this.get_defaultFailedCallback(); + if (callback) { + var userContext = context[2] || this.get_defaultUserContext(); + callback(err, userContext, "Sys.Services.ProfileService.save"); + } + else { + Sys.Net.WebServiceProxy._defaultFailedCallback(err, methodName); + } + } + function Sys$Services$_ProfileService$_unflattenProperties(properties) { + var unflattenedProperties = {}; + var dotIndex; + var val; + var count = 0; + for (var key in properties) { + count++; + val = properties[key]; + dotIndex = key.indexOf('.'); + if (dotIndex !== -1) { + var groupName = key.substr(0, dotIndex); + key = key.substr(dotIndex+1); + var group = unflattenedProperties[groupName]; + if (!group || !Sys.Services.ProfileGroup.isInstanceOfType(group)) { + group = new Sys.Services.ProfileGroup(); + unflattenedProperties[groupName] = group; + } + group[key] = val; + } + else { + unflattenedProperties[key] = val; + } + } + properties.length = count; + return unflattenedProperties; + } +Sys.Services._ProfileService.prototype = { + _defaultLoadCompletedCallback: null, + _defaultSaveCompletedCallback: null, + _path: '', + _timeout: 0, + get_defaultLoadCompletedCallback: Sys$Services$_ProfileService$get_defaultLoadCompletedCallback, + set_defaultLoadCompletedCallback: Sys$Services$_ProfileService$set_defaultLoadCompletedCallback, + get_defaultSaveCompletedCallback: Sys$Services$_ProfileService$get_defaultSaveCompletedCallback, + set_defaultSaveCompletedCallback: Sys$Services$_ProfileService$set_defaultSaveCompletedCallback, + get_path: Sys$Services$_ProfileService$get_path, + load: Sys$Services$_ProfileService$load, + save: Sys$Services$_ProfileService$save, + _clonePropertyNames: Sys$Services$_ProfileService$_clonePropertyNames, + _flattenProperties: Sys$Services$_ProfileService$_flattenProperties, + _get_path: Sys$Services$_ProfileService$_get_path, + _onLoadComplete: Sys$Services$_ProfileService$_onLoadComplete, + _onLoadFailed: Sys$Services$_ProfileService$_onLoadFailed, + _onSaveComplete: Sys$Services$_ProfileService$_onSaveComplete, + _onSaveFailed: Sys$Services$_ProfileService$_onSaveFailed, + _unflattenProperties: Sys$Services$_ProfileService$_unflattenProperties +} +Sys.Services._ProfileService.registerClass('Sys.Services._ProfileService', Sys.Net.WebServiceProxy); +Sys.Services.ProfileService = new Sys.Services._ProfileService(); +Sys.Services.ProfileGroup = function Sys$Services$ProfileGroup(properties) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "properties", mayBeNull: true, optional: true} + ]); + if (e) throw e; + if (properties) { + for (var property in properties) { + this[property] = properties[property]; + } + } +} +Sys.Services.ProfileGroup.registerClass('Sys.Services.ProfileGroup'); +Sys.Services._AuthenticationService = function Sys$Services$_AuthenticationService() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + Sys.Services._AuthenticationService.initializeBase(this); +} +Sys.Services._AuthenticationService.DefaultWebServicePath = ''; + function Sys$Services$_AuthenticationService$get_defaultLoginCompletedCallback() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._defaultLoginCompletedCallback; + } + function Sys$Services$_AuthenticationService$set_defaultLoginCompletedCallback(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); + if (e) throw e; + this._defaultLoginCompletedCallback = value; + } + function Sys$Services$_AuthenticationService$get_defaultLogoutCompletedCallback() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._defaultLogoutCompletedCallback; + } + function Sys$Services$_AuthenticationService$set_defaultLogoutCompletedCallback(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); + if (e) throw e; + this._defaultLogoutCompletedCallback = value; + } + function Sys$Services$_AuthenticationService$get_isLoggedIn() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._authenticated; + } + function Sys$Services$_AuthenticationService$get_path() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._path || ''; + } + function Sys$Services$_AuthenticationService$login(username, password, isPersistent, customInfo, redirectUrl, loginCompletedCallback, failedCallback, userContext) { + /// + /// + /// + /// + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "username", type: String}, + {name: "password", type: String, mayBeNull: true}, + {name: "isPersistent", type: Boolean, mayBeNull: true, optional: true}, + {name: "customInfo", type: String, mayBeNull: true, optional: true}, + {name: "redirectUrl", type: String, mayBeNull: true, optional: true}, + {name: "loginCompletedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "failedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "userContext", mayBeNull: true, optional: true} + ]); + if (e) throw e; + this._invoke(this._get_path(), "Login", false, + { userName: username, password: password, createPersistentCookie: isPersistent }, + Function.createDelegate(this, this._onLoginComplete), + Function.createDelegate(this, this._onLoginFailed), + [username, password, isPersistent, customInfo, redirectUrl, loginCompletedCallback, failedCallback, userContext]); + } + function Sys$Services$_AuthenticationService$logout(redirectUrl, logoutCompletedCallback, failedCallback, userContext) { + /// + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "redirectUrl", type: String, mayBeNull: true, optional: true}, + {name: "logoutCompletedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "failedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "userContext", mayBeNull: true, optional: true} + ]); + if (e) throw e; + this._invoke(this._get_path(), "Logout", false, {}, + Function.createDelegate(this, this._onLogoutComplete), + Function.createDelegate(this, this._onLogoutFailed), + [redirectUrl, logoutCompletedCallback, failedCallback, userContext]); + } + function Sys$Services$_AuthenticationService$_get_path() { + var path = this.get_path(); + if(!path.length) { + path = Sys.Services._AuthenticationService.DefaultWebServicePath; + } + if(!path || !path.length) { + throw Error.invalidOperation(Sys.Res.servicePathNotSet); + } + return path; + } + function Sys$Services$_AuthenticationService$_onLoginComplete(result, context, methodName) { + if(typeof(result) !== "boolean") { + throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType, methodName, "Boolean")); + } + + var redirectUrl = context[4]; + var userContext = context[7] || this.get_defaultUserContext(); + var callback = context[5] || this.get_defaultLoginCompletedCallback() || this.get_defaultSucceededCallback(); + + if(result) { + this._authenticated = true; + if (callback) { + callback(true, userContext, "Sys.Services.AuthenticationService.login"); + } + + if (typeof(redirectUrl) !== "undefined" && redirectUrl !== null) { + window.location.href = redirectUrl; + } + } + else if (callback) { + callback(false, userContext, "Sys.Services.AuthenticationService.login"); + } + } + function Sys$Services$_AuthenticationService$_onLoginFailed(err, context, methodName) { + var callback = context[6] || this.get_defaultFailedCallback(); + if (callback) { + var userContext = context[7] || this.get_defaultUserContext(); + callback(err, userContext, "Sys.Services.AuthenticationService.login"); + } + else { + Sys.Net.WebServiceProxy._defaultFailedCallback(err, methodName); + } + } + function Sys$Services$_AuthenticationService$_onLogoutComplete(result, context, methodName) { + if(result !== null) { + throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType, methodName, "null")); + } + + var redirectUrl = context[0]; + var userContext = context[3] || this.get_defaultUserContext(); + var callback = context[1] || this.get_defaultLogoutCompletedCallback() || this.get_defaultSucceededCallback(); + this._authenticated = false; + + if (callback) { + callback(null, userContext, "Sys.Services.AuthenticationService.logout"); + } + + if(!redirectUrl) { + window.location.reload(); + } + else { + window.location.href = redirectUrl; + } + } + function Sys$Services$_AuthenticationService$_onLogoutFailed(err, context, methodName) { + var callback = context[2] || this.get_defaultFailedCallback(); + if (callback) { + callback(err, context[3], "Sys.Services.AuthenticationService.logout"); + } + else { + Sys.Net.WebServiceProxy._defaultFailedCallback(err, methodName); + } + } + function Sys$Services$_AuthenticationService$_setAuthenticated(authenticated) { + this._authenticated = authenticated; + } +Sys.Services._AuthenticationService.prototype = { + _defaultLoginCompletedCallback: null, + _defaultLogoutCompletedCallback: null, + _path: '', + _timeout: 0, + _authenticated: false, + get_defaultLoginCompletedCallback: Sys$Services$_AuthenticationService$get_defaultLoginCompletedCallback, + set_defaultLoginCompletedCallback: Sys$Services$_AuthenticationService$set_defaultLoginCompletedCallback, + get_defaultLogoutCompletedCallback: Sys$Services$_AuthenticationService$get_defaultLogoutCompletedCallback, + set_defaultLogoutCompletedCallback: Sys$Services$_AuthenticationService$set_defaultLogoutCompletedCallback, + get_isLoggedIn: Sys$Services$_AuthenticationService$get_isLoggedIn, + get_path: Sys$Services$_AuthenticationService$get_path, + login: Sys$Services$_AuthenticationService$login, + logout: Sys$Services$_AuthenticationService$logout, + _get_path: Sys$Services$_AuthenticationService$_get_path, + _onLoginComplete: Sys$Services$_AuthenticationService$_onLoginComplete, + _onLoginFailed: Sys$Services$_AuthenticationService$_onLoginFailed, + _onLogoutComplete: Sys$Services$_AuthenticationService$_onLogoutComplete, + _onLogoutFailed: Sys$Services$_AuthenticationService$_onLogoutFailed, + _setAuthenticated: Sys$Services$_AuthenticationService$_setAuthenticated +} +Sys.Services._AuthenticationService.registerClass('Sys.Services._AuthenticationService', Sys.Net.WebServiceProxy); +Sys.Services.AuthenticationService = new Sys.Services._AuthenticationService(); +Sys.Services._RoleService = function Sys$Services$_RoleService() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + Sys.Services._RoleService.initializeBase(this); + this._roles = []; +} +Sys.Services._RoleService.DefaultWebServicePath = ''; + function Sys$Services$_RoleService$get_defaultLoadCompletedCallback() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._defaultLoadCompletedCallback; + } + function Sys$Services$_RoleService$set_defaultLoadCompletedCallback(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); + if (e) throw e; + this._defaultLoadCompletedCallback = value; + } + function Sys$Services$_RoleService$get_path() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._path || ''; + } + function Sys$Services$_RoleService$get_roles() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return Array.clone(this._roles); + } + function Sys$Services$_RoleService$isUserInRole(role) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "role", type: String} + ]); + if (e) throw e; + var v = this._get_rolesIndex()[role.trim().toLowerCase()]; + return !!v; + } + function Sys$Services$_RoleService$load(loadCompletedCallback, failedCallback, userContext) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "loadCompletedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "failedCallback", type: Function, mayBeNull: true, optional: true}, + {name: "userContext", mayBeNull: true, optional: true} + ]); + if (e) throw e; + Sys.Net.WebServiceProxy.invoke( + this._get_path(), + "GetRolesForCurrentUser", + false, + {} , + Function.createDelegate(this, this._onLoadComplete), + Function.createDelegate(this, this._onLoadFailed), + [loadCompletedCallback, failedCallback, userContext], + this.get_timeout()); + } + function Sys$Services$_RoleService$_get_path() { + var path = this.get_path(); + if(!path || !path.length) { + path = Sys.Services._RoleService.DefaultWebServicePath; + } + if(!path || !path.length) { + throw Error.invalidOperation(Sys.Res.servicePathNotSet); + } + return path; + } + function Sys$Services$_RoleService$_get_rolesIndex() { + if (!this._rolesIndex) { + var index = {}; + for(var i=0; i < this._roles.length; i++) { + index[this._roles[i].toLowerCase()] = true; + } + this._rolesIndex = index; + } + return this._rolesIndex; + } + function Sys$Services$_RoleService$_onLoadComplete(result, context, methodName) { + if(result && !(result instanceof Array)) { + throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType, methodName, "Array")); + } + this._roles = result; + this._rolesIndex = null; + var callback = context[0] || this.get_defaultLoadCompletedCallback() || this.get_defaultSucceededCallback(); + if (callback) { + var userContext = context[2] || this.get_defaultUserContext(); + var clonedResult = Array.clone(result); + callback(clonedResult, userContext, "Sys.Services.RoleService.load"); + } + } + function Sys$Services$_RoleService$_onLoadFailed(err, context, methodName) { + var callback = context[1] || this.get_defaultFailedCallback(); + if (callback) { + var userContext = context[2] || this.get_defaultUserContext(); + callback(err, userContext, "Sys.Services.RoleService.load"); + } + else { + Sys.Net.WebServiceProxy._defaultFailedCallback(err, methodName); + } + } +Sys.Services._RoleService.prototype = { + _defaultLoadCompletedCallback: null, + _rolesIndex: null, + _timeout: 0, + _path: '', + get_defaultLoadCompletedCallback: Sys$Services$_RoleService$get_defaultLoadCompletedCallback, + set_defaultLoadCompletedCallback: Sys$Services$_RoleService$set_defaultLoadCompletedCallback, + get_path: Sys$Services$_RoleService$get_path, + get_roles: Sys$Services$_RoleService$get_roles, + isUserInRole: Sys$Services$_RoleService$isUserInRole, + load: Sys$Services$_RoleService$load, + _get_path: Sys$Services$_RoleService$_get_path, + _get_rolesIndex: Sys$Services$_RoleService$_get_rolesIndex, + _onLoadComplete: Sys$Services$_RoleService$_onLoadComplete, + _onLoadFailed: Sys$Services$_RoleService$_onLoadFailed +} +Sys.Services._RoleService.registerClass('Sys.Services._RoleService', Sys.Net.WebServiceProxy); +Sys.Services.RoleService = new Sys.Services._RoleService(); +Type.registerNamespace('Sys.Serialization'); +Sys.Serialization.JavaScriptSerializer = function Sys$Serialization$JavaScriptSerializer() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); +} +Sys.Serialization.JavaScriptSerializer.registerClass('Sys.Serialization.JavaScriptSerializer'); +Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs = []; +Sys.Serialization.JavaScriptSerializer._charsToEscape = []; +Sys.Serialization.JavaScriptSerializer._dateRegEx = new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', 'g'); +Sys.Serialization.JavaScriptSerializer._escapeChars = {}; +Sys.Serialization.JavaScriptSerializer._escapeRegEx = new RegExp('["\\\\\\x00-\\x1F]', 'i'); +Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal = new RegExp('["\\\\\\x00-\\x1F]', 'g'); +Sys.Serialization.JavaScriptSerializer._jsonRegEx = new RegExp('[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]', 'g'); +Sys.Serialization.JavaScriptSerializer._jsonStringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', 'g'); +Sys.Serialization.JavaScriptSerializer._serverTypeFieldName = '__type'; +Sys.Serialization.JavaScriptSerializer._init = function Sys$Serialization$JavaScriptSerializer$_init() { + var replaceChars = ['\\u0000','\\u0001','\\u0002','\\u0003','\\u0004','\\u0005','\\u0006','\\u0007', + '\\b','\\t','\\n','\\u000b','\\f','\\r','\\u000e','\\u000f','\\u0010','\\u0011', + '\\u0012','\\u0013','\\u0014','\\u0015','\\u0016','\\u0017','\\u0018','\\u0019', + '\\u001a','\\u001b','\\u001c','\\u001d','\\u001e','\\u001f']; + Sys.Serialization.JavaScriptSerializer._charsToEscape[0] = '\\'; + Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['\\'] = new RegExp('\\\\', 'g'); + Sys.Serialization.JavaScriptSerializer._escapeChars['\\'] = '\\\\'; + Sys.Serialization.JavaScriptSerializer._charsToEscape[1] = '"'; + Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"'] = new RegExp('"', 'g'); + Sys.Serialization.JavaScriptSerializer._escapeChars['"'] = '\\"'; + for (var i = 0; i < 32; i++) { + var c = String.fromCharCode(i); + Sys.Serialization.JavaScriptSerializer._charsToEscape[i+2] = c; + Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c] = new RegExp(c, 'g'); + Sys.Serialization.JavaScriptSerializer._escapeChars[c] = replaceChars[i]; + } +} +Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeBooleanWithBuilder(object, stringBuilder) { + stringBuilder.append(object.toString()); +} +Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeNumberWithBuilder(object, stringBuilder) { + if (isFinite(object)) { + stringBuilder.append(String(object)); + } + else { + throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers); + } +} +Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeStringWithBuilder(string, stringBuilder) { + stringBuilder.append('"'); + if (Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(string)) { + if (Sys.Serialization.JavaScriptSerializer._charsToEscape.length === 0) { + Sys.Serialization.JavaScriptSerializer._init(); + } + if (string.length < 128) { + string = string.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal, + function(x) { return Sys.Serialization.JavaScriptSerializer._escapeChars[x]; }); + } + else { + for (var i = 0; i < 34; i++) { + var c = Sys.Serialization.JavaScriptSerializer._charsToEscape[i]; + if (string.indexOf(c) !== -1) { + if (Sys.Browser.agent === Sys.Browser.Opera || Sys.Browser.agent === Sys.Browser.FireFox) { + string = string.split(c).join(Sys.Serialization.JavaScriptSerializer._escapeChars[c]); + } + else { + string = string.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c], + Sys.Serialization.JavaScriptSerializer._escapeChars[c]); + } + } + } + } + } + stringBuilder.append(string); + stringBuilder.append('"'); +} +Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeWithBuilder(object, stringBuilder, sort, prevObjects) { + var i; + switch (typeof object) { + case 'object': + if (object) { + if (prevObjects){ + for( var j = 0; j < prevObjects.length; j++) { + if (prevObjects[j] === object) { + throw Error.invalidOperation(Sys.Res.cannotSerializeObjectWithCycle); + } + } + } + else { + prevObjects = new Array(); + } + try { + Array.add(prevObjects, object); + + if (Number.isInstanceOfType(object)){ + Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder); + } + else if (Boolean.isInstanceOfType(object)){ + Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder); + } + else if (String.isInstanceOfType(object)){ + Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder); + } + + else if (Array.isInstanceOfType(object)) { + stringBuilder.append('['); + + for (i = 0; i < object.length; ++i) { + if (i > 0) { + stringBuilder.append(','); + } + Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object[i], stringBuilder,false,prevObjects); + } + stringBuilder.append(']'); + } + else { + if (Date.isInstanceOfType(object)) { + stringBuilder.append('"\\/Date('); + stringBuilder.append(object.getTime()); + stringBuilder.append(')\\/"'); + break; + } + var properties = []; + var propertyCount = 0; + for (var name in object) { + if (name.startsWith('$')) { + continue; + } + if (name === Sys.Serialization.JavaScriptSerializer._serverTypeFieldName && propertyCount !== 0){ + properties[propertyCount++] = properties[0]; + properties[0] = name; + } + else{ + properties[propertyCount++] = name; + } + } + if (sort) properties.sort(); + stringBuilder.append('{'); + var needComma = false; + + for (i=0; i + /// + /// + var e = Function._validateParams(arguments, [ + {name: "object", mayBeNull: true} + ]); + if (e) throw e; + var stringBuilder = new Sys.StringBuilder(); + Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object, stringBuilder, false); + return stringBuilder.toString(); +} +Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data, secure) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "data", type: String}, + {name: "secure", type: Boolean, optional: true} + ]); + if (e) throw e; + + if (data.length === 0) throw Error.argument('data', Sys.Res.cannotDeserializeEmptyString); + try { + var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, "$1new Date($2)"); + + if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test( + exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ''))) throw null; + return eval('(' + exp + ')'); + } + catch (e) { + throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson); + } +} + +Sys.CultureInfo = function Sys$CultureInfo(name, numberFormat, dateTimeFormat) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "name", type: String}, + {name: "numberFormat", type: Object}, + {name: "dateTimeFormat", type: Object} + ]); + if (e) throw e; + this.name = name; + this.numberFormat = numberFormat; + this.dateTimeFormat = dateTimeFormat; +} + function Sys$CultureInfo$_getDateTimeFormats() { + if (! this._dateTimeFormats) { + var dtf = this.dateTimeFormat; + this._dateTimeFormats = + [ dtf.MonthDayPattern, + dtf.YearMonthPattern, + dtf.ShortDatePattern, + dtf.ShortTimePattern, + dtf.LongDatePattern, + dtf.LongTimePattern, + dtf.FullDateTimePattern, + dtf.RFC1123Pattern, + dtf.SortableDateTimePattern, + dtf.UniversalSortableDateTimePattern ]; + } + return this._dateTimeFormats; + } + function Sys$CultureInfo$_getMonthIndex(value) { + if (!this._upperMonths) { + this._upperMonths = this._toUpperArray(this.dateTimeFormat.MonthNames); + } + return Array.indexOf(this._upperMonths, this._toUpper(value)); + } + function Sys$CultureInfo$_getAbbrMonthIndex(value) { + if (!this._upperAbbrMonths) { + this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames); + } + return Array.indexOf(this._upperAbbrMonths, this._toUpper(value)); + } + function Sys$CultureInfo$_getDayIndex(value) { + if (!this._upperDays) { + this._upperDays = this._toUpperArray(this.dateTimeFormat.DayNames); + } + return Array.indexOf(this._upperDays, this._toUpper(value)); + } + function Sys$CultureInfo$_getAbbrDayIndex(value) { + if (!this._upperAbbrDays) { + this._upperAbbrDays = this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames); + } + return Array.indexOf(this._upperAbbrDays, this._toUpper(value)); + } + function Sys$CultureInfo$_toUpperArray(arr) { + var result = []; + for (var i = 0, il = arr.length; i < il; i++) { + result[i] = this._toUpper(arr[i]); + } + return result; + } + function Sys$CultureInfo$_toUpper(value) { + return value.split("\u00A0").join(' ').toUpperCase(); + } +Sys.CultureInfo.prototype = { + _getDateTimeFormats: Sys$CultureInfo$_getDateTimeFormats, + _getMonthIndex: Sys$CultureInfo$_getMonthIndex, + _getAbbrMonthIndex: Sys$CultureInfo$_getAbbrMonthIndex, + _getDayIndex: Sys$CultureInfo$_getDayIndex, + _getAbbrDayIndex: Sys$CultureInfo$_getAbbrDayIndex, + _toUpperArray: Sys$CultureInfo$_toUpperArray, + _toUpper: Sys$CultureInfo$_toUpper +} +Sys.CultureInfo._parse = function Sys$CultureInfo$_parse(value) { + var cultureInfo = Sys.Serialization.JavaScriptSerializer.deserialize(value); + return new Sys.CultureInfo(cultureInfo.name, cultureInfo.numberFormat, cultureInfo.dateTimeFormat); +} +Sys.CultureInfo.registerClass('Sys.CultureInfo'); +Sys.CultureInfo.InvariantCulture = Sys.CultureInfo._parse('{"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00A4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]}}'); +if (typeof(__cultureInfo) === 'undefined') { + var __cultureInfo = '{"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]}}'; +} +Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo); +delete __cultureInfo; + +Sys.UI.Behavior = function Sys$UI$Behavior(element) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + Sys.UI.Behavior.initializeBase(this); + this._element = element; + var behaviors = element._behaviors; + if (!behaviors) { + element._behaviors = [this]; + } + else { + behaviors[behaviors.length] = this; + } +} + function Sys$UI$Behavior$get_element() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._element; + } + function Sys$UI$Behavior$get_id() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id'); + if (baseId) return baseId; + if (!this._element || !this._element.id) return ''; + return this._element.id + '$' + this.get_name(); + } + function Sys$UI$Behavior$get_name() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this._name) return this._name; + var name = Object.getTypeName(this); + var i = name.lastIndexOf('.'); + if (i != -1) name = name.substr(i + 1); + if (!this.get_isInitialized()) this._name = name; + return name; + } + function Sys$UI$Behavior$set_name(value) { + var e = Function._validateParams(arguments, [{name: "value", type: String}]); + if (e) throw e; + if ((value === '') || (value.charAt(0) === ' ') || (value.charAt(value.length - 1) === ' ')) + throw Error.argument('value', Sys.Res.invalidId); + if (typeof(this._element[value]) !== 'undefined') + throw Error.invalidOperation(String.format(Sys.Res.behaviorDuplicateName, value)); + if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Res.cantSetNameAfterInit); + this._name = value; + } + function Sys$UI$Behavior$initialize() { + Sys.UI.Behavior.callBaseMethod(this, 'initialize'); + var name = this.get_name(); + if (name) this._element[name] = this; + } + function Sys$UI$Behavior$dispose() { + Sys.UI.Behavior.callBaseMethod(this, 'dispose'); + if (this._element) { + var name = this.get_name(); + if (name) { + this._element[name] = null; + } + Array.remove(this._element._behaviors, this); + delete this._element; + } + } +Sys.UI.Behavior.prototype = { + _name: null, + get_element: Sys$UI$Behavior$get_element, + get_id: Sys$UI$Behavior$get_id, + get_name: Sys$UI$Behavior$get_name, + set_name: Sys$UI$Behavior$set_name, + initialize: Sys$UI$Behavior$initialize, + dispose: Sys$UI$Behavior$dispose +} +Sys.UI.Behavior.registerClass('Sys.UI.Behavior', Sys.Component); +Sys.UI.Behavior.getBehaviorByName = function Sys$UI$Behavior$getBehaviorByName(element, name) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "name", type: String} + ]); + if (e) throw e; + var b = element[name]; + return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null; +} +Sys.UI.Behavior.getBehaviors = function Sys$UI$Behavior$getBehaviors(element) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + if (!element._behaviors) return []; + return Array.clone(element._behaviors); +} +Sys.UI.Behavior.getBehaviorsByType = function Sys$UI$Behavior$getBehaviorsByType(element, type) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true}, + {name: "type", type: Type} + ]); + if (e) throw e; + var behaviors = element._behaviors; + var results = []; + if (behaviors) { + for (var i = 0, l = behaviors.length; i < l; i++) { + if (type.isInstanceOfType(behaviors[i])) { + results[results.length] = behaviors[i]; + } + } + } + return results; +} + +Sys.UI.VisibilityMode = function Sys$UI$VisibilityMode() { + /// + /// + /// + if (arguments.length !== 0) throw Error.parameterCount(); + throw Error.notImplemented(); +} +Sys.UI.VisibilityMode.prototype = { + hide: 0, + collapse: 1 +} +Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode"); + +Sys.UI.Control = function Sys$UI$Control(element) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "element", domElement: true} + ]); + if (e) throw e; + if (typeof(element.control) != 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined); + Sys.UI.Control.initializeBase(this); + this._element = element; + element.control = this; +} + function Sys$UI$Control$get_element() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + return this._element; + } + function Sys$UI$Control$get_id() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._element) return ''; + return this._element.id; + } + function Sys$UI$Control$set_id(value) { + var e = Function._validateParams(arguments, [{name: "value", type: String}]); + if (e) throw e; + throw Error.invalidOperation(Sys.Res.cantSetId); + } + function Sys$UI$Control$get_parent() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (this._parent) return this._parent; + if (!this._element) return null; + + var parentElement = this._element.parentNode; + while (parentElement) { + if (parentElement.control) { + return parentElement.control; + } + parentElement = parentElement.parentNode; + } + return null; + } + function Sys$UI$Control$set_parent(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Control}]); + if (e) throw e; + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + var parents = [this]; + var current = value; + while (current) { + if (Array.contains(parents, current)) throw Error.invalidOperation(Sys.Res.circularParentChain); + parents[parents.length] = current; + current = current.get_parent(); + } + this._parent = value; + } + function Sys$UI$Control$get_visibilityMode() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + return Sys.UI.DomElement.getVisibilityMode(this._element); + } + function Sys$UI$Control$set_visibilityMode(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.VisibilityMode}]); + if (e) throw e; + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + Sys.UI.DomElement.setVisibilityMode(this._element, value); + } + function Sys$UI$Control$get_visible() { + /// + if (arguments.length !== 0) throw Error.parameterCount(); + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + return Sys.UI.DomElement.getVisible(this._element); + } + function Sys$UI$Control$set_visible(value) { + var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); + if (e) throw e; + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + Sys.UI.DomElement.setVisible(this._element, value) + } + function Sys$UI$Control$addCssClass(className) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "className", type: String} + ]); + if (e) throw e; + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + Sys.UI.DomElement.addCssClass(this._element, className); + } + function Sys$UI$Control$dispose() { + Sys.UI.Control.callBaseMethod(this, 'dispose'); + if (this._element) { + this._element.control = undefined; + delete this._element; + } + if (this._parent) delete this._parent; + } + function Sys$UI$Control$onBubbleEvent(source, args) { + /// + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "source"}, + {name: "args", type: Sys.EventArgs} + ]); + if (e) throw e; + return false; + } + function Sys$UI$Control$raiseBubbleEvent(source, args) { + /// + /// + /// + var e = Function._validateParams(arguments, [ + {name: "source"}, + {name: "args", type: Sys.EventArgs} + ]); + if (e) throw e; + var currentTarget = this.get_parent(); + while (currentTarget) { + if (currentTarget.onBubbleEvent(source, args)) { + return; + } + currentTarget = currentTarget.get_parent(); + } + } + function Sys$UI$Control$removeCssClass(className) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "className", type: String} + ]); + if (e) throw e; + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + Sys.UI.DomElement.removeCssClass(this._element, className); + } + function Sys$UI$Control$toggleCssClass(className) { + /// + /// + var e = Function._validateParams(arguments, [ + {name: "className", type: String} + ]); + if (e) throw e; + if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); + Sys.UI.DomElement.toggleCssClass(this._element, className); + } +Sys.UI.Control.prototype = { + _parent: null, + _visibilityMode: Sys.UI.VisibilityMode.hide, + get_element: Sys$UI$Control$get_element, + get_id: Sys$UI$Control$get_id, + set_id: Sys$UI$Control$set_id, + get_parent: Sys$UI$Control$get_parent, + set_parent: Sys$UI$Control$set_parent, + get_visibilityMode: Sys$UI$Control$get_visibilityMode, + set_visibilityMode: Sys$UI$Control$set_visibilityMode, + get_visible: Sys$UI$Control$get_visible, + set_visible: Sys$UI$Control$set_visible, + addCssClass: Sys$UI$Control$addCssClass, + dispose: Sys$UI$Control$dispose, + onBubbleEvent: Sys$UI$Control$onBubbleEvent, + raiseBubbleEvent: Sys$UI$Control$raiseBubbleEvent, + removeCssClass: Sys$UI$Control$removeCssClass, + toggleCssClass: Sys$UI$Control$toggleCssClass +} +Sys.UI.Control.registerClass('Sys.UI.Control', Sys.Component); + + +Type.registerNamespace('Sys'); + +Sys.Res={ +'urlMustBeLessThan1024chars':'The history state must be small enough to not make the url larger than 1024 characters.', +'argumentTypeName':'Value is not the name of an existing type.', +'methodRegisteredTwice':'Method {0} has already been registered.', +'cantSetIdAfterInit':'The id property can\'t be set on this object after initialization.', +'cantBeCalledAfterDispose':'Can\'t be called after dispose.', +'componentCantSetIdAfterAddedToApp':'The id property of a component can\'t be set after it\'s been added to the Application object.', +'behaviorDuplicateName':'A behavior with name \'{0}\' already exists or it is the name of an existing property on the target element.', +'notATypeName':'Value is not a valid type name.', +'typeShouldBeTypeOrString':'Value is not a valid type or a valid type name.', +'historyInvalidHistorySettingCombination':'Cannot set enableHistory to false when ScriptManager.EnableHistory is true.', +'stateMustBeStringDictionary':'The state object can only have null and string fields.', +'boolTrueOrFalse':'Value must be \'true\' or \'false\'.', +'scriptLoadFailedNoHead':'ScriptLoader requires pages to contain a element.', +'stringFormatInvalid':'The format string is invalid.', +'referenceNotFound':'Component \'{0}\' was not found.', +'enumReservedName':'\'{0}\' is a reserved name that can\'t be used as an enum value name.', +'eventHandlerNotFound':'Handler not found.', +'circularParentChain':'The chain of control parents can\'t have circular references.', +'undefinedEvent':'\'{0}\' is not an event.', +'notAMethod':'{0} is not a method.', +'propertyUndefined':'\'{0}\' is not a property or an existing field.', +'historyCannotEnableHistory':'Cannot set enableHistory after initialization.', +'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.', +'scriptLoadFailedDebug':'The script \'{0}\' failed to load. Check for:\r\n Inaccessible path.\r\n Script errors. (IE) Enable \'Display a notification about every script error\' under advanced settings.\r\n Missing call to Sys.Application.notifyScriptLoaded().', +'propertyNotWritable':'\'{0}\' is not a writable property.', +'enumInvalidValueName':'\'{0}\' is not a valid name for an enum value.', +'controlAlreadyDefined':'A control is already associated with the element.', +'addHandlerCantBeUsedForError':'Can\'t add a handler for the error event using this method. Please set the window.onerror property instead.', +'namespaceContainsObject':'Object {0} already exists and is not a namespace.', +'cantAddNonFunctionhandler':'Can\'t add a handler that is not a function.', +'invalidNameSpace':'Value is not a valid namespace identifier.', +'notAnInterface':'Value is not a valid interface.', +'eventHandlerNotFunction':'Handler must be a function.', +'propertyNotAnArray':'\'{0}\' is not an Array property.', +'typeRegisteredTwice':'Type {0} has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.', +'cantSetNameAfterInit':'The name property can\'t be set on this object after initialization.', +'historyMissingFrame':'For the history feature to work in IE, the page must have an iFrame element with id \'__historyFrame\' pointed to a page that gets its title from the \'title\' query string parameter and calls Sys.Application._onIFrameLoad() on the parent window. This can be done by setting EnableHistory to true on ScriptManager.', +'appDuplicateComponent':'Two components with the same id \'{0}\' can\'t be added to the application.', +'historyCannotAddHistoryPointWithHistoryDisabled':'A history point can only be added if enableHistory is set to true.', +'appComponentMustBeInitialized':'Components must be initialized before they are added to the Application object.', +'baseNotAClass':'Value is not a class.', +'methodNotFound':'No method found with name \'{0}\'.', +'arrayParseBadFormat':'Value must be a valid string representation for an array. It must start with a \'[\' and end with a \']\'.', +'stateFieldNameInvalid':'State field names must not contain any \'=\' characters.', +'cantSetId':'The id property can\'t be set on this object.', +'historyMissingHiddenInput':'For the history feature to work in Safari 2, the page must have a hidden input element with id \'__history\'.', +'stringFormatBraceMismatch':'The format string contains an unmatched opening or closing brace.', +'enumValueNotInteger':'An enumeration definition can only contain integer values.', +'propertyNullOrUndefined':'Cannot set the properties of \'{0}\' because it returned a null value.', +'argumentDomNode':'Value must be a DOM element or a text node.', +'componentCantSetIdTwice':'The id property of a component can\'t be set more than once.', +'createComponentOnDom':'Value must be null for Components that are not Controls or Behaviors.', +'createNotComponent':'{0} does not derive from Sys.Component.', +'createNoDom':'Value must not be null for Controls and Behaviors.', +'cantAddWithoutId':'Can\'t add a component that doesn\'t have an id.', +'badTypeName':'Value is not the name of the type being registered or the name is a reserved word.', +'argumentInteger':'Value must be an integer.', +'scriptLoadMultipleCallbacks':'The script \'{0}\' contains multiple calls to Sys.Application.notifyScriptLoaded(). Only one is allowed.', +'invokeCalledTwice':'Cannot call invoke more than once.', +'webServiceFailed':'The server method \'{0}\' failed with the following error: {1}', +'webServiceInvalidJsonWrapper':'The server method \'{0}\' returned invalid data. The \'d\' property is missing from the JSON wrapper.', +'argumentType':'Object cannot be converted to the required type.', +'argumentNull':'Value cannot be null.', +'controlCantSetId':'The id property can\'t be set on a control.', +'formatBadFormatSpecifier':'Format specifier was invalid.', +'webServiceFailedNoMsg':'The server method \'{0}\' failed.', +'argumentDomElement':'Value must be a DOM element.', +'invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.', +'cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.', +'actualValue':'Actual value was {0}.', +'enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.', +'scriptLoadFailed':'The script \'{0}\' could not be loaded.', +'parameterCount':'Parameter count mismatch.', +'cannotDeserializeEmptyString':'Cannot deserialize empty string.', +'formatInvalidString':'Input string was not in a correct format.', +'invalidTimeout':'Value must be greater than or equal to zero.', +'cannotAbortBeforeStart':'Cannot abort when executor has not started.', +'argument':'Value does not fall within the expected range.', +'cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.', +'invalidHttpVerb':'httpVerb cannot be set to an empty or null string.', +'nullWebRequest':'Cannot call executeRequest with a null webRequest.', +'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.', +'cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.', +'argumentUndefined':'Value cannot be undefined.', +'webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}', +'servicePathNotSet':'The path to the web service has not been set.', +'argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.', +'cannotCallOnceStarted':'Cannot call {0} once started.', +'badBaseUrl1':'Base URL does not contain ://.', +'badBaseUrl2':'Base URL does not contain another /.', +'badBaseUrl3':'Cannot find last / in base URL.', +'setExecutorAfterActive':'Cannot set executor after it has become active.', +'paramName':'Parameter name: {0}', +'cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.', +'cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.', +'format':'One of the identified items was in an invalid format.', +'assertFailedCaller':'Assertion Failed: {0}\r\nat {1}', +'argumentOutOfRange':'Specified argument was out of the range of valid values.', +'webServiceTimedOut':'The server method \'{0}\' timed out.', +'notImplemented':'The method or operation is not implemented.', +'assertFailed':'Assertion Failed: {0}', +'invalidOperation':'Operation is not valid due to the current state of the object.', +'breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?' +}; + +if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded(); diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.js b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.js new file mode 100644 index 00000000..db85c14e --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftAjax.js @@ -0,0 +1,7 @@ +//---------------------------------------------------------- +// Copyright (C) Microsoft Corporation. All rights reserved. +//---------------------------------------------------------- +// MicrosoftAjax.js +Function.__typeName="Function";Function.__class=true;Function.createCallback=function(b,a){return function(){var e=arguments.length;if(e>0){var d=[];for(var c=0;cc){var f=Error.parameterCount();f.popStackFrame();return f}return null};Function._validateParameter=function(c,a,h){var b,g=a.type,l=!!a.integer,k=!!a.domElement,m=!!a.mayBeNull;b=Function._validateParameterType(c,g,l,k,m,h);if(b){b.popStackFrame();return b}var e=a.elementType,f=!!a.elementMayBeNull;if(g===Array&&typeof c!=="undefined"&&c!==null&&(e||!f)){var j=!!a.elementInteger,i=!!a.elementDomElement;for(var d=0;d0&&(dc.Calendar.TwoDigitYearMax)return a-100}return a};Date._getParseRegExp=function(b,e){if(!b._parseRegExp)b._parseRegExp={};else if(b._parseRegExp[e])return b._parseRegExp[e];var c=Date._expandFormat(b,e);c=c.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1");var a=new Sys.StringBuilder("^"),j=[],f=0,i=0,h=Date._getTokenRegExp(),d;while((d=h.exec(c))!==null){var l=c.slice(f,d.index);f=h.lastIndex;i+=Date._appendPreOrPostMatch(l,a);if(i%2===1){a.append(d[0]);continue}switch(d[0]){case "dddd":case "ddd":case "MMMM":case "MMM":a.append("(\\D+)");break;case "tt":case "t":a.append("(\\D*)");break;case "yyyy":a.append("(\\d{4})");break;case "fff":a.append("(\\d{3})");break;case "ff":a.append("(\\d{2})");break;case "f":a.append("(\\d)");break;case "dd":case "d":case "MM":case "M":case "yy":case "y":case "HH":case "H":case "hh":case "h":case "mm":case "m":case "ss":case "s":a.append("(\\d\\d?)");break;case "zzz":a.append("([+-]?\\d\\d?:\\d{2})");break;case "zz":case "z":a.append("([+-]?\\d\\d?)")}Array.add(j,d[0])}Date._appendPreOrPostMatch(c.slice(f),a);a.append("$");var k=a.toString().replace(/\s+/g,"\\s+"),g={"regExp":k,"groups":j};b._parseRegExp[e]=g;return g};Date._getTokenRegExp=function(){return /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g};Date.parseLocale=function(a){return Date._parse(a,Sys.CultureInfo.CurrentCulture,arguments)};Date.parseInvariant=function(a){return Date._parse(a,Sys.CultureInfo.InvariantCulture,arguments)};Date._parse=function(g,c,h){var e=false;for(var a=1,i=h.length;a31)return null;break;case "MMMM":c=j._getMonthIndex(a);if(c<0||c>11)return null;break;case "MMM":c=j._getAbbrMonthIndex(a);if(c<0||c>11)return null;break;case "M":case "MM":var c=parseInt(a,10)-1;if(c<0||c>11)return null;break;case "y":case "yy":f=Date._expandYear(m,parseInt(a,10));if(f<0||f>9999)return null;break;case "yyyy":f=parseInt(a,10);if(f<0||f>9999)return null;break;case "h":case "hh":d=parseInt(a,10);if(d===12)d=0;if(d<0||d>11)return null;break;case "H":case "HH":d=parseInt(a,10);if(d<0||d>23)return null;break;case "m":case "mm":n=parseInt(a,10);if(n<0||n>59)return null;break;case "s":case "ss":o=parseInt(a,10);if(o<0||o>59)return null;break;case "tt":case "t":var u=a.toUpperCase();r=u===m.PMDesignator.toUpperCase();if(!r&&u!==m.AMDesignator.toUpperCase())return null;break;case "f":e=parseInt(a,10)*100;if(e<0||e>999)return null;break;case "ff":e=parseInt(a,10)*10;if(e<0||e>999)return null;break;case "fff":e=parseInt(a,10);if(e<0||e>999)return null;break;case "dddd":g=j._getDayIndex(a);if(g<0||g>6)return null;break;case "ddd":g=j._getAbbrDayIndex(a);if(g<0||g>6)return null;break;case "zzz":var q=a.split(/:/);if(q.length!==2)return null;var i=parseInt(q[0],10);if(i<-12||i>13)return null;var l=parseInt(q[1],10);if(l<0||l>59)return null;k=i*60+(a.startsWith("-")?-l:l);break;case "z":case "zz":var i=parseInt(a,10);if(i<-12||i>13)return null;k=i*60}}var b=new Date;if(f===null)f=b.getFullYear();if(c===null)c=b.getMonth();if(h===null)h=b.getDate();b.setFullYear(f,c,h);if(b.getDate()!==h)return null;if(g!==null&&b.getDay()!==g)return null;if(r&&d<12)d+=12;b.setHours(d,n,o,e);if(k!==null){var t=b.getMinutes()-(k+b.getTimezoneOffset());b.setHours(b.getHours()+parseInt(t/60,10),t%60)}return b};Date.prototype.format=function(a){return this._toFormattedString(a,Sys.CultureInfo.InvariantCulture)};Date.prototype.localeFormat=function(a){return this._toFormattedString(a,Sys.CultureInfo.CurrentCulture)};Date.prototype._toFormattedString=function(e,h){if(!e||e.length===0||e==="i")if(h&&h.name.length>0)return this.toLocaleString();else return this.toString();var d=h.dateTimeFormat;e=Date._expandFormat(d,e);var a=new Sys.StringBuilder,b;function c(a){if(a<10)return "0"+a;return a.toString()}function g(a){if(a<10)return "00"+a;if(a<100)return "0"+a;return a.toString()}var j=0,i=Date._getTokenRegExp();for(;true;){var l=i.lastIndex,f=i.exec(e),k=e.slice(l,f?f.index:e.length);j+=Date._appendPreOrPostMatch(k,a);if(!f)break;if(j%2===1){a.append(f[0]);continue}switch(f[0]){case "dddd":a.append(d.DayNames[this.getDay()]);break;case "ddd":a.append(d.AbbreviatedDayNames[this.getDay()]);break;case "dd":a.append(c(this.getDate()));break;case "d":a.append(this.getDate());break;case "MMMM":a.append(d.MonthNames[this.getMonth()]);break;case "MMM":a.append(d.AbbreviatedMonthNames[this.getMonth()]);break;case "MM":a.append(c(this.getMonth()+1));break;case "M":a.append(this.getMonth()+1);break;case "yyyy":a.append(this.getFullYear());break;case "yy":a.append(c(this.getFullYear()%100));break;case "y":a.append(this.getFullYear()%100);break;case "hh":b=this.getHours()%12;if(b===0)b=12;a.append(c(b));break;case "h":b=this.getHours()%12;if(b===0)b=12;a.append(b);break;case "HH":a.append(c(this.getHours()));break;case "H":a.append(this.getHours());break;case "mm":a.append(c(this.getMinutes()));break;case "m":a.append(this.getMinutes());break;case "ss":a.append(c(this.getSeconds()));break;case "s":a.append(this.getSeconds());break;case "tt":a.append(this.getHours()<12?d.AMDesignator:d.PMDesignator);break;case "t":a.append((this.getHours()<12?d.AMDesignator:d.PMDesignator).charAt(0));break;case "f":a.append(g(this.getMilliseconds()).charAt(0));break;case "ff":a.append(g(this.getMilliseconds()).substr(0,2));break;case "fff":a.append(g(this.getMilliseconds()));break;case "z":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+Math.floor(Math.abs(b)));break;case "zz":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+c(Math.floor(Math.abs(b))));break;case "zzz":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+c(Math.floor(Math.abs(b)))+d.TimeSeparator+c(Math.abs(this.getTimezoneOffset()%60)))}}return a.toString()};Number.__typeName="Number";Number.__class=true;Number.parseLocale=function(a){return Number._parse(a,Sys.CultureInfo.CurrentCulture)};Number.parseInvariant=function(a){return Number._parse(a,Sys.CultureInfo.InvariantCulture)};Number._parse=function(b,o){b=b.trim();if(b.match(/^[+-]?infinity$/i))return parseFloat(b);if(b.match(/^0x[a-f0-9]+$/i))return parseInt(b);var a=o.numberFormat,g=Number._parseNumberNegativePattern(b,a,a.NumberNegativePattern),h=g[0],e=g[1];if(h===""&&a.NumberNegativePattern!==1){g=Number._parseNumberNegativePattern(b,a,1);h=g[0];e=g[1]}if(h==="")h="+";var j,d,f=e.indexOf("e");if(f<0)f=e.indexOf("E");if(f<0){d=e;j=null}else{d=e.substr(0,f);j=e.substr(f+1)}var c,k,m=d.indexOf(a.NumberDecimalSeparator);if(m<0){c=d;k=null}else{c=d.substr(0,m);k=d.substr(m+a.NumberDecimalSeparator.length)}c=c.split(a.NumberGroupSeparator).join("");var n=a.NumberGroupSeparator.replace(/\u00A0/g," ");if(a.NumberGroupSeparator!==n)c=c.split(n).join("");var l=h+c;if(k!==null)l+="."+k;if(j!==null){var i=Number._parseNumberNegativePattern(j,a,1);if(i[0]==="")i[0]="+";l+="e"+i[0]+i[1]}if(l.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/))return parseFloat(l);return Number.NaN};Number._parseNumberNegativePattern=function(a,d,e){var b=d.NegativeSign,c=d.PositiveSign;switch(e){case 4:b=" "+b;c=" "+c;case 3:if(a.endsWith(b))return ["-",a.substr(0,a.length-b.length)];else if(a.endsWith(c))return ["+",a.substr(0,a.length-c.length)];break;case 2:b+=" ";c+=" ";case 1:if(a.startsWith(b))return ["-",a.substr(b.length)];else if(a.startsWith(c))return ["+",a.substr(c.length)];break;case 0:if(a.startsWith("(")&&a.endsWith(")"))return ["-",a.substr(1,a.length-2)]}return ["",a]};Number.prototype.format=function(a){return this._toFormattedString(a,Sys.CultureInfo.InvariantCulture)};Number.prototype.localeFormat=function(a){return this._toFormattedString(a,Sys.CultureInfo.CurrentCulture)};Number.prototype._toFormattedString=function(d,j){if(!d||d.length===0||d==="i")if(j&&j.name.length>0)return this.toLocaleString();else return this.toString();var o=["n %","n%","%n"],n=["-n %","-n%","-%n"],p=["(n)","-n","- n","n-","n -"],m=["$n","n$","$ n","n $"],l=["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];function g(a,c,d){for(var b=a.length;b1?parseInt(e[1]):0;e=b.split(".");b=e[0];a=e.length>1?e[1]:"";var q;if(c>0){a=g(a,c,false);b+=a.slice(0,c);a=a.substr(c)}else if(c<0){c=-c;b=g(b,c+1,true);a=b.slice(-c,b.length)+a;b=b.slice(0,-c)}if(i>0){if(a.length>i)a=a.slice(0,i);else a=g(a,i,false);a=p+a}else a="";var d=b.length-1,f="";while(d>=0){if(h===0||h>d)if(f.length>0)return b.slice(0,d+1)+n+f+a;else return b.slice(0,d+1)+a;if(f.length>0)f=b.slice(d-h+1,d+1)+n+f;else f=b.slice(d-h+1,d+1);d-=h;if(k1)b=parseInt(d.slice(1),10);var c;switch(d.charAt(0)){case "d":case "D":c="n";if(b!==-1)e=g(""+e,b,true);if(this<0)e=-e;break;case "c":case "C":if(this<0)c=l[a.CurrencyNegativePattern];else c=m[a.CurrencyPositivePattern];if(b===-1)b=a.CurrencyDecimalDigits;e=i(Math.abs(this),b,a.CurrencyGroupSizes,a.CurrencyGroupSeparator,a.CurrencyDecimalSeparator);break;case "n":case "N":if(this<0)c=p[a.NumberNegativePattern];else c="n";if(b===-1)b=a.NumberDecimalDigits;e=i(Math.abs(this),b,a.NumberGroupSizes,a.NumberGroupSeparator,a.NumberDecimalSeparator);break;case "p":case "P":if(this<0)c=n[a.PercentNegativePattern];else c=o[a.PercentPositivePattern];if(b===-1)b=a.PercentDecimalDigits;e=i(Math.abs(this)*100,b,a.PercentGroupSizes,a.PercentGroupSeparator,a.PercentDecimalSeparator);break;default:throw Error.format(Sys.Res.formatBadFormatSpecifier)}var k=/n|\$|-|%/g,f="";for(;true;){var q=k.lastIndex,h=k.exec(c);f+=c.slice(q,h?h.index:c.length);if(!h)break;switch(h[0]){case "n":f+=e;break;case "$":f+=a.CurrencySymbol;break;case "-":f+=a.NegativeSign;break;case "%":f+=a.PercentSymbol}}return f};RegExp.__typeName="RegExp";RegExp.__class=true;Array.__typeName="Array";Array.__class=true;Array.add=Array.enqueue=function(a,b){a[a.length]=b};Array.addRange=function(a,b){a.push.apply(a,b)};Array.clear=function(a){a.length=0};Array.clone=function(a){if(a.length===1)return [a[0]];else return Array.apply(null,a)};Array.contains=function(a,b){return Array.indexOf(a,b)>=0};Array.dequeue=function(a){return a.shift()};Array.forEach=function(b,e,d){for(var a=0,f=b.length;a=0)b.splice(a,1);return a>=0};Array.removeAt=function(a,b){a.splice(b,1)};if(!window)this.window=this;window.Type=Function;Type.prototype.callBaseMethod=function(a,d,b){var c=this.getBaseMethod(a,d);if(!b)return c.apply(a);else return c.apply(a,b)};Type.prototype.getBaseMethod=function(d,c){var b=this.getBaseType();if(b){var a=b.prototype[c];return a instanceof Function?a:null}return null};Type.prototype.getBaseType=function(){return typeof this.__baseType==="undefined"?null:this.__baseType};Type.prototype.getInterfaces=function(){var a=[],b=this;while(b){var c=b.__interfaces;if(c)for(var d=0,f=c.length;d-1){Sys.Browser.agent=Sys.Browser.InternetExplorer;Sys.Browser.version=parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);if(Sys.Browser.version>=8)if(document.documentMode>=7)Sys.Browser.documentMode=document.documentMode;Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" Firefox/")>-1){Sys.Browser.agent=Sys.Browser.Firefox;Sys.Browser.version=parseFloat(navigator.userAgent.match(/Firefox\/(\d+\.\d+)/)[1]);Sys.Browser.name="Firefox";Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" AppleWebKit/")>-1){Sys.Browser.agent=Sys.Browser.Safari;Sys.Browser.version=parseFloat(navigator.userAgent.match(/AppleWebKit\/(\d+(\.\d+)?)/)[1]);Sys.Browser.name="Safari"}else if(navigator.userAgent.indexOf("Opera/")>-1)Sys.Browser.agent=Sys.Browser.Opera;Type.registerNamespace("Sys.UI");Sys._Debug=function(){};Sys._Debug.prototype={_appendConsole:function(a){if(typeof Debug!=="undefined"&&Debug.writeln)Debug.writeln(a);if(window.console&&window.console.log)window.console.log(a);if(window.opera)window.opera.postError(a);if(window.debugService)window.debugService.trace(a)},_appendTrace:function(b){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value+=b+"\n"},assert:function(c,a,b){if(!c){a=b&&this.assert.caller?String.format(Sys.Res.assertFailedCaller,a,this.assert.caller):String.format(Sys.Res.assertFailed,a);if(confirm(String.format(Sys.Res.breakIntoDebugger,a)))this.fail(a)}},clearTrace:function(){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value=""},fail:function(message){this._appendConsole(message);if(Sys.Browser.hasDebuggerStatement)eval("debugger")},trace:function(a){this._appendConsole(a);this._appendTrace(a)},traceDump:function(a,b){var c=this._traceDump(a,b,true)},_traceDump:function(a,c,f,b,d){c=c?c:"traceDump";b=b?b:"";if(a===null){this.trace(b+c+": null");return}switch(typeof a){case "undefined":this.trace(b+c+": Undefined");break;case "number":case "string":case "boolean":this.trace(b+c+": "+a);break;default:if(Date.isInstanceOfType(a)||RegExp.isInstanceOfType(a)){this.trace(b+c+": "+a.toString());break}if(!d)d=[];else if(Array.contains(d,a)){this.trace(b+c+": ...");return}Array.add(d,a);if(a==window||a===document||window.HTMLElement&&a instanceof HTMLElement||typeof a.nodeName==="string"){var k=a.tagName?a.tagName:"DomElement";if(a.id)k+=" - "+a.id;this.trace(b+c+" {"+k+"}")}else{var i=Object.getTypeName(a);this.trace(b+c+(typeof i==="string"?" {"+i+"}":""));if(b===""||f){b+=" ";var e,j,l,g,h;if(Array.isInstanceOfType(a)){j=a.length;for(e=0;e=0;d--){var k=h[d].trim();b=a[k];if(typeof b!=="number")throw Error.argument("value",String.format(Sys.Res.enumInvalidValue,c.split(",")[d].trim(),this.__typeName));j|=b}return j}}function Sys$Enum$toString(c){if(typeof c==="undefined"||c===null)return this.__string;var d=this.prototype,a;if(!this.__flags||c===0){for(a in d)if(d[a]===c)return a}else{var b=this.__sortedValues;if(!b){b=[];for(a in d)b[b.length]={key:a,value:d[a]};b.sort(function(a,b){return a.value-b.value});this.__sortedValues=b}var e=[],g=c;for(a=b.length-1;a>=0;a--){var h=b[a],f=h.value;if(f===0)continue;if((f&c)===f){e[e.length]=h.key;g-=f;if(g===0)break}}if(e.length&&g===0)return e.reverse().join(", ")}return ""}Type.prototype.registerEnum=function(b,c){Sys.__upperCaseTypes[b.toUpperCase()]=this;for(var a in this.prototype)this[a]=this.prototype[a];this.__typeName=b;this.parse=Sys$Enum$parse;this.__string=this.toString();this.toString=Sys$Enum$toString;this.__flags=c;this.__enum=true};Type.isEnum=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__enum};Type.isFlags=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__flags};Sys.EventHandlerList=function(){this._list={}};Sys.EventHandlerList.prototype={addHandler:function(b,a){Array.add(this._getEvent(b,true),a)},removeHandler:function(c,b){var a=this._getEvent(c);if(!a)return;Array.remove(a,b)},getHandler:function(b){var a=this._getEvent(b);if(!a||a.length===0)return null;a=Array.clone(a);return function(c,d){for(var b=0,e=a.length;b=0;c--)$removeHandler(a,b,d[c].handler)}a._events=null}},$removeHandler=Sys.UI.DomEvent.removeHandler=function(a,e,f){var d=null,c=a._events[e];for(var b=0,g=c.length;b=0)d.className=(a.substr(0,b)+" "+a.substring(b+c.length+1,a.length)).trim()};Sys.UI.DomElement.setLocation=function(b,c,d){var a=b.style;a.position="absolute";a.left=c+"px";a.top=d+"px"};Sys.UI.DomElement.toggleCssClass=function(b,a){if(Sys.UI.DomElement.containsCssClass(b,a))Sys.UI.DomElement.removeCssClass(b,a);else Sys.UI.DomElement.addCssClass(b,a)};Sys.UI.DomElement.getVisibilityMode=function(a){return a._visibilityMode===Sys.UI.VisibilityMode.hide?Sys.UI.VisibilityMode.hide:Sys.UI.VisibilityMode.collapse};Sys.UI.DomElement.setVisibilityMode=function(a,b){Sys.UI.DomElement._ensureOldDisplayMode(a);if(a._visibilityMode!==b){a._visibilityMode=b;if(Sys.UI.DomElement.getVisible(a)===false)if(a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none";a._visibilityMode=b}};Sys.UI.DomElement.getVisible=function(b){var a=b.currentStyle||Sys.UI.DomElement._getCurrentStyle(b);if(!a)return true;return a.visibility!=="hidden"&&a.display!=="none"};Sys.UI.DomElement.setVisible=function(a,b){if(b!==Sys.UI.DomElement.getVisible(a)){Sys.UI.DomElement._ensureOldDisplayMode(a);a.style.visibility=b?"visible":"hidden";if(b||a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none"}};Sys.UI.DomElement._ensureOldDisplayMode=function(a){if(!a._oldDisplayMode){var b=a.currentStyle||Sys.UI.DomElement._getCurrentStyle(a);a._oldDisplayMode=b?b.display:null;if(!a._oldDisplayMode||a._oldDisplayMode==="none")switch(a.tagName.toUpperCase()){case "DIV":case "P":case "ADDRESS":case "BLOCKQUOTE":case "BODY":case "COL":case "COLGROUP":case "DD":case "DL":case "DT":case "FIELDSET":case "FORM":case "H1":case "H2":case "H3":case "H4":case "H5":case "H6":case "HR":case "IFRAME":case "LEGEND":case "OL":case "PRE":case "TABLE":case "TD":case "TH":case "TR":case "UL":a._oldDisplayMode="block";break;case "LI":a._oldDisplayMode="list-item";break;default:a._oldDisplayMode="inline"}}};Sys.UI.DomElement._getWindow=function(a){var b=a.ownerDocument||a.document||a;return b.defaultView||b.parentWindow};Sys.UI.DomElement._getCurrentStyle=function(a){if(a.nodeType===3)return null;var c=Sys.UI.DomElement._getWindow(a);if(a.documentElement)a=a.documentElement;var b=c&&a!==c&&c.getComputedStyle?c.getComputedStyle(a,null):a.currentStyle||a.style;if(!b&&Sys.Browser.agent===Sys.Browser.Safari&&a.style){var g=a.style.display,f=a.style.position;a.style.position="absolute";a.style.display="block";var e=c.getComputedStyle(a,null);a.style.display=g;a.style.position=f;b={};for(var d in e)b[d]=e[d];b.display="none"}return b};Sys.IContainer=function(){};Sys.IContainer.prototype={};Sys.IContainer.registerInterface("Sys.IContainer");Sys._ScriptLoader=function(){this._scriptsToLoad=null;this._sessions=[];this._scriptLoadedDelegate=Function.createDelegate(this,this._scriptLoadedHandler)};Sys._ScriptLoader.prototype={dispose:function(){this._stopSession();this._loading=false;if(this._events)delete this._events;this._sessions=null;this._currentSession=null;this._scriptLoadedDelegate=null},loadScripts:function(d,b,c,a){var e={allScriptsLoadedCallback:b,scriptLoadFailedCallback:c,scriptLoadTimeoutCallback:a,scriptsToLoad:this._scriptsToLoad,scriptTimeout:d};this._scriptsToLoad=null;this._sessions[this._sessions.length]=e;if(!this._loading)this._nextSession()},notifyScriptLoaded:function(){if(!this._loading)return;this._currentTask._notified++;if(Sys.Browser.agent===Sys.Browser.Safari)if(this._currentTask._notified===1)window.setTimeout(Function.createDelegate(this,function(){this._scriptLoadedHandler(this._currentTask.get_scriptElement(),true)}),0)},queueCustomScriptTag:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,a)},queueScriptBlock:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{text:a})},queueScriptReference:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{src:a})},_createScriptElement:function(c){var a=document.createElement("script");a.type="text/javascript";for(var b in c)a[b]=c[b];return a},_loadScriptsInternal:function(){var b=this._currentSession;if(b.scriptsToLoad&&b.scriptsToLoad.length>0){var c=Array.dequeue(b.scriptsToLoad),a=this._createScriptElement(c);if(a.text&&Sys.Browser.agent===Sys.Browser.Safari){a.innerHTML=a.text;delete a.text}if(typeof c.src==="string"){this._currentTask=new Sys._ScriptLoaderTask(a,this._scriptLoadedDelegate);this._currentTask.execute()}else{document.getElementsByTagName("head")[0].appendChild(a);Sys._ScriptLoader._clearScript(a);this._loadScriptsInternal()}}else{this._stopSession();var d=b.allScriptsLoadedCallback;if(d)d(this);this._nextSession()}},_nextSession:function(){if(this._sessions.length===0){this._loading=false;this._currentSession=null;return}this._loading=true;var a=Array.dequeue(this._sessions);this._currentSession=a;if(a.scriptTimeout>0)this._timeoutCookie=window.setTimeout(Function.createDelegate(this,this._scriptLoadTimeoutHandler),a.scriptTimeout*1000);this._loadScriptsInternal()},_raiseError:function(a){var c=this._currentSession.scriptLoadFailedCallback,b=this._currentTask.get_scriptElement();this._stopSession();if(c){c(this,b,a);this._nextSession()}else{this._loading=false;throw Sys._ScriptLoader._errorScriptLoadFailed(b.src,a)}},_scriptLoadedHandler:function(a,b){if(b&&this._currentTask._notified)if(this._currentTask._notified>1)this._raiseError(true);else{Array.add(Sys._ScriptLoader._getLoadedScripts(),a.src);this._currentTask.dispose();this._currentTask=null;this._loadScriptsInternal()}else this._raiseError(false)},_scriptLoadTimeoutHandler:function(){var a=this._currentSession.scriptLoadTimeoutCallback;this._stopSession();if(a)a(this);this._nextSession()},_stopSession:function(){if(this._timeoutCookie){window.clearTimeout(this._timeoutCookie);this._timeoutCookie=null}if(this._currentTask){this._currentTask.dispose();this._currentTask=null}}};Sys._ScriptLoader.registerClass("Sys._ScriptLoader",null,Sys.IDisposable);Sys._ScriptLoader.getInstance=function(){var a=Sys._ScriptLoader._activeInstance;if(!a)a=Sys._ScriptLoader._activeInstance=new Sys._ScriptLoader;return a};Sys._ScriptLoader.isScriptLoaded=function(b){var a=document.createElement("script");a.src=b;return Array.contains(Sys._ScriptLoader._getLoadedScripts(),a.src)};Sys._ScriptLoader.readLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts){var b=Sys._ScriptLoader._referencedScripts=[],c=document.getElementsByTagName("script");for(i=c.length-1;i>=0;i--){var d=c[i],a=d.src;if(a.length)if(!Array.contains(b,a))Array.add(b,a)}}};Sys._ScriptLoader._clearScript=function(a){if(!Sys.Debug.isDebug)a.parentNode.removeChild(a)};Sys._ScriptLoader._errorScriptLoadFailed=function(b,d){var a;if(d)a=Sys.Res.scriptLoadMultipleCallbacks;else a=Sys.Res.scriptLoadFailed;var e="Sys.ScriptLoadFailedException: "+String.format(a,b),c=Error.create(e,{name:"Sys.ScriptLoadFailedException","scriptUrl":b});c.popStackFrame();return c};Sys._ScriptLoader._getLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts){Sys._ScriptLoader._referencedScripts=[];Sys._ScriptLoader.readLoadedScripts()}return Sys._ScriptLoader._referencedScripts};Sys._ScriptLoaderTask=function(b,a){this._scriptElement=b;this._completedCallback=a;this._notified=0};Sys._ScriptLoaderTask.prototype={get_scriptElement:function(){return this._scriptElement},dispose:function(){if(this._disposed)return;this._disposed=true;this._removeScriptElementHandlers();Sys._ScriptLoader._clearScript(this._scriptElement);this._scriptElement=null},execute:function(){this._addScriptElementHandlers();document.getElementsByTagName("head")[0].appendChild(this._scriptElement)},_addScriptElementHandlers:function(){this._scriptLoadDelegate=Function.createDelegate(this,this._scriptLoadHandler);if(Sys.Browser.agent!==Sys.Browser.InternetExplorer){this._scriptElement.readyState="loaded";$addHandler(this._scriptElement,"load",this._scriptLoadDelegate)}else $addHandler(this._scriptElement,"readystatechange",this._scriptLoadDelegate);if(this._scriptElement.addEventListener){this._scriptErrorDelegate=Function.createDelegate(this,this._scriptErrorHandler);this._scriptElement.addEventListener("error",this._scriptErrorDelegate,false)}},_removeScriptElementHandlers:function(){if(this._scriptLoadDelegate){var a=this.get_scriptElement();if(Sys.Browser.agent!==Sys.Browser.InternetExplorer)$removeHandler(a,"load",this._scriptLoadDelegate);else $removeHandler(a,"readystatechange",this._scriptLoadDelegate);if(this._scriptErrorDelegate){this._scriptElement.removeEventListener("error",this._scriptErrorDelegate,false);this._scriptErrorDelegate=null}this._scriptLoadDelegate=null}},_scriptErrorHandler:function(){if(this._disposed)return;this._completedCallback(this.get_scriptElement(),false)},_scriptLoadHandler:function(){if(this._disposed)return;var a=this.get_scriptElement();if(a.readyState!=="loaded"&&a.readyState!=="complete")return;var b=this;window.setTimeout(function(){b._completedCallback(a,true)},0)}};Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask",null,Sys.IDisposable);Sys.ApplicationLoadEventArgs=function(b,a){Sys.ApplicationLoadEventArgs.initializeBase(this);this._components=b;this._isPartialLoad=a};Sys.ApplicationLoadEventArgs.prototype={get_components:function(){return this._components},get_isPartialLoad:function(){return this._isPartialLoad}};Sys.ApplicationLoadEventArgs.registerClass("Sys.ApplicationLoadEventArgs",Sys.EventArgs);Sys.HistoryEventArgs=function(a){Sys.HistoryEventArgs.initializeBase(this);this._state=a};Sys.HistoryEventArgs.prototype={get_state:function(){return this._state}};Sys.HistoryEventArgs.registerClass("Sys.HistoryEventArgs",Sys.EventArgs);Sys._Application=function(){Sys._Application.initializeBase(this);this._disposableObjects=[];this._components={};this._createdComponents=[];this._secondPassComponents=[];this._appLoadHandler=null;this._beginRequestHandler=null;this._clientId=null;this._currentEntry="";this._endRequestHandler=null;this._history=null;this._enableHistory=false;this._historyFrame=null;this._historyInitialized=false;this._historyInitialLength=0;this._historyLength=0;this._historyPointIsNew=false;this._ignoreTimer=false;this._initialState=null;this._state={};this._timerCookie=0;this._timerHandler=null;this._uniqueId=null;this._unloadHandlerDelegate=Function.createDelegate(this,this._unloadHandler);this._loadHandlerDelegate=Function.createDelegate(this,this._loadHandler);Sys.UI.DomEvent.addHandler(window,"unload",this._unloadHandlerDelegate);Sys.UI.DomEvent.addHandler(window,"load",this._loadHandlerDelegate)};Sys._Application.prototype={_creatingComponents:false,_disposing:false,get_isCreatingComponents:function(){return this._creatingComponents},get_stateString:function(){var a=window.location.hash;if(this._isSafari2()){var b=this._getHistory();if(b)a=b[window.history.length-this._historyInitialLength]}if(a.length>0&&a.charAt(0)==="#")a=a.substring(1);if(Sys.Browser.agent===Sys.Browser.Firefox)a=this._serializeState(this._deserializeState(a,true));return a},get_enableHistory:function(){return this._enableHistory},set_enableHistory:function(a){this._enableHistory=a},add_init:function(a){if(this._initialized)a(this,Sys.EventArgs.Empty);else this.get_events().addHandler("init",a)},remove_init:function(a){this.get_events().removeHandler("init",a)},add_load:function(a){this.get_events().addHandler("load",a)},remove_load:function(a){this.get_events().removeHandler("load",a)},add_navigate:function(a){this.get_events().addHandler("navigate",a)},remove_navigate:function(a){this.get_events().removeHandler("navigate",a)},add_unload:function(a){this.get_events().addHandler("unload",a)},remove_unload:function(a){this.get_events().removeHandler("unload",a)},addComponent:function(a){this._components[a.get_id()]=a},addHistoryPoint:function(c,f){this._ensureHistory();var b=this._state;for(var a in c){var d=c[a];if(d===null){if(typeof b[a]!=="undefined")delete b[a]}else b[a]=d}var e=this._serializeState(b);this._historyPointIsNew=true;this._setState(e,f);this._raiseNavigate()},beginCreateComponents:function(){this._creatingComponents=true},dispose:function(){if(!this._disposing){this._disposing=true;if(this._timerCookie){window.clearTimeout(this._timerCookie);delete this._timerCookie}if(this._endRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);delete this._endRequestHandler}if(this._beginRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);delete this._beginRequestHandler}if(window.pageUnload)window.pageUnload(this,Sys.EventArgs.Empty);var c=this.get_events().getHandler("unload");if(c)c(this,Sys.EventArgs.Empty);var b=Array.clone(this._disposableObjects);for(var a=0,e=b.length;a'");d.write(""+(c||document.title)+"parent.Sys.Application._onIFrameLoad(\''+a+"');");d.close()}this._ignoreTimer=false;var h=this.get_stateString();this._currentEntry=a;if(a!==h){if(this._isSafari2()){var g=this._getHistory();g[window.history.length-this._historyInitialLength+1]=a;this._setHistory(g);this._historyLength=window.history.length+1;var b=document.createElement("form");b.method="get";b.action="#"+a;document.appendChild(b);b.submit();document.removeChild(b)}else window.location.hash=a;if(typeof c!=="undefined"&&c!==null)document.title=c}}},_unloadHandler:function(){this.dispose()},_updateHiddenField:function(b){if(this._clientId){var a=document.getElementById(this._clientId);if(a)a.value=b}}};Sys._Application.registerClass("Sys._Application",Sys.Component,Sys.IContainer);Sys.Application=new Sys._Application;var $find=Sys.Application.findComponent;Type.registerNamespace("Sys.Net");Sys.Net.WebRequestExecutor=function(){this._webRequest=null;this._resultObject=null};Sys.Net.WebRequestExecutor.prototype={get_webRequest:function(){return this._webRequest},_set_webRequest:function(a){this._webRequest=a},get_started:function(){throw Error.notImplemented()},get_responseAvailable:function(){throw Error.notImplemented()},get_timedOut:function(){throw Error.notImplemented()},get_aborted:function(){throw Error.notImplemented()},get_responseData:function(){throw Error.notImplemented()},get_statusCode:function(){throw Error.notImplemented()},get_statusText:function(){throw Error.notImplemented()},get_xml:function(){throw Error.notImplemented()},get_object:function(){if(!this._resultObject)this._resultObject=Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());return this._resultObject},executeRequest:function(){throw Error.notImplemented()},abort:function(){throw Error.notImplemented()},getResponseHeader:function(){throw Error.notImplemented()},getAllResponseHeaders:function(){throw Error.notImplemented()}};Sys.Net.WebRequestExecutor.registerClass("Sys.Net.WebRequestExecutor");Sys.Net.XMLDOM=function(d){if(!window.DOMParser){var c=["Msxml2.DOMDocument.3.0","Msxml2.DOMDocument"];for(var b=0,f=c.length;b0)this._timer=window.setTimeout(Function.createDelegate(this,this._onTimeout),d);this._xmlHttpRequest.send(c);this._started=true},getResponseHeader:function(b){var a;try{a=this._xmlHttpRequest.getResponseHeader(b)}catch(c){}if(!a)a="";return a},getAllResponseHeaders:function(){return this._xmlHttpRequest.getAllResponseHeaders()},get_responseData:function(){return this._xmlHttpRequest.responseText},get_statusCode:function(){var a=0;try{a=this._xmlHttpRequest.status}catch(b){}return a},get_statusText:function(){return this._xmlHttpRequest.statusText},get_xml:function(){var a=this._xmlHttpRequest.responseXML;if(!a||!a.documentElement){a=Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);if(!a||!a.documentElement)return null}else if(navigator.userAgent.indexOf("MSIE")!==-1)a.setProperty("SelectionLanguage","XPath");if(a.documentElement.namespaceURI==="http://www.mozilla.org/newlayout/xml/parsererror.xml"&&a.documentElement.tagName==="parsererror")return null;if(a.documentElement.firstChild&&a.documentElement.firstChild.tagName==="parsererror")return null;return a},abort:function(){if(this._aborted||this._responseAvailable||this._timedOut)return;this._aborted=true;this._clearTimer();if(this._xmlHttpRequest&&!this._responseAvailable){this._xmlHttpRequest.onreadystatechange=Function.emptyMethod;this._xmlHttpRequest.abort();this._xmlHttpRequest=null;this._webRequest.completed(Sys.EventArgs.Empty)}}};Sys.Net.XMLHttpExecutor.registerClass("Sys.Net.XMLHttpExecutor",Sys.Net.WebRequestExecutor);Sys.Net._WebRequestManager=function(){this._defaultTimeout=0;this._defaultExecutorType="Sys.Net.XMLHttpExecutor"};Sys.Net._WebRequestManager.prototype={add_invokingRequest:function(a){this._get_eventHandlerList().addHandler("invokingRequest",a)},remove_invokingRequest:function(a){this._get_eventHandlerList().removeHandler("invokingRequest",a)},add_completedRequest:function(a){this._get_eventHandlerList().addHandler("completedRequest",a)},remove_completedRequest:function(a){this._get_eventHandlerList().removeHandler("completedRequest",a)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_defaultTimeout:function(){return this._defaultTimeout},set_defaultTimeout:function(a){this._defaultTimeout=a},get_defaultExecutorType:function(){return this._defaultExecutorType},set_defaultExecutorType:function(a){this._defaultExecutorType=a},executeRequest:function(webRequest){var executor=webRequest.get_executor();if(!executor){var failed=false;try{var executorType=eval(this._defaultExecutorType);executor=new executorType}catch(a){failed=true}webRequest.set_executor(executor)}if(executor.get_aborted())return;var evArgs=new Sys.Net.NetworkRequestEventArgs(webRequest),handler=this._get_eventHandlerList().getHandler("invokingRequest");if(handler)handler(this,evArgs);if(!evArgs.get_cancel())executor.executeRequest()}};Sys.Net._WebRequestManager.registerClass("Sys.Net._WebRequestManager");Sys.Net.WebRequestManager=new Sys.Net._WebRequestManager;Sys.Net.NetworkRequestEventArgs=function(a){Sys.Net.NetworkRequestEventArgs.initializeBase(this);this._webRequest=a};Sys.Net.NetworkRequestEventArgs.prototype={get_webRequest:function(){return this._webRequest}};Sys.Net.NetworkRequestEventArgs.registerClass("Sys.Net.NetworkRequestEventArgs",Sys.CancelEventArgs);Sys.Net.WebRequest=function(){this._url="";this._headers={};this._body=null;this._userContext=null;this._httpVerb=null;this._executor=null;this._invokeCalled=false;this._timeout=0};Sys.Net.WebRequest.prototype={add_completed:function(a){this._get_eventHandlerList().addHandler("completed",a)},remove_completed:function(a){this._get_eventHandlerList().removeHandler("completed",a)},completed:function(b){var a=Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");if(a)a(this._executor,b);a=this._get_eventHandlerList().getHandler("completed");if(a)a(this._executor,b)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_url:function(){return this._url},set_url:function(a){this._url=a},get_headers:function(){return this._headers},get_httpVerb:function(){if(this._httpVerb===null){if(this._body===null)return "GET";return "POST"}return this._httpVerb},set_httpVerb:function(a){this._httpVerb=a},get_body:function(){return this._body},set_body:function(a){this._body=a},get_userContext:function(){return this._userContext},set_userContext:function(a){this._userContext=a},get_executor:function(){return this._executor},set_executor:function(a){this._executor=a;this._executor._set_webRequest(this)},get_timeout:function(){if(this._timeout===0)return Sys.Net.WebRequestManager.get_defaultTimeout();return this._timeout},set_timeout:function(a){this._timeout=a},getResolvedUrl:function(){return Sys.Net.WebRequest._resolveUrl(this._url)},invoke:function(){Sys.Net.WebRequestManager.executeRequest(this);this._invokeCalled=true}};Sys.Net.WebRequest._resolveUrl=function(b,a){if(b&&b.indexOf("://")!==-1)return b;if(!a||a.length===0){var d=document.getElementsByTagName("base")[0];if(d&&d.href&&d.href.length>0)a=d.href;else a=document.URL}var c=a.indexOf("?");if(c!==-1)a=a.substr(0,c);c=a.indexOf("#");if(c!==-1)a=a.substr(0,c);a=a.substr(0,a.lastIndexOf("/")+1);if(!b||b.length===0)return a;if(b.charAt(0)==="/"){var e=a.indexOf("://"),g=a.indexOf("/",e+3);return a.substr(0,g)+b}else{var f=a.lastIndexOf("/");return a.substr(0,f+1)+b}};Sys.Net.WebRequest._createQueryString=function(d,b){if(!b)b=encodeURIComponent;var a=new Sys.StringBuilder,f=0;for(var c in d){var e=d[c];if(typeof e==="function")continue;var g=Sys.Serialization.JavaScriptSerializer.serialize(e);if(f!==0)a.append("&");a.append(c);a.append("=");a.append(b(g));f++}return a.toString()};Sys.Net.WebRequest._createUrl=function(a,b){if(!b)return a;var d=Sys.Net.WebRequest._createQueryString(b);if(d.length>0){var c="?";if(a&&a.indexOf("?")!==-1)c="&";return a+c+d}else return a};Sys.Net.WebRequest.registerClass("Sys.Net.WebRequest");Sys.Net.WebServiceProxy=function(){};Sys.Net.WebServiceProxy.prototype={get_timeout:function(){return this._timeout},set_timeout:function(a){if(a<0)throw Error.argumentOutOfRange("value",a,Sys.Res.invalidTimeout);this._timeout=a},get_defaultUserContext:function(){return this._userContext},set_defaultUserContext:function(a){this._userContext=a},get_defaultSucceededCallback:function(){return this._succeeded},set_defaultSucceededCallback:function(a){this._succeeded=a},get_defaultFailedCallback:function(){return this._failed},set_defaultFailedCallback:function(a){this._failed=a},get_path:function(){return this._path},set_path:function(a){this._path=a},_invoke:function(d,e,g,f,c,b,a){if(c===null||typeof c==="undefined")c=this.get_defaultSucceededCallback();if(b===null||typeof b==="undefined")b=this.get_defaultFailedCallback();if(a===null||typeof a==="undefined")a=this.get_defaultUserContext();return Sys.Net.WebServiceProxy.invoke(d,e,g,f,c,b,a,this.get_timeout())}};Sys.Net.WebServiceProxy.registerClass("Sys.Net.WebServiceProxy");Sys.Net.WebServiceProxy.invoke=function(k,a,j,d,i,c,f,h){var b=new Sys.Net.WebRequest;b.get_headers()["Content-Type"]="application/json; charset=utf-8";if(!d)d={};var g=d;if(!j||!g)g={};b.set_url(Sys.Net.WebRequest._createUrl(k+"/"+encodeURIComponent(a),g));var e=null;if(!j){e=Sys.Serialization.JavaScriptSerializer.serialize(d);if(e==="{}")e=""}b.set_body(e);b.add_completed(l);if(h&&h>0)b.set_timeout(h);b.invoke();function l(d){if(d.get_responseAvailable()){var g=d.get_statusCode(),b=null;try{var e=d.getResponseHeader("Content-Type");if(e.startsWith("application/json"))b=d.get_object();else if(e.startsWith("text/xml"))b=d.get_xml();else b=d.get_responseData()}catch(m){}var k=d.getResponseHeader("jsonerror"),h=k==="true";if(h){if(b)b=new Sys.Net.WebServiceError(false,b.Message,b.StackTrace,b.ExceptionType)}else if(e.startsWith("application/json"))b=b.d;if(g<200||g>=300||h){if(c){if(!b||!h)b=new Sys.Net.WebServiceError(false,String.format(Sys.Res.webServiceFailedNoMsg,a),"","");b._statusCode=g;c(b,f,a)}}else if(i)i(b,f,a)}else{var j;if(d.get_timedOut())j=String.format(Sys.Res.webServiceTimedOut,a);else j=String.format(Sys.Res.webServiceFailedNoMsg,a);if(c)c(new Sys.Net.WebServiceError(d.get_timedOut(),j,"",""),f,a)}}return b};Sys.Net.WebServiceProxy._generateTypedConstructor=function(a){return function(b){if(b)for(var c in b)this[c]=b[c];this.__type=a}};Sys.Net.WebServiceError=function(c,d,b,a){this._timedOut=c;this._message=d;this._stackTrace=b;this._exceptionType=a;this._statusCode=-1};Sys.Net.WebServiceError.prototype={get_timedOut:function(){return this._timedOut},get_statusCode:function(){return this._statusCode},get_message:function(){return this._message},get_stackTrace:function(){return this._stackTrace},get_exceptionType:function(){return this._exceptionType}};Sys.Net.WebServiceError.registerClass("Sys.Net.WebServiceError");Type.registerNamespace("Sys.Services");Sys.Services._ProfileService=function(){Sys.Services._ProfileService.initializeBase(this);this.properties={}};Sys.Services._ProfileService.DefaultWebServicePath="";Sys.Services._ProfileService.prototype={_defaultLoadCompletedCallback:null,_defaultSaveCompletedCallback:null,_path:"",_timeout:0,get_defaultLoadCompletedCallback:function(){return this._defaultLoadCompletedCallback},set_defaultLoadCompletedCallback:function(a){this._defaultLoadCompletedCallback=a},get_defaultSaveCompletedCallback:function(){return this._defaultSaveCompletedCallback},set_defaultSaveCompletedCallback:function(a){this._defaultSaveCompletedCallback=a},get_path:function(){return this._path||""},load:function(c,d,e,f){var b,a;if(!c){a="GetAllPropertiesForCurrentUser";b={authenticatedUserOnly:false}}else{a="GetPropertiesForCurrentUser";b={properties:this._clonePropertyNames(c),authenticatedUserOnly:false}}this._invoke(this._get_path(),a,false,b,Function.createDelegate(this,this._onLoadComplete),Function.createDelegate(this,this._onLoadFailed),[d,e,f])},save:function(d,b,c,e){var a=this._flattenProperties(d,this.properties);this._invoke(this._get_path(),"SetPropertiesForCurrentUser",false,{values:a.value,authenticatedUserOnly:false},Function.createDelegate(this,this._onSaveComplete),Function.createDelegate(this,this._onSaveFailed),[b,c,e,a.count])},_clonePropertyNames:function(e){var c=[],d={};for(var b=0;b0)a.append(",");Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b[c],a,false,g)}a.append("]")}else{if(Date.isInstanceOfType(b)){a.append('"\\/Date(');a.append(b.getTime());a.append(')\\/"');break}var d=[],f=0;for(var e in b){if(e.startsWith("$"))continue;if(e===Sys.Serialization.JavaScriptSerializer._serverTypeFieldName&&f!==0){d[f++]=d[0];d[0]=e}else d[f++]=e}if(i)d.sort();a.append("{");var j=false;for(c=0;c + /// + /// + /// + /// + /// +}; +Sys.Mvc.InsertionMode.prototype = { + replace: 0, + insertBefore: 1, + insertAfter: 2 +} +Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode', false); + + +//////////////////////////////////////////////////////////////////////////////// +// Sys.Mvc.AjaxContext + +Sys.Mvc.AjaxContext = function Sys_Mvc_AjaxContext(request, updateTarget, loadingElement, insertionMode) { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + this._request = request; + this._updateTarget = updateTarget; + this._loadingElement = loadingElement; + this._insertionMode = insertionMode; +} +Sys.Mvc.AjaxContext.prototype = { + _insertionMode: 0, + _loadingElement: null, + _response: null, + _request: null, + _updateTarget: null, + + get_data: function Sys_Mvc_AjaxContext$get_data() { + /// + if (this._response) { + return this._response.get_responseData(); + } + else { + return null; + } + }, + + get_insertionMode: function Sys_Mvc_AjaxContext$get_insertionMode() { + /// + return this._insertionMode; + }, + + get_loadingElement: function Sys_Mvc_AjaxContext$get_loadingElement() { + /// + return this._loadingElement; + }, + + get_response: function Sys_Mvc_AjaxContext$get_response() { + /// + return this._response; + }, + set_response: function Sys_Mvc_AjaxContext$set_response(value) { + /// + this._response = value; + return value; + }, + + get_request: function Sys_Mvc_AjaxContext$get_request() { + /// + return this._request; + }, + + get_updateTarget: function Sys_Mvc_AjaxContext$get_updateTarget() { + /// + return this._updateTarget; + } +} + + +//////////////////////////////////////////////////////////////////////////////// +// Sys.Mvc.AsyncHyperlink + +Sys.Mvc.AsyncHyperlink = function Sys_Mvc_AsyncHyperlink() { +} +Sys.Mvc.AsyncHyperlink.handleClick = function Sys_Mvc_AsyncHyperlink$handleClick(anchor, evt, ajaxOptions) { + /// + /// + /// + /// + /// + /// + evt.preventDefault(); + Sys.Mvc.MvcHelpers._asyncRequest(anchor.href, 'post', '', anchor, ajaxOptions); +} + + +//////////////////////////////////////////////////////////////////////////////// +// Sys.Mvc.MvcHelpers + +Sys.Mvc.MvcHelpers = function Sys_Mvc_MvcHelpers() { +} +Sys.Mvc.MvcHelpers._serializeForm = function Sys_Mvc_MvcHelpers$_serializeForm(form) { + /// + /// + /// + var formElements = form.elements; + var formBody = new Sys.StringBuilder(); + var count = formElements.length; + for (var i = 0; i < count; i++) { + var element = formElements[i]; + var name = element.name; + if (!name || !name.length) { + continue; + } + var tagName = element.tagName.toUpperCase(); + if (tagName === 'INPUT') { + var inputElement = element; + var type = inputElement.type; + if ((type === 'text') || (type === 'password') || (type === 'hidden') || (((type === 'checkbox') || (type === 'radio')) && element.checked)) { + formBody.append(encodeURIComponent(name)); + formBody.append('='); + formBody.append(encodeURIComponent(inputElement.value)); + formBody.append('&'); + } + } + else if (tagName === 'SELECT') { + var selectElement = element; + var optionCount = selectElement.options.length; + for (var j = 0; j < optionCount; j++) { + var optionElement = selectElement.options[j]; + if (optionElement.selected) { + formBody.append(encodeURIComponent(name)); + formBody.append('='); + formBody.append(encodeURIComponent(optionElement.value)); + formBody.append('&'); + } + } + } + else if (tagName === 'TEXTAREA') { + formBody.append(encodeURIComponent(name)); + formBody.append('='); + formBody.append(encodeURIComponent((element.value))); + formBody.append('&'); + } + } + return formBody.toString(); +} +Sys.Mvc.MvcHelpers._asyncRequest = function Sys_Mvc_MvcHelpers$_asyncRequest(url, verb, body, triggerElement, ajaxOptions) { + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + if (ajaxOptions.confirm) { + if (!confirm(ajaxOptions.confirm)) { + return; + } + } + if (ajaxOptions.url) { + url = ajaxOptions.url; + } + if (ajaxOptions.httpMethod) { + verb = ajaxOptions.httpMethod; + } + if (body.length > 0 && !body.endsWith('&')) { + body += '&'; + } + body += 'X-Requested-With=XMLHttpRequest'; + var requestBody = ''; + if (verb.toUpperCase() === 'GET' || verb.toUpperCase() === 'DELETE') { + if (url.indexOf('?') > -1) { + if (!url.endsWith('&')) { + url += '&'; + } + url += body; + } + else { + url += '?'; + url += body; + } + } + else { + requestBody = body; + } + var request = new Sys.Net.WebRequest(); + request.set_url(url); + request.set_httpVerb(verb); + request.set_body(requestBody); + if (verb.toUpperCase() === 'PUT') { + request.get_headers()['Content-Type'] = 'application/x-www-form-urlencoded;'; + } + request.get_headers()['X-Requested-With'] = 'XMLHttpRequest'; + var updateElement = null; + if (ajaxOptions.updateTargetId) { + updateElement = $get(ajaxOptions.updateTargetId); + } + var loadingElement = null; + if (ajaxOptions.loadingElementId) { + loadingElement = $get(ajaxOptions.loadingElementId); + } + var ajaxContext = new Sys.Mvc.AjaxContext(request, updateElement, loadingElement, ajaxOptions.insertionMode); + var continueRequest = true; + if (ajaxOptions.onBegin) { + continueRequest = ajaxOptions.onBegin(ajaxContext) !== false; + } + if (loadingElement) { + Sys.UI.DomElement.setVisible(ajaxContext.get_loadingElement(), true); + } + if (continueRequest) { + request.add_completed(Function.createDelegate(null, function(executor) { + Sys.Mvc.MvcHelpers._onComplete(request, ajaxOptions, ajaxContext); + })); + request.invoke(); + } +} +Sys.Mvc.MvcHelpers._onComplete = function Sys_Mvc_MvcHelpers$_onComplete(request, ajaxOptions, ajaxContext) { + /// + /// + /// + /// + /// + /// + ajaxContext.set_response(request.get_executor()); + if (ajaxOptions.onComplete && ajaxOptions.onComplete(ajaxContext) === false) { + return; + } + var statusCode = ajaxContext.get_response().get_statusCode(); + if ((statusCode >= 200 && statusCode < 300) || statusCode === 304 || statusCode === 1223) { + if (statusCode !== 204 && statusCode !== 304 && statusCode !== 1223) { + var contentType = ajaxContext.get_response().getResponseHeader('Content-Type'); + if ((contentType) && (contentType.indexOf('application/x-javascript') !== -1)) { + eval(ajaxContext.get_data()); + } + else { + Sys.Mvc.MvcHelpers.updateDomElement(ajaxContext.get_updateTarget(), ajaxContext.get_insertionMode(), ajaxContext.get_data()); + } + } + if (ajaxOptions.onSuccess) { + ajaxOptions.onSuccess(ajaxContext); + } + } + else { + if (ajaxOptions.onFailure) { + ajaxOptions.onFailure(ajaxContext); + } + } + if (ajaxContext.get_loadingElement()) { + Sys.UI.DomElement.setVisible(ajaxContext.get_loadingElement(), false); + } +} +Sys.Mvc.MvcHelpers.updateDomElement = function Sys_Mvc_MvcHelpers$updateDomElement(target, insertionMode, content) { + /// + /// + /// + /// + /// + /// + if (target) { + switch (insertionMode) { + case Sys.Mvc.InsertionMode.replace: + target.innerHTML = content; + break; + case Sys.Mvc.InsertionMode.insertBefore: + if (content && content.length > 0) { + target.innerHTML = content + target.innerHTML.trimStart(); + } + break; + case Sys.Mvc.InsertionMode.insertAfter: + if (content && content.length > 0) { + target.innerHTML = target.innerHTML.trimEnd() + content; + } + break; + } + } +} + + +//////////////////////////////////////////////////////////////////////////////// +// Sys.Mvc.AsyncForm + +Sys.Mvc.AsyncForm = function Sys_Mvc_AsyncForm() { +} +Sys.Mvc.AsyncForm.handleSubmit = function Sys_Mvc_AsyncForm$handleSubmit(form, evt, ajaxOptions) { + /// + /// + /// + /// + /// + /// + evt.preventDefault(); + var body = Sys.Mvc.MvcHelpers._serializeForm(form); + Sys.Mvc.MvcHelpers._asyncRequest(form.action, form.method || 'post', body, form, ajaxOptions); +} + + +Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext'); +Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink'); +Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers'); +Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm'); + +// ---- Do not remove this footer ---- +// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) +// ----------------------------------- diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftMvcAjax.js b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftMvcAjax.js new file mode 100644 index 00000000..6d6a7e82 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/MicrosoftMvcAjax.js @@ -0,0 +1,23 @@ +//---------------------------------------------------------- +// Copyright (C) Microsoft Corporation. All rights reserved. +//---------------------------------------------------------- +// MicrosoftMvcAjax.js + +Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_AjaxOptions=function(){return {};} +Sys.Mvc.InsertionMode=function(){};Sys.Mvc.InsertionMode.prototype = {replace:0,insertBefore:1,insertAfter:2} +Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;} +Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}} +Sys.Mvc.AsyncHyperlink=function(){} +Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$1(anchor.href,'post','',anchor,ajaxOptions);} +Sys.Mvc.MvcHelpers=function(){} +Sys.Mvc.MvcHelpers.$0=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $3=0;$3<$2;$3++){var $4=$0[$3];var $5=$4.name;if(!$5||!$5.length){continue;}var $6=$4.tagName.toUpperCase();if($6==='INPUT'){var $7=$4;var $8=$7.type;if(($8==='text')||($8==='password')||($8==='hidden')||((($8==='checkbox')||($8==='radio'))&&$4.checked)){$1.append(encodeURIComponent($5));$1.append('=');$1.append(encodeURIComponent($7.value));$1.append('&');}}else if($6==='SELECT'){var $9=$4;var $A=$9.options.length;for(var $B=0;$B<$A;$B++){var $C=$9.options[$B];if($C.selected){$1.append(encodeURIComponent($5));$1.append('=');$1.append(encodeURIComponent($C.value));$1.append('&');}}}else if($6==='TEXTAREA'){$1.append(encodeURIComponent($5));$1.append('=');$1.append(encodeURIComponent(($4.value)));$1.append('&');}}return $1.toString();} +Sys.Mvc.MvcHelpers.$1=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0='';if($p1.toUpperCase()==='GET'||$p1.toUpperCase()==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$0=$p2;}var $1=new Sys.Net.WebRequest();$1.set_url($p0);$1.set_httpVerb($p1);$1.set_body($0);if($p1.toUpperCase()==='PUT'){$1.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$1.get_headers()['X-Requested-With']='XMLHttpRequest';var $2=null;if($p4.updateTargetId){$2=$get($p4.updateTargetId);}var $3=null;if($p4.loadingElementId){$3=$get($p4.loadingElementId);}var $4=new Sys.Mvc.AjaxContext($1,$2,$3,$p4.insertionMode);var $5=true;if($p4.onBegin){$5=$p4.onBegin($4)!==false;}if($3){Sys.UI.DomElement.setVisible($4.get_loadingElement(),true);}if($5){$1.add_completed(Function.createDelegate(null,function($p1_0){ +Sys.Mvc.MvcHelpers.$2($1,$p4,$4);}));$1.invoke();}} +Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}} +Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:target.innerHTML=content;break;case 1:if(content&&content.length>0){target.innerHTML=content+target.innerHTML.trimStart();}break;case 2:if(content&&content.length>0){target.innerHTML=target.innerHTML.trimEnd()+content;}break;}}} +Sys.Mvc.AsyncForm=function(){} +Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=Sys.Mvc.MvcHelpers.$0(form);Sys.Mvc.MvcHelpers.$1(form.action,form.method||'post',$0,form,ajaxOptions);} +Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm'); +// ---- Do not remove this footer ---- +// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) +// ----------------------------------- diff --git a/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/jquery-1.3.2-vsdoc.js b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/jquery-1.3.2-vsdoc.js new file mode 100644 index 00000000..27aefb87 --- /dev/null +++ b/SparkleShare/Windows/tools/gettext-cs-utils/Gettext.CsUtils/Samples/Gettext.Samples.Mvc/Scripts/jquery-1.3.2-vsdoc.js @@ -0,0 +1,6255 @@ +/* + * This file has been commented to support Visual Studio Intellisense. + * You should not use this file at runtime inside the browser--it is only + * intended to be used only for design-time IntelliSense. Please use the + * standard jQuery library for all production use. + * + * Comment version: 1.3.2a + */ + +/* + * jQuery JavaScript Library v1.3.2 + * + * Copyright (c) 2009 John Resig, http://jquery.com/ + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ + +(function(){ + +var + // Will speed up references to window, and allows munging its name. + window = this, + // Will speed up references to undefined, and allows munging its name. + undefined, + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + // Map over the $ in case of overwrite + _$ = window.$, + + jQuery = window.jQuery = window.$ = function(selector, context) { + /// + /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements. + /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML. + /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s). + /// 4: $(callback) - A shorthand for $(document).ready(). + /// + /// + /// 1: expression - An expression to search with. + /// 2: html - A string of HTML to create on the fly. + /// 3: elements - DOM element(s) to be encapsulated by a jQuery object. + /// 4: callback - The function to execute when the DOM is ready. + /// + /// + /// 1: context - A DOM Element, Document or jQuery to use as context. + /// + /// + /// The DOM node context originally passed to jQuery() (if none was passed then context will be equal to the document). + /// + /// + /// A selector representing selector originally passed to jQuery(). + /// + /// + + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context ); + }, + + // A simple way to check for HTML strings or ID strings + // (both of which we optimize for) + quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, + // Is it a simple selector + isSimple = /^.[^:#\[\.,]*$/; + +jQuery.fn = jQuery.prototype = { + init: function( selector, context ) { + /// + /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements. + /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML. + /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s). + /// 4: $(callback) - A shorthand for $(document).ready(). + /// + /// + /// 1: expression - An expression to search with. + /// 2: html - A string of HTML to create on the fly. + /// 3: elements - DOM element(s) to be encapsulated by a jQuery object. + /// 4: callback - The function to execute when the DOM is ready. + /// + /// + /// 1: context - A DOM Element, Document or jQuery to use as context. + /// + /// + + // Make sure that a selection was provided + selector = selector || document; + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this[0] = selector; + this.length = 1; + this.context = selector; + return this; + } + // Handle HTML strings + if (typeof selector === "string") { + // Are we dealing with HTML string or an ID? + var match = quickExpr.exec(selector); + + // Verify a match, and that no context was specified for #id + if (match && (match[1] || !context)) { + + // HANDLE: $(html) -> $(array) + if (match[1]) + selector = jQuery.clean([match[1]], context); + + // HANDLE: $("#id") + else { + var elem = document.getElementById(match[3]); + + // Handle the case where IE and Opera return items + // by name instead of ID + if (elem && elem.id != match[3]) + return jQuery().find(selector); + + // Otherwise, we inject the element directly into the jQuery object + var ret = jQuery(elem || []); + ret.context = document; + ret.selector = selector; + return ret; + } + + // HANDLE: $(expr, [context]) + // (which is just equivalent to: $(content).find(expr) + } else + return jQuery(context).find(selector); + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) + return jQuery( document ).ready( selector ); + + // Make sure that old selector state is passed along + if ( selector.selector && selector.context ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return this.setArray(jQuery.isArray( selector ) ? + selector : + jQuery.makeArray(selector)); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.3.2", + + // The number of elements contained in the matched element set + size: function() { + /// + /// The number of elements currently matched. + /// Part of Core + /// + /// + + return this.length; + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + /// + /// Access a single matched element. num is used to access the + /// Nth element matched. + /// Part of Core + /// + /// + /// + /// Access the element in the Nth position. + /// + + return num == undefined ? + + // Return a 'clean' array + Array.prototype.slice.call( this ) : + + // Return just the object + this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + /// + /// Set the jQuery object to an array of elements, while maintaining + /// the stack. + /// Part of Core + /// + /// + /// + /// An array of elements + /// + + // Build a new jQuery matched element set + var ret = jQuery( elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) + ret.selector = this.selector + (this.selector ? " " : "") + selector; + else if ( name ) + ret.selector = this.selector + "." + name + "(" + selector + ")"; + + // Return the newly-formed element set + return ret; + }, + + // Force the current matched set of elements to become + // the specified array of elements (destroying the stack in the process) + // You should use pushStack() in order to do this, but maintain the stack + setArray: function( elems ) { + /// + /// Set the jQuery object to an array of elements. This operation is + /// completely destructive - be sure to use .pushStack() if you wish to maintain + /// the jQuery stack. + /// Part of Core + /// + /// + /// + /// An array of elements + /// + + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + this.length = 0; + Array.prototype.push.apply( this, elems ); + + return this; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + /// + /// Execute a function within the context of every matched element. + /// This means that every time the passed-in function is executed + /// (which is once for every element matched) the 'this' keyword + /// points to the specific element. + /// Additionally, the function, when executed, is passed a single + /// argument representing the position of the element in the matched + /// set. + /// Part of Core + /// + /// + /// + /// A function to execute + /// + + return jQuery.each( this, callback, args ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + /// + /// Searches every matched element for the object and returns + /// the index of the element, if found, starting with zero. + /// Returns -1 if the object wasn't found. + /// Part of Core + /// + /// + /// + /// Object to search for + /// + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem && elem.jquery ? elem[0] : elem + , this ); + }, + + attr: function( name, value, type ) { + /// + /// Set a single property to a computed value, on all matched elements. + /// Instead of a value, a function is provided, that computes the value. + /// Part of DOM/Attributes + /// + /// + /// + /// The name of the property to set. + /// + /// + /// A function returning the value to set. + /// + + var options = name; + + // Look for the case where we're accessing a style value + if ( typeof name === "string" ) + if ( value === undefined ) + return this[0] && jQuery[ type || "attr" ]( this[0], name ); + + else { + options = {}; + options[ name ] = value; + } + + // Check to see if we're setting style values + return this.each(function(i){ + // Set all the styles + for ( name in options ) + jQuery.attr( + type ? + this.style : + this, + name, jQuery.prop( this, options[ name ], type, i, name ) + ); + }); + }, + + css: function( key, value ) { + /// + /// Set a single style property to a value, on all matched elements. + /// If a number is provided, it is automatically converted into a pixel value. + /// Part of CSS + /// + /// + /// + /// The name of the property to set. + /// + /// + /// The value to set the property to. + /// + + // ignore negative width and height values + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) + value = undefined; + return this.attr( key, value, "curCSS" ); + }, + + text: function( text ) { + /// + /// Set the text contents of all matched elements. + /// Similar to html(), but escapes HTML (replace "<" and ">" with their + /// HTML entities). + /// Part of DOM/Attributes + /// + /// + /// + /// The text value to set the contents of the element to. + /// + + if ( typeof text !== "object" && text != null ) + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); + + var ret = ""; + + jQuery.each( text || this, function(){ + jQuery.each( this.childNodes, function(){ + if ( this.nodeType != 8 ) + ret += this.nodeType != 1 ? + this.nodeValue : + jQuery.fn.text( [ this ] ); + }); + }); + + return ret; + }, + + wrapAll: function( html ) { + /// + /// Wrap all matched elements with a structure of other elements. + /// This wrapping process is most useful for injecting additional + /// stucture into a document, without ruining the original semantic + /// qualities of a document. + /// This works by going through the first element + /// provided and finding the deepest ancestor element within its + /// structure - it is that element that will en-wrap everything else. + /// This does not work with elements that contain text. Any necessary text + /// must be added after the wrapping is done. + /// Part of DOM/Manipulation + /// + /// + /// + /// A DOM element that will be wrapped around the target. + /// + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).clone(); + + if ( this[0].parentNode ) + wrap.insertBefore( this[0] ); + + wrap.map(function(){ + var elem = this; + + while ( elem.firstChild ) + elem = elem.firstChild; + + return elem; + }).append(this); + } + + return this; + }, + + wrapInner: function( html ) { + /// + /// Wraps the inner child contents of each matched elemenht (including text nodes) with an HTML structure. + /// + /// + /// A string of HTML or a DOM element that will be wrapped around the target contents. + /// + /// + + return this.each(function(){ + jQuery( this ).contents().wrapAll( html ); + }); + }, + + wrap: function( html ) { + /// + /// Wrap all matched elements with a structure of other elements. + /// This wrapping process is most useful for injecting additional + /// stucture into a document, without ruining the original semantic + /// qualities of a document. + /// This works by going through the first element + /// provided and finding the deepest ancestor element within its + /// structure - it is that element that will en-wrap everything else. + /// This does not work with elements that contain text. Any necessary text + /// must be added after the wrapping is done. + /// Part of DOM/Manipulation + /// + /// + /// + /// A DOM element that will be wrapped around the target. + /// + + return this.each(function(){ + jQuery( this ).wrapAll( html ); + }); + }, + + append: function() { + /// + /// Append content to the inside of every matched element. + /// This operation is similar to doing an appendChild to all the + /// specified elements, adding them into the document. + /// Part of DOM/Manipulation + /// + /// + /// + /// Content to append to the target + /// + + return this.domManip(arguments, true, function(elem){ + if (this.nodeType == 1) + this.appendChild( elem ); + }); + }, + + prepend: function() { + /// + /// Prepend content to the inside of every matched element. + /// This operation is the best way to insert elements + /// inside, at the beginning, of all matched elements. + /// Part of DOM/Manipulation + /// + /// + /// + /// Content to prepend to the target. + /// + + return this.domManip(arguments, true, function(elem){ + if (this.nodeType == 1) + this.insertBefore( elem, this.firstChild ); + }); + }, + + before: function() { + /// + /// Insert content before each of the matched elements. + /// Part of DOM/Manipulation + /// + /// + /// + /// Content to insert before each target. + /// + + return this.domManip(arguments, false, function(elem){ + this.parentNode.insertBefore( elem, this ); + }); + }, + + after: function() { + /// + /// Insert content after each of the matched elements. + /// Part of DOM/Manipulation + /// + /// + /// + /// Content to insert after each target. + /// + + return this.domManip(arguments, false, function(elem){ + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + }, + + end: function() { + /// + /// End the most recent 'destructive' operation, reverting the list of matched elements + /// back to its previous state. After an end operation, the list of matched elements will + /// revert to the last state of matched elements. + /// If there was no destructive operation before, an empty set is returned. + /// Part of DOM/Traversing + /// + /// + + return this.prevObject || jQuery( [] ); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: [].push, + sort: [].sort, + splice: [].splice, + + find: function( selector ) { + /// + /// Searches for all elements that match the specified expression. + /// This method is a good way to find additional descendant + /// elements with which to process. + /// All searching is done using a jQuery expression. The expression can be + /// written using CSS 1-3 Selector syntax, or basic XPath. + /// Part of DOM/Traversing + /// + /// + /// + /// An expression to search with. + /// + /// + + if ( this.length === 1 ) { + var ret = this.pushStack( [], "find", selector ); + ret.length = 0; + jQuery.find( selector, this[0], ret ); + return ret; + } else { + return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ + return jQuery.find( selector, elem ); + })), "find", selector ); + } + }, + + clone: function( events ) { + /// + /// Clone matched DOM Elements and select the clones. + /// This is useful for moving copies of the elements to another + /// location in the DOM. + /// Part of DOM/Manipulation + /// + /// + /// + /// (Optional) Set to false if you don't want to clone all descendant nodes, in addition to the element itself. + /// + + // Do the clone + var ret = this.map(function(){ + if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { + // IE copies events bound via attachEvent when + // using cloneNode. Calling detachEvent on the + // clone will also remove the events from the orignal + // In order to get around this, we use innerHTML. + // Unfortunately, this means some modifications to + // attributes in IE that are actually only stored + // as properties will not be copied (such as the + // the name attribute on an input). + var html = this.outerHTML; + if ( !html ) { + var div = this.ownerDocument.createElement("div"); + div.appendChild( this.cloneNode(true) ); + html = div.innerHTML; + } + + return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; + } else + return this.cloneNode(true); + }); + + // Copy the events from the original to the clone + if ( events === true ) { + var orig = this.find("*").andSelf(), i = 0; + + ret.find("*").andSelf().each(function(){ + if ( this.nodeName !== orig[i].nodeName ) + return; + + var events = jQuery.data( orig[i], "events" ); + + for ( var type in events ) { + for ( var handler in events[ type ] ) { + jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); + } + } + + i++; + }); + } + + // Return the cloned set + return ret; + }, + + filter: function( selector ) { + /// + /// Removes all elements from the set of matched elements that do not + /// pass the specified filter. This method is used to narrow down + /// the results of a search. + /// }) + /// Part of DOM/Traversing + /// + /// + /// + /// A function to use for filtering + /// + /// + + return this.pushStack( + jQuery.isFunction( selector ) && + jQuery.grep(this, function(elem, i){ + return selector.call( elem, i ); + }) || + + jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ + return elem.nodeType === 1; + }) ), "filter", selector ); + }, + + closest: function( selector ) { + /// + /// Get a set of elements containing the closest parent element that matches the specified selector, the starting element included. + /// + /// + /// + /// An expression to filter the elements with. + /// + /// + + var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, + closer = 0; + + return this.map(function(){ + var cur = this; + while ( cur && cur.ownerDocument ) { + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { + jQuery.data(cur, "closest", closer); + return cur; + } + cur = cur.parentNode; + closer++; + } + }); + }, + + not: function( selector ) { + /// + /// Removes any elements inside the array of elements from the set + /// of matched elements. This method is used to remove one or more + /// elements from a jQuery object. + /// Part of DOM/Traversing + /// + /// + /// A set of elements to remove from the jQuery set of matched elements. + /// + /// + + if ( typeof selector === "string" ) + // test special case where just one selector is passed in + if ( isSimple.test( selector ) ) + return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); + else + selector = jQuery.multiFilter( selector, this ); + + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; + return this.filter(function() { + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; + }); + }, + + add: function( selector ) { + /// + /// Adds one or more Elements to the set of matched elements. + /// Part of DOM/Traversing + /// + /// + /// One or more Elements to add + /// + /// + + return this.pushStack( jQuery.unique( jQuery.merge( + this.get(), + typeof selector === "string" ? + jQuery( selector ) : + jQuery.makeArray( selector ) + ))); + }, + + is: function( selector ) { + /// + /// Checks the current selection against an expression and returns true, + /// if at least one element of the selection fits the given expression. + /// Does return false, if no element fits or the expression is not valid. + /// filter(String) is used internally, therefore all rules that apply there + /// apply here, too. + /// Part of DOM/Traversing + /// + /// + /// + /// The expression with which to filter + /// + + return !!selector && jQuery.multiFilter( selector, this ).length > 0; + }, + + hasClass: function( selector ) { + /// + /// Checks the current selection against a class and returns whether at least one selection has a given class. + /// + /// The class to check against + /// True if at least one element in the selection has the class, otherwise false. + + return !!selector && this.is( "." + selector ); + }, + + val: function( value ) { + /// + /// Set the value of every matched element. + /// Part of DOM/Attributes + /// + /// + /// + /// Set the property to the specified value. + /// + + if ( value === undefined ) { + var elem = this[0]; + + if ( elem ) { + if( jQuery.nodeName( elem, 'option' ) ) + return (elem.attributes.value || {}).specified ? elem.value : elem.text; + + // We need to handle select boxes special + if ( jQuery.nodeName( elem, "select" ) ) { + var index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type == "select-one"; + + // Nothing was selected + if ( index < 0 ) + return null; + + // Loop through all the selected options + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { + var option = options[ i ]; + + if ( option.selected ) { + // Get the specifc value for the option + value = jQuery(option).val(); + + // We don't need an array for one selects + if ( one ) + return value; + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + } + + // Everything else, we just grab the value + return (elem.value || "").replace(/\r/g, ""); + + } + + return undefined; + } + + if ( typeof value === "number" ) + value += ''; + + return this.each(function(){ + if ( this.nodeType != 1 ) + return; + + if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) + this.checked = (jQuery.inArray(this.value, value) >= 0 || + jQuery.inArray(this.name, value) >= 0); + + else if ( jQuery.nodeName( this, "select" ) ) { + var values = jQuery.makeArray(value); + + jQuery( "option", this ).each(function(){ + this.selected = (jQuery.inArray( this.value, values ) >= 0 || + jQuery.inArray( this.text, values ) >= 0); + }); + + if ( !values.length ) + this.selectedIndex = -1; + + } else + this.value = value; + }); + }, + + html: function( value ) { + /// + /// Set the html contents of every matched element. + /// This property is not available on XML documents. + /// Part of DOM/Attributes + /// + /// + /// + /// Set the html contents to the specified value. + /// + + return value === undefined ? + (this[0] ? + this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : + null) : + this.empty().append( value ); + }, + + replaceWith: function( value ) { + /// + /// Replaces all matched element with the specified HTML or DOM elements. + /// + /// + /// The content with which to replace the matched elements. + /// + /// The element that was just replaced. + + return this.after( value ).remove(); + }, + + eq: function( i ) { + /// + /// Reduce the set of matched elements to a single element. + /// The position of the element in the set of matched elements + /// starts at 0 and goes to length - 1. + /// Part of Core + /// + /// + /// + /// pos The index of the element that you wish to limit to. + /// + + return this.slice( i, +i + 1 ); + }, + + slice: function() { + /// + /// Selects a subset of the matched elements. Behaves exactly like the built-in Array slice method. + /// + /// Where to start the subset (0-based). + /// Where to end the subset (not including the end element itself). + /// If omitted, ends at the end of the selection + /// The sliced elements + + return this.pushStack( Array.prototype.slice.apply( this, arguments ), + "slice", Array.prototype.slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + /// + /// This member is internal. + /// + /// + /// + + return this.pushStack( jQuery.map(this, function(elem, i){ + return callback.call( elem, i, elem ); + })); + }, + + andSelf: function() { + /// + /// Adds the previous selection to the current selection. + /// + /// + + return this.add( this.prevObject ); + }, + + domManip: function( args, table, callback ) { + /// + /// Args + /// + /// + /// Insert TBODY in TABLEs if one is not found. + /// + /// + /// If dir<0, process args in reverse order. + /// + /// + /// The function doing the DOM manipulation. + /// + /// + /// + /// Part of Core + /// + + if ( this[0] ) { + var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), + scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), + first = fragment.firstChild; + + if ( first ) + for ( var i = 0, l = this.length; i < l; i++ ) + callback.call( root(this[i], first), this.length > 1 || i > 0 ? + fragment.cloneNode(true) : fragment ); + + if ( scripts ) + jQuery.each( scripts, evalScript ); + } + + return this; + + function root( elem, cur ) { + return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? + (elem.getElementsByTagName("tbody")[0] || + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : + elem; + } + } +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +function evalScript( i, elem ) { + /// + /// This method is internal. + /// + /// + + if ( elem.src ) + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + + else + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + + if ( elem.parentNode ) + elem.parentNode.removeChild( elem ); +} + +function now(){ + /// + /// Gets the current date. + /// + /// The current date. + return +new Date; +} + +jQuery.extend = jQuery.fn.extend = function() { + /// + /// Extend one object with one or more others, returning the original, + /// modified, object. This is a great utility for simple inheritance. + /// jQuery.extend(settings, options); + /// var settings = jQuery.extend({}, defaults, options); + /// Part of JavaScript + /// + /// + /// The object to extend + /// + /// + /// The object that will be merged into the first. + /// + /// + /// (optional) More objects to merge into the first + /// + /// + + // copy reference to target object + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) + target = {}; + + // extend jQuery itself if only one argument is passed + if ( length == i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) + // Extend the base object + for ( var name in options ) { + var src = target[ name ], copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) + continue; + + // Recurse if we're merging object values + if ( deep && copy && typeof copy === "object" && !copy.nodeType ) + target[ name ] = jQuery.extend( deep, + // Never move original objects, clone them + src || ( copy.length != null ? [ ] : { } ) + , copy ); + + // Don't bring in undefined values + else if ( copy !== undefined ) + target[ name ] = copy; + + } + + // Return the modified object + return target; +}; + +// exclude the following css properties to add px +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, + // cache defaultView + defaultView = document.defaultView || {}, + toString = Object.prototype.toString; + +jQuery.extend({ + noConflict: function( deep ) { + /// + /// Run this function to give control of the $ variable back + /// to whichever library first implemented it. This helps to make + /// sure that jQuery doesn't conflict with the $ object + /// of other libraries. + /// By using this function, you will only be able to access jQuery + /// using the 'jQuery' variable. For example, where you used to do + /// $("div p"), you now must do jQuery("div p"). + /// Part of Core + /// + /// + + window.$ = _$; + + if ( deep ) + window.jQuery = _jQuery; + + return jQuery; + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + /// + /// Determines if the parameter passed is a function. + /// + /// The object to check + /// True if the parameter is a function; otherwise false. + + return toString.call(obj) === "[object Function]"; + }, + + isArray: function(obj) { + /// + /// Determine if the parameter passed is an array. + /// + /// Object to test whether or not it is an array. + /// True if the parameter is a function; otherwise false. + + return toString.call(obj) === "[object Array]"; + }, + + // check if an element is in a (or is an) XML document + isXMLDoc: function( elem ) { + /// + /// Determines if the parameter passed is an XML document. + /// + /// The object to test + /// True if the parameter is an XML document; otherwise false. + + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || + !!elem.ownerDocument && jQuery.isXMLDoc(elem.ownerDocument); + }, + + // Evalulates a script in a global context + globalEval: function( data ) { + /// + /// Internally evaluates a script in a global context. + /// + /// + + if ( data && /\S/.test(data) ) { + // Inspired by code by Andrea Giammarchi + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html + var head = document.getElementsByTagName("head")[0] || document.documentElement, + script = document.createElement("script"); + + script.type = "text/javascript"; + if ( jQuery.support.scriptEval ) + script.appendChild( document.createTextNode( data ) ); + else + script.text = data; + + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709). + head.insertBefore( script, head.firstChild ); + head.removeChild( script ); + } + }, + + nodeName: function( elem, name ) { + /// + /// Checks whether the specified element has the specified DOM node name. + /// + /// The element to examine + /// The node name to check + /// True if the specified node name matches the node's DOM node name; otherwise false + + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + /// + /// A generic iterator function, which can be used to seemlessly + /// iterate over both objects and arrays. This function is not the same + /// as $().each() - which is used to iterate, exclusively, over a jQuery + /// object. This function can be used to iterate over anything. + /// The callback has two arguments:the key (objects) or index (arrays) as first + /// the first, and the value as the second. + /// Part of JavaScript + /// + /// + /// The object, or array, to iterate over. + /// + /// + /// The function that will be executed on every object. + /// + /// + + var name, i = 0, length = object.length; + + if ( args ) { + if ( length === undefined ) { + for ( name in object ) + if ( callback.apply( object[ name ], args ) === false ) + break; + } else + for ( ; i < length; ) + if ( callback.apply( object[ i++ ], args ) === false ) + break; + + // A special, fast, case for the most common use of each + } else { + if ( length === undefined ) { + for ( name in object ) + if ( callback.call( object[ name ], name, object[ name ] ) === false ) + break; + } else + for ( var value = object[0]; + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} + } + + return object; + }, + + prop: function( elem, value, type, i, name ) { + /// + /// This method is internal. + /// + /// + // This member is not documented within the jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.prop + + // Handle executable functions + if ( jQuery.isFunction( value ) ) + value = value.call( elem, i ); + + // Handle passing in a number to a CSS property + return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? + value + "px" : + value; + }, + + className: { + // internal only, use addClass("class") + add: function( elem, classNames ) { + /// + /// Internal use only; use addClass('class') + /// + /// + + jQuery.each((classNames || "").split(/\s+/), function(i, className){ + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) + elem.className += (elem.className ? " " : "") + className; + }); + }, + + // internal only, use removeClass("class") + remove: function( elem, classNames ) { + /// + /// Internal use only; use removeClass('class') + /// + /// + + if (elem.nodeType == 1) + elem.className = classNames !== undefined ? + jQuery.grep(elem.className.split(/\s+/), function(className){ + return !jQuery.className.has( classNames, className ); + }).join(" ") : + ""; + }, + + // internal only, use hasClass("class") + has: function( elem, className ) { + /// + /// Internal use only; use hasClass('class') + /// + /// + + return elem && jQuery.inArray(className, (elem.className || elem).toString().split(/\s+/)) > -1; + } + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + /// + /// Swap in/out style options. + /// + + var old = {}; + // Remember the old values, and insert the new ones + for ( var name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + callback.call( elem ); + + // Revert the old values + for ( var name in options ) + elem.style[ name ] = old[ name ]; + }, + + css: function( elem, name, force, extra ) { + /// + /// This method is internal only. + /// + /// + // This method is undocumented in jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.css + + if ( name == "width" || name == "height" ) { + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; + + function getWH() { + val = name == "width" ? elem.offsetWidth : elem.offsetHeight; + + if ( extra === "border" ) + return; + + jQuery.each( which, function() { + if ( !extra ) + val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; + if ( extra === "margin" ) + val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; + else + val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; + }); + } + + if ( elem.offsetWidth !== 0 ) + getWH(); + else + jQuery.swap( elem, props, getWH ); + + return Math.max(0, Math.round(val)); + } + + return jQuery.curCSS( elem, name, force ); + }, + + curCSS: function( elem, name, force ) { + /// + /// This method is internal only. + /// + /// + // This method is undocumented in jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.curCSS + + var ret, style = elem.style; + + // We need to handle opacity special in IE + if ( name == "opacity" && !jQuery.support.opacity ) { + ret = jQuery.attr( style, "opacity" ); + + return ret == "" ? + "1" : + ret; + } + + // Make sure we're using the right name for getting the float value + if ( name.match( /float/i ) ) + name = styleFloat; + + if ( !force && style && style[ name ] ) + ret = style[ name ]; + + else if ( defaultView.getComputedStyle ) { + + // Only "float" is needed here + if ( name.match( /float/i ) ) + name = "float"; + + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); + + var computedStyle = defaultView.getComputedStyle( elem, null ); + + if ( computedStyle ) + ret = computedStyle.getPropertyValue( name ); + + // We should always get a number back from opacity + if ( name == "opacity" && ret == "" ) + ret = "1"; + + } else if ( elem.currentStyle ) { + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ + return letter.toUpperCase(); + }); + + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { + // Remember the original values + var left = style.left, rsLeft = elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + elem.runtimeStyle.left = elem.currentStyle.left; + style.left = ret || 0; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + elem.runtimeStyle.left = rsLeft; + } + } + + return ret; + }, + + clean: function( elems, context, fragment ) { + /// + /// This method is internal only. + /// + /// + // This method is undocumented in the jQuery API: http://docs.jquery.com/action/edit/Internals/jQuery.clean + + + context = context || document; + + // !context.createElement fails in IE with an error but returns typeof 'object' + if ( typeof context.createElement === "undefined" ) + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { + var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); + if ( match ) + return [ context.createElement( match[1] ) ]; + } + + var ret = [], scripts = [], div = context.createElement("div"); + + jQuery.each(elems, function(i, elem){ + if ( typeof elem === "number" ) + elem += ''; + + if ( !elem ) + return; + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? + all : + front + ">"; + }); + + // Trim whitespace, otherwise indexOf won't work as expected + var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); + + var wrap = + // option or optgroup + !tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && + [ 1, "", "
" ] || + + !tags.indexOf("", "" ] || + + // matched above + (!tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + // IE can't serialize and