Exemple #1
0
        public bool SaveVenderSettings(AllWin_Paras setting)
        {
            string path = PubFunc.GetVenderSettingPath();

            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }
            XmlSerializer xml = new XmlSerializer(typeof(AllWin_Paras));

            using (Stream stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
            {
                xml.Serialize(stream, setting);
            }

            return(true);
        }
Exemple #2
0
        public AllWin_Paras?LoadVenderSettings()
        {
            AllWin_Paras?setting = null;
            string       path    = PubFunc.GetVenderSettingPath();

            if (string.IsNullOrEmpty(path) || !File.Exists(path))
            {
                return(setting);
            }
            XmlSerializer xml = new XmlSerializer(typeof(AllWin_Paras));

            using (Stream stream = new FileStream(path,
                                                  FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                setting = (AllWin_Paras)xml.Deserialize(stream);
                stream.Close();
            }
            return(setting);
        }