/// <summary> /// Setzt den Token-Datei-Pfad /// </summary> /// <param name="withDefault"></param> public void SetTokenPath(bool withDefault = false) { InputMessageBox filePath = new InputMessageBox("Path of Token-File", "Insert your filepath", Settings.Default.filePath, Resources.Document128, /*"Tokens.xml",*/ true); filePath.ShowDialog(); if (Settings.Default.lastInputCorrect) { TokenFilePath = Supporter.BuildPath(Settings.Default.lastInputString, Settings.Default.SettingUseJSON, "Tokens"); if (!File.Exists(TokenFilePath)) { if (Directory.Exists(Path.GetDirectoryName(TokenFilePath))) { File.Create(TokenFilePath); } else { HelpUser(0); return; } } Settings.Default.filePath = TokenFilePath; Settings.Default.Save(); } else { if (withDefault) { string path = Application.StartupPath + @"\Tokens.txt"; TokenFilePath = path; } } }
/// ------------------------------------------------------------------------------------------------------------------------ /// <summary> /// Read-Decider (Online/Offline) /// </summary> public void DecideArrays(bool startUp = true) { string path = Supporter.BuildPath(Settings.Default.filePath, Settings.Default.SettingUseJSON); if (!Settings.Default.SettingUseLocalFile) { try { Networker.DownloadFile(2, startUp); } catch (Exception) { Settings.Default.SettingUseLocalFile = true; DecideArrays(startUp); } } if (Settings.Default.SettingUseJSON) { TryReadJSONArrays(path); } else { TryReadArrays(path); } }
/// <summary> /// Setzt den Log-Datei-Pfad /// </summary> /// <param name="withDefault"></param> public void SetLogPath(bool withDefault = false) { InputMessageBox filePath = new InputMessageBox("Path of Log-File", "Insert your filepath", Settings.Default.logFilePath, Resources.Pencil128, /*"RequestLog.xml",*/ true); filePath.ShowDialog(); if (Settings.Default.lastInputCorrect) { LogFilePath = Supporter.BuildPath(Settings.Default.lastInputString, Settings.Default.SettingUseJSON, "RequestLog"); if (!File.Exists(LogFilePath)) { if (Directory.Exists(Path.GetDirectoryName(LogFilePath))) { File.Create(LogFilePath); } else { HelpUser(1); return; } } Settings.Default.logFilePath = LogFilePath; Settings.Default.Save(); } else { if (withDefault) { string path = Application.StartupPath + @"\RequestLog.txt"; LogFilePath = path; } } }
/// <summary> /// /// </summary> public string CheckDataMode(bool isJSON) { string path = TokenFilePath; if (Supporter.FileIsJSON(path) != isJSON) { Settings.Default.filePath = Supporter.BuildPath(path, isJSON); } CheckFiles(); return(Settings.Default.filePath); }