コード例 #1
0
        private bool GoalsLoad(eLANGUAGE lan)
        {
            bool   rtn  = true;
            string path = $"Data\\GolaList_{lan.ToString()}.xml";

            if (System.IO.File.Exists(path))
            {
                System.IO.FileStream fs4 = new System.IO.FileStream(string.Format(path, Environment.CurrentDirectory), System.IO.FileMode.Open, System.IO.FileAccess.Read);
                try
                {
                    XmlSerializer xs2  = new XmlSerializer(_inst.sys.goals.GetType());
                    var           temp = (GOALINFO)xs2.Deserialize(fs4);
                    _inst.sys.goals = temp;
                }
                catch (Exception e)
                {
                    Debug.Assert(false, $"{e.ToString()}");
                }
                fs4.Close();
                if (0 >= _inst.sys.goals.lst.Count)
                {
                    rtn = false;
                }
            }
            else
            {
                rtn = false;
            }
            return(rtn);
        }
コード例 #2
0
        public bool IOLoad(eLANGUAGE lan)
        {
            bool rtn = true;

            string path = $"Data\\IOList_{lan.ToString()}.xml";

            try
            {
                if (System.IO.File.Exists(path))
                {
                    System.IO.FileStream fs4 = new System.IO.FileStream(string.Format(path, Environment.CurrentDirectory), System.IO.FileMode.Open, System.IO.FileAccess.Read);
                    XmlSerializer        xs2 = new XmlSerializer(_inst.sys.io.GetType());
                    var temp = (IOINFO)xs2.Deserialize(fs4);
                    fs4.Close();
                    _inst.sys.io = temp;
                }
                else
                {
                    rtn = false;
                }
            }
            catch (Exception e)
            {
                Debug.Assert(false, $"{e.ToString()}");
                return(false);
            }
            return(rtn);
        }
コード例 #3
0
 private bool GoalsSave(eLANGUAGE lan)
 {
     // xml 형태로 파일 기록
     try
     {
         string path = $"Data\\GolaList_{lan}.xml";
         System.IO.FileStream fs3 = new System.IO.FileStream(path, System.IO.FileMode.Create, System.IO.FileAccess.Write);
         XmlSerializer        xs  = new XmlSerializer(_inst.sys.goals.GetType());
         xs.Serialize(fs3, _inst.sys.goals);
         fs3.Close();
     }
     catch (Exception e)
     {
         Debug.Assert(false, $"{e.ToString()}");
         return(false);
     }
     return(true);
 }