using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;
namespace OutlookExpress_V1._._
{
    class PerlProperties
    {
        public void CreateFirstFileAsArchive(string fileName)
        {
            if (!File.Exists(fileName))
            {
                XmlTextWriter xmlWriter = new XmlTextWriter(fileName, Encoding.UTF8);

                xmlWriter.WriteStartDocument(true);
                xmlWriter.WriteStartElement("MAILS");//Root Element
                xmlWriter.WriteStartElement("MAIL");//Department Element 

                xmlWriter.WriteStartAttribute("MN"); //Attribute "Name"            
                xmlWriter.WriteString("0"); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("TO"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("FROM"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("CC"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("SUBJECT"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("DATE"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("SIZE"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("FOLDER"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("ISREAD"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("PRIORITY"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteEndElement(); //End of Mail Element  
                xmlWriter.WriteEndElement(); //End of Mails Element                     
                xmlWriter.WriteEndDocument();

                xmlWriter.Flush();
                xmlWriter.Close();
            }
        }
        public void CreateFirstFile()
        {
            if (!File.Exists("PersonalFolder.xml"))
            {
                XmlTextWriter xmlWriter = new XmlTextWriter("PersonalFolder.xml", Encoding.UTF8);

                xmlWriter.WriteStartDocument(true);
                xmlWriter.WriteStartElement("MAILS");//Root Element
                xmlWriter.WriteStartElement("MAIL");//Department Element 

                xmlWriter.WriteStartAttribute("MN"); //Attribute "Name"            
                xmlWriter.WriteString("0"); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("TO"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("FROM"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("CC"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("SUBJECT"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("DATE"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("SIZE"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("FOLDER"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("ISREAD"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("PRIORITY"); //Attribute "Name"            
                xmlWriter.WriteString(""); //Attribute Value            
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteEndElement(); //End of Mail Element  
                xmlWriter.WriteEndElement(); //End of Mails Element                     
                xmlWriter.WriteEndDocument();

                xmlWriter.Flush();
                xmlWriter.Close();
            }
        }
        public string GetDateName(string d3, string d4)
        {
            string s3 = d3.ToString();
            string s4 = d4.ToString();
            DateTime d1 = DateTime.Parse(s4);
            string s = "Today";
            DateTime dateValue = DateTime.Now;
            TimeSpan sd = dateValue.Subtract(d1);
            switch (dateValue.ToString("ddd"))
            {
                case "Mon":
                    if (sd.Days == 0)
                    {
                        s = "A:Today";
                    }
                    else if (sd.Days >= 1 && sd.Days <= 5)
                    {
                        s = "B:Last Week";
                    }
                    else if (sd.Days >= 6 && sd.Days <= 13)
                    {
                        s = "C:Two Weeks Ago";
                    }
                    else if (sd.Days >= 14 && sd.Days <= 21)
                    {
                        s = "D:Three Weeks Ago";
                    }
                    else if (sd.Days >= 22 && sd.Days <= 52)
                    {
                        s = "E:Last Month";
                    }
                    else
                    {
                        s = "F:Older";
                    }
                    break;
                case "Tue":
                    if (sd.Days == 0)
                    {
                        s = "A:Today";
                    }
                    else if (sd.Days >= 1 && sd.Days <= 1)
                    {
                        s = "B:Yesterday";
                    }
                    else if (sd.Days >= 2 && sd.Days <= 5)
                    {
                        s = "C:Last Week";
                    }
                    else if (sd.Days >= 6 && sd.Days <= 13)
                    {
                        s = "D:Two Weeks Ago";
                    }
                    else if (sd.Days >= 14 && sd.Days <= 21)
                    {
                        s = "E:Three Weeks Ago";
                    }
                    else if (sd.Days >= 22 && sd.Days <= 52)
                    {
                        s = "F:Last Month";
                    }
                    else
                    {
                        s = "G:Older";
                    }
                    break;
                case "Wed":
                    if (sd.Days == 0)
                    {
                        s = "A:Today";
                    }
                    else if (sd.Days >= 1 && sd.Days <= 1)
                    {
                        s = "B:Yesterday";
                    }
                    else if (sd.Days >= 2 && sd.Days <= 2)
                    {
                        s = "C:Monday";
                    }
                    else if (sd.Days >= 3 && sd.Days <= 5)
                    {
                        s = "D:Last Week";
                    }
                    else if (sd.Days >= 6 && sd.Days <= 13)
                    {
                        s = "E:Two Weeks Ago";
                    }
                    else if (sd.Days >= 14 && sd.Days <= 21)
                    {
                        s = "F:Three Weeks Ago";
                    }
                    else if (sd.Days >= 22 && sd.Days <= 52)
                    {
                        s = "G:Last Month";
                    }
                    else
                    {
                        s = "H:Older";
                    }
                    break;
                case "Thu":
                    if (sd.Days == 0)
                    {
                        s = "A:Today";
                    }
                    else if (sd.Days >= 1 && sd.Days <= 1)
                    {
                        s = "B:Yesterday";
                    }
                    else if (sd.Days >= 2 && sd.Days <= 2)
                    {
                        s = "C:Tuesday";
                    }
                    else if (sd.Days >= 3 && sd.Days <= 3)
                    {
                        s = "D:Monday";
                    }
                    else if (sd.Days >= 4 && sd.Days <= 5)
                    {
                        s = "E:Last Week";
                    }
                    else if (sd.Days >= 6 && sd.Days <= 13)
                    {
                        s = "F:Two Weeks Ago";
                    }
                    else if (sd.Days >= 14 && sd.Days <= 21)
                    {
                        s = "G:Three Weeks Ago";
                    }
                    else if (sd.Days >= 22 && sd.Days <= 52)
                    {
                        s = "H:Last Month";
                    }
                    else
                    {
                        s = "I:Older";
                    }
                    break;
                case "Fri":
                    if (sd.Days == 0)
                    {
                        s = "A:Today";
                    }
                    else if (sd.Days >= 1 && sd.Days <= 1)
                    {
                        s = "B:Yesterday";
                    }
                    else if (sd.Days >= 2 && sd.Days <= 2)
                    {
                        s = "C:Tuesday";
                    }
                    else if (sd.Days >= 3 && sd.Days <= 3)
                    {
                        s = "D:Monday";
                    }
                    else if (sd.Days >= 4 && sd.Days <= 5)
                    {
                        s = "E:Last Week";
                    }
                    else if (sd.Days >= 6 && sd.Days <= 13)
                    {
                        s = "F:Two Weeks Ago";
                    }
                    else if (sd.Days >= 14 && sd.Days <= 21)
                    {
                        s = "G:Three Weeks Ago";
                    }
                    else if (sd.Days >= 22 && sd.Days <= 52)
                    {
                        s = "H:Last Month";
                    }
                    else
                    {
                        s = "I:Older";
                    }
                    break;
                case "Sat":
                    if (sd.Days == 0)
                    {
                        s = "A:Today";
                    }
                    else if (sd.Days >= 1 && sd.Days <= 1)
                    {
                        s = "B:Yesterday";
                    }
                    else if (sd.Days >= 2 && sd.Days <= 2)
                    {
                        s = "C:Wednesday";
                    }
                    else if (sd.Days >= 3 && sd.Days <= 3)
                    {
                        s = "D:Tuesday";
                    }
                    else if (sd.Days >= 4 && sd.Days <= 4)
                    {
                        s = "E:Monday";
                    }
                    else if (sd.Days >= 0 && sd.Days <= 5)
                    {
                        s = "F:Last Week";
                    }
                    else if (sd.Days >= 6 && sd.Days <= 13)
                    {
                        s = "G:Two Weeks Ago";
                    }
                    else if (sd.Days >= 14 && sd.Days <= 21)
                    {
                        s = "H:Three Weeks Ago";
                    }
                    else if (sd.Days >= 22 && sd.Days <= 52)
                    {
                        s = "I:Last Month";
                    }
                    else
                    {
                        s = "J:Older";
                    }
                    break;

                case "Sun":
                    if (sd.Days >= 0 && sd.Days <= 5)
                    {
                        s = "A:Last Week";
                    }
                    else if (sd.Days >= 6 && sd.Days <= 13)
                    {
                        s = "B:Two Weeks Ago";
                    }
                    else if (sd.Days >= 14 && sd.Days <= 21)
                    {
                        s = "C:Three Weeks Ago";
                    }
                    else if (sd.Days >= 22 && sd.Days <= 52)
                    {
                        s = "D:Last Month";
                    }
                    else
                    {
                        s = "E:Older";
                    }
                    break;

            }
            return s;
        }
        public void CreateFolder()
        {
            XmlTextWriter xmlWriter = new XmlTextWriter("PerlLookUpF.xml", Encoding.UTF8);
            xmlWriter.WriteStartDocument(true);
            xmlWriter.WriteStartElement("FOLDERS");//Root Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("Deleted Items"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("Drafts"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("Inbox"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("Junk Emails"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("Outbox"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("RSS Feeds"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("Sent Mails"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("FOLDER");//Department Element 
            xmlWriter.WriteStartAttribute("FN"); //Attribute "Name"            
            xmlWriter.WriteString("Search Folder"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element
            xmlWriter.WriteEndElement(); //End of Mails Element
                     
            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            xmlWriter.Close();



        }

        public void CreateTask()
        {
            XmlTextWriter xmlWriter = new XmlTextWriter("PerlLookUpTask.xml", Encoding.UTF8);
            xmlWriter.WriteStartDocument(true);
            xmlWriter.WriteStartElement("TASKLIST");//Root Element

            xmlWriter.WriteStartElement("TASK");//Department Element 
            xmlWriter.WriteStartAttribute("DATE"); //Attribute "Name"            
            xmlWriter.WriteString("1/1/2009"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("TASK");//Department Element 
            xmlWriter.WriteStartAttribute("TIME"); //Attribute "Name"            
            xmlWriter.WriteString("5:00 PM"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("TASK");//Department Element 
            xmlWriter.WriteStartAttribute("DESCRIPTION"); //Attribute "Name"            
            xmlWriter.WriteString("No Task"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element

            xmlWriter.WriteStartElement("TASK");//Department Element 
            xmlWriter.WriteStartAttribute("STATUS"); //Attribute "Name"            
            xmlWriter.WriteString("UnDone"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element 
                  
            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            xmlWriter.Close();



        }

        public void CreateNotes()
        {
            XmlTextWriter xmlWriter = new XmlTextWriter("PerlLookUpNotes.xml", Encoding.UTF8);
            xmlWriter.WriteStartDocument(true);
            xmlWriter.WriteStartElement("NOTESLIST");//Root Element

            xmlWriter.WriteStartElement("NOTE");//Department Element 
            xmlWriter.WriteStartAttribute("DESCRIPTION"); //Attribute "Name"            
            xmlWriter.WriteString("No Note"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element   
        
            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            xmlWriter.Close();



        }

        public void CreateContact()
        {
            XmlTextWriter xmlWriter = new XmlTextWriter("PerlLookUpContact.xml", Encoding.UTF8);
            xmlWriter.WriteStartDocument(true);
            xmlWriter.WriteStartElement("CONTACTLIST");//Root Element
            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("FNAME"); //Attribute "Name"            
            xmlWriter.WriteString("Kundan"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element 
  
            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("LNAME"); //Attribute "Name"            
            xmlWriter.WriteString("Singh"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element 
 
            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("EMAIL"); //Attribute "Name"            
            xmlWriter.WriteString("Kundan_Singh@priyanet.com"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element
 
            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("PHONE"); //Attribute "Name"            
            xmlWriter.WriteString("9711------"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element 

            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("MESSANGER"); //Attribute "Name"            
            xmlWriter.WriteString("v-6kusi@hotmail.com"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element   

            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("GROUP"); //Attribute "Name"            
            xmlWriter.WriteString("Friend"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element   

            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("COMPANY"); //Attribute "Name"            
            xmlWriter.WriteString("PSPL"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element   

            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("ADDRESS"); //Attribute "Name"            
            xmlWriter.WriteString("Noida - 65 A - 26"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element   

            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("STATE"); //Attribute "Name"            
            xmlWriter.WriteString("Uttar Pradesh"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element   

            xmlWriter.WriteStartElement("CONTACT");//Department Element 
            xmlWriter.WriteStartAttribute("COUNTRY"); //Attribute "Name"            
            xmlWriter.WriteString("India"); //Attribute Value            
            xmlWriter.WriteEndAttribute();
            xmlWriter.WriteEndElement(); //End of Mail Element   

            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            xmlWriter.Close();



        }
    }
}
