private string getFromBase64(string in_string) { string v_ret = in_string; if (Convertion.isBase64(v_ret)) //(v_ret.IndexOf(" ") == -1 && v_ret.IndexOf("\t") == -1 && v_ret.IndexOf("\n") == -1 && v_ret.IndexOf(";") == -1 && v_ret.IndexOf(":") == -1 && v_ret.IndexOf(".") == -1 && v_ret.IndexOf("?") == -1 && v_ret.IndexOf("!") == -1 && v_ret.IndexOf("{") == -1 && v_ret.IndexOf("}") == -1 && v_ret.IndexOf("[") == -1 && v_ret.IndexOf("]") == -1 && v_ret.IndexOf("(") == -1 && v_ret.IndexOf(")") == -1 && v_ret.IndexOf("_") == -1 && v_ret.IndexOf("-") == -1) { try { v_ret = Convertion.FromBase64(v_ret); } catch { } } return(v_ret); }
private void timer1_Tick(object sender, System.EventArgs e) { try { IDataObject dObj; string v_val = ""; string v_key = ""; dObj = Clipboard.GetDataObject(); if (dObj.GetDataPresent(DataFormats.Text)) { v_val = dObj.GetData(DataFormats.Text).ToString();//.Replace("\n", " ");//.Replace("\u000A", " ").Replace("\u000D", " "); string o_val = v_val; v_key = v_val.Replace("\n", " ").Replace("\u000A", " ").Replace("\u000D", " ").Replace("\t", " "); while (v_key.IndexOf(" ") != -1) { v_key = v_key.Replace(" ", " "); } v_val = Convertion.ToBase64(v_val); if (isValid(v_val) && !htTemp.ContainsValue(v_val) && !htTemp.ContainsKey(v_key)) { htTemp.Add(v_key, v_val); //listboxClips.Items.Add(v_val); ListViewItem lvi = listV.Items.Add(v_key); lvi.SubItems.Add(v_val); tSSL.Text = "Added new value. " + System.DateTime.Now.ToLongTimeString(); } if (replacerToolStripMenuItem.Checked) { if (htLang.ContainsKey(o_val.ToLower())) { string k = htLang[o_val.ToLower()].ToString(); if (toolStripMenuItem5.Checked) { Clipboard.SetText("\"+Lang.getWord(session,\"" + k + "\")+\""); } else { Clipboard.SetText("<%=Lang.getWord(session,\"" + k + "\")%>"); } } } } else if (dObj.GetDataPresent(DataFormats.Bitmap)) { Bitmap bmap; bmap = (Bitmap)dObj.GetData(DataFormats.Bitmap); if (!Directory.Exists(Application.StartupPath + "\\saved_file")) { Directory.CreateDirectory(Application.StartupPath + "\\saved_file"); } string v_filename = Application.StartupPath + "\\saved_file\\" + System.DateTime.Now.ToString().Replace(" ", "").Replace("/", "").Replace("\\", "").Replace(":", "").Replace("-", "") + ".png"; v_key = v_filename; v_val = Convertion.ToBase64(v_filename); if (!htTemp.ContainsValue(v_val) && !htTemp.ContainsKey(v_key)) { bmap.Save(v_filename); Clipboard.SetDataObject(new object(), false); ListViewItem lvi = listV.Items.Add(v_key); lvi.SubItems.Add(v_val); htTemp.Add(lvi.Text, lvi.SubItems[1].Text); tSSL.Text = "Saved image: " + v_filename; } } this.Text = listV.Items.Count.ToString(); } catch { } }