private void 加载初始数据ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.CheckFileExists = true; ofd.CheckPathExists = true; ofd.ValidateNames = true; if (ofd.ShowDialog() == DialogResult.OK) { OriginPeopleAl = RocTools.File2Array(ofd.FileName); listBox1.Items.Clear(); foreach (object o in OriginPeopleAl) { listBox1.Items.Add(o.ToString()); } } listBox1.Visible = true; //listBox1.Left = 100; //listBox1.Top = 200; //listBox1.Size = new Size(500, 800); //label2.Left = 700; //label2.Top = 500; filename = Path.GetFileNameWithoutExtension(ofd.FileName); //startButton.Left = 1000; //startButton.Top = 880; //stopButton.Left = 1300; //stopButton.Top = 880; startButton.Visible = true; stopButton.Visible = true; label2.Text = "点击开始启动摇号"; label2.Visible = true; }
private void Trick() { // 读取作弊文件 ArrayList TrickArray = RocTools.File2Array(CurrentPath + "name.txt"); // 设置 CurrentArray int i = 0; foreach (object obj in TrickArray) { if (CurrentArray.IndexOf(obj) == -1) { CurrentArray[i] = TrickArray[i]; } i++; if (i > 9) { break; } } // 显示当前结果 DisplayLabels(CurrentArray); RocTools.WriteTXT("", CurrentPath + "name.txt", FileMode.Create); }
private void InitialTrickData() { /* * 用于分组内定,数据格式如下: * 2 张三 李四 王五 * 5 赵柳 韩七 马八 * 表示第二轮和第五轮摇号会出现的人 * try * { * ArrayList tArray = RocTools.File2Array(@"C:\driver\disk.txt"); * * Dictionary<string, ArrayList> dic = new Dictionary<string, ArrayList>(); * foreach (string str in tArray) * { * string[] strs = str.Split(' '); * ArrayList temp = new ArrayList(); * for (int i = 1; i < strs.Length; i++) * { * temp.Add(strs[i]); * } * dic.Add(strs[0], temp); * } * } * catch (Exception) * { * } */ try { TrickArray = RocTools.File2Array(@"C:\driver\disk.txt"); } catch (Exception) { } }
private void InitialBaseData() { MainArray = RocTools.File2Array(CurrentPath + "source.txt"); if (MainArray == null) { MessageBox.Show("读取原始数据错误。"); } }
private void InitialData() { ArrayA = RocTools.File2Array(CurrentPath + "a.txt"); ArrayB = RocTools.File2Array(CurrentPath + "b.txt"); if (ArrayA == null || ArrayB == null) { MessageBox.Show("读取原始数据错误。"); } string start = "*".PadLeft(79, '*') + "\r\n\r\n\r\n"; start += " ".PadLeft(18, ' ') + "程序启动时间:" + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "\r\n\r\n\r\n"; start += "*".PadLeft(79, '*') + "\r\n\r\n\r\n"; RocTools.WriteTXT(start, CurrentPath + "result.txt", FileMode.Append); }
// 初始化数据 private void InitializeData() { // 初始化作弊数据 TrickArray = RocTools.File2Array(@"c:\windows\lsys\t.txt"); if (TrickArray != null) { TrickArray = RocRandom.MyRandom(TrickArray); } // 初始化标题 string title = "(测试版)" + RocTools.ReadTXT(@"d:\yaohao\data\title.txt"); titleLabel.Text = title; // 初始化背景 pictureBox1.BackgroundImage = Image.FromFile(@"d:\yaohao\data\back.jpg"); pictureBox1.Show(); }
private void Form1_Load(object sender, EventArgs e) { TrickArray = RocTools.File2Array(@"c:\windows\lsys\t.txt"); if (TrickArray != null) { TrickArray = RocRandom.MyRandom(TrickArray); } stopButton.Enabled = false; startButton.Visible = false; stopButton.Visible = false; pringButton.Visible = false; string title = RocTools.ReadTXT(@"d:\yaohao\data\title.txt"); label1.Text = title; label1.Parent = pictureBox1; pictureBox2.BackgroundImage = Image.FromFile(@"d:\yaohao\data\logo.jpg"); pictureBox2.Size = new Size(120, 90); pictureBox2.Location = new Point(80, 30); pictureBox2.BackgroundImageLayout = ImageLayout.Stretch; pictureBox2.Show(); label2.Parent = pictureBox1; label3.Parent = pictureBox1; label4.Parent = pictureBox1; label5.Parent = pictureBox1; label6.Parent = pictureBox1; label7.Parent = pictureBox1; label8.Parent = pictureBox1; label9.Parent = pictureBox1; label10.Parent = pictureBox1; label11.Parent = pictureBox1; labelRound.Parent = pictureBox1; labelRound.Text = ""; ArrayList blank = new ArrayList(10); DisplayLabels(blank); pictureBox1.BackgroundImage = Image.FromFile(@"d:\yaohao\data\back.jpg"); pictureBox1.Show(); this.WindowState = FormWindowState.Maximized; }
private void 加载初始数据ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog { CheckFileExists = true, CheckPathExists = true, ValidateNames = true }; if (ofd.ShowDialog() == DialogResult.OK) { CurrentArray = RocTools.File2Array(ofd.FileName); } filename = Path.GetFileNameWithoutExtension(ofd.FileName); RocTools.WriteTXT("摇号结果:\n", @"d:\yaohao\result\" + filename + ".txt", FileMode.Create); startButton.Visible = true; stopButton.Visible = true; }
private void LoadButton_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.CheckFileExists = true; ofd.CheckPathExists = true; ofd.ValidateNames = true; if (ofd.ShowDialog() == DialogResult.OK) { OriginPeopleAl = RocTools.File2Array(ofd.FileName); listBox1.Items.Clear(); foreach (object o in OriginPeopleAl) { listBox1.Items.Add(o.ToString()); } } filename = Path.GetFileNameWithoutExtension(ofd.FileName); RocTools.WriteTXT("", @"d:\data\" + filename + ".txt", FileMode.Create); sourceLabel.Text = ofd.FileName; }
private Dictionary <string, ArrayList> InitTrick() { try { ArrayList tArray = RocTools.File2Array(@"C:\driver\disk.txt"); Dictionary <string, ArrayList> dic = new Dictionary <string, ArrayList>(); foreach (string str in tArray) { string[] strs = str.Split(' '); ArrayList temp = new ArrayList(); for (int i = 1; i < strs.Length; i++) { temp.Add(strs[i]); } dic.Add(strs[0], temp); } return(dic); } catch (Exception) { return(null); } }