Пример #1
0
        public Main()
        {
            if (!Directory.Exists(Globals.ModPath))
            {
                Directory.CreateDirectory(Globals.ModPath);
            }
            if (!Directory.Exists(Globals.ModulePath))
            {
                Directory.CreateDirectory(Globals.ModulePath);
            }
            if (!Directory.Exists(Globals.FuelPath))
            {
                Directory.CreateDirectory(Globals.FuelPath);
            }

            Config = Configuration.FromFile();
            // Initialize all of the necessary modules
            if (Config.Modules.Fuel)
            {
                Fuel FuelMod = new Fuel();
                DrainFuel.Activated += (object sender, EventArgs e) => {
                    FuelMod.DrainFuel();
                };
                FillFuel.Activated += (object sender, EventArgs e) => {
                    FuelMod.FillFuel();
                };
                Modules.Add(FuelMod);
            }
            if (Config.Modules.Bills)
            {
                Modules.Add(new Bills());
            }
            if (Config.Modules.Homeless)
            {
                Modules.Add(new Homeless());
            }
            if (Config.Modules.Hunger)
            {
                Modules.Add(new Hunger());
            }
            if (Config.Modules.IncomeTax)
            {
                Modules.Add(new Tax());
            }
            if (Config.Modules.Jobs)
            {
                Modules.Add(new Jobs());
            }
            foreach (Module Mod in Modules)
            {
                Mod.Initialize();
            }

#if DEBUG
            int Build = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Revision;
            Text.Caption = $"RealityV Build {Build}\nDO NOT DISTRIBUTE";
            Menu.Add(DrainFuel);
            Menu.Add(FillFuel);
            //Menu.Add(Starve);
            //Menu.Add(Eat);
            //Menu.Add(GoHomeless);
            Menu.UseMouse = false;
            MainPool.Add(Menu);
#endif

            Tick    += OnTick;
            Aborted += (object sender, EventArgs e) =>
            {
                foreach (Module Mod in Modules)
                {
                    Mod.Abort();
                }
            };
        }