示例#1
0
文件: FormConfig.cs 项目: iruka-/slag
        private void _save()
        {
            var data = new SAVEFORMAT();

            data.EditorPath = textBox1.Text;

            util.Save(data);
        }
示例#2
0
文件: util.cs 项目: iruka-/slag
        public static void Save(SAVEFORMAT data)
        {
            var ms = new MemoryStream();
            var bf = new BinaryFormatter();

            bf.Serialize(ms, data);

            if (!Directory.Exists(Path.GetDirectoryName(m_savepth)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(m_savepth));
            }
            try {
                File.WriteAllBytes(m_savepth, ms.ToArray());
            }
            catch (SystemException e)
            {
                MessageBox.Show(e.Message);
            }
        }