commit
dad6b2dae0
|
@ -205,14 +205,13 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
string version = InstallationInfo.Version;
|
string version = InstallationInfo.Version;
|
||||||
|
|
||||||
if (InstallationInfo.Directory.StartsWith ("/app", StringComparison.InvariantCulture))
|
if (InstallationInfo.IsFlatpak)
|
||||||
version += " (Flatpak)";
|
version += " (Flatpak)";
|
||||||
|
|
||||||
Logger.LogInfo ("Environment", "SparkleShare " + version);
|
Logger.LogInfo ("Environment", "SparkleShare " + version);
|
||||||
Logger.LogInfo ("Environment", "Git LFS " + Sparkles.Git.GitCommand.GitLFSVersion);
|
Logger.LogInfo ("Environment", "Git LFS " + Sparkles.Git.GitCommand.GitLFSVersion);
|
||||||
Logger.LogInfo ("Environment", "Git " + Sparkles.Git.GitCommand.GitVersion);
|
Logger.LogInfo ("Environment", "Git " + Sparkles.Git.GitCommand.GitVersion);
|
||||||
|
|
||||||
// TODO: Nice OS version names for Linux (Fedora 24, Ubuntu 16.04, etc.)
|
|
||||||
if (InstallationInfo.OperatingSystem == OS.Mac)
|
if (InstallationInfo.OperatingSystem == OS.Mac)
|
||||||
Logger.LogInfo ("Environment", InstallationInfo.MacOSVersion ());
|
Logger.LogInfo ("Environment", InstallationInfo.MacOSVersion ());
|
||||||
else
|
else
|
||||||
|
@ -641,10 +640,9 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
this.fetcher.EnableFetchedRepoCrypto (password);
|
this.fetcher.EnableFetchedRepoCrypto (password);
|
||||||
FinishFetcher (StorageType.Encrypted);
|
FinishFetcher (StorageType.Encrypted);
|
||||||
} // TODO: make this the main method. password optional. need to know storage type before Complete to allow crypto in lfs
|
}
|
||||||
// Make sure IsCryptoPasswordCorrect works with SparkleShare.txt checkout and LFS
|
|
||||||
|
|
||||||
|
|
||||||
public void FinishFetcher (StorageType selected_storage_type)
|
public void FinishFetcher (StorageType selected_storage_type)
|
||||||
{
|
{
|
||||||
this.watcher.EnableRaisingEvents = false;
|
this.watcher.EnableRaisingEvents = false;
|
||||||
|
@ -655,17 +653,17 @@ namespace SparkleShare {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
|
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.LogInfo ("Controller", "Error moving directory, trying again...", e);
|
Logger.LogInfo ("Controller", "Error moving directory, trying again...", e);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ClearDirectoryAttributes (this.fetcher.TargetFolder);
|
ClearDirectoryAttributes (this.fetcher.TargetFolder);
|
||||||
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
|
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
|
||||||
|
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
Logger.LogInfo ("Controller", "Error moving directory", x);
|
Logger.LogInfo ("Controller", "Error moving directory", x);
|
||||||
|
|
||||||
this.fetcher.Dispose ();
|
this.fetcher.Dispose ();
|
||||||
this.fetcher = null;
|
this.fetcher = null;
|
||||||
this.watcher.EnableRaisingEvents = true;
|
this.watcher.EnableRaisingEvents = true;
|
||||||
|
@ -674,7 +672,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
string backend = BaseFetcher.GetBackend (this.fetcher.RemoteUrl.ToString ());
|
string backend = BaseFetcher.GetBackend (this.fetcher.RemoteUrl.ToString ());
|
||||||
|
|
||||||
Config.AddFolder (target_folder_name, identifier, this.fetcher.RemoteUrl.ToString (), backend);
|
Config.AddFolder (target_folder_name, identifier, this.fetcher.RemoteUrl.ToString (), backend);
|
||||||
|
|
||||||
if (this.fetcher.FetchedRepoStorageType != StorageType.Plain) {
|
if (this.fetcher.FetchedRepoStorageType != StorageType.Plain) {
|
||||||
|
|
|
@ -536,7 +536,6 @@ namespace SparkleShare {
|
||||||
string folder_name = Path.GetFileName (PreviousPath);
|
string folder_name = Path.GetFileName (PreviousPath);
|
||||||
folder_name = folder_name.ReplaceUnderscoreWithSpace ();
|
folder_name = folder_name.ReplaceUnderscoreWithSpace ();
|
||||||
|
|
||||||
// TODO: Open SparkleShare/$HOST
|
|
||||||
SparkleShare.Controller.OpenSparkleShareFolder (folder_name);
|
SparkleShare.Controller.OpenSparkleShareFolder (folder_name);
|
||||||
FinishPageCompleted ();
|
FinishPageCompleted ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ namespace SparkleShare
|
||||||
Setup.Application = application;
|
Setup.Application = application;
|
||||||
EventLog.Application = application;
|
EventLog.Application = application;
|
||||||
About.Application = application;
|
About.Application = application;
|
||||||
|
Note.Application = application;
|
||||||
|
|
||||||
SparkleShare.Controller.UIHasLoaded ();
|
SparkleShare.Controller.UIHasLoaded ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Sparkles {
|
||||||
public string ToMessage ()
|
public string ToMessage ()
|
||||||
{
|
{
|
||||||
string message = "added: {0}";
|
string message = "added: {0}";
|
||||||
|
|
||||||
switch (Changes [0].Type) {
|
switch (Changes [0].Type) {
|
||||||
case ChangeType.Edited: message = "edited: {0}"; break;
|
case ChangeType.Edited: message = "edited: {0}"; break;
|
||||||
case ChangeType.Deleted: message = "deleted: {0}"; break;
|
case ChangeType.Deleted: message = "deleted: {0}"; break;
|
||||||
|
@ -64,7 +64,7 @@ namespace Sparkles {
|
||||||
public ChangeType Type;
|
public ChangeType Type;
|
||||||
public DateTime Timestamp;
|
public DateTime Timestamp;
|
||||||
public bool IsFolder;
|
public bool IsFolder;
|
||||||
|
|
||||||
public string Path;
|
public string Path;
|
||||||
public string MovedToPath;
|
public string MovedToPath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace Sparkles {
|
namespace Sparkles {
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ namespace Sparkles {
|
||||||
public readonly string FilePath;
|
public readonly string FilePath;
|
||||||
public readonly string TmpPath;
|
public readonly string TmpPath;
|
||||||
public readonly string BinPath;
|
public readonly string BinPath;
|
||||||
|
|
||||||
public readonly string LogFilePath;
|
public readonly string LogFilePath;
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,11 +117,10 @@ namespace Sparkles {
|
||||||
CreateInitialConfig ();
|
CreateInitialConfig ();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new XmlException (FilePath + " does not contain a valid config XML structure.");
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
Load (FilePath);
|
|
||||||
TmpPath = Path.Combine (DirectoryPath, "tmp");
|
TmpPath = Path.Combine (DirectoryPath, "tmp");
|
||||||
Directory.CreateDirectory (TmpPath);
|
Directory.CreateDirectory (TmpPath);
|
||||||
}
|
}
|
||||||
|
@ -138,17 +139,16 @@ namespace Sparkles {
|
||||||
user_name = user_name.TrimEnd (',');
|
user_name = user_name.TrimEnd (',');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Don't do this manually
|
XElement xml =
|
||||||
string n = Environment.NewLine;
|
new XElement ("sparkleshare",
|
||||||
File.WriteAllText (FilePath,
|
new XElement ("user",
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + n +
|
new XElement ("name", user_name),
|
||||||
"<sparkleshare>" + n +
|
new XElement ("email", "Unknown")
|
||||||
" <user>" + n +
|
),
|
||||||
" <name>" + user_name + "</name>" + n +
|
new XElement ("notifications", bool.TrueString)
|
||||||
" <email>Unknown</email>" + n +
|
);
|
||||||
" </user>" + n +
|
|
||||||
" <notifications>True</notifications>" + n +
|
LoadXml (xml.ToString ());
|
||||||
"</sparkleshare>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,9 +351,6 @@ namespace Sparkles {
|
||||||
|
|
||||||
void Save ()
|
void Save ()
|
||||||
{
|
{
|
||||||
if (!File.Exists (FilePath))
|
|
||||||
throw new FileNotFoundException (FilePath + " does not exist");
|
|
||||||
|
|
||||||
Save (FilePath);
|
Save (FilePath);
|
||||||
Logger.LogInfo ("Config", "Wrote to '" + FilePath + "'");
|
Logger.LogInfo ("Config", "Wrote to '" + FilePath + "'");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
using IO = System.IO;
|
using IO = System.IO;
|
||||||
|
|
||||||
|
@ -80,33 +81,31 @@ namespace Sparkles {
|
||||||
if (IO.File.Exists (preset_path))
|
if (IO.File.Exists (preset_path))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// TODO: Don't write manually
|
string icon_name = "own-server.png";
|
||||||
string preset_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
|
||||||
"<sparkleshare>" +
|
|
||||||
" <preset>" +
|
|
||||||
" <info>" +
|
|
||||||
" <name>" + name + "</name>" +
|
|
||||||
" <description>" + description + "</description>" +
|
|
||||||
" <icon>own-server.png</icon>" +
|
|
||||||
" </info>" +
|
|
||||||
" <address>" +
|
|
||||||
" <value>" + address_value + "</value>" +
|
|
||||||
" <example>" + address_example + "</example>" +
|
|
||||||
" </address>" +
|
|
||||||
" <path>" +
|
|
||||||
" <value>" + path_value + "</value>" +
|
|
||||||
" <example>" + path_example + "</example>" +
|
|
||||||
" </path>" +
|
|
||||||
" </preset>" +
|
|
||||||
"</sparkleshare>";
|
|
||||||
|
|
||||||
preset_xml = preset_xml.Replace ("<value></value>", "<value/>");
|
XElement xml =
|
||||||
preset_xml = preset_xml.Replace ("<example></example>", "<example/>");
|
new XElement ("sparkleshare",
|
||||||
|
new XElement ("preset",
|
||||||
|
new XElement ("info",
|
||||||
|
new XElement ("name", name),
|
||||||
|
new XElement ("description", description),
|
||||||
|
new XElement ("icon", icon_name)
|
||||||
|
),
|
||||||
|
new XElement ("address",
|
||||||
|
new XElement ("value", address_value),
|
||||||
|
new XElement ("example", address_example)
|
||||||
|
),
|
||||||
|
new XElement ("path",
|
||||||
|
new XElement ("value", path_value),
|
||||||
|
new XElement ("example", path_example)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (!IO.Directory.Exists (LocalPresetsPath))
|
if (!IO.Directory.Exists (LocalPresetsPath))
|
||||||
IO.Directory.CreateDirectory (LocalPresetsPath);
|
IO.Directory.CreateDirectory (LocalPresetsPath);
|
||||||
|
|
||||||
IO.File.WriteAllText (preset_path, preset_xml);
|
IO.File.WriteAllText (preset_path, xml.ToString ());
|
||||||
return new Preset (preset_path);
|
return new Preset (preset_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AuthenticationInfo.cs" />
|
<Compile Include="AuthenticationInfo.cs" />
|
||||||
|
|
Loading…
Reference in a new issue