convert tabs to space
This commit is contained in:
parent
c274e87019
commit
c0996c6569
|
@ -184,14 +184,15 @@ namespace SparkleLib {
|
|||
|
||||
if (File.Exists (identifier_path)) {
|
||||
Identifier = File.ReadAllText (identifier_path).Trim ();
|
||||
File.SetAttributes (identifier_path, FileAttributes.Hidden);
|
||||
|
||||
|
||||
} else {
|
||||
Identifier = CreateIdentifier ();
|
||||
File.WriteAllText (identifier_path, Identifier);
|
||||
|
||||
CreateInitialChangeSet ();
|
||||
}
|
||||
|
||||
File.SetAttributes (identifier_path, FileAttributes.Hidden);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ namespace SparkleLib {
|
|||
public class SparkleChange {
|
||||
|
||||
public SparkleChangeType Type;
|
||||
public DateTime Timestamp;
|
||||
public DateTime Timestamp;
|
||||
public bool IsFolder = false;
|
||||
|
||||
|
||||
public string Path;
|
||||
public string MovedToPath;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
}
|
||||
|
||||
.table-wrapper {
|
||||
padding: 64px 32px;
|
||||
padding: 64px 32px;
|
||||
}
|
||||
|
||||
td {
|
||||
|
|
|
@ -54,15 +54,15 @@ namespace SparkleShare {
|
|||
"under certain conditions. Please read the GNU GPLv3 for details." + n +
|
||||
n +
|
||||
"Usage: sparkleshare [start|stop|restart]");
|
||||
Console.WriteLine ("SparkleShare is already running.");
|
||||
Console.WriteLine ("SparkleShare is already running.");
|
||||
Environment.Exit (-1);
|
||||
}
|
||||
|
||||
// Only allow one instance of SparkleShare (on Windows)
|
||||
if (!program_mutex.WaitOne (0, false)) {
|
||||
Console.WriteLine ("SparkleShare is already running.");
|
||||
Environment.Exit (-1);
|
||||
}
|
||||
// Only allow one instance of SparkleShare (on Windows)
|
||||
if (!program_mutex.WaitOne (0, false)) {
|
||||
Console.WriteLine ("SparkleShare is already running.");
|
||||
Environment.Exit (-1);
|
||||
}
|
||||
|
||||
try {
|
||||
Controller = new SparkleController ();
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace SparkleShare {
|
|||
return message = string.Format (message, change_set.Changes [0].Path);
|
||||
|
||||
} else if (change_set.Changes.Count > 1) {
|
||||
message = string.Format (message, change_set.Changes [0].Path);
|
||||
message = string.Format (message, change_set.Changes [0].Path);
|
||||
return string.Format (message + " and {0} more", change_set.Changes.Count - 1);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -504,7 +504,7 @@ namespace SparkleShare {
|
|||
|
||||
string tmp_path = this.config.TmpPath;
|
||||
|
||||
if (!Directory.Exists (tmp_path)) {
|
||||
if (!Directory.Exists (tmp_path)) {
|
||||
Directory.CreateDirectory (tmp_path);
|
||||
File.SetAttributes (tmp_path, File.GetAttributes (tmp_path) | FileAttributes.Hidden);
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ namespace SparkleShare {
|
|||
|
||||
this.fetcher.Complete ();
|
||||
string canonical_name = Path.GetFileNameWithoutExtension (this.fetcher.RemoteUrl.AbsolutePath);
|
||||
canonical_name = canonical_name.Replace ("-crypto", "");
|
||||
canonical_name = canonical_name.Replace ("-crypto", "");
|
||||
|
||||
bool target_folder_exists = Directory.Exists (
|
||||
Path.Combine (this.config.FoldersPath, canonical_name));
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace SparkleShare {
|
|||
return IO.Path.Combine (PluginsPath, image_file_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool PathUsesLowerCase {
|
||||
get {
|
||||
string uses_lower_case = GetValue ("path", "uses_lower_case");
|
||||
|
|
|
@ -342,7 +342,7 @@ namespace SparkleShare {
|
|||
public void AddPageCompleted (string address, string remote_path)
|
||||
{
|
||||
SyncingFolder = Path.GetFileNameWithoutExtension (remote_path);
|
||||
SyncingFolder = SyncingFolder.Replace ("-crypto", "");
|
||||
SyncingFolder = SyncingFolder.Replace ("-crypto", "");
|
||||
ProgressBarPercentage = 1.0;
|
||||
|
||||
ChangePageEvent (PageType.Syncing, null);
|
||||
|
|
|
@ -117,8 +117,8 @@ namespace SparkleShare {
|
|||
Width = 318
|
||||
};
|
||||
|
||||
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
|
||||
SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
|
||||
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
|
||||
SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
|
||||
SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
|
||||
SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
|
||||
|
||||
|
@ -140,11 +140,11 @@ namespace SparkleShare {
|
|||
Canvas.SetLeft (credits, 294);
|
||||
Canvas.SetTop (credits, 142);
|
||||
|
||||
canvas.Children.Add (website_link);
|
||||
canvas.Children.Add (website_link);
|
||||
Canvas.SetLeft (website_link, 289);
|
||||
Canvas.SetTop (website_link, 222);
|
||||
|
||||
canvas.Children.Add (credits_link);
|
||||
canvas.Children.Add (credits_link);
|
||||
Canvas.SetLeft (credits_link, 289 + website_link.ActualWidth + 60);
|
||||
Canvas.SetTop (credits_link, 222);
|
||||
|
||||
|
@ -169,32 +169,32 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public class SparkleLink : Label {
|
||||
public class SparkleLink : Label {
|
||||
|
||||
public SparkleLink (string title, string url)
|
||||
{
|
||||
FontSize = 11;
|
||||
Cursor = Cursors.Hand;
|
||||
Foreground = new SolidColorBrush (Color.FromRgb (135, 178, 227));
|
||||
public SparkleLink (string title, string url)
|
||||
{
|
||||
FontSize = 11;
|
||||
Cursor = Cursors.Hand;
|
||||
Foreground = new SolidColorBrush (Color.FromRgb (135, 178, 227));
|
||||
|
||||
TextDecoration underline = new TextDecoration () {
|
||||
Pen = new Pen (new SolidColorBrush (Color.FromRgb (135, 178, 227)), 1),
|
||||
PenThicknessUnit = TextDecorationUnit.FontRecommended
|
||||
};
|
||||
TextDecoration underline = new TextDecoration () {
|
||||
Pen = new Pen (new SolidColorBrush (Color.FromRgb (135, 178, 227)), 1),
|
||||
PenThicknessUnit = TextDecorationUnit.FontRecommended
|
||||
};
|
||||
|
||||
TextDecorationCollection collection = new TextDecorationCollection ();
|
||||
collection.Add (underline);
|
||||
TextDecorationCollection collection = new TextDecorationCollection ();
|
||||
collection.Add (underline);
|
||||
|
||||
TextBlock text_block = new TextBlock () {
|
||||
Text = title,
|
||||
TextDecorations = collection
|
||||
};
|
||||
TextBlock text_block = new TextBlock () {
|
||||
Text = title,
|
||||
TextDecorations = collection
|
||||
};
|
||||
|
||||
Content = text_block;
|
||||
Content = text_block;
|
||||
|
||||
MouseUp += delegate {
|
||||
Program.Controller.OpenWebsite (url);
|
||||
};
|
||||
}
|
||||
}
|
||||
MouseUp += delegate {
|
||||
Program.Controller.OpenWebsite (url);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,17 +129,17 @@ namespace SparkleShare {
|
|||
public override bool CreateSparkleShareFolder ()
|
||||
{
|
||||
if (Directory.Exists (FoldersPath))
|
||||
return false;
|
||||
return false;
|
||||
|
||||
Directory.CreateDirectory (FoldersPath);
|
||||
File.SetAttributes (FoldersPath, File.GetAttributes (FoldersPath) | FileAttributes.System);
|
||||
|
||||
SparkleLogger.LogInfo ("Config", "Created '" + FoldersPath + "'");
|
||||
SparkleLogger.LogInfo ("Config", "Created '" + FoldersPath + "'");
|
||||
|
||||
string app_path = Path.GetDirectoryName (Forms.Application.ExecutablePath);
|
||||
string app_path = Path.GetDirectoryName (Forms.Application.ExecutablePath);
|
||||
string icon_file_path = Path.Combine (app_path, "Pixmaps", "sparkleshare-folder.ico");
|
||||
|
||||
if (!File.Exists (icon_file_path)) {
|
||||
if (!File.Exists (icon_file_path)) {
|
||||
string ini_file_path = Path.Combine (FoldersPath, "desktop.ini");
|
||||
|
||||
string ini_file = "[.ShellClassInfo]" +
|
||||
|
@ -147,20 +147,20 @@ namespace SparkleShare {
|
|||
"IconIndex=0" +
|
||||
"InfoTip=SparkleShare";
|
||||
|
||||
try {
|
||||
File.Create (ini_file_path).Close ();
|
||||
File.WriteAllText (ini_file_path, ini_file);
|
||||
|
||||
File.SetAttributes (ini_file_path,
|
||||
File.GetAttributes (ini_file_path) | FileAttributes.Hidden | FileAttributes.System);
|
||||
try {
|
||||
File.Create (ini_file_path).Close ();
|
||||
File.WriteAllText (ini_file_path, ini_file);
|
||||
|
||||
File.SetAttributes (ini_file_path,
|
||||
File.GetAttributes (ini_file_path) | FileAttributes.Hidden | FileAttributes.System);
|
||||
|
||||
} catch (IOException e) {
|
||||
SparkleLogger.LogInfo ("Config",
|
||||
"Failed setting icon for '" + FoldersPath + "': " + e.Message);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
SparkleLogger.LogInfo ("Config",
|
||||
"Failed setting icon for '" + FoldersPath + "': " + e.Message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -172,20 +172,20 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public override void OpenFolder (string path)
|
||||
{
|
||||
Process process = new Process ();
|
||||
process.StartInfo.FileName = "explorer";
|
||||
process.StartInfo.Arguments = path;
|
||||
|
||||
process.Start ();
|
||||
}
|
||||
public override void OpenFolder (string path)
|
||||
{
|
||||
Process process = new Process ();
|
||||
process.StartInfo.FileName = "explorer";
|
||||
process.StartInfo.Arguments = path;
|
||||
|
||||
process.Start ();
|
||||
}
|
||||
|
||||
|
||||
public override void OpenWebsite (string url)
|
||||
{
|
||||
Process.Start (new ProcessStartInfo (url));
|
||||
}
|
||||
public override void OpenWebsite (string url)
|
||||
{
|
||||
Process.Start (new ProcessStartInfo (url));
|
||||
}
|
||||
|
||||
|
||||
public override void Quit ()
|
||||
|
|
|
@ -117,10 +117,10 @@ namespace SparkleShare {
|
|||
"MouseClick", RoutingStrategy.Bubble, typeof (MouseButtonEventHandler), typeof (SparkleNotifyIcon));
|
||||
|
||||
public readonly RoutedEvent MouseDoubleClickEvent = EventManager.RegisterRoutedEvent(
|
||||
"MouseDoubleClick", RoutingStrategy.Bubble, typeof (MouseButtonEventHandler), typeof (SparkleNotifyIcon));
|
||||
"MouseDoubleClick", RoutingStrategy.Bubble, typeof (MouseButtonEventHandler), typeof (SparkleNotifyIcon));
|
||||
|
||||
public readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
||||
"Text", typeof(string), typeof (SparkleNotifyIcon), new PropertyMetadata (OnTextChanged));
|
||||
"Text", typeof(string), typeof (SparkleNotifyIcon), new PropertyMetadata (OnTextChanged));
|
||||
|
||||
|
||||
private string header_text;
|
||||
|
@ -154,7 +154,7 @@ namespace SparkleShare {
|
|||
// TODO:
|
||||
// - Use the image pointed to by image_path
|
||||
// - Find a way to use the prettier (Win7?) balloons
|
||||
this.notify_icon.ShowBalloonTip (5 * 1000, title, subtext, Forms.ToolTipIcon.Info);
|
||||
this.notify_icon.ShowBalloonTip (5 * 1000, title, subtext, Forms.ToolTipIcon.Info);
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,7 +241,7 @@ namespace SparkleShare {
|
|||
struct_pointer, typeof (MouseLLHook));
|
||||
|
||||
return new Point (mouse_hook.X, mouse_hook.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int OnMouseEventProc (int code, int button, IntPtr data_pointer)
|
||||
|
@ -277,7 +277,7 @@ namespace SparkleShare {
|
|||
GetModuleHandle (module.ModuleName), 0);
|
||||
}
|
||||
|
||||
if (this.mouse_hook_handle == 0)
|
||||
if (this.mouse_hook_handle == 0)
|
||||
throw new Win32Exception (Marshal.GetLastWin32Error ());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,172 +25,172 @@ using System.Windows.Forms;
|
|||
namespace SparkleShare {
|
||||
|
||||
public class Shortcut : IDisposable {
|
||||
|
||||
private IShellLinkW link;
|
||||
|
||||
public Shortcut ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void Create (string file_path, string target_path)
|
||||
{
|
||||
link = (IShellLinkW) new CShellLink ();
|
||||
this.link.SetShowCmd (1);
|
||||
this.link.SetPath (target_path);
|
||||
(this.link as IPersistFile).Save (file_path, true);
|
||||
}
|
||||
|
||||
|
||||
public void Dispose () {
|
||||
if (this.link == null )
|
||||
return;
|
||||
|
||||
Marshal.ReleaseComObject (this.link);
|
||||
this.link = null;
|
||||
}
|
||||
|
||||
|
||||
~Shortcut ()
|
||||
{
|
||||
Dispose ();
|
||||
}
|
||||
|
||||
|
||||
private IShellLinkW link;
|
||||
|
||||
public Shortcut ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void Create (string file_path, string target_path)
|
||||
{
|
||||
link = (IShellLinkW) new CShellLink ();
|
||||
this.link.SetShowCmd (1);
|
||||
this.link.SetPath (target_path);
|
||||
(this.link as IPersistFile).Save (file_path, true);
|
||||
}
|
||||
|
||||
|
||||
public void Dispose () {
|
||||
if (this.link == null )
|
||||
return;
|
||||
|
||||
Marshal.ReleaseComObject (this.link);
|
||||
this.link = null;
|
||||
}
|
||||
|
||||
|
||||
~Shortcut ()
|
||||
{
|
||||
Dispose ();
|
||||
}
|
||||
|
||||
|
||||
private class UnManagedMethods {
|
||||
[DllImport ("Shell32", CharSet = CharSet.Auto)]
|
||||
internal extern static int ExtractIconEx (
|
||||
[MarshalAs(UnmanagedType.LPTStr)] string lpszFile, int nIconIndex,
|
||||
IntPtr[] phIconLarge, IntPtr[] phIconSmall, int nIcons);
|
||||
|
||||
[DllImport ("user32")]
|
||||
internal static extern int DestroyIcon (IntPtr hIcon);
|
||||
}
|
||||
|
||||
|
||||
[StructLayoutAttribute (LayoutKind.Sequential, Pack = 4, Size = 0)]
|
||||
private struct _FILETIME {
|
||||
public uint dwLowDateTime;
|
||||
public uint dwHighDateTime;
|
||||
}
|
||||
|
||||
|
||||
[StructLayoutAttribute(LayoutKind.Sequential, Pack = 4, Size = 0, CharSet = CharSet.Unicode)]
|
||||
private struct _WIN32_FIND_DATAW {
|
||||
public uint dwFileAttributes;
|
||||
public _FILETIME ftCreationTime;
|
||||
public _FILETIME ftLastAccessTime;
|
||||
public _FILETIME ftLastWriteTime;
|
||||
public uint nFileSizeHigh;
|
||||
public uint nFileSizeLow;
|
||||
public uint dwReserved0;
|
||||
public uint dwReserved1;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr , SizeConst = 260)]
|
||||
public string cFileName;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
|
||||
public string cAlternateFileName;
|
||||
}
|
||||
|
||||
|
||||
[ComImportAttribute ()]
|
||||
[GuidAttribute ("0000010C-0000-0000-C000-000000000046")]
|
||||
[InterfaceTypeAttribute (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IPersist {
|
||||
[PreserveSig]
|
||||
void GetClassID (out Guid pClassID);
|
||||
}
|
||||
|
||||
|
||||
[ComImportAttribute ()]
|
||||
[GuidAttribute ("0000010B-0000-0000-C000-000000000046")]
|
||||
[InterfaceTypeAttribute (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IPersistFile {
|
||||
[PreserveSig]
|
||||
void GetClassID (out Guid pClassID);
|
||||
void IsDirty ();
|
||||
|
||||
void Load(
|
||||
[MarshalAs (UnmanagedType.LPWStr)] string pszFileName,
|
||||
uint dwMode);
|
||||
|
||||
void Save(
|
||||
[MarshalAs (UnmanagedType.LPWStr)] string pszFileName,
|
||||
[MarshalAs (UnmanagedType.Bool)] bool fRemember);
|
||||
|
||||
void SaveCompleted(
|
||||
[MarshalAs (UnmanagedType.LPWStr)] string pszFileName);
|
||||
|
||||
void GetCurFile (
|
||||
[MarshalAs (UnmanagedType.LPWStr)] out string ppszFileName);
|
||||
}
|
||||
|
||||
|
||||
[ComImportAttribute()]
|
||||
[GuidAttribute("000214F9-0000-0000-C000-000000000046")]
|
||||
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IShellLinkW
|
||||
{
|
||||
void GetPath(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
|
||||
int cchMaxPath,
|
||||
ref _WIN32_FIND_DATAW pfd,
|
||||
uint fFlags);
|
||||
|
||||
void GetIDList(out IntPtr ppidl);
|
||||
void SetIDList(IntPtr pidl);
|
||||
|
||||
void GetDescription(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
|
||||
int cchMaxName);
|
||||
|
||||
void SetDescription(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||
|
||||
void GetWorkingDirectory(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir,
|
||||
int cchMaxPath);
|
||||
|
||||
void SetWorkingDirectory(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszDir);
|
||||
|
||||
void GetArguments(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs,
|
||||
int cchMaxPath);
|
||||
|
||||
void SetArguments(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
|
||||
|
||||
void GetHotkey(out short pwHotkey);
|
||||
void SetHotkey(short pwHotkey);
|
||||
|
||||
void GetShowCmd(out uint piShowCmd);
|
||||
void SetShowCmd(uint piShowCmd);
|
||||
|
||||
void GetIconLocation(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath,
|
||||
int cchIconPath,
|
||||
out int piIcon);
|
||||
|
||||
void SetIconLocation(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszIconPath,
|
||||
int iIcon);
|
||||
|
||||
void SetRelativePath(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszPathRel,
|
||||
uint dwReserved);
|
||||
|
||||
void Resolve(IntPtr hWnd, uint fFlags);
|
||||
|
||||
void SetPath(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszFile);
|
||||
}
|
||||
private class UnManagedMethods {
|
||||
[DllImport ("Shell32", CharSet = CharSet.Auto)]
|
||||
internal extern static int ExtractIconEx (
|
||||
[MarshalAs(UnmanagedType.LPTStr)] string lpszFile, int nIconIndex,
|
||||
IntPtr[] phIconLarge, IntPtr[] phIconSmall, int nIcons);
|
||||
|
||||
[DllImport ("user32")]
|
||||
internal static extern int DestroyIcon (IntPtr hIcon);
|
||||
}
|
||||
|
||||
|
||||
[StructLayoutAttribute (LayoutKind.Sequential, Pack = 4, Size = 0)]
|
||||
private struct _FILETIME {
|
||||
public uint dwLowDateTime;
|
||||
public uint dwHighDateTime;
|
||||
}
|
||||
|
||||
|
||||
[StructLayoutAttribute(LayoutKind.Sequential, Pack = 4, Size = 0, CharSet = CharSet.Unicode)]
|
||||
private struct _WIN32_FIND_DATAW {
|
||||
public uint dwFileAttributes;
|
||||
public _FILETIME ftCreationTime;
|
||||
public _FILETIME ftLastAccessTime;
|
||||
public _FILETIME ftLastWriteTime;
|
||||
public uint nFileSizeHigh;
|
||||
public uint nFileSizeLow;
|
||||
public uint dwReserved0;
|
||||
public uint dwReserved1;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr , SizeConst = 260)]
|
||||
public string cFileName;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
|
||||
public string cAlternateFileName;
|
||||
}
|
||||
|
||||
|
||||
[ComImportAttribute ()]
|
||||
[GuidAttribute ("0000010C-0000-0000-C000-000000000046")]
|
||||
[InterfaceTypeAttribute (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IPersist {
|
||||
[PreserveSig]
|
||||
void GetClassID (out Guid pClassID);
|
||||
}
|
||||
|
||||
|
||||
[ComImportAttribute ()]
|
||||
[GuidAttribute ("0000010B-0000-0000-C000-000000000046")]
|
||||
[InterfaceTypeAttribute (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IPersistFile {
|
||||
[PreserveSig]
|
||||
void GetClassID (out Guid pClassID);
|
||||
void IsDirty ();
|
||||
|
||||
void Load(
|
||||
[MarshalAs (UnmanagedType.LPWStr)] string pszFileName,
|
||||
uint dwMode);
|
||||
|
||||
void Save(
|
||||
[MarshalAs (UnmanagedType.LPWStr)] string pszFileName,
|
||||
[MarshalAs (UnmanagedType.Bool)] bool fRemember);
|
||||
|
||||
void SaveCompleted(
|
||||
[MarshalAs (UnmanagedType.LPWStr)] string pszFileName);
|
||||
|
||||
void GetCurFile (
|
||||
[MarshalAs (UnmanagedType.LPWStr)] out string ppszFileName);
|
||||
}
|
||||
|
||||
|
||||
[ComImportAttribute()]
|
||||
[GuidAttribute("000214F9-0000-0000-C000-000000000046")]
|
||||
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IShellLinkW
|
||||
{
|
||||
void GetPath(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
|
||||
int cchMaxPath,
|
||||
ref _WIN32_FIND_DATAW pfd,
|
||||
uint fFlags);
|
||||
|
||||
void GetIDList(out IntPtr ppidl);
|
||||
void SetIDList(IntPtr pidl);
|
||||
|
||||
void GetDescription(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
|
||||
int cchMaxName);
|
||||
|
||||
void SetDescription(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||
|
||||
void GetWorkingDirectory(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir,
|
||||
int cchMaxPath);
|
||||
|
||||
void SetWorkingDirectory(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszDir);
|
||||
|
||||
void GetArguments(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs,
|
||||
int cchMaxPath);
|
||||
|
||||
void SetArguments(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
|
||||
|
||||
void GetHotkey(out short pwHotkey);
|
||||
void SetHotkey(short pwHotkey);
|
||||
|
||||
void GetShowCmd(out uint piShowCmd);
|
||||
void SetShowCmd(uint piShowCmd);
|
||||
|
||||
void GetIconLocation(
|
||||
[Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath,
|
||||
int cchIconPath,
|
||||
out int piIcon);
|
||||
|
||||
void SetIconLocation(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszIconPath,
|
||||
int iIcon);
|
||||
|
||||
void SetRelativePath(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszPathRel,
|
||||
uint dwReserved);
|
||||
|
||||
void Resolve(IntPtr hWnd, uint fFlags);
|
||||
|
||||
void SetPath(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszFile);
|
||||
}
|
||||
|
||||
|
||||
[GuidAttribute ("00021401-0000-0000-C000-000000000046")]
|
||||
[ClassInterfaceAttribute (ClassInterfaceType.None)]
|
||||
[ComImportAttribute ()]
|
||||
private class CShellLink {}
|
||||
}
|
||||
|
||||
[GuidAttribute ("00021401-0000-0000-C000-000000000046")]
|
||||
[ClassInterfaceAttribute (ClassInterfaceType.None)]
|
||||
[ComImportAttribute ()]
|
||||
private class CShellLink {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,11 @@ namespace SparkleShare {
|
|||
for (int y = 0; y < frames_in_height; y++) {
|
||||
for (int x = 0; x < frames_in_width; x++) {
|
||||
if (!(y == 0 && x == 0)) {
|
||||
CroppedBitmap crop = new CroppedBitmap (spinner_gallery,
|
||||
CroppedBitmap crop = new CroppedBitmap (spinner_gallery,
|
||||
new Int32Rect (size * x, size * y, size, size));
|
||||
|
||||
frames [i] = new Image ();
|
||||
frames [i].Source = crop;
|
||||
|
||||
frames [i] = new Image ();
|
||||
frames [i].Source = crop;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -59,18 +59,18 @@ namespace SparkleShare {
|
|||
};
|
||||
|
||||
this.timer.Elapsed += delegate {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
if (current_frame < frame_count - 1)
|
||||
current_frame++;
|
||||
else
|
||||
current_frame = 0;
|
||||
|
||||
Source = frames [current_frame].Source;
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
this.timer.Start ();
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
public SparkleStatusIcon ()
|
||||
{
|
||||
{
|
||||
this.syncing_idle_image = SparkleUIHelpers.GetBitmap ("process-syncing-idle");
|
||||
this.syncing_up_image = SparkleUIHelpers.GetBitmap ("process-syncing-up");
|
||||
this.syncing_down_image = SparkleUIHelpers.GetBitmap ("process-syncing-down");
|
||||
|
@ -61,9 +61,9 @@ namespace SparkleShare {
|
|||
this.notify_icon.HeaderText = "SparkleShare";
|
||||
|
||||
CreateMenu ();
|
||||
|
||||
Controller.UpdateIconEvent += delegate (IconState state) {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
|
||||
Controller.UpdateIconEvent += delegate (IconState state) {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
switch (state) {
|
||||
case IconState.Idle: {
|
||||
this.notify_icon.Icon = this.syncing_idle_image;
|
||||
|
@ -86,22 +86,22 @@ namespace SparkleShare {
|
|||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Controller.UpdateStatusItemEvent += delegate (string state_text) {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
this.state_item.Header = state_text;
|
||||
this.state_item.UpdateLayout ();
|
||||
this.notify_icon.HeaderText = "SparkleShare\n" + state_text;
|
||||
});
|
||||
};
|
||||
|
||||
Controller.UpdateMenuEvent += delegate (IconState state) {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
CreateMenu ();
|
||||
});
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Controller.UpdateStatusItemEvent += delegate (string state_text) {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
this.state_item.Header = state_text;
|
||||
this.state_item.UpdateLayout ();
|
||||
this.notify_icon.HeaderText = "SparkleShare\n" + state_text;
|
||||
});
|
||||
};
|
||||
|
||||
Controller.UpdateMenuEvent += delegate (IconState state) {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
CreateMenu ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.UpdateQuitItemEvent += delegate (bool item_enabled) {
|
||||
Dispatcher.BeginInvoke ((Action) delegate {
|
||||
|
@ -120,14 +120,14 @@ namespace SparkleShare {
|
|||
Header = Controller.StateText,
|
||||
IsEnabled = false
|
||||
};
|
||||
|
||||
this.notify_icon.HeaderText = "SparkleShare\n" + Controller.StateText;
|
||||
|
||||
this.notify_icon.HeaderText = "SparkleShare\n" + Controller.StateText;
|
||||
|
||||
Image folder_image = new Image () {
|
||||
Source = SparkleUIHelpers.GetImageSource ("sparkleshare-folder"),
|
||||
Source = SparkleUIHelpers.GetImageSource ("sparkleshare-folder"),
|
||||
Width = 16,
|
||||
Height = 16
|
||||
};
|
||||
Height = 16
|
||||
};
|
||||
|
||||
SparkleMenuItem folder_item = new SparkleMenuItem () {
|
||||
Header = "SparkleShare",
|
||||
|
@ -156,8 +156,8 @@ namespace SparkleShare {
|
|||
};
|
||||
|
||||
SparkleMenuItem notify_item = new SparkleMenuItem () {
|
||||
Header = "Notifications"
|
||||
};
|
||||
Header = "Notifications"
|
||||
};
|
||||
|
||||
CheckBox notify_check_box = new CheckBox () {
|
||||
Margin = new Thickness (6, 0, 0, 0),
|
||||
|
@ -166,11 +166,11 @@ namespace SparkleShare {
|
|||
|
||||
notify_item.Icon = notify_check_box;
|
||||
|
||||
notify_check_box.Click += delegate {
|
||||
this.context_menu.IsOpen = false;
|
||||
Program.Controller.ToggleNotifications ();
|
||||
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
|
||||
};
|
||||
notify_check_box.Click += delegate {
|
||||
this.context_menu.IsOpen = false;
|
||||
Program.Controller.ToggleNotifications ();
|
||||
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
|
||||
};
|
||||
|
||||
notify_item.Click += delegate {
|
||||
Program.Controller.ToggleNotifications ();
|
||||
|
@ -197,7 +197,7 @@ namespace SparkleShare {
|
|||
|
||||
this.context_menu.Items.Add (this.state_item);
|
||||
this.context_menu.Items.Add (new Separator ());
|
||||
this.context_menu.Items.Add (folder_item);
|
||||
this.context_menu.Items.Add (folder_item);
|
||||
|
||||
if (Controller.Folders.Length > 0) {
|
||||
int i = 0;
|
||||
|
@ -208,12 +208,12 @@ namespace SparkleShare {
|
|||
|
||||
subfolder_item.Click += OpenFolderDelegate (folder_name);
|
||||
|
||||
Image subfolder_image = new Image () {
|
||||
Source = SparkleUIHelpers.GetImageSource ("folder"),
|
||||
Width = 16,
|
||||
Height = 16
|
||||
};
|
||||
|
||||
Image subfolder_image = new Image () {
|
||||
Source = SparkleUIHelpers.GetImageSource ("folder"),
|
||||
Width = 16,
|
||||
Height = 16
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty (Controller.FolderErrors [i])) {
|
||||
subfolder_item.Icon = new Image () {
|
||||
Source = (BitmapSource) Imaging.CreateBitmapSourceFromHIcon (
|
||||
|
@ -228,20 +228,20 @@ namespace SparkleShare {
|
|||
};
|
||||
|
||||
subfolder_item.Items.Add (error_item);
|
||||
|
||||
} else {
|
||||
subfolder_item.Icon = subfolder_image;
|
||||
}
|
||||
|
||||
this.context_menu.Items.Add (subfolder_item);
|
||||
|
||||
} else {
|
||||
subfolder_item.Icon = subfolder_image;
|
||||
}
|
||||
|
||||
this.context_menu.Items.Add (subfolder_item);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
SparkleMenuItem more_item = new SparkleMenuItem () {
|
||||
}
|
||||
|
||||
SparkleMenuItem more_item = new SparkleMenuItem () {
|
||||
Header = "More projects"
|
||||
};
|
||||
|
||||
|
||||
i = 0;
|
||||
foreach (string folder_name in Controller.OverflowFolders) {
|
||||
SparkleMenuItem subfolder_item = new SparkleMenuItem () {
|
||||
|
@ -250,13 +250,13 @@ namespace SparkleShare {
|
|||
|
||||
subfolder_item.Click += OpenFolderDelegate (folder_name);
|
||||
|
||||
Image subfolder_image = new Image () {
|
||||
Source = SparkleUIHelpers.GetImageSource ("folder"),
|
||||
Width = 16,
|
||||
Height = 16
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty (Controller.OverflowFolderErrors [i])) {
|
||||
Image subfolder_image = new Image () {
|
||||
Source = SparkleUIHelpers.GetImageSource ("folder"),
|
||||
Width = 16,
|
||||
Height = 16
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty (Controller.OverflowFolderErrors [i])) {
|
||||
subfolder_item.Icon = new Image () {
|
||||
Source = (BitmapSource) Imaging.CreateBitmapSourceFromHIcon (
|
||||
System.Drawing.SystemIcons.Exclamation.Handle, Int32Rect.Empty,
|
||||
|
@ -270,34 +270,34 @@ namespace SparkleShare {
|
|||
};
|
||||
|
||||
subfolder_item.Items.Add (error_item);
|
||||
|
||||
} else {
|
||||
|
||||
} else {
|
||||
subfolder_item.Icon = subfolder_image;
|
||||
}
|
||||
|
||||
more_item.Items.Add (subfolder_item);
|
||||
}
|
||||
|
||||
more_item.Items.Add (subfolder_item);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (more_item.Items.Count > 0) {
|
||||
|
||||
if (more_item.Items.Count > 0) {
|
||||
this.context_menu.Items.Add (new Separator ());
|
||||
this.context_menu.Items.Add (more_item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.context_menu.Items.Add (new Separator ());
|
||||
this.context_menu.Items.Add (add_item);
|
||||
this.context_menu.Items.Add (this.log_item);
|
||||
this.context_menu.Items.Add (new Separator ());
|
||||
this.context_menu.Items.Add (notify_item);
|
||||
this.context_menu.Items.Add (new Separator ());
|
||||
this.context_menu.Items.Add (notify_item);
|
||||
this.context_menu.Items.Add (new Separator ());
|
||||
this.context_menu.Items.Add (about_item);
|
||||
this.context_menu.Items.Add (new Separator ());
|
||||
this.context_menu.Items.Add (this.exit_item);
|
||||
|
||||
this.notify_icon.ContextMenu = this.context_menu;
|
||||
|
||||
this.notify_icon.ContextMenu = this.context_menu;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ namespace SparkleShare {
|
|||
|
||||
public SparkleUI ()
|
||||
{
|
||||
// FIXME: The second time windows are shown, the windows
|
||||
// don't have the smooth ease in animation, but appear abruptly.
|
||||
// The ease out animation always seems to work
|
||||
// FIXME: The second time windows are shown, the windows
|
||||
// don't have the smooth ease in animation, but appear abruptly.
|
||||
// The ease out animation always seems to work
|
||||
Setup = new SparkleSetup ();
|
||||
EventLog = new SparkleEventLog ();
|
||||
About = new SparkleAbout ();
|
||||
|
|
|
@ -55,15 +55,15 @@ namespace SparkleShare {
|
|||
Stream image_stream = assembly.GetManifestResourceStream ("SparkleShare.Pixmaps." + name + ".png");
|
||||
return (Drawing.Bitmap) Drawing.Bitmap.FromStream (image_stream);
|
||||
}
|
||||
|
||||
|
||||
public static string GetHTML (string name)
|
||||
|
||||
|
||||
public static string GetHTML (string name)
|
||||
{
|
||||
Assembly assembly = Assembly.GetExecutingAssembly ();
|
||||
StreamReader html_reader = new StreamReader (
|
||||
assembly.GetManifestResourceStream ("SparkleShare.HTML." + name));
|
||||
assembly.GetManifestResourceStream ("SparkleShare.HTML." + name));
|
||||
|
||||
return html_reader.ReadToEnd ();
|
||||
return html_reader.ReadToEnd ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue