コード例 #1
0
ファイル: Setting_File.cs プロジェクト: Chatra123/pfAdapter
        /// <summary>
        /// 設定ファイルを読込
        /// </summary>
        /// <return>
        ///   succcess  -->  Setting_File
        ///   fail      -->  null
        /// </return>
        public static Setting_File LoadFile(string xmlpath = null)
        {
            xmlpath = xmlpath ?? Default_XmlPath;
            //新規作成
            if (Path.GetFileName(xmlpath) == Default_XmlName &&
                File.Exists(xmlpath) == false)
            {
                XmlRW.Save(xmlpath, Sample_B()); //Sample_RunTest  Sample_B  Sample_E
            }
            var file = XmlRW.Load <Setting_File>(xmlpath);

            //追加された項目、削除された項目を書き換え。
            if (file != null && file.Rev != CurrentRev)
            {
                file.Rev = CurrentRev;
                file     = Sample_B(file);
                XmlRW.Save(xmlpath, file);
            }
            return(file);
        }