Beispiel #1
0
        private void ParseHashes(string mask)
        {
            bool parseListfile = ListfileHandler.GetUnknownListfile("unk_listfile.txt", mask);

            string[] lines = new string[0];

            // sanity check it actually exists
            if (File.Exists("unk_listfile.txt"))
            {
                lines = File.ReadAllLines("unk_listfile.txt");
            }

            // parse items - hex and standard because why not
            ulong dump = 0;
            IEnumerable <ulong> hashes = new ulong[1];            // 0 hash is used as a dump

#if DEBUG
            hashes = hashes.Concat(new ulong[] { 4097458660625243137, 13345699920692943597 });                                            // test hashes for the README examples
#endif
            hashes = hashes.Concat(lines.Where(x => ulong.TryParse(x.Trim(), NumberStyles.HexNumber, null, out dump)).Select(x => dump)); // hex
            hashes = hashes.Concat(lines.Where(x => ulong.TryParse(x.Trim(), out dump)).Select(x => dump));                               // standard
            hashes = hashes.Distinct().OrderBy(HashSort);                                                                                 // order by first byte - IMPORTANT

            TargetHashes = new HashSet <ulong>(hashes);

            if (TargetHashes == null || TargetHashes.Count <= 1)
            {
                throw new ArgumentException("Unknown listfile is missing or empty");
            }
        }
Beispiel #2
0
        private void ParseHashes()
        {
            bool parseListfile = ListfileHandler.GetUnknownListfile("unk_listfile.txt", "");

            if (parseListfile)
            {
                string[] lines = new string[0];

                // sanity check it actually exists
                if (File.Exists("unk_listfile.txt"))
                {
                    lines = File.ReadAllLines("unk_listfile.txt");
                }

                // parse items - hex and standard because why not
                ulong dump = 0;
                IEnumerable <ulong> hashes = new ulong[0];                                                                                    // 0 hash is used as a dump
#if DEBUG
                hashes = hashes.Concat(new ulong[] { 4097458660625243137, 13345699920692943597 });                                            // test hashes for the README examples
#endif
                hashes = hashes.Concat(lines.Where(x => ulong.TryParse(x.Trim(), NumberStyles.HexNumber, null, out dump)).Select(x => dump)); // hex
                hashes = hashes.Concat(lines.Where(x => ulong.TryParse(x.Trim(), out dump)).Select(x => dump));                               // standard
                hashes = hashes.Distinct().OrderBy(Jenkins96.HashSort).ThenBy(x => x);

                TargetHashes = hashes.ToArray();

                BuildLookup();
            }

            if (TargetHashes == null || TargetHashes.Length < 1)
            {
                throw new ArgumentException("Unknown listfile is missing or empty");
            }
        }