private void OnEnable()
        {
            if (_runStartUpOnEnable)
            {
                if (!IsInitialized)
                {
                    Initialize();
                }

                if (DisplayManager != null)
                {
                    DisplayManager.Setup(this);
                    _runStartUpOnEnable = false;
                }

                if (_fromSave)
                {
                    if (_savedData == null)
                    {
                        ReadySaveData();
                    }

                    QuickLogger.Info($"Loaded {Mod.FriendlyName}");
                }

                _runStartUpOnEnable = false;
            }
        }
Ejemplo n.º 2
0
        bool IFCSStorage.IsAllowedToAdd(Pickupable pickupable, bool verbose)
        {
            var eatable = pickupable.gameObject.GetComponent <Eatable>();

            if (eatable != null)
            {
                if (eatable.decomposes && pickupable.GetTechType() != TechType.CreepvinePiece)
                {
                    QuickLogger.Message(ExStorageDepotBuildable.FoodNotAllowed(), true);
                    return(false);
                }
            }

            if (_mono.DumpContainer == null)
            {
                QuickLogger.Error("DumpContainer returned null");
                return(false);
            }

            if (!CanBeStored(_mono.DumpContainer.GetCount() + 1, pickupable.GetTechType()))
            {
                QuickLogger.Info(ExStorageDepotBuildable.NoMoreSpace(), true);
                return(false);
            }

            return(true);
        }
        public static void Patch()
        {
            QuickLogger.Info("Started patching. Version: " + QuickLogger.GetAssemblyVersion());

#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
#endif

            try
            {
                LoadConfiguration();

                FEHolderBuildable.PatchHelper();

                var harmony = HarmonyInstance.Create("com.fireextinguishergholder.MAC");

                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Ejemplo n.º 4
0
        private static IEnumerable <IParsedPluginPack> GetAllPacks(string folderLocation)
        {
            // Check all folders
            foreach (string pluginFolder in Directory.GetDirectories(folderLocation))
            {
                // Find the CustomBatteriesPack.txt file
                string pluginDataFilePath = Path.Combine(pluginFolder, PluginFileName);
                string plugingFolderName  = new DirectoryInfo(Path.GetDirectoryName(pluginDataFilePath)).Name;

                if (!File.Exists(pluginDataFilePath))
                {
                    QuickLogger.Warning($"Plugin packs folder '{plugingFolderName}' did not contain a file named '{PluginFileName}'");
                    continue;
                }

                QuickLogger.Info($"Reading plugin pack '{plugingFolderName}'");

                string text = File.ReadAllText(pluginDataFilePath, Encoding.UTF8);

                var plugin = new EmTextPluginPack();

                bool readCorrectly = plugin.FromString(text);

                if (!readCorrectly)
                {
                    QuickLogger.Warning($"Pack file in '{pluginFolder}' contained errors and could not be read");
                    continue;
                }

                plugin.PluginPackFolder = pluginFolder;

                yield return(plugin);
            }
        }
        public static void Patch()
        {
            try
            {
                QuickLogger.Info($"Started patching. Version {QuickLogger.GetAssemblyVersion()}");

                var thermalMk2 = new CyclopsThermalChargerMk2();
                thermalMk2.Patch();

                MCUServices.Register.CyclopsUpgradeHandler((SubRoot cyclops) =>
                {
                    return(new ThermalUpgradeHandler(TechType.CyclopsThermalReactorModule, thermalMk2.TechType, cyclops));
                });

                MCUServices.Register.CyclopsCharger <ThermalCharger>((SubRoot cyclops) =>
                {
                    return(new ThermalCharger(thermalMk2.TechType, cyclops));
                });

                MCUServices.Register.PdaIconOverlay(TechType.CyclopsThermalReactorModule, CreateIconOverlay);
                MCUServices.Register.PdaIconOverlay(thermalMk2.TechType, CreateIconOverlay);

                QuickLogger.Info($"Finished patching.");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
        private static void ParseAndPatchFiles(string[] workingFiles, string directory)
        {
            QuickLogger.Info($"{workingFiles.Length} files found in the {directory} folder");

            int rollingCount = 0;

            foreach (string file in workingFiles)
            {
                rollingCount += DeserializeFile(file);
            }

            QuickLogger.Info($"{rollingCount} entries successfully discovered across files in {directory}");

            QuickLogger.Debug($"Validating entries - First Pass");
            foreach (IParsingPackage package in OrderedPackages)
            {
                package.PrePassValidation();
            }

            QuickLogger.Debug($"Validating entries - Second Pass");
            MasterUniquenessValidation();

            QuickLogger.Debug($"Sending requests to SMLHelper");
            foreach (IParsingPackage package in OrderedPackages)
            {
                package.SendToSMLHelper();
            }
        }
        public static void Patch()
        {
            try
            {
                QuickLogger.Info($"Started patching. Version {QuickLogger.GetAssemblyVersion()}");

                var solar1 = new CyclopsSolarCharger();
                var solar2 = new CyclopsSolarChargerMk2(solar1);

                solar1.Patch();
                solar2.Patch();

                MCUServices.Register.CyclopsCharger <SolarCharger>((SubRoot cyclops) =>
                {
                    return(new SolarCharger(solar1.TechType, solar2.TechType, cyclops));
                });

                MCUServices.Register.CyclopsUpgradeHandler((SubRoot cyclops) =>
                {
                    return(new SolarUpgradeHandler(solar1.TechType, solar2.TechType, cyclops));
                });

                MCUServices.Register.PdaIconOverlay(solar1.TechType, CreateIconOverlay);

                MCUServices.Register.PdaIconOverlay(solar2.TechType, CreateIconOverlay);

                QuickLogger.Info($"Finished patching.");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Ejemplo n.º 8
0
        public static void Patch()
        {
            QuickLogger.Info("Started patching " + QuickLogger.GetAssemblyVersion());
            QuickLogger.DebugLogsEnabled = false;

            var defenseSystem = new CyclopsAutoDefense();

            defenseSystem.Patch();

            var antiParasites = new CyclopsParasiteRemover();

            antiParasites.Patch();

            var defenseSystemMk2 = new CyclopsAutoDefenseMk2(defenseSystem);

            defenseSystemMk2.Patch();

            DisplayTexts.Main.Patch();

            var harmony = new Harmony("com.cyclopsautozapper.psmod");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            QuickLogger.Info("Finished Patching");
        }
Ejemplo n.º 9
0
        public static void Patch()
        {
            try
            {
                QuickLogger.Info($"Started patching. Version: {QuickLogger.GetAssemblyVersion(Assembly.GetExecutingAssembly())}");

#if DEBUG
                QuickLogger.DebugLogsEnabled = true;
                QuickLogger.Debug("Debug logs enabled");
#endif

                GlobalBundle = FcAssetBundlesService.PublicAPI.GetAssetBundleByName(FcAssetBundlesService.PublicAPI.GlobalBundleName);

                Configuration = Mod.LoadConfiguration();

                OptionsPanelHandler.RegisterModOptions(new Options());

                AddTechFabricatorItems();

                var harmony = HarmonyInstance.Create("com.hydroponicharvestor.fcstudios");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                VersionChecker.Check <ModConfiguration>("https://github.com/ccgould/FCStudios_SubnauticaMods/raw/master/FCS_HydroponicHarvesters/mod.json");

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Ejemplo n.º 10
0
        public static void Patch()
        {
            QuickLogger.Info($"Started patching. Version: {QuickLogger.GetAssemblyVersion(Assembly.GetExecutingAssembly())}");

#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
#endif

            var harmony = HarmonyInstance.Create("com.fcsdemo.fcstudios");
            harmony.PatchAll(Assembly.GetExecutingAssembly());

            Configuration = Mod.LoadConfiguration();

            foreach (ModEntry modEntry in Configuration.Config.Prefabs)
            {
                QuickLogger.Info($"Added Prefab {modEntry.ClassID}");
                modEntry.Prefab = FCSDemoModel.GetPrefabs(modEntry.PrefabName);
                var prefab = new FCSDemoBuidable(modEntry);
                prefab.Patch();
            }

            try
            {
                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
        public void OnProtoDeserialize(ProtobufSerializer serializer)
        {
            QuickLogger.Debug("// ****************************** Load Data *********************************** //");

            if (_prefabID != null)
            {
                QuickLogger.Info($"Loading Horizontal Duck {_prefabID.Id}");

                if (File.Exists(SaveFile))
                {
                    string savedDataJson = File.ReadAllText(SaveFile).Trim();

                    //LoadData
                    var savedData = JsonConvert.DeserializeObject <SaveData>(savedDataJson);

                    BoxCollider collider = this.gameObject.GetComponent <BoxCollider>();
                    collider.size = new Vector3(savedData.Size.X, savedData.Size.Y, savedData.Size.Z);
                }
            }
            else
            {
                QuickLogger.Error("PrefabIdentifier is null");
            }
            QuickLogger.Debug("// ****************************** Loaded Data *********************************** //");
        }
Ejemplo n.º 12
0
        public static void Patch()
        {
            QuickLogger.Info("Started patching. Version: " + QuickLogger.GetAssemblyVersion(Assembly.GetExecutingAssembly()));

#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
#endif

            try
            {
                Config = Mod.LoadConfiguration();

                AddTechFabricatorItems();

                ExStorageDepotBuildable.PatchHelper();

                var harmony = HarmonyInstance.Create("com.exstoragedepot.fcstudios");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
        private void OnEnable()
        {
            if (!_runStartUpOnEnable)
            {
                return;
            }

            if (!IsInitialized)
            {
                Initialize();
            }

            if (_data == null)
            {
                ReadySaveData();
            }

            if (_fromSave)
            {
                TankManager.SetTankLevel(_data.TankLevel);
                ColorManager.SetColorFromSave(_data.BodyColor.Vector4ToColor());
                StorageManager.NumberOfBottles = _data.ContainerAmount;
                _isInSub = _data.IsInSub;
                QuickLogger.Info($"Loaded {Mod.FriendlyName}");
                _fromSave = false;
            }
        }
        public void PrePassValidation()
        {
            //  Use the ToSet function as a copy constructor - this way we can iterate across the
            //      temp structure, but change the permanent one in the case of duplicates
            foreach (CustomCraftEntry item in this.ParsedEntries)
            {
                if (!item.PassesPreValidation(item.Origin))
                {
                    continue;
                }

                if (this.UniqueEntries.ContainsKey(item.ID))
                {
                    QuickLogger.Warning($"Duplicate entry for {this.TypeName} '{item.ID}' in {item.Origin} was already added by another working file. Kept first one. Discarded duplicate.");
                }
                else
                {
                    // All checks passed
                    this.UniqueEntries.Add(item.ID, item);
                }
            }

            if (this.ParsedEntries.Count > 0)
            {
                QuickLogger.Info($"{this.UniqueEntries.Count} of {this.ParsedEntries.Count} {this.TypeName} entries staged for patching");
            }
        }
Ejemplo n.º 15
0
        private void OnEnable()
        {
            if (_runStartUpOnEnable)
            {
                if (!IsInitialized)
                {
                    Initialize();
                }

                if (_fromSave)
                {
                    if (_savedData == null)
                    {
                        ReadySaveData();
                    }

                    ColorManager.SetColorFromSave(_savedData.BodyColor.Vector4ToColor());
                    GaspodCollectorStorage.SetStorageAmount(_savedData.GaspodAmount);
                    PowerManager.LoadSaveData(_savedData.Batteries);
                    DisplayManager.OnStorageAmountChange(_savedData.GaspodAmount);
                    ReattachBeaconAfterLoad();
                    QuickLogger.Info($"Loaded {Mod.FriendlyName}");
                }

                _runStartUpOnEnable = false;
            }
        }
Ejemplo n.º 16
0
        private void OnEnable()
        {
            if (!_runStartUpOnEnable)
            {
                return;
            }

            Setup();

            if (_fromSave)
            {
                QuickLogger.Info($"Loading {Mod.FriendlyName}");
                var prefabIdentifier = GetComponent <PrefabIdentifier>();
                var id   = prefabIdentifier?.Id ?? string.Empty;
                var data = Mod.GetSaveData(id);

                if (data == null)
                {
                    QuickLogger.Info($"No save found for PrefabId {id}");
                    return;
                }

                SetPinging(data.IsPinging);
                HealthManager.SetHealth(data.HealthLevel);
                OxygenManager.SetO2Level(data.OxygenLevel);
                _beaconID = data.BeaconID;
                _fromSave = false;

                ReattachBeaconAfterLoad();

                QuickLogger.Info($"Loaded {Mod.FriendlyName}");
            }
        }
Ejemplo n.º 17
0
        // This mod is intended to be replaced by the VModFabricator
        // But since some people still want it, it's kept up and maintained.
        public static void Patch()
        {
            QuickLogger.Info("Started patching " + QuickLogger.GetAssemblyVersion());

            // Remove all original Cyclops fabricator nodes
            foreach (string origNodeID in NodeCollections.OriginalCyclopsModuleCraftingNodes)
            {
                CraftTreeHandler.RemoveNode(CraftTree.Type.CyclopsFabricator, origNodeID);
            }

            NodeCollections.CheckForCrossModAdditions();

            // Includes a new Cyclops Upgrades Tab (This will keep things more organized and prevent the icons from being rendered off screen when there's too many)
            // Recreates all the tabs from the Vehicle Upgrade Console

            foreach (ModulesTab tab in NodeCollections.UpgradeModuleTabs)
            {
                CraftTreeHandler.AddTabNode(CraftTree.Type.CyclopsFabricator, tab.TabID, tab.TabName, tab.TabSprite);

                foreach (TechType craftTypeID in tab.CraftNodes)
                {
                    CraftTreeHandler.AddCraftingNode(CraftTree.Type.CyclopsFabricator, craftTypeID, tab.TabID);
                }
            }

            QuickLogger.Info("Patching complete");
        }
        private void OnEnable()
        {
            if (_runStartUpOnEnable)
            {
                if (!IsInitialized)
                {
                    Initialize();
                }

                if (DisplayManager != null)
                {
                    var numberOfItems = FridgeComponent.NumberOfItems;
                    DisplayManager.OnContainerUpdate(numberOfItems, QPatch.Configuration.StorageLimit);
                    DisplayManager.UpdateScreenLabel(NameController.GetCurrentName(), NameController);
                }

                if (_fromSave)
                {
                    if (_savedData == null)
                    {
                        ReadySaveData();
                    }

                    PowerManager.LoadSave(_savedData.PowercellData);
                    FridgeComponent.LoadSave(_savedData.FridgeContainer);
                    NameController.SetCurrentName(_savedData.UnitName);
                    ColorManager.SetColorFromSave(_savedData.BodyColor.Vector4ToColor());
                    QuickLogger.Info($"Loaded {Mod.FriendlyName}");
                }

                _runStartUpOnEnable = false;
            }
        }
 internal void Patch()
 {
     QuickLogger.Info($"Patching plugin pack '{this.OriginalPlugInPack.PluginPackName}'");
     // Batteries must always patch before Power Cells
     _customBattery.Patch();
     _customPowerCell.Patch();
 }
Ejemplo n.º 20
0
        public static void Patch()
        {
            QuickLogger.Info("Initializing FCS Power Storage");

            var assembly = Assembly.GetExecutingAssembly();

            QuickLogger.Info("Started patching. Version: " + QuickLogger.GetAssemblyVersion(assembly));

            try
            {
#if DEBUG
                QuickLogger.DebugLogsEnabled = true;
                QuickLogger.Debug("Debug logs enabled");
#endif
                AddTechFabricatorItems();

                LoadData.Patch();

                FCSPowerStorageBuildable.PatchHelper();
            }
            catch (Exception e)
            {
                _success = false;
                QuickLogger.Error($"Error in QPatch {e.Message}");
            }
            QuickLogger.Info("FCS Power Storage initializ" + (!_success ? "ation failed." : "ed successfully."));
        }
Ejemplo n.º 21
0
        public static void PatchTextPacks()
        {
            string pluginPacksFolder = Path.Combine(CbCore.ExecutingFolder, "Packs");

            if (!Directory.Exists(pluginPacksFolder))
            {
                QuickLogger.Warning("'Packs' folder was not found. Folder will be created. No text plugins were patched.");
                Directory.CreateDirectory(pluginPacksFolder);
                return;
            }

            var customPacks = new List <TextPluginPack>();

            foreach (IParsedPluginPack pluginPack in GetAllPacks(pluginPacksFolder))
            {
                customPacks.Add(new TextPluginPack(pluginPack));
            }

            if (customPacks.Count == 0)
            {
                QuickLogger.Info("No plugin files were found in the 'Packs' folder. No text plugins were patched.");
                return;
            }

            foreach (TextPluginPack customPack in customPacks)
            {
                customPack.Patch();
            }
        }
Ejemplo n.º 22
0
        public static void Patch()
        {
            QuickLogger.Info("Started patching " + QuickLogger.GetAssemblyVersion());

            var zapper = new CyclopsZapperModule();

            zapper.Patch();

            MCUServices.Register.CyclopsUpgradeHandler((SubRoot cyclops) =>
            {
                return(new UpgradeHandler(zapper.TechType, cyclops)
                {
                    MaxCount = 2,
                });
            });

            MCUServices.Register.PdaIconOverlay(zapper.TechType, (uGUI_ItemIcon icon, InventoryItem upgradeModule) =>
            {
                return(new ZapperIconOverlay(zapper.TechType, icon, upgradeModule));
            });

            MCUServices.Register.AuxCyclopsManager <Zapper>((SubRoot cyclops) =>
            {
                return(new Zapper(zapper.TechType, cyclops));
            });

            var harmony = HarmonyInstance.Create("com.cyclopsautozapper.psmod");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            QuickLogger.Info("Finished Patching");
        }
Ejemplo n.º 23
0
        public static void Patch()
        {
            Version = QuickLogger.GetAssemblyVersion(Assembly.GetExecutingAssembly());
            QuickLogger.Info($"Started patching. Version: {Version}");


#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
#endif

            try
            {
                GlobalBundle = FCSTechFabricator.QPatch.Bundle;

                if (GlobalBundle == null)
                {
                    QuickLogger.Error("Global Bundle has returned null stopping patching");
                    throw new FileNotFoundException("Bundle failed to load");
                }

                LoadConfiguration();

                HSPBuildable.PatchSMLHelper();

                var harmony = HarmonyInstance.Create("com.seacooker.fcstudios");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Ejemplo n.º 24
0
        public void SelectAndShowObject(Transform target)
        {
            SelectedTransform = target;

            if (target == null)
            {
                return;
            }

            var controller = target.GetComponentInChildren <FCSDemoController>();

            if (controller == null)
            {
                return;
            }

            ChangeSelectedColor(controller);
            QuickLogger.Info($"Model {controller.Name} Selected", true);

            //while (target != null)
            //{
            //    _openedObjects.Add(target.gameObject);
            //    target = target.parent;
            //}

            //_wasObjectJustSelected = true;
        }
Ejemplo n.º 25
0
        public static void Patch()
        {
            Version = QuickLogger.GetAssemblyVersion(Assembly.GetExecutingAssembly());
            QuickLogger.Info($"Started patching. Version: {Version}");


#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
#endif

            try
            {
                GlobalBundle = FcAssetBundlesService.PublicAPI.GetAssetBundleByName(FcAssetBundlesService.PublicAPI
                                                                                    .GlobalBundleName);

                if (GlobalBundle == null)
                {
                    QuickLogger.Error("Global Bundle has returned null stopping patching");
                    throw new FileNotFoundException("Bundle failed to load");
                }

                AddTechFabricatorItems();

                var alterraGen = new CUCBuildable();
                alterraGen.Patch();

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Ejemplo n.º 26
0
        internal void HealPlayer()
        {
            if (!IsPlayerInTrigger)
            {
                QuickLogger.Info(LanguageHelpers.GetLanguage(AMMiniMedBayBuildable.NotInPositionMessageKey), true);
                return;
            }

            if (_nitrogenLevel.GetNitrogenEnabled())
            {
                _nitrogenPartial = _nitrogenLevel.safeNitrogenDepth / _processTime;
            }

            if (!PowerManager.GetIsPowerAvailable())
            {
                return;
            }

            if (Player.main.liveMixin.IsFullHealth())
            {
                return;
            }

            Player.main.playerController.SetEnabled(false);
            var remainder = Player.main.liveMixin.maxHealth - Player.main.liveMixin.health;

            _healthPartial = remainder / _processTime;
            PowerManager.SetHasBreakerTripped(false);
            UpdateIsHealing(true);
        }
Ejemplo n.º 27
0
        public static void Patch()
        {
            var assembly = Assembly.GetExecutingAssembly();

            QuickLogger.Info("Started patching. Version: " + QuickLogger.GetAssemblyVersion(assembly));

#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
#endif

            try
            {
                AddTechFabricatorItems();

                AMMiniMedBayBuildable.PatchHelper();

                var harmony = HarmonyInstance.Create("com.amminimedbay.fcstudios");

                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Ejemplo n.º 28
0
        public static void Patch()
        {
            QuickLogger.Info($"Started patching. Version {QuickLogger.GetAssemblyVersion()}");

            try
            {
                var harmony = HarmonyInstance.Create("com.CyclopsEnhancedSonar.psmod");
                harmony.Patch( // Create a postfix patch on the SubControl Start method to add the CySonarComponent
                    original: AccessTools.Method(typeof(SubControl), nameof(SubControl.Start)),
                    postfix: new HarmonyMethod(typeof(QPatch), nameof(QPatch.SubControlStartPostfix)));

                // Register a custom upgrade handler for the CyclopsSonarModule
                MCUServices.Register.CyclopsUpgradeHandler((SubRoot s) => new SonarUpgradeHandler(s));

                // Register a PDA Icon Overlay for the CyclopsSonarModule
                MCUServices.Register.PdaIconOverlay(TechType.CyclopsSonarModule,
                                                    (uGUI_ItemIcon i, InventoryItem u) => new SonarPdaDisplay(i, u));

                // Add a language line for the text in the SonarPdaDisplay to allow it to be easily overridden
                LanguageHandler.SetLanguageLine(SonarPdaDisplay.SpeedUpKey, SonarPdaDisplay.SpeedUpText);

                QuickLogger.Info($"Finished patching.");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Ejemplo n.º 29
0
        internal static void CheckLogLevel()
        {
            if (!File.Exists(FileLocations.ConfigFile))
            {
                File.WriteAllText(FileLocations.ConfigFile, Config.PrettyPrint());
                QuickLogger.DebugLogsEnabled = false;
                QuickLogger.Info("CustomCraft2Config file was not found. Default file written.");
            }
            else
            {
                string configText = File.ReadAllText(FileLocations.ConfigFile, Encoding.UTF8);

                if (Config.FromString(configText))
                {
                    QuickLogger.DebugLogsEnabled = Config.EnabledDebugLogs;
                }
            }

            if (QuickLogger.DebugLogsEnabled)
            {
                QuickLogger.Debug("Debug logging is enable");
            }
            else
            {
                QuickLogger.Info("To enable Debug logging, change the \"DebugLogsEnabled\" attribute in the mod.json file to true");
            }
        }
Ejemplo n.º 30
0
        private void OnEnable()
        {
            if (!_runStartUpOnEnable)
            {
                return;
            }

            if (!IsInitialized)
            {
                Initialize();
            }

            if (_data == null)
            {
                ReadySaveData();
            }

            if (_fromSave)
            {
                NameController.SetCurrentName(_data.UnitName);
                SetIsGlobal(_data.IsGlobal);
                ColorManager.SetColorFromSave(_data.BodyColor.Vector4ToColor());
                DisplayManager.SetTab(_data.SelectedTab);
                QuickLogger.Info($"Loaded {Mod.FriendlyName}");
                _fromSave = false;
            }
        }