Exemplo n.º 1
0
        // Token: 0x06001009 RID: 4105 RVA: 0x000687F0 File Offset: 0x000669F0
        public bool Equals(object obj)
        {
            ModInfo modInfo = obj as ModInfo;

            return(modInfo != null && modInfo.Id == this.Id);
        }
Exemplo n.º 2
0
        // Token: 0x0600100B RID: 4107 RVA: 0x0006883C File Offset: 0x00066A3C
        public static ModInfo LoadFromFile(string path, bool debugInfo)
        {
            ModInfo modInfo = ModXmlLoader.Deserialize <ModInfo>(path, false);

            if (modInfo == null)
            {
                InternalModding.Assemblies.MLog.Error("Could not load " + new FileInfo(path));
                return(null);
            }
            modInfo.Directory = new FileInfo(path).Directory.FullName;
            for (int i = 0; i < modInfo.Events.Count; i++)
            {
                ModInfo.EventInfo eventInfo = modInfo.Events[i];
                if (!eventInfo.Validate("Event"))
                {
                    InternalModding.Assemblies.MLog.Error("Not loading the mod manifest.");
                    return(null);
                }
                if (!string.IsNullOrEmpty(eventInfo.Path))
                {
                    modInfo.Events[i] = ModXmlLoader.Deserialize <ModInfo.EventInfo>(ModPaths.GetFilePath(modInfo, eventInfo.Path, false), false);
                    if (modInfo.Events[i] == null)
                    {
                        InternalModding.Assemblies.MLog.Error("Not loading the mod manifest.");
                        return(null);
                    }
                }
            }
            foreach (ModInfo.EventInfo eventInfo2 in modInfo.Events)
            {
                //eventInfo2.CreateProperties();
            }
            if (modInfo.IdFromFileSpecified)
            {
                modInfo.Id = new Guid(modInfo.IdFromFile);
            }
            else
            {
                modInfo.Id = Guid.NewGuid();
                InternalModding.Assemblies.MLog.Info(string.Concat(new object[]
                {
                    "Generated an ID for ",
                    modInfo.Name,
                    " (",
                    modInfo.Id,
                    "), writing it to the file."
                }));
                ModInfo.WriteIdElement(modInfo);
            }
            if (!modInfo.Validate())
            {
                InternalModding.Assemblies.MLog.Error("There was an error loading the mod manifest: " + path);
                return(null);
            }
            modInfo.Description = modInfo.Description.Trim();
            foreach (ModInfo.AssemblyInfo assemblyInfo in modInfo.Assemblies)
            {
                assemblyInfo.Path = ModPaths.GetFilePath(modInfo, assemblyInfo.Path, false);
            }
            foreach (ModInfo.BlockInfo blockInfo in modInfo.Blocks)
            {
                blockInfo.Path = ModPaths.GetFilePath(modInfo, blockInfo.Path, false);
            }
            foreach (ModInfo.EntityInfo entityInfo in modInfo.Entities)
            {
                entityInfo.Path = ModPaths.GetFilePath(modInfo, entityInfo.Path, false);
            }
            if (modInfo.ResourceChoices.Resources == null)
            {
                modInfo.ResourceChoices.Resources = new ModInfo.ResourceInfo[0];
                //modInfo.ResourceChoices.ResourceTypes = new ModResource.ResourceType[0];
            }
            for (int j = 0; j < modInfo.ResourceChoices.Resources.Length; j++)
            {
                ModInfo.ResourceInfo resourceInfo = modInfo.ResourceChoices.Resources[j];
                resourceInfo.Path = ModPaths.GetFilePath(modInfo, resourceInfo.Path, true);
                //resourceInfo.Type = modInfo.ResourceChoices.ResourceTypes[j];
            }
            return(modInfo);
        }
Exemplo n.º 3
0
 // Token: 0x06000FC0 RID: 4032 RVA: 0x0006813C File Offset: 0x0006633C
 public ModContainer(ModInfo data)
 {
     this.Info       = data;
     this.Assemblies = new List <ModAssembly>();
     this.HadLoadOrActivateErrors = false;
 }