private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { //We have the file to open! Stream strum = openFileDialog1.OpenFile(); //Load the library to replace the program's current library Program.tslMain = TagSuggestionLibrary.load(strum); //Close the stream and clean up strum.Close(); }
private void btnReset_Click(object sender, EventArgs e) { //Open the library file Stream strum = File.OpenRead("main.tsl"); //Reload the library from it Program.tslMain = TagSuggestionLibrary.load(strum); //close the stream and clean up strum.Close(); //Reload the manager FormTSLManage_Load(null, null); //Clear the textbox of suggestions tbxTagsThen.Text = ""; }
private void Form1_Load(object sender, EventArgs e) { //TagSuggestionLibrary Initialization if (File.Exists("main.tsl")) { Stream filereadstream = File.OpenRead("main.tsl"); try { Program.tslMain = TagSuggestionLibrary.load(filereadstream); } catch (Exception sEx) { MessageBox.Show(sEx.Message); Program.tslMain = TagSuggestionLibrary.generate(); Stream filewritestream = File.OpenWrite("main.tsl"); Program.tslMain.write(filewritestream); filewritestream.Close(); } filereadstream.Close(); } else { Program.tslMain = TagSuggestionLibrary.generate(); Stream filewritestream = File.OpenWrite("main.tsl"); Program.tslMain.write(filewritestream); filewritestream.Close(); } //Login information if (File.Exists("logindata")) { Stream river = File.OpenRead("logindata"); try { Program.loginMain = FuckingOAuthLogin.load(river); } catch (Exception sEx) { MessageBox.Show(sEx.Message); (new LoginManager()).Show(); } river.Close(); } else { (new LoginManager()).Show(); } //Pixiv Login Data if (File.Exists("PixivPHPSESSID")) { Stream river = File.OpenRead("PixivPHPSESSID"); StreamReader riverRider = new StreamReader(river); PixivRetrieval.PixivCookie = riverRider.ReadToEnd(); tbxPHPSESSID.Text = PixivRetrieval.PixivCookie; river.Close(); } //Image box so it scales the image down for the correct size picbxTheImage.SizeMode = PictureBoxSizeMode.Zoom; //Set the tracker for the length of tumblr tags textbox to zero TumblrTagsLen = 0; }