Ejemplo n.º 1
0
        public static void Main()
        {
            // Первичные значения (Из-за using).
            string id    = "";
            string token = "";

            // Проверка файла на существование.
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            if (!File.Exists(path_data))
            {
                using (FileStream stream = File.Create(path_data)) { }
            }

            // Чтение параметров.
            using (StreamReader sr = new StreamReader(path_data, Encoding.UTF8))
            {
                id    = sr.ReadLine();
                token = sr.ReadLine();
            }

            // Проверка существования данных.
            if (id == null)
            {
                Aauth.AauthRun();
            }
            else
            {
                Check.CheckRun(token, id, path_onlineusers, count);
            }
        }
Ejemplo n.º 2
0
        public static void CheckRun(string token, string id, string path, int count)
        {
            string text1 = Friends.ConvertFriendsOnline(Friends.ParseFriendsOnline(token, id, count), path);

            if (text1 == "error")
            {
                Aauth.AauthRun();
            }

            string text2 = Messages.UnReadedMessages(token, id);

            if (text2 == "error")
            {
                Aauth.AauthRun();
            }

            string text = text1 + text2 + "&";


            // Проверка файла на существование.
            if (File.Exists(path))
            {
                File.Delete(path);
                using (FileStream stream = File.Create(path)) { }
            }
            else
            {
                using (FileStream stream = File.Create(path)) { }
            }

            using (StreamWriter outfile = new StreamWriter(path))
            {
                outfile.Write(text);
            }
        }