Exemplo n.º 1
0
        public void SaveHeader(LetterInfo letterInfo)
        {
            using (FileStream fileStream = new FileStream(_pathFileHeader, FileMode.OpenOrCreate))
            {
                int idx = 0;
                int cnt = letterInfo.Count();
                while (idx < cnt)
                {
                    Letter letter = letterInfo.Item(idx);

                    byte[] array = Encoding.UTF8.GetBytes(letter.LetterData.Header + Environment.NewLine);

                    int offset    = 0;
                    int count     = 1024;
                    int countData = array.Length;
                    while (offset < countData)
                    {
                        int value = countData - offset;
                        if (value < count)
                        {
                            count = value;
                        }

                        fileStream.Write(array, offset, count);

                        offset += count;
                    }

                    idx++;
                }
            }
        }
Exemplo n.º 2
0
        private static void ReceivingLetters()
        {
            RequestGMail requestGMail = _controlGMail.RequestGMail;

            Console.WriteLine("Получение списка заголовков писем ...");
            requestGMail.GetListLetters(_letterInfo);

            int idx = 0;
            int cnt = _letterInfo.Count();

            while (idx < cnt)
            {
                Letter letter = _letterInfo.Item(idx);
                requestGMail.GetLetter(letter);

                idx++;
            }
        }