/// <summary>
        /// 保存工程数据到文件
        /// </summary>
        /// <param name="path"></param>
        public void SaveProject(string path)
        {
            bool canSave = true;

            //读取数据
            this.ToolsDic = ToolsFactory.ToolsDic;
            this.SerializeCheck();

            foreach (var item in ToolsDic.Values)
            {
                foreach (var item1 in item)
                {
                    item1.ClearTrainData();
                    item1.SerializeCheck();
                    if (SerializationFile.TrySerialize(item1) == false)
                    {
                        canSave = false;
                        throw new Exception(item1.Name + "数据序列化异常");
                    }
                }
            }

            if (canSave)
            {
                SerializationFile.SerializeObject(path, this);
            }
        }
Example #2
0
 public void SaveSetting()
 {
     if (projectPath == projectPathInit)
     {
         projectPath = null;     //保存projectPath为null,当使用时调用ProjectPath返回projectPathInit值。
     }
     if (SerializationFile.TrySerialize(Instance))
     {
         try
         {
             SerializationFile.SerializeObject(userDataPath, Instance);
         }
         catch (Exception)
         {
             //Util.WriteLog(this.GetType(), ex);
             Util.Notify(Level.Err, "用户设置保存失败");
         }
     }
 }