コード例 #1
0
        public IEnumerable <string> AllFileNames()
        {
            var lookup = new Dictionary <uint, string>();

            if (GlobalFileSystem.Exists("global mix database.dat"))
            {
                var db = new XccGlobalDatabase(GlobalFileSystem.Open("global mix database.dat"));
                foreach (var e in db.Entries)
                {
                    var hash = IdxEntry.HashFilename(e, PackageHashType.CRC32);
                    if (!lookup.ContainsKey(hash))
                    {
                        lookup.Add(hash, e);
                    }
                }
            }

            return(index.Keys.Select(k => lookup.ContainsKey(k) ? lookup[k] : "{0:X}".F(k)));
        }
コード例 #2
0
        uint?FindMatchingHash(string filename)
        {
            var hash = IdxEntry.HashFilename(filename, PackageHashType.CRC32);

            if (index.ContainsKey(hash))
            {
                return(hash);
            }

            // Maybe we were given a raw hash?
            uint raw;

            if (!uint.TryParse(filename, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out raw))
            {
                return(null);
            }

            if ("{0:X}".F(raw) == filename && index.ContainsKey(raw))
            {
                return(raw);
            }

            return(null);
        }