public GameDefinition(Game game, Func <string, bool> status) { if (game != null) { id = game.id; ManifestVersion = game.ManifestVersion; AllTypesHash = game.AllTypesHash; WorldBuilderVersion = game.WorldBuilderVersion; ThemeColor = game.ThemeColor; if (Registry.LocalMachine.OpenSubKey(game.RegistryEntry.Key) != null && Registry.LocalMachine.OpenSubKey(game.RegistryEntry.Key).GetValue(game.RegistryEntry.Value) != null) { DocPath = string.Format( "{0}{1}{2}{1}Mods", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Path.DirectorySeparatorChar, Registry.LocalMachine.OpenSubKey(game.RegistryEntry.Key).GetValue(game.RegistryEntry.Value).ToString()); } else { DocPath = string.Empty; } Streams = new List <StreamDefinition>(); foreach (StreamType stream in game.Stream) { Streams.Add(new StreamDefinition(stream)); } DefinitionPath = string.Format( "{0}{1}Games{1}{2}", Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), Path.DirectorySeparatorChar, id); Assets = new AssetDefinition(); getAssetDefinitions(new DirectoryInfo(DefinitionPath), status); foreach (BaseAssetType asset in Assets.AssetTypes) { if (asset.GetType() == typeof(AssetType)) { foreach (BaseAssetType otherAsset in Assets.AssetTypes) { if (otherAsset.GetType() == typeof(AssetType)) { AssetType otherAssetType = otherAsset as AssetType; if (otherAssetType.Entries != null && otherAssetType.Entries[0].GetType() == typeof(EntryInheritanceType) && (otherAssetType.Entries[0] as EntryInheritanceType).AssetType == asset.id) { asset.Subclasses.Add(otherAssetType); otherAssetType.Superclass = asset; } } } } } foreach (GameAssetType asset in Assets.GameAssetTypes) { foreach (GameAssetType otherAsset in Assets.GameAssetTypes) { if (otherAsset.Entries != null && otherAsset.Entries[0].GetType() == typeof(EntryInheritanceType) && (otherAsset.Entries[0] as EntryInheritanceType).AssetType == asset.id) { asset.Subclasses.Add(otherAsset); otherAsset.Superclass = asset; } } } } else { id = "None"; } }
public void Merge(AssetDefinition source) { AssetTypes.AddRange(source.AssetTypes); GameAssetTypes.AddRange(source.GameAssetTypes); }