Exemplo n.º 1
0
        public ModManifest(string path)
        {
            InstalledPath = path;
            path          = path + "/module.xml";
            XmlObjectLoader loader = new XmlObjectLoader(path);
            ModXML          xmldata;

            if (loader.Load <XML.ModXML>(out xmldata))
            {
                MetaData = new ModBaseInfo(InstalledPath,
                                           xmldata.ModInfo.Name,
                                           xmldata.ModInfo.Description,
                                           xmldata.ModInfo.Version,
                                           xmldata.ModInfo.Icon,
                                           xmldata.ModInfo.Thumb,
                                           xmldata.ModInfo.StartupBackground,
                                           xmldata.ModInfo.Assemblies,
                                           xmldata.ModInfo.DisplayInChooser);
                Data = new ModDataInfo(xmldata.Data.animationXml,
                                       xmldata.Data.characterXML,
                                       xmldata.Data.soundXML,
                                       xmldata.Data.musicXML,
                                       xmldata.Data.itemXML,
                                       xmldata.Data.itemTypeXML,
                                       xmldata.Data.sideXML,
                                       xmldata.Data.skinXML,
                                       xmldata.Data.mapsXml,
                                       xmldata.Data.worldMapsXML,
                                       xmldata.Data.locationsXML,
                                       xmldata.Data.skeletonsXML,
                                       xmldata.Data.modelsXml,
                                       xmldata.Data.scenePropsXML,
                                       xmldata.Data.menusXml,
                                       xmldata.Data.stringsXml,
                                       xmldata.Data.uiLayoutsXml,
                                       xmldata.Data.cursorsXml,
                                       xmldata.Data.mapTemplatesXml,
                                       xmldata.Data.vehicleXml,
                                       xmldata.Data.DataDir.MapDir,
                                       xmldata.Data.DataDir.MusicDir,
                                       xmldata.Data.DataDir.ScriptDir);
                Media = xmldata.Media;

                Settings = xmldata.Settings.Settings;

                ID = (new DirectoryInfo(path)).Name;
            }
        }
Exemplo n.º 2
0
        private void LoadXmlData(ModManifest manifest)
        {
            XmlObjectLoader loader = null;

            if (!string.IsNullOrEmpty(manifest.Data.Animations))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Animations);
                ModAnimationsDfnXml animationDfn;
                loader.Load(out animationDfn);
                currentMod.AnimationInfos = animationDfn.Animations;
                loadModWorker.ReportProgress(20);
            }

            if (!string.IsNullOrEmpty(manifest.Data.Characters))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Characters);
                ModCharactersDfnXML characterDfn;
                loader.Load(out characterDfn);
                currentMod.CharacterInfos = characterDfn.CharacterDfns;
                loadModWorker.ReportProgress(50);
            }

            if (!string.IsNullOrEmpty(manifest.Data.ItemTypes))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.ItemTypes);
                ModItemTypesDfnXml itemTypesDfn;
                loader.Load(out itemTypesDfn);
                currentMod.ItemTypeInfos = itemTypesDfn != null ? itemTypesDfn.ItemTypes : null;
                loadModWorker.ReportProgress(75);
            }

            if (!string.IsNullOrEmpty(manifest.Data.Items))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Items);
                ModItemsDfnXML itemDfn;
                loader.Load(out itemDfn);
                currentMod.ItemInfos = itemDfn != null ? itemDfn.Items : null;
                loadModWorker.ReportProgress(75);
            }

            if (!string.IsNullOrEmpty(manifest.Data.Sides))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Sides);
                ModSidesDfnXML sideDfn;
                loader.Load(out sideDfn);
                currentMod.SideInfos = sideDfn.Sides;
                loadModWorker.ReportProgress(80);
            }

            if (!string.IsNullOrEmpty(manifest.Data.Skin))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Skin);
                ModSkinDfnXML skinDfn;
                loader.Load(out skinDfn);
                currentMod.SkinInfos = skinDfn.CharacterSkinList;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Music))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Music);
                ModTracksDfnXML trackDfn;
                loader.Load(out trackDfn);
                currentMod.MusicInfos = trackDfn.Tracks;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Sound))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Sound);
                ModSoundsDfnXML soundDfn;
                loader.Load(out soundDfn);
                currentMod.SoundInfos = soundDfn.Sounds;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Maps))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Maps);
                ModMapsDfnXml mapsDfn;
                loader.Load(out mapsDfn);
                currentMod.MapInfos = mapsDfn.Maps;
            }

            if (!string.IsNullOrEmpty(manifest.Data.WorldMaps))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.WorldMaps);
                ModWorldMapsDfnXml worldMapsDfn;
                loader.Load(out worldMapsDfn);
                currentMod.WorldMapInfos = worldMapsDfn.WorldMaps;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Locations))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Locations);
                ModLocationsDfnXml locationsDfn;
                loader.Load(out locationsDfn);
                currentMod.LocationInfos = locationsDfn.Locations;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Skeletons))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Skeletons);
                ModSkeletonsDfnXML skeletonsDfn;
                loader.Load(out skeletonsDfn);
                currentMod.SkeletonInfos = skeletonsDfn.Skeletons;
            }

            if (!string.IsNullOrEmpty(manifest.Data.SceneProps))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.SceneProps);
                ModScenePropsDfnXml scenePropsDfnXml;
                loader.Load(out scenePropsDfnXml);
                currentMod.ScenePropInfos = scenePropsDfnXml.SceneProps;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Models))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Models);
                ModModelsDfnXml modelsDfnXml;
                loader.Load(out modelsDfnXml);
                currentMod.ModelInfos = modelsDfnXml.Models;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Menus))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Menus);
                ModMenusDfnXml menusDfnXml;
                loader.Load(out menusDfnXml);
                currentMod.MenuInfos = menusDfnXml.Menus;
            }

            if (!string.IsNullOrEmpty(manifest.Data.UILayouts))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.UILayouts);
                ModUILayoutsDfnXml uiLayoutsDfnXml;
                loader.Load(out uiLayoutsDfnXml);
                currentMod.UILayoutInfos = uiLayoutsDfnXml.UILayouts;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Strings))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Strings);
                ModStringsDfnXml stringsDfnXml;
                loader.Load(out stringsDfnXml);
                currentMod.StringInfos = stringsDfnXml.Strings;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Cursors))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Cursors);
                ModCursorsDfnXml cursorsDfnXml;
                loader.Load(out cursorsDfnXml);
                currentMod.CursorInfos = cursorsDfnXml.Cursors;
            }

            if (!string.IsNullOrEmpty(manifest.Data.MapTemplates))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.MapTemplates);
                ModMapTemplatesDfnXml mapTemplatesDfnXml;
                loader.Load(out mapTemplatesDfnXml);
                currentMod.MapTemplateInfos = mapTemplatesDfnXml.MapTemplates;
            }

            if (!string.IsNullOrEmpty(manifest.Data.Vehicles))
            {
                loader = new XmlObjectLoader(manifest.InstalledPath + "/" + manifest.Data.Vehicles);
                ModVehiclesDfnXml vehiclesDfnXml;
                loader.Load(out vehiclesDfnXml);
                currentMod.VehicleInfos = vehiclesDfnXml.VehicleDfns;
            }
        }