Beispiel #1
0
        public static bool LoadParams()
        {
            Debug.Log("Загрузка настроек");
            if (File.Exists(paramsFile))
            {
                try
                {
                    using (FileStream fs = new FileStream(paramsFile, FileMode.Open))
                    {
                        XmlSerializer formatter = new XmlSerializer(typeof(ParamsObj));
                        m_params = (ParamsObj)formatter.Deserialize(fs);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                    return(false);
                }
            }
            else
            {
                m_params = new ParamsObj();

                XmlSerializer formatter = new XmlSerializer(typeof(ParamsObj));
                using (FileStream fs = new FileStream(paramsFile, FileMode.OpenOrCreate))
                {
                    formatter.Serialize(fs, m_params);
                }

                return(false);
            }
        }
Beispiel #2
0
 public bool Equals(ParamsObj obj)
 {
     return(telegToken == obj.telegToken &&
            useProxy == obj.useProxy &&
            proxyIP == obj.proxyIP &&
            proxyPort == obj.proxyPort);
 }