Example #1
0
        //-----------------------------------------------------------------------------------------------------------
        /// <summary>
        /// FTPs the send.
        /// </summary>
        /// <param name="ftpInfo">The FTP info.</param>
        /// <param name="filesToUpload">The files to upload.</param>
        public void FTPSend(FTPInfo ftpInfo, List <string> filesToUpload)
        {
            this.ftpInfo = ftpInfo;

            try
            {
                if (ftpInfo.ProtectPassword)
                {
                    ftpInfo.Password = OperationUtils.EncryptDecrypt(ftpInfo.Password);
                }

                foreach (string file in filesToUpload)
                {
                    CreateRecursiveFTPFolder();

                    Stream requestStream = UploadFile(file);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (ftpInfo.ProtectPassword)
                {
                    ftpInfo.Password = OperationUtils.EncryptDecrypt(ftpInfo.Password);
                }
            }
        }
        //-----------------------------------------------------------------------------------------------------------
        /// <summary>
        /// FTPs the send.
        /// </summary>
        /// <param name="ftpInfo">The FTP info.</param>
        /// <param name="filesToUpload">The files to upload.</param>
        public void FTPSend(FTPInfo ftpInfo, List<string> filesToUpload)
        {
            this.ftpInfo = ftpInfo;

            try
            {
                if (ftpInfo.ProtectPassword)
                {
                    ftpInfo.Password = OperationUtils.EncryptDecrypt(ftpInfo.Password);
                }

                foreach (string file in filesToUpload)
                {
                    CreateRecursiveFTPFolder();

                    Stream requestStream = UploadFile(file);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (ftpInfo.ProtectPassword)
                {
                    ftpInfo.Password = OperationUtils.EncryptDecrypt(ftpInfo.Password);
                }
            }
        }
Example #3
0
        //-----------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the object,Not Implemented here.
        /// </summary>
        /// <param name="objects">The objects.</param>
        /// <param name="args">The args.</param>
        public void FTPReceive(FTPInfo ftpInfo, List <string> filesToDownload)
        {
            this.ftpInfo = ftpInfo;

            foreach (string file in filesToDownload)
            {
            }
        }
        //-----------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the object,Not Implemented here.
        /// </summary>
        /// <param name="objects">The objects.</param>
        /// <param name="args">The args.</param>
        public void FTPReceive(FTPInfo ftpInfo, List<string> filesToDownload)
        {
            this.ftpInfo = ftpInfo;

            foreach (string file in filesToDownload)
            {

            }
        }
 //--------------------------------------------------------------------------------------------
 /// <summary>
 /// Initilizes the FTP object.
 /// </summary>
 private void InitilizeFTPObject()
 {
     if (FtpInfo == null)
     {
         if (File.Exists(Path.Combine(CurrentAppConfigDir, FTPInfo.FTP_INFO_FILE)))
         {
             FtpInfo = FTPInfo.Deserialize(File.ReadAllText(Path.Combine(CurrentAppConfigDir, FTPInfo.FTP_INFO_FILE)));
         }
         else FtpInfo = new FTPInfo();
     }
 }
        private void SerializeDefaultObject()
        {
            //PMAInfo
            pmaInfo = new PMAInfo();
            pmaInfo.MailingTime = DateTime.Now.ToString("d/M/yyyy HH:mm");
            pmaInfo.ReportsIntervalHours = 12;
            pmaInfo.ClientName = System.Environment.MachineName;
            pmaInfo.DisposeLogFile = false;
            pmaInfo.TriggerSeed = 20;
            pmaInfo.UseFTP = true;
            pmaInfo.UseSMTP = false;

            // EMAIL INFO
            emailsInfo = new Emails();
            emailsInfo.EmailTo = new List<string>();
            emailsInfo.EmailTo.Add("*****@*****.**");
            emailsInfo.EmailCC = new List<string>();
            emailsInfo.EmailCC.Add("*****@*****.**");
            emailsInfo.AttachmentPath = "";
            emailsInfo.Subject = "Server Report";
            emailsInfo.BodyContent = "Please Find the Report Attached";

            // SMTP Info
            smtpInfo = new SmtpInfo();
            smtpInfo.ProtectPassword = true;
            smtpInfo.UserName = "******";
            smtpInfo.Password = "******";
            smtpInfo.Port = 587;
            smtpInfo.SmtpServer = "smtp.gmail.com";
            smtpInfo.SSL = true;
            smtpInfo.TimeOut = 100000;

            //FTP Info
            ftpInfo = new FTPInfo();
            ftpInfo.FTPServer = "ftp://202.54.213.231";
            ftpInfo.FTPServerFolder = "PerformanceReports";
            ftpInfo.Password = "******";
            ftpInfo.Port = 21;
            ftpInfo.ProtectPassword = true;
            ftpInfo.SSL = false;
            ftpInfo.TimeOut = 100000;
            ftpInfo.UserName = "******";

            SerializedInfo();
        }
 private void DeserilizeObjects()
 {
     try
     {
         pmaInfo = PMAInfo.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, PMAInfo.PMA_INFO_FILE)));
         emailsInfo = Emails.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, Emails.EMAILS_INFO_FILE)));
         smtpInfo = SmtpInfo.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, SmtpInfo.SMTP_INFO_FILE)));
         ftpInfo = FTPInfo.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, FTPInfo.FTP_INFO_FILE)));
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }