/// <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> /// 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; } } }
private void btnGoogleDriveDirectLink_Click(object sender, EventArgs e) { InputMessageBox directLink = new InputMessageBox("Get GoogleDrive-directLink", "Insert your sharing-link", string.Empty, Resources.GoogleDrive128, false); directLink.ShowDialog(); if (Settings.Default.lastInputCorrect) { string link = Supporter.GetGoogleDriveDirectLink(Settings.Default.lastInputString); if (Settings.Default.lastInputCorrect) { DialogResult result = MessageBox.Show("Do you want to use this directlink as new fileURL?\r\nOtherwise it will be copied to your clipboard", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { Settings.Default.fileURL = link; } else { Clipboard.SetText(link); } } else { MessageBox.Show("There was an error with the sharinglink.\r\nYou will be redirected to a website...", "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error); Supporter.OpenBrowser("https://sites.google.com/site/gdocs2direct/"); } } }
/// <summary> /// Setzt die URL für die Datei aus dem Web /// </summary> public void SetFileURL() { InputMessageBox filePath = new InputMessageBox("URL of Token-File", "Insert your URL", Settings.Default.fileURL, Resources.Cloud128); filePath.ShowDialog(); if (Settings.Default.lastInputCorrect) { fileUrl = Settings.Default.lastInputString; Settings.Default.fileURL = fileUrl; Settings.Default.Save(); } }
/// <summary> /// Setzt das UserToken mit der gegebenen Option sich anzumelden /// </summary> /// <param name="withDefault"></param> public void SetUserToken() { Button btn = new Button() { Image = Resources.Login32, FlatStyle = FlatStyle.Flat, Visible = true }; InputMessageBox usertoken = new InputMessageBox("Usertoken", "Insert token-ID", Settings.Default.userToken, btn); usertoken.ShowDialog(); if (Settings.Default.lastInputCorrect) { UserToken = Settings.Default.lastInputString; Settings.Default.userToken = UserToken; Settings.Default.Save(); } }