示例#1
0
 public EmailHandler(EmailAuth emailAuth)
 {
     Hostname = emailAuth.Hostname;
     Port     = emailAuth.Port;
     UseSsl   = emailAuth.UseSsl;
     Username = emailAuth.Username;
     Password = emailAuth.Password;
     Folder   = emailAuth.Folder;
     Title    = emailAuth.Title;
     Sender   = emailAuth.Sender;
     StdDate  = new DateTime(1971
                             , 1, 1, 15, 0, 0);
 }
示例#2
0
        static void Main(string[] args)
        {
            try
            {
                using (FileStream fs = new FileStream("EmailAuth.xml", FileMode.Open))
                {
                    emailAuth = (EmailAuth)emailAuthFormatter.Deserialize(fs);
                }
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine($"Creating a new EmailAuth.xml ...");
                using (FileStream fs = new FileStream("EmailAuth.xml", FileMode.Create))
                {
                    emailAuth = new EmailAuth();
                    emailAuthFormatter.Serialize(fs, emailAuth);
                }
            }

            EmailHandler emailHandler = new EmailHandler(emailAuth);

            messages = emailHandler.ObtainMessages();

            try
            {
                using (FileStream fs = new FileStream("GoogleAuth.xml", FileMode.Open))
                {
                    googleAuth = (GoogleAuth)googleAuthFormatter.Deserialize(fs);
                }
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine($"Creating a new GoogleAuth.xml ...");
                using (FileStream fs = new FileStream("GoogleAuth.xml", FileMode.Create))
                {
                    googleAuth = new GoogleAuth();
                    googleAuthFormatter.Serialize(fs, googleAuth);
                }
            }

            GoogleSpreadsheetHandler googleSpreadsheetHandler = new GoogleSpreadsheetHandler(messages, googleAuth);

            googleSpreadsheetHandler.SpreadsheetsConnect();
        }