示例#1
0
        public FrmTiebaPost()
        {
            InitializeComponent();
            this.txtCookie.Text   = IniUtility.ReadString(this.GetType().Name, this.txtCookie.Name, string.Empty);
            this.txtBody.Text     = IniUtility.ReadString(this.GetType().Name, this.txtBody.Name, string.Empty);
            this.cmbInterval.Text = IniUtility.ReadString(this.GetType().Name, this.cmbInterval.Name, 5);

            if (File.Exists("posts.txt"))
            {
                using (StreamReader sr = new StreamReader("posts.txt", Encoding.UTF8))
                {
                    string line = null;
                    do
                    {
                        line = sr.ReadLine();
                        if (string.IsNullOrWhiteSpace(line))
                        {
                            continue;
                        }
                        if (line.Contains("BIDUPSID=") || line.Contains("BAIDUID="))
                        {
                            this.txtCookie.Text = line;
                            continue;
                        }
                        else if (line.StartsWith("--ie="))
                        {
                            this.txtBody.Text = line.Substring(2);
                            continue;
                        }
                        lstPosts.Add(line);
                    } while (line != null);
                }
                this.lblPostsCount.Text = lstPosts.Count.ToString();
            }
            this.Text += " - " + Application.StartupPath;
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmTiebaPost_FormClosed(object sender, FormClosedEventArgs e)
 {
     IniUtility.WriteString(this.GetType().Name, this.txtCookie.Name, this.txtCookie.Text);
     IniUtility.WriteString(this.GetType().Name, this.txtBody.Name, this.txtBody.Text);
     IniUtility.WriteString(this.GetType().Name, this.cmbInterval.Name, this.cmbInterval.Text);
 }