public void CalculateStats() { tbCount.Text = tbCipher.Text.Trim().Length + "/" + tbCipher.Text.Trim().Replace(" ", "").Length; StringBuilder factors = new StringBuilder(); for (int i = 2; i < Math.Sqrt(tbCipher.Text.Trim().Length); i++) { if (tbCipher.Text.Trim().Length % i == 0) { factors.Append(i); factors.Append(","); } } if (factors.Length == 0) { tbFactors.Text = "Prime"; } else { factors.Length--; tbFactors.Text = factors.ToString(); } tbHasJ.Text = ((tbCipher.Text.IndexOf("j") >= 0 || tbCipher.Text.IndexOf("J") >= 0) ? "Yes" : ""); tbHasPound.Text = ((tbCipher.Text.IndexOf("#") >= 0) ? "Yes" : ""); tbHasNumbers.Text = ((tbCipher.Text.IndexOf("0") >= 0 || tbCipher.Text.IndexOf("1") >= 0 || tbCipher.Text.IndexOf("2") >= 0 || tbCipher.Text.IndexOf("3") >= 0 || tbCipher.Text.IndexOf("4") >= 0 || tbCipher.Text.IndexOf("5") >= 0 || tbCipher.Text.IndexOf("6") >= 0 || tbCipher.Text.IndexOf("7") >= 0 || tbCipher.Text.IndexOf("8") >= 0 || tbCipher.Text.IndexOf("9") >= 0) ? "Yes" : ""); tbIC.Text = CryptSharp.Utility.IndexOfCoincidence(tbCipher.Text, tbUsedAlphabet.Text).ToString(); lvFrequencies.Items.Clear(); Dictionary<char, int> frequencies = CryptSharp.Utility.Frequencies(tbCipher.Text.ToCharArray(), tbUsedAlphabet.Text.ToCharArray()); foreach (char c in frequencies.Keys) { ListViewItem i = new ListViewItem(); i.Text = c.ToString(); i.SubItems.Add(frequencies[c].ToString()); lvFrequencies.Items.Add(i); } lvICByKeyLength.Items.Clear(); for (int i = 1; i < tbCipher.Text.Trim().Length / 2; i++) { ListViewItem item = new ListViewItem(); item.Text = i.ToString(); item.SubItems.Add(CryptSharp.Utility.AvgVigenereIndexOfCoincidence(tbCipher.Text.Trim(), tbUsedAlphabet.Text, i).ToString()); lvICByKeyLength.Items.Add(item); } }
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { axWindowsMediaPlayer1.Ctlcontrols.stop(); TreeNode selnode = e.Node; int i = selnode.Index; string[] s = new string[list[i].Items.Count]; lb2.Items.Clear(); listView2.Items.Clear(); listView1.Items.Clear(); ds.Items.Clear(); for (int j = 0; j < list[i].Items.Count; j++) { s[j] = list[i].Items[j].ToString(); lb2.Items.Add(s[j]); listView2.Items.Add(Path.GetFileNameWithoutExtension(s[j])); } plItems = axWindowsMediaPlayer1.playlistCollection.getByName(myPlaylist); if (plItems.count == 0) { pl = axWindowsMediaPlayer1.playlistCollection.newPlaylist(myPlaylist); } else { pl = plItems.Item(0); } int q = 0; foreach (string file in s) { ListViewItem item = new ListViewItem(s[q]); ds.Items.Add(Path.GetFileNameWithoutExtension(item.ToString())); q++; m1 = axWindowsMediaPlayer1.newMedia(file); pl.appendItem(m1); } //choi nhac axWindowsMediaPlayer1.currentPlaylist = pl; axWindowsMediaPlayer1.Ctlcontrols.play(); axWindowsMediaPlayer1.playlistCollection.remove(pl); }
private void button7_Click(object sender, EventArgs e) { //SELECT 列名 FROM テーブル名 where 列名 LIKE '探索文字'; //オブジェクト指向パラダイム MySqlConnection con = new MySqlConnection(); string conString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString; con.ConnectionString = conString; try { con.Open(); //MessageBox.Show("接続成功"); } catch (Exception err) { MessageBox.Show(err.Message); } foreach (ListViewItem itemx in listView1.CheckedItems) { string msg = itemx.Text; //MessageBox.Show("チェックが付いている項目は" + msg); // SELECT文出す StringBuilder sql = new StringBuilder(); sql.AppendLine("SELECT importance FROM content WHERE id LIKE '" + msg + "'"); // よみこむやつ MySqlCommand cmd = new MySqlCommand(sql.ToString(), con); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { string importance = reader.GetString("importance"); ListViewItem itemx1 = new ListViewItem(); itemx1.SubItems.Add(importance); //重要度 string txtimportance = itemx1.ToString(); textBox4.Text = importance; } } //最後にとじる con.Close(); }
private void CreatePlayLis(OpenFileDialog open, ListView lv) { plItems = axWindowsMediaPlayer1.playlistCollection.getByName(myPlaylist); if (plItems.count == 0) pl = axWindowsMediaPlayer1.playlistCollection.newPlaylist(myPlaylist); else pl = plItems.Item(0); //them vao listview va thu vien WMP int i = 0; foreach (string file in open.FileNames) { ListViewItem item = new ListViewItem(open.FileNames[i]); lv.Items.Add(Path.GetFileNameWithoutExtension(item.ToString())); i++; m1 = axWindowsMediaPlayer1.newMedia(file); pl.appendItem(m1); } //choi nhac axWindowsMediaPlayer1.currentPlaylist = pl; axWindowsMediaPlayer1.Ctlcontrols.play(); axWindowsMediaPlayer1.playlistCollection.remove(pl); }