public static FuckingOAuthLogin load(Stream strum) { Dictionary <string, string> dick; BinaryFormatter boyfriend = new BinaryFormatter(); FuckingOAuthLogin retval; //Deserialize the dictionary storage try { dick = (Dictionary <string, string>)boyfriend.Deserialize(strum); } catch (InvalidCastException sEx) { throw new Exception("Stream deserialized not Dictionary<string, string>"); } //Attempt to extract the information try { retval = new FuckingOAuthLogin(dick["ConsumerKey"], dick["ConsumerSecret"], dick["Token"], dick["TokenSecret"]); retval.Authorized = bool.Parse(dick["Authorized"]); retval.BlogName = dick["BlogName"]; }catch (Exception sEx) { throw new Exception("Deserialized Dictionary<string, string> fails to contain bvalid login data"); } //Return the assembled FuckingOAuthLogin return(retval); }
private void btnRequestToken_Click(object sender, EventArgs e) { currentLogin = FuckingOAuthLogin.getToken("scKZ3jbMMZ08sDLFf4Ceg9njAGMX3XYDnDN6ma0eFMGJ64e1xf", "CMovNXhiReAHKA1JTU7DhME1FXwf0mx0MkzUdBqwYJnyFx5Z1R"); tbxToken.Text = currentLogin.Token; tbxTokenSecret.Text = currentLogin.TokenSecret; }
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; }