Exemplo n.º 1
0
        private void AddLocalRecord(string region, string uid)
        {
            if (checkedluid.Contains(uid))
            {
                return;
            }
            checkedluid.Add(uid);
            string apibase = Config.localRecordDir + "\\" + region + "\\" + uid + "\\";

            if (!Directory.Exists(apibase))
            {
                return;
            }
            string apiurl = apibase + "info";

            Console.WriteLine("Checking Local [" + region + "] " + uid);
            string[] lines = File.ReadAllLines(apiurl);
            foreach (string line in lines)
            {
                if (line.StartsWith("RECD"))
                {
                    string[] record = line.Split('|');
                    if (record.Length < 4)
                    {
                        Console.WriteLine("[Local, " + region + "," + uid + "] Error record format: " + line);
                    }
                    else
                    {
                        BanRecord bc = new BanRecord(record[1], record[2], apibase + record[3] + "\\record.html");
                        records.Add(bc);
                    }
                }
                else if (line.StartsWith("LINK"))
                {
                    string[] link = line.Split('|');
                    if (link.Length < 2)
                    {
                        Console.WriteLine("[Local, " + region + "," + uid + "] Error link format: " + line);
                    }
                    else
                    {
                        AddLocalRecord(region, link[1]);
                    }
                }
            }
        }