diff --git a/SparkleShare/Common/BaseController.cs b/SparkleShare/Common/BaseController.cs
index 10333255..a31b9b5b 100644
--- a/SparkleShare/Common/BaseController.cs
+++ b/SparkleShare/Common/BaseController.cs
@@ -224,7 +224,7 @@ namespace SparkleShare {
// TODO: ToString() with nice os version names (Mac OS X Yosemite, Fedora 24, Ubuntu 16.04, etc.)
Logger.LogInfo ("Environment", InstallationInfo.OperatingSystem + " (" + Environment.OSVersion + ")");
- UserAuthenticationInfo = new SSHAuthenticationInfo();
+ UserAuthenticationInfo = new SSHAuthenticationInfo ();
SSHAuthenticationInfo.DefaultAuthenticationInfo = UserAuthenticationInfo;
Preset.PresetsPath = PresetsPath;
diff --git a/SparkleShare/Windows/About.cs b/SparkleShare/Windows/About.cs
index a0e2d2f0..af9f3991 100644
--- a/SparkleShare/Windows/About.cs
+++ b/SparkleShare/Windows/About.cs
@@ -17,13 +17,10 @@
using System;
using System.ComponentModel;
-using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Xaml;
namespace SparkleShare {
diff --git a/SparkleShare/Windows/Bubbles.cs b/SparkleShare/Windows/Bubbles.cs
index bac2a3b4..3e692768 100644
--- a/SparkleShare/Windows/Bubbles.cs
+++ b/SparkleShare/Windows/Bubbles.cs
@@ -15,8 +15,6 @@
// along with this program. If not, see .
-using System;
-
namespace SparkleShare {
public class Bubbles {
diff --git a/SparkleShare/Windows/Controller.cs b/SparkleShare/Windows/Controller.cs
index b34914ff..4fe2d868 100644
--- a/SparkleShare/Windows/Controller.cs
+++ b/SparkleShare/Windows/Controller.cs
@@ -16,18 +16,13 @@
using System;
-using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading;
using System.Windows;
using Forms = System.Windows.Forms;
-using Microsoft.Win32;
using Sparkles;
using Sparkles.Git;
@@ -59,8 +54,8 @@ namespace SparkleShare {
Environment.SetEnvironmentVariable ("HOME", Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
SSHCommand.SSHPath = Path.Combine (msysgit_path, "usr", "bin");
- SSHFetcher.SSHKeyScan = Path.Combine(msysgit_path, "usr", "bin", "ssh-keyscan.exe");
- GitCommand.GitPath = Path.Combine(msysgit_path, "bin", "git.exe");
+ SSHFetcher.SSHKeyScan = Path.Combine (msysgit_path, "usr", "bin", "ssh-keyscan.exe");
+ GitCommand.GitPath = Path.Combine (msysgit_path, "bin", "git.exe");
base.Initialize ();
}
@@ -90,12 +85,12 @@ namespace SparkleShare {
public override void SetFolderIcon ()
{
- string app_path = Path.GetDirectoryName(Forms.Application.ExecutablePath);
- string icon_file_path = Path.Combine(app_path, "Images", "sparkleshare-folder.ico");
+ string app_path = Path.GetDirectoryName (Forms.Application.ExecutablePath);
+ string icon_file_path = Path.Combine (app_path, "Images", "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_path = Path.Combine (FoldersPath, "desktop.ini");
string n = Environment.NewLine;
string ini_file = "[.ShellClassInfo]" + n +
@@ -105,16 +100,16 @@ namespace SparkleShare {
try
{
- File.Create(ini_file_path).Close();
- File.WriteAllText(ini_file_path, ini_file);
+ 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);
+ File.SetAttributes (ini_file_path,
+ File.GetAttributes (ini_file_path) | FileAttributes.Hidden | FileAttributes.System);
}
catch (IOException e)
{
- Logger.LogInfo("Config", "Failed setting icon for '" + FoldersPath + "': " + e.Message);
+ Logger.LogInfo ("Config", "Failed setting icon for '" + FoldersPath + "': " + e.Message);
}
}
}
@@ -158,10 +153,10 @@ namespace SparkleShare {
{
if (!Directory.Exists (FoldersPath))
{
- Directory.CreateDirectory(FoldersPath);
+ Directory.CreateDirectory (FoldersPath);
- File.SetAttributes(FoldersPath, File.GetAttributes(FoldersPath) | FileAttributes.System);
- Logger.LogInfo("Config", "Created '" + FoldersPath + "'");
+ File.SetAttributes (FoldersPath, File.GetAttributes(FoldersPath) | FileAttributes.System);
+ Logger.LogInfo ("Config", "Created '" + FoldersPath + "'");
}
}
diff --git a/SparkleShare/Windows/EventLog.cs b/SparkleShare/Windows/EventLog.cs
index c7d1213f..de38cff2 100644
--- a/SparkleShare/Windows/EventLog.cs
+++ b/SparkleShare/Windows/EventLog.cs
@@ -16,12 +16,9 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
-using System.Linq;
using System.Security.Permissions;
-using System.Text;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
diff --git a/SparkleShare/Windows/Setup.cs b/SparkleShare/Windows/Setup.cs
index 4064f0c7..33eef79a 100644
--- a/SparkleShare/Windows/Setup.cs
+++ b/SparkleShare/Windows/Setup.cs
@@ -17,23 +17,16 @@
using Sparkles;
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.IO;
-using System.Media;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
using System.Windows.Shell;
using Drawing = System.Drawing;
using Imaging = System.Windows.Interop.Imaging;
-using WPF = System.Windows.Controls;
namespace SparkleShare {
diff --git a/SparkleShare/Windows/Shortcut.cs b/SparkleShare/Windows/Shortcut.cs
index 763a6971..b889d5f4 100644
--- a/SparkleShare/Windows/Shortcut.cs
+++ b/SparkleShare/Windows/Shortcut.cs
@@ -16,11 +16,8 @@
using System;
-using System.ComponentModel;
-using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
-using System.Windows.Forms;
namespace SparkleShare {
diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs
deleted file mode 100644
index 24aa73ec..00000000
--- a/SparkleShare/Windows/SparkleEventLog.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// 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.ComponentModel;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Security.Permissions;
-using System.Threading;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-
-using Microsoft.Win32;
-using Shapes = System.Windows.Shapes;
-
-using SparkleLib;
-
-namespace SparkleShare {
-
- public class SparkleEventLog : Window {
-
- public SparkleEventLogController Controller = new SparkleEventLogController ();
-
- private Canvas canvas;
- private Label size_label_value;
- private Label history_label_value;
- private ComboBox combo_box;
- private WebBrowser web_browser;
- private SparkleSpinner spinner;
-
-
- public SparkleEventLog ()
- {
- Title = "Recent Changes";
- Height = 640;
- Width = 480;
- ResizeMode = ResizeMode.NoResize; // TODO
- Background = new SolidColorBrush (Color.FromRgb (240, 240, 240));
- AllowsTransparency = false;
- Icon = SparkleUIHelpers.GetImageSource ("sparkleshare-app", "ico");
-
- int x = (int) (SystemParameters.PrimaryScreenWidth * 0.61);
- int y = (int) (SystemParameters.PrimaryScreenHeight * 0.5 - (Height * 0.5));
-
- WindowStartupLocation = WindowStartupLocation.Manual;
- Left = x;
- Top = y;
-
- WriteOutImages ();
-
- Label size_label = new Label () {
- Content = "Size:",
- FontWeight = FontWeights.Bold
- };
-
- this.size_label_value = new Label () {
- Content = Controller.Size
- };
-
- size_label.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
- Rect size_label_rect = new Rect (size_label.DesiredSize);
-
- Label history_label = new Label () {
- Content = "History:",
- FontWeight = FontWeights.Bold
- };
-
- this.history_label_value = new Label () {
- Content = Controller.HistorySize,
- };
-
- history_label.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
- Rect history_label_rect = new Rect (history_label.DesiredSize);
-
- Shapes.Rectangle line = new Shapes.Rectangle () {
- Width = Width,
- Height = 1,
- Fill = new SolidColorBrush (Color.FromRgb (223, 223, 223))
- };
-
- Shapes.Rectangle background = new Shapes.Rectangle () {
- Width = Width,
- Height = Height,
- Fill = new SolidColorBrush (Color.FromRgb (250, 250, 250))
- };
-
- this.web_browser = new WebBrowser () {
- Width = Width - 6,
- Height = Height - 64
- };
-
- this.web_browser.ObjectForScripting = new SparkleScriptingObject ();
-
-
- spinner = new SparkleSpinner (22);
-
- // Disable annoying IE clicking sound
- CoInternetSetFeatureEnabled (21, 0x00000002, true);
-
-
- this.canvas = new Canvas ();
- Content = this.canvas;
-
- this.canvas.Children.Add (size_label);
- Canvas.SetLeft (size_label, 24);
- Canvas.SetTop (size_label, 4);
-
- this.canvas.Children.Add (this.size_label_value);
- Canvas.SetLeft (this.size_label_value, 22 + size_label_rect.Width);
- Canvas.SetTop (this.size_label_value, 4);
-
- this.canvas.Children.Add (history_label);
- Canvas.SetLeft (history_label, 130);
- Canvas.SetTop (history_label, 4);
-
- this.canvas.Children.Add (this.history_label_value);
- Canvas.SetLeft (this.history_label_value, 130 + history_label_rect.Width);
- Canvas.SetTop (this.history_label_value, 4);
-
- this.canvas.Children.Add (background);
- Canvas.SetLeft (background, 0);
- Canvas.SetTop (background, 36);
-
- this.canvas.Children.Add (spinner);
- Canvas.SetLeft (spinner, (Width / 2) - 15);
- Canvas.SetTop (spinner, (Height / 2) - 22);
-
- this.canvas.Children.Add (line);
- Canvas.SetLeft (line, 0);
- Canvas.SetTop (line, 35);
-
-
- Closing += Close;
-
- Controller.ShowWindowEvent += delegate {
- Dispatcher.BeginInvoke ((Action) delegate {
- Show ();
- Activate ();
- BringIntoView ();
- });
- };
-
- Controller.HideWindowEvent += delegate {
- Dispatcher.BeginInvoke ((Action) delegate {
- Hide ();
-
- if (this.canvas.Children.Contains (this.web_browser))
- this.canvas.Children.Remove (this.web_browser);
- });
- };
-
- Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) {
- Dispatcher.BeginInvoke ((Action) delegate {
- this.size_label_value.Content = size;
- this.size_label_value.UpdateLayout ();
-
- this.history_label_value.Content = history_size;
- this.history_label_value.UpdateLayout ();
- });
- };
-
- Controller.UpdateChooserEvent += delegate (string [] folders) {
- Dispatcher.BeginInvoke ((Action) delegate {
- UpdateChooser (folders);
- });
- };
-
- Controller.UpdateChooserEnablementEvent += delegate (bool enabled) {
- Dispatcher.BeginInvoke ((Action) delegate {
- this.combo_box.IsEnabled = enabled;
- });
- };
-
- Controller.UpdateContentEvent += delegate (string html) {
- Dispatcher.BeginInvoke ((Action) delegate {
- UpdateContent (html);
- });
- };
-
- Controller.ContentLoadingEvent += delegate {
- Dispatcher.BeginInvoke ((Action) delegate {
- this.spinner.Start ();
-
- if (this.canvas.Children.Contains (this.web_browser))
- this.canvas.Children.Remove (this.web_browser);
- });
- };
-
- Controller.ShowSaveDialogEvent += delegate (string file_name, string target_folder_path) {
- Dispatcher.BeginInvoke ((Action) delegate {
- SaveFileDialog dialog = new SaveFileDialog () {
- FileName = file_name,
- InitialDirectory = target_folder_path,
- Title = "Restore from History",
- DefaultExt = "." + Path.GetExtension (file_name),
- Filter = "All Files|*.*"
- };
-
- Nullable result = dialog.ShowDialog (this);
-
- if (result == true)
- Controller.SaveDialogCompleted (dialog.FileName);
- else
- Controller.SaveDialogCancelled ();
- });
- };
- }
-
-
- public void UpdateChooser (string [] folders)
- {
- if (folders == null)
- folders = Controller.Folders;
-
- if (this.combo_box != null)
- this.canvas.Children.Remove (this.combo_box);
-
- this.combo_box = new ComboBox () {
- Width = 160
- };
-
- ComboBoxItem item = new ComboBoxItem () {
- Content = "Summary"
- };
-
- this.combo_box.Items.Add (item);
- this.combo_box.Items.Add (new Separator ());
-
- this.combo_box.SelectedItem = combo_box.Items [0];
-
- int row = 2;
- foreach (string folder in folders) {
- this.combo_box.Items.Add (
- new ComboBoxItem () { Content = folder }
- );
-
- if (folder.Equals (Controller.SelectedFolder))
- this.combo_box.SelectedItem = combo_box.Items [row];
-
- row++;
- }
-
- this.combo_box.SelectionChanged += delegate {
- Dispatcher.BeginInvoke ((Action) delegate {
- int index = this.combo_box.SelectedIndex;
-
- if (index == 0)
- Controller.SelectedFolder = null;
- else
- Controller.SelectedFolder = (string)
- (this.combo_box.Items [index] as ComboBoxItem).Content;
- });
- };
-
- this.canvas.Children.Add (combo_box);
- Canvas.SetLeft (this.combo_box, Width - 24 - this.combo_box.Width);
- Canvas.SetTop (this.combo_box, 6);
- }
-
-
- public void UpdateContent (string html)
- {
- string pixmaps_path = Path.Combine (SparkleLib.SparkleConfig.DefaultConfig.TmpPath, "Images".SHA1 ());
- pixmaps_path = pixmaps_path.Replace ("\\", "/");
-
- html = html.Replace ("", "'Segoe UI', sans-serif");
- html = html.Replace ("", "13px");
- html = html.Replace ("", "12px");
- html = html.Replace ("", "#bbb");
- html = html.Replace ("", "#ddd");
- html = html.Replace ("", "90%");
- html = html.Replace ("", "#f5f5f5");
- html = html.Replace ("", "#0085cf");
- html = html.Replace ("", "#009ff8");
- html = html.Replace ("", pixmaps_path);
- html = html.Replace ("", pixmaps_path + "/document-added-12.png");
- html = html.Replace ("", pixmaps_path + "/document-edited-12.png");
- html = html.Replace ("", pixmaps_path + "/document-deleted-12.png");
- html = html.Replace ("", pixmaps_path + "/document-moved-12.png");
-
- this.spinner.Stop ();
-
- this.web_browser.ObjectForScripting = new SparkleScriptingObject ();
- this.web_browser.NavigateToString (html);
-
- if (!this.canvas.Children.Contains (this.web_browser)) {
- this.canvas.Children.Add (this.web_browser);
- Canvas.SetLeft (this.web_browser, 0);
- Canvas.SetTop (this.web_browser, 36);
- }
- }
-
-
- private void WriteOutImages ()
- {
- string tmp_path = SparkleLib.SparkleConfig.DefaultConfig.TmpPath;
- string pixmaps_path = Path.Combine (tmp_path, "Images".SHA1 ());
-
- if (!Directory.Exists (pixmaps_path)) {
- Directory.CreateDirectory (pixmaps_path);
-
- File.SetAttributes (tmp_path,
- File.GetAttributes (tmp_path) | FileAttributes.Hidden);
- }
-
- BitmapSource image = SparkleUIHelpers.GetImageSource ("user-icon-default");
- string file_path = Path.Combine (pixmaps_path, "user-icon-default.png");
-
- using (FileStream stream = new FileStream (file_path, FileMode.Create))
- {
- BitmapEncoder encoder = new PngBitmapEncoder ();
- encoder.Frames.Add (BitmapFrame.Create (image));
- encoder.Save (stream);
- }
-
- string [] actions = new string [] {"added", "deleted", "edited", "moved"};
-
- foreach (string action in actions) {
- image = SparkleUIHelpers.GetImageSource ("document-" + action + "-12");
- file_path = Path.Combine (pixmaps_path, "document-" + action + "-12.png");
-
- using (FileStream stream = new FileStream (file_path, FileMode.Create))
- {
- BitmapEncoder encoder = new PngBitmapEncoder ();
- encoder.Frames.Add (BitmapFrame.Create (image));
- encoder.Save (stream);
- }
- }
- }
-
-
- private void Close (object sender, CancelEventArgs args)
- {
- Controller.WindowClosed ();
- args.Cancel = true;
- }
-
-
- [DllImport ("urlmon.dll")]
- [PreserveSig]
- [return:MarshalAs (UnmanagedType.Error)]
- static extern int CoInternetSetFeatureEnabled (int feature,
- [MarshalAs (UnmanagedType.U4)] int flags, bool enable);
- }
-
-
- [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
- [ComVisible(true)]
- public class SparkleScriptingObject {
-
- public void LinkClicked (string url)
- {
- SparkleShare.UI.EventLog.Controller.LinkClicked (url);
- }
- }
-}
diff --git a/SparkleShare/Windows/SparkleUIHelpers.cs b/SparkleShare/Windows/SparkleUIHelpers.cs
index 640f17d3..7742bc64 100644
--- a/SparkleShare/Windows/SparkleUIHelpers.cs
+++ b/SparkleShare/Windows/SparkleUIHelpers.cs
@@ -18,8 +18,6 @@
using System;
using System.IO;
using System.Reflection;
-using System.Windows;
-using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
diff --git a/SparkleShare/Windows/UserInterface.cs b/SparkleShare/Windows/UserInterface.cs
index f8893625..9f73cdbd 100644
--- a/SparkleShare/Windows/UserInterface.cs
+++ b/SparkleShare/Windows/UserInterface.cs
@@ -55,7 +55,7 @@ namespace SparkleShare {
}
- public void Run ()
+ public void Run (string [] args)
{
Application.Run ();
StatusIcon.Dispose ();
diff --git a/Sparkles/Git/GitCommand.cs b/Sparkles/Git/GitCommand.cs
index 40d89462..0748dac5 100644
--- a/Sparkles/Git/GitCommand.cs
+++ b/Sparkles/Git/GitCommand.cs
@@ -15,7 +15,6 @@
// along with this program. If not, see .
using System;
using System.Globalization;
-using System.IO;
using System.Text.RegularExpressions;
namespace Sparkles.Git {
diff --git a/Sparkles/Git/GitFetcher.cs b/Sparkles/Git/GitFetcher.cs
index d7199760..63638be6 100644
--- a/Sparkles/Git/GitFetcher.cs
+++ b/Sparkles/Git/GitFetcher.cs
@@ -16,9 +16,7 @@
using System;
-using System.Globalization;
using System.IO;
-using System.Text.RegularExpressions;
using System.Threading;
namespace Sparkles.Git {
@@ -307,8 +305,6 @@ namespace Sparkles.Git {
string output = git_ls_remote.StartAndReadStandardOutput ();
- var a = git_ls_remote.StandardError.ReadToEnd();
-
if (git_ls_remote.ExitCode != 0)
return null;
@@ -426,9 +422,9 @@ namespace Sparkles.Git {
if (InstallationInfo.OperatingSystem == OS.Mac || InstallationInfo.OperatingSystem == OS.Windows) {
smudge_command = "env GIT_SSH_COMMAND='" + GIT_SSH_COMMAND + "' " +
- Path.Combine(Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace("\\", "/") + " smudge %f";
+ Path.Combine (Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace ("\\", "/") + " smudge %f";
- clean_command = Path.Combine (Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace("\\", "/") + " clean %f";
+ clean_command = Path.Combine (Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace ("\\", "/") + " clean %f";
} else {
smudge_command = "env GIT_SSH_COMMAND='" + GIT_SSH_COMMAND + "' git-lfs smudge %f";
diff --git a/Sparkles/Git/GitRepository.cs b/Sparkles/Git/GitRepository.cs
index 377197ea..96b3aa10 100644
--- a/Sparkles/Git/GitRepository.cs
+++ b/Sparkles/Git/GitRepository.cs
@@ -79,7 +79,7 @@ namespace Sparkles.Git {
git_config = new GitCommand (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\"");
git_config.StartAndWaitForExit ();
- git_config = new GitCommand(LocalPath, "config core.sshCommand " + SSHCommand.FormatGitSSHCommand(auth_info));
+ git_config = new GitCommand (LocalPath, "config core.sshCommand " + SSHCommand.FormatGitSSHCommand (auth_info));
git_config.StartAndWaitForExit();
}
@@ -211,7 +211,7 @@ namespace Sparkles.Git {
pre_push_hook_content =
"#!/bin/sh" + Environment.NewLine +
"env GIT_SSH_COMMAND='" + SSHCommand.FormatGitSSHCommand (auth_info) + "' " +
- Path.Combine(Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace("\\", "/") + " pre-push \"$@\"";
+ Path.Combine (Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace ("\\", "/") + " pre-push \"$@\"";
} else {
pre_push_hook_content =
diff --git a/Sparkles/SSHCommand.cs b/Sparkles/SSHCommand.cs
index 3f10905a..310ffec3 100644
--- a/Sparkles/SSHCommand.cs
+++ b/Sparkles/SSHCommand.cs
@@ -1,12 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO;
-namespace Sparkles
-{
+namespace Sparkles {
public class SSHCommand : Command
{
public static string SSHPath = "";