示例#1
0
        public void SaveMaps(ICLIFlags toolFlags)
        {
            string basePath;

            if (toolFlags is ExtractFlags flags)
            {
                basePath = flags.OutputPath;
            }
            else
            {
                throw new Exception("no output path");
            }

            Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides);

            if (parsedTypes == null)
            {
                QueryHelp(QueryTypes);
                return;
            }

            foreach (ulong key in TrackedFiles[0x9F])
            {
                STUMapHeader map = GetInstance <STUMapHeader>(key);
                if (map == null)
                {
                    continue;
                }
                MapHeader mapInfo = ListMaps.GetMap(key);
                mapInfo.Name = mapInfo.Name ?? "Title Screen";

                Dictionary <string, ParsedArg> config = GetQuery(parsedTypes, mapInfo.Name, mapInfo.VariantName,
                                                                 mapInfo.GetUniqueName(), mapInfo.GetName(), teResourceGUID.Index(map.m_map).ToString("X"), "*");

                if (config.Count == 0)
                {
                    continue;
                }

                Map.Save(flags, mapInfo, map, key, basePath);
                SaveScratchDatabase();
            }
        }
示例#2
0
        private static void ProcessMapNames(DynamicChoicesContainer container)
        {
            var mapContainer = container.GetType(VALID_MAP_NAMES);

            foreach (ulong key in Program.TrackedFiles[0x9F])
            {
                MapHeader map = ListMaps.GetMap(key);
                if (map == null)
                {
                    continue;
                }

                var name = map.VariantName ?? map.Name ?? $"Title Screen ({teResourceGUID.Index(key):X})";

                mapContainer.Choices.Add(new DynamicChoice {
                    DisplayName = name,
                    QueryName   = teResourceGUID.Index(map.MapGUID).ToString("X")
                });
            }
        }
示例#3
0
        public void SaveMaps(ICLIFlags toolFlags)
        {
            string basePath;

            if (toolFlags is ExtractFlags flags)
            {
                basePath = flags.OutputPath;
            }
            else
            {
                throw new Exception("no output path");
            }

            Dictionary <string, Dictionary <string, ParsedArg> > parsedTypes = ParseQuery(flags, QueryTypes, QueryNameOverrides);

            if (parsedTypes == null)
            {
                QueryHelp(QueryTypes); return;
            }
            foreach (ulong key in TrackedFiles[0x9F])
            {
                STUMap map = GetInstance <STUMap>(key);
                if (map == null)
                {
                    continue;
                }
                ListMaps.MapInfo mapInfo = ListMaps.GetMap(key);
                mapInfo.Name = mapInfo.Name ?? "Title Screen";

                Dictionary <string, ParsedArg> config = new Dictionary <string, ParsedArg>();
                foreach (string name in new [] { mapInfo.Name, mapInfo.NameB, mapInfo.UniqueName, GUID.Index(map.MapDataResource1).ToString("X"), "*" })
                {
                    if (name == null)
                    {
                        continue;
                    }
                    string theName = name.ToLowerInvariant();
                    if (!parsedTypes.ContainsKey(theName))
                    {
                        continue;
                    }
                    foreach (KeyValuePair <string, ParsedArg> parsedArg in parsedTypes[theName])
                    {
                        if (config.ContainsKey(parsedArg.Key))
                        {
                            config[parsedArg.Key] = config[parsedArg.Key].Combine(parsedArg.Value);
                        }
                        else
                        {
                            config[parsedArg.Key] = parsedArg.Value.Combine(null); // clone for safety
                        }
                    }
                }

                if (config.Count == 0)
                {
                    continue;
                }

                Map.Save(flags, map, key, basePath);
            }
        }