Example #1
0
        private void userPanel_FormClosing(object sender, FormClosingEventArgs e)
        {
            usrf          = new userinfo();
            usrf.chatHist = textChat.Text;
            string tempname = this.Name + ".cfg";

            using (FileStream fs = new FileStream(tempname, FileMode.Create))
            {
                IFormatter ft = new BinaryFormatter();
                ft.Serialize(fs, usrf);
            }
        }
Example #2
0
        private void userPanel_Load(object sender, EventArgs e)
        {
            string tempname = this.Name + ".cfg";

            if (File.Exists(tempname))
            {
                using (FileStream fs = new FileStream(tempname, FileMode.Open))
                {
                    IFormatter ft = new BinaryFormatter();
                    usrf = ft.Deserialize(fs) as userinfo;
                    string[] split = usrf.chatHist.Split('\n');
                    //        this.textChat.ForeColor = System.Drawing.Color.Gray;
                    foreach (string tempx in split)
                    {
                        this.textChat.AppendText(tempx + "\n");
                    }
                    this.textChat.AppendText("-----------History above---------\n");
                    //this.textChat.ForeColor = System.Drawing.Color.White;
                }
            }
        }