Ejemplo n.º 1
0
        public static bool SaveEMailSettingConfigFile(string fileName, EMailNotifyConfig data, out string errMsg)
        {
            FileStream fs = null;

            errMsg = string.Empty;
            try
            {
                string filePath = Path.GetDirectoryName(fileName);
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                using (fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    XmlSerializer     xmlSserializer = new XmlSerializer(typeof(EMailNotifyConfig), "");
                    EMailNotifyConfig temp           = (EMailNotifyConfig)data.Clone();
                    temp.Password = CoderPW(temp.Password);
                    xmlSserializer.Serialize(fs, temp);
                    return(true);
                }
            }
            catch (Exception e)
            {
                errMsg = e.Message;
                return(false);
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }
Ejemplo n.º 2
0
 public static EMailNotifyConfig LoadEMailSettingConfigFile(string fileName)
 {
     if (!File.Exists(fileName))
     {
         return(new EMailNotifyConfig());
     }
     else
     {
         FileStream fs = null;
         try
         {
             using (fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None))
             {
                 XmlSerializer     xmlSerializer = new XmlSerializer(typeof(EMailNotifyConfig), "");
                 EMailNotifyConfig temp          = (EMailNotifyConfig)xmlSerializer.Deserialize(fs);
                 temp.Password = DecoderPW(temp.Password);
                 return(temp);
             }
         }
         catch (Exception e)
         {
             Debug.WriteLine(e.ToString());
             return(new EMailNotifyConfig());
         }
         finally
         {
             if (fs != null)
             {
                 fs.Close();
             }
         }
     }
 }
Ejemplo n.º 3
0
        public object Clone()
        {
            EMailNotifyConfig temp = new EMailNotifyConfig();

            temp._enableRecoverNotify = this._enableRecoverNotify;
            temp._sendTimer           = this._sendTimer;
            temp._sendMailWeek        = this._sendMailWeek;
            temp._sendMailModel       = this._sendMailModel;
            temp._timeEMailNotify     = this._timeEMailNotify;
            temp._emailAddr           = this._emailAddr;
            temp._emailSendSource     = this._emailSendSource;
            temp._enableJournal       = this._enableJournal;
            temp._enableNotify        = this._enableNotify;
            temp._password            = this._password;
            temp._port        = this._port;
            temp._smtpServer  = this._smtpServer;
            temp._logSaveDays = this._logSaveDays;
            temp._bEnableSsl  = this._bEnableSsl;
            for (int i = 0; i < this._receiveInfoList.Count; i++)
            {
                temp._receiveInfoList.Add((ReceiverInfo)_receiveInfoList[i].Clone());
            }
            return(temp);
        }
Ejemplo n.º 4
0
 public static bool SaveEMailSettingConfigFile(string fileName, EMailNotifyConfig data, out string errMsg)
 {
     FileStream fs = null;
     errMsg = string.Empty;
     try
     {
         string filePath = Path.GetDirectoryName(fileName);
         if (!Directory.Exists(filePath))
         {
             Directory.CreateDirectory(filePath);
         }
         using (fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
         {
             XmlSerializer xmlSserializer = new XmlSerializer(typeof(EMailNotifyConfig), "");
             EMailNotifyConfig temp = (EMailNotifyConfig)data.Clone();
             temp.Password = CoderPW(temp.Password);
             xmlSserializer.Serialize(fs, temp);
             return true;
         }
     }
     catch (Exception e)
     {
         errMsg = e.Message;
         return false;
     }
     finally
     {
         if (fs != null)
         {
             fs.Close();
         }
     }
 }
Ejemplo n.º 5
0
 public object Clone()
 {
     EMailNotifyConfig temp = new EMailNotifyConfig();
     temp._enableRecoverNotify = this._enableRecoverNotify;
     temp._sendTimer = this._sendTimer;
     temp._sendMailWeek = this._sendMailWeek;
     temp._sendMailModel = this._sendMailModel;
     temp._timeEMailNotify = this._timeEMailNotify;
     temp._emailAddr = this._emailAddr;
     temp._emailSendSource = this._emailSendSource;
     temp._enableJournal = this._enableJournal;
     temp._enableNotify = this._enableNotify;
     temp._password = this._password;
     temp._port = this._port;
     temp._smtpServer = this._smtpServer;
     temp._logSaveDays = this._logSaveDays;
     temp._bEnableSsl = this._bEnableSsl;
     for (int i = 0; i < this._receiveInfoList.Count; i++)
     {
         temp._receiveInfoList.Add((ReceiverInfo)_receiveInfoList[i].Clone());
     }
     return temp;
 }