/// <summary> /// 保存処理 /// </summary> public void Save() { //以下、パス生成処理 string clFileName = ClsTool.GetAppFileName(); string clPath = ClsPath.GetPath(clFileName + ".setting"); //以下、Json作成処理 DataContractJsonSerializer clSerializer = new DataContractJsonSerializer(typeof(ClsSetting)); MemoryStream clMemStream = new MemoryStream(); clSerializer.WriteObject(clMemStream, this); string clBuffer = Encoding.UTF8.GetString(clMemStream.ToArray()); //FileHistoryを最大数 10 に制限する if (mFileHistory.Count() > 10) { mFileHistory.RemoveRange(10, mFileHistory.Count() - 10); } //以下、保存処理 File.WriteAllText(clPath, clBuffer); }
private static int mSelectLineNo; //現在選択中のライン番号 /// <summary> /// 初期化処理 /// </summary> public static void Init() { //以下、保存データ読み込み処理 ClsSystem.mSetting = null; string clFileName = ClsTool.GetAppFileName(); string clPath = ClsPath.GetPath(clFileName + ".setting"); bool isExist = File.Exists(clPath); if (isExist) { try { using (FileStream clStream = new FileStream(clPath, FileMode.Open)) { DataContractJsonSerializer clSerializer = new DataContractJsonSerializer(typeof(ClsSetting)); ClsSystem.mSetting = (ClsSetting)clSerializer.ReadObject(clStream); clStream.Close(); } } catch (Exception) { ClsSystem.mSetting = null; } } if (ClsSystem.mSetting == null) { ClsSystem.mSetting = new ClsSetting(); ClsSystem.mSetting.Save(); } //以下、データ初期化処理 ClsSystem.mDicImage = new Dictionary <int, ClsDatImage>(); ClsSystem.mMotionSelectKey = -1; ClsSystem.mDicMotion = new Dictionary <int, ClsDatMotion>(); ClsSystem.mSelectFrameNo = -1; ClsSystem.mSelectLineNo = -1; }
private void button_Add_Click(object sender, EventArgs e) { AddImage(ClsPath.GetPath()); }
public static string GetPath() { string clPathBase = ClsPath.GetPath(""); return(clPathBase); }