コード例 #1
0
ファイル: XGEFSettings.cs プロジェクト: ketura/XGEF
        public static XGEFSettings ConsolidateFromFile(string path)
        {
            List <DummySettings> list     = DummyFromFile(path).ToList();
            XGEFSettings         settings = GetDefaultSettings();

            foreach (var dummy in list)
            {
                foreach (PropertyInfo dummyProp in typeof(DummySettings).GetProperties())
                {
                    PropertyInfo prop       = typeof(XGEFSettings).GetProperty(dummyProp.Name);
                    object       dummyField = dummyProp.GetValue(dummy, null);
                    object       field      = prop.GetValue(settings, null);
                    if (dummyField == null)
                    {
                        continue;
                    }

                    if (!dummyField.Equals(field))
                    {
                        prop.SetValue(settings, dummyField);
                    }
                }
            }

            return(settings);
        }
コード例 #2
0
        public override void LoadSettings(XGEFSettings settings)
        {
            CoreMod = GetCoreModInfo(settings);

            WriteConsolidatedFiles    = settings.SaveConsolidatedCode;
            ConsolidatedFilesLocation = settings.ConsolidatedCodeLocation;

            if (WriteConsolidatedFiles)
            {
                Directory.CreateDirectory(ConsolidatedFilesLocation);
            }

            IgnoreCircularReferences = settings.IgnoreCircularDependencies;
            IgnoreConflictingMods    = settings.IgnoreModConflicts;
            IgnoreRequiredMods       = settings.IgnoreModRequirements;

            CircularExceptions       = settings.CircularExceptions;
            ModRequirementExceptions = settings.ModRequirementExceptions;
            ModConflictExceptions    = settings.ModConflictExceptions;

            if (IgnoreCircularReferences == RequirementHandling.Specify && CircularExceptions.Count == 0)
            {
                Manager.Warn($"IgnoreCircularDependencies is set to '{RequirementHandling.Specify.ToString()}', but CircularExceptions has not been populated with any mod IDs!");
            }

            if (IgnoreRequiredMods == RequirementHandling.Specify && ModRequirementExceptions.Count == 0)
            {
                Manager.Warn($"IgnoreRequiredMods is set to '{RequirementHandling.Specify.ToString()}', but ModRequirementExceptions has not been populated with any mod IDs!");
            }

            if (IgnoreConflictingMods == RequirementHandling.Specify && ModRequirementExceptions.Count == 0)
            {
                Manager.Warn($"IgnoreConflictingMods is set to '{RequirementHandling.Specify.ToString()}', but ModRequirementExceptions has not been populated with any mod IDs!");
            }
        }
コード例 #3
0
        protected ModInfo GetCoreModInfo(XGEFSettings settings)
        {
            ModInfo core = ModInfo.FromFile(Path.Combine(CoreLocation, settings.EngineRelativePath, ModInfo.DefaultFilename));

            core.ModName              = settings.CoreModAssemblyName;
            core.ModDescription       = "A collection of default systems that make up the core of the game.";
            core.RequestedRunPriority = RequestedPriority.Normal;
            core.ModID     = ModInfo.CoreModID;
            core.ModAuthor = "XGEF";

            core.SetLocation(CoreLocation);
            core.CleanLists();

            return(core);
        }
コード例 #4
0
ファイル: XGEFSettings.cs プロジェクト: ketura/XGEF
        public static XGEFSettings GetDefaultSettings()
        {
            XGEFSettings settings = new XGEFSettings()
            {
                CoreModAssemblyName        = "CoreMods",
                EngineRelativePath         = "Engine",
                GameRelativePath           = "Game",
                LogOutput                  = LogLevel.Info,
                LogMethodTrace             = false,
                IgnoreCircularDependencies = RequirementHandling.None,
                CircularExceptions         = new List <Guid>(),
                IgnoreModRequirements      = RequirementHandling.None,
                ModRequirementExceptions   = new List <Guid>(),
                IgnoreModConflicts         = RequirementHandling.None,
                ModConflictExceptions      = new List <Guid>()
            };

            return(settings);
        }
コード例 #5
0
 public virtual void LoadSettings(XGEFSettings settings)
 {
 }