Example #1
0
        internal void SaveProjectHeadInfo()
        {
            try
            {
                string xml = XmlHelper.XmlSerialize(_projHeadList, Encoding.UTF8);
                byte[] data;
                EncryptHelper.EncryptResult res = EncryptHelper.Encrypt(xml, "ProjectHeadInfo", out data);

                FileStream fs = new FileStream("ProjHead.pjh", FileMode.Create);
                fs.Write(data, 0, data.Length);
                fs.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #2
0
        internal void LoadProjectHeadInfo()
        {
            try
            {
                FileStream fs   = new FileStream("ProjHead.pjh", FileMode.Open, FileAccess.Read);
                byte[]     data = new byte[(int)fs.Length];
                fs.Read(data, 0, (int)fs.Length);
                fs.Close();

                string xmlStr = "";
                EncryptHelper.EncryptResult res = EncryptHelper.Decrypt(data, "ProjectHeadInfo", ref xmlStr);
                if (res != EncryptHelper.EncryptResult.Good)
                {
                    return;
                }

                _projHeadList.Clear();
                _projHeadList = XmlHelper.XmlDeserialize <List <ProjectHeadInfo> >(xmlStr, Encoding.UTF8);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }