Пример #1
0
        private static void MainLoop(string fileName, MumbleLink ml)
        {
            while (!ShouldExit())
            {
                MumbleLink.LinkedMem  state;
                MumbleLink.GW2Context context;
                ml.Read(out state, out context);

                string newContents = genContents(state, context);
                if (newContents != oldContents)
                {
                    File.WriteAllText(fileName, newContents);

                    DayNightCycle.TimeOfDay tod = DayNightCycle.Classify();

                    oldContents = newContents;
                    Thread.Sleep(WriteDelayMs);
                }
                Thread.Sleep(PollIntervalMs);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            ShowWindow(GetConsoleWindow(), ShowWindowCommands.Hide);
            System.IO.File.WriteAllText(logFile, "GuildWars 2 : Graphical Overhaul\n");

            if (!ParseArgs(args))
            {
                PrintUsage();
                return;
            }
            if (launch != null)
            {
                try {
                    Program.log("Launching Gw2");
                    game = Process.Start(launch, launchArgs);
                } catch (Exception ex) {
                    Program.log(ex.Message);
                    Program.log("Launch failed");
                }
            }

            Unlocker.Execute();

            using (var ml = MumbleLink.Open()) {
                try {
                    MainLoop(fileName, ml);
                } catch (UnauthorizedAccessException ex) {
                    Program.log(string.Format((ex.Message)));
                    if (!isAdministrator())
                    {
                        try {
                            elevate(args);
                            return;
                        } catch (Exception) { }
                    }
                    Program.log("Permission was denied");
                    return;
                }
            }
        }