예제 #1
0
        private static void Initialize()
        {
            if (!Utils.IsApplicationInstalled("Discord"))
            {
                Console.WriteLine("I noticed you do not have Discord installed. Please install Discord for this program to work.", Color.Red);
                Console.ReadKey();
            }

            string updateInfo = UpdateCheck.IsAvailable();

            //Empty string means no update available
            if (string.IsNullOrEmpty(updateInfo))
            {
                var client = UpdateCheck.GetGamePatch();
                Console.Title = $"MAT2 Discord Rich Presence Client by victorshx (Patch {client.GameVersion})";
                Mem.bla       = client.Base;

                FindGame();

                //Invoke UpdatePresence function every 5 seconds
                System.Timers.Timer timer = new System.Timers.Timer();
                timer.Elapsed += new ElapsedEventHandler(Discord.UpdatePresence);
                timer.Interval = 5 * 1000;
                timer.Enabled  = true;
            }
            else
            {
                Console.WriteLine($"Update available." +
                                  Environment.NewLine +
                                  $"Information: {updateInfo}", Color.Orange);
                Thread.Sleep(3000);
                Process.Start(Const.REPO_RELEASE_URL);
                Console.ReadKey();
            }
        }