Esempio n. 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;
                }
                ListMaps.MapInfo mapInfo = ListMaps.GetMap(key);
                mapInfo.Name = mapInfo.Name ?? "Title Screen";

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

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

                Map.Save(flags, map, key, basePath);
            }
        }
Esempio n. 2
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);
            }
        }