private bool MakeSettingsFile() { string cfgstring = String.Empty; try { TextWriter tw = new StreamWriter(Program.GetPath() + @"\settings.cfg"); tw.WriteLine(cfgstring); tw.Close(); } catch (Exception ex) { ExceptionBox.ExceptionForm tmp = new ExceptionBox.ExceptionForm(ref ex); tmp.ShowDialog(); return(false); } return(true); }
private void BTN_Start_Click(object sender, EventArgs e) { BTN_Start.Enabled = false; BTN_Pause.Enabled = BTN_Stop.Enabled = true; textBox2.Clear(); string url = (string)Settings.Global.settings["UpdateURL"]; try { if (Directory.Exists(Settings.Global.settings["GameDirectory"].ToString())) { _downloader.LocalDirectory = Settings.Global.settings["GameDirectory"].ToString(); } else { textBox2.AppendText("WARNING - Save directory \"" + Settings.Global.settings["GameDirectory"].ToString() + "\" does not exist! Please check settings." + Environment.NewLine); _downloader.LocalDirectory = Program.GetPath(); } textBox2.AppendText("Saving files to '" + _downloader.LocalDirectory + "'" + Environment.NewLine); _downloader.Files.Clear(); textBox2.AppendText("Downloading manifest file..." + Environment.NewLine); string manifest = ReadWebPage(url + "/manifest.txt"); textBox2.AppendText(manifest); textBox2.Select(0, 0); foreach (string line in manifest.Split('\n')) { String trimmed = line.Trim(' ', '\r'); if (trimmed.Length > 0) { _downloader.Files.Add(new FileDownloader.FileInfo(url + "/" + trimmed)); } } _downloader.Start(); } catch (Exception ex) { ExceptionBox.ExceptionForm exb = new ExceptionBox.ExceptionForm(ref ex); exb.ShowDialog(this); } }
static public string SelectFile(string filter) { return(SelectFile(Program.GetPath(), filter)); }
static public string SelectFile() { return(SelectFile(Program.GetPath(), "All files (*.*)|*.*")); }
static public string SelectFolder() { return(SelectFolder(Program.GetPath())); }