create a link code on first start, then rename it after the user entered a name
This commit is contained in:
parent
43659919eb
commit
f0640f1982
|
@ -200,7 +200,14 @@ namespace SparkleShare {
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty (key_file_path)) {
|
if (!string.IsNullOrEmpty (key_file_path)) {
|
||||||
string public_key_file_path = key_file_path + ".pub";
|
string public_key_file_path = key_file_path + ".pub";
|
||||||
string link_code_file_path = Path.Combine (FoldersPath, CurrentUser.Name + "'s link code.txt");
|
string name = Program.Controller.CurrentUser.Name.Split (" ".ToCharArray ()) [0];
|
||||||
|
|
||||||
|
if (name.EndsWith ("s"))
|
||||||
|
name += "'";
|
||||||
|
else
|
||||||
|
name += "'s";
|
||||||
|
|
||||||
|
string link_code_file_path = Path.Combine (FoldersPath, name + " link code.txt");
|
||||||
|
|
||||||
// Create an easily accessible copy of the public
|
// Create an easily accessible copy of the public
|
||||||
// key in the user's SparkleShare folder
|
// key in the user's SparkleShare folder
|
||||||
|
@ -233,6 +240,21 @@ namespace SparkleShare {
|
||||||
if (FirstRun) {
|
if (FirstRun) {
|
||||||
ShowSetupWindow (PageType.Setup);
|
ShowSetupWindow (PageType.Setup);
|
||||||
|
|
||||||
|
new Thread (() => {
|
||||||
|
string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
|
||||||
|
string key_file_name = DateTime.Now.ToString ("yyyy-MM-dd HH\\hmm");
|
||||||
|
|
||||||
|
string [] key_pair = SparkleKeys.GenerateKeyPair (keys_path, key_file_name);
|
||||||
|
SparkleKeys.ImportPrivateKey (key_pair [0]);
|
||||||
|
|
||||||
|
string link_code_file_path = Path.Combine (Program.Controller.FoldersPath, "Your link code.txt");
|
||||||
|
|
||||||
|
// Create an easily accessible copy of the public
|
||||||
|
// key in the user's SparkleShare folder
|
||||||
|
File.Copy (key_pair [1], link_code_file_path, true);
|
||||||
|
|
||||||
|
}).Start ();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
new Thread (() => {
|
new Thread (() => {
|
||||||
CheckRepositories ();
|
CheckRepositories ();
|
||||||
|
|
|
@ -237,18 +237,19 @@ namespace SparkleShare {
|
||||||
Program.Controller.CurrentUser = new SparkleUser (full_name, email);
|
Program.Controller.CurrentUser = new SparkleUser (full_name, email);
|
||||||
|
|
||||||
new Thread (() => {
|
new Thread (() => {
|
||||||
string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
|
string link_code_file_path = Path.Combine (Program.Controller.FoldersPath, "Your link code.txt");
|
||||||
string key_file_name = DateTime.Now.ToString ("yyyy-MM-dd HH\\hmm");
|
|
||||||
|
|
||||||
string [] key_pair = SparkleKeys.GenerateKeyPair (keys_path, key_file_name);
|
if (File.Exists (link_code_file_path)) {
|
||||||
SparkleKeys.ImportPrivateKey (key_pair [0]);
|
string name = Program.Controller.CurrentUser.Name.Split (" ".ToCharArray ()) [0];
|
||||||
|
|
||||||
string link_code_file_path = Path.Combine (Program.Controller.FoldersPath,
|
if (name.EndsWith ("s"))
|
||||||
Program.Controller.CurrentUser.Name + "'s link code.txt");
|
name += "'";
|
||||||
|
else
|
||||||
|
name += "'s";
|
||||||
|
|
||||||
// Create an easily accessible copy of the public
|
string new_file_path = Path.Combine (Program.Controller.FoldersPath, name + " link code.txt");
|
||||||
// key in the user's SparkleShare folder
|
File.Move (link_code_file_path, new_file_path);
|
||||||
File.Copy (key_pair [1], link_code_file_path, true);
|
}
|
||||||
|
|
||||||
}).Start ();
|
}).Start ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue