Example #1
0
        /// <summary>
        ///     Read a KTID File list
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="game"></param>
        /// <returns></returns>
        public static Dictionary <KTIDReference, string> LoadKTIDFileList(string?filename = null, string game = "")
        {
            var loc      = ManagedFSHelper.GetFileListLocation(filename, game, "rdb");
            var csv      = ManagedFSHelper.GetFileList(loc, 3);
            var fileList = new Dictionary <KTIDReference, string>();

            foreach (var(key, value) in csv.Select(x => (key: KTIDReference.Parse(x[1].ToLower(), NumberStyles.HexNumber), value: x[2])))
            {
                fileList[key] = value;
            }

            return(fileList);
        }
Example #2
0
        /// <summary>
        ///     Read a KTID file list preserving the namespace
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="game"></param>
        /// <returns></returns>
        public static Dictionary <KTIDReference, (string, string)> LoadKTIDFileListEx(string?filename = null, string game = "")
        {
            var loc      = ManagedFSHelper.GetFileListLocation(filename, game, "rdb");
            var csv      = ManagedFSHelper.GetFileList(loc, 3);
            var fileList = new Dictionary <KTIDReference, (string, string)>();

            foreach (var(key, value) in csv.Select(x => (key: KTIDReference.Parse(x[1].ToLower(), NumberStyles.HexNumber), value: (x[0], x[2]))))
            {
                if (fileList.ContainsKey(key))
                {
                    Logger.Warn("NYO", $"File List contains filename hash twice! ({key}, {value}, {fileList[key]})");
                }
                fileList[key] = value;
            }

            return(fileList);
        }