예제 #1
0
 public SteamAccount(NestedElement uele)
 {
     Name = uele.Name;
     if (uele.Children.ContainsKey("SteamID"))
     {
         SteamID = uele.Children["SteamID"].Value;
     }
 }
예제 #2
0
        public NestedElement(Queue <string> read)
        {
            Children = new Dictionary <string, NestedElement>();
            String          line    = read.Dequeue();
            MatchCollection matches = name_value_regex.Matches(line);

            if (string.IsNullOrWhiteSpace(line.TrimEnd('}')))
            {
                return;
            }

            if (matches.Count == 0)
            {
                throw new Exception("WHT THE HELL");
            }

            Name = matches[0].Value.Trim('\"');
            if (matches.Count > 1)
            {
                Value = matches[1].Value.Trim('\"');
            }


            Ready = true;
            line  = read.Peek();
            if (open_regex.IsMatch(line))
            {
                read.Dequeue();
                while (true)
                {
                    NestedElement ele = new NestedElement(read);
                    if (ele.Ready)
                    {
                        Children.Add(ele.Name, ele);
                    }
                    if (read.Count == 0 && line == "{")
                    {
                        break;
                    }

                    line = read.Peek();
                    if (close_regex.IsMatch(line))
                    {
                        read.Dequeue();
                        return;
                    }
                }
            }
        }
        public NestedElementFile(String file_name) {
            TextReader read = new StreamReader(file_name);
            Queue<string> lines = new Queue<string>();
            String line = read.ReadLine();
            while (line != null) {
                lines.Enqueue(line);
                line = read.ReadLine();
            }

            while(lines.Count>0) {
                NestedElement ele = new NestedElement(lines);
                if (ele.Ready) {
                    Elements.Add(ele.Name,ele);
                }
            }
            System.Console.Out.WriteLine("adas");
        }
        public NestedElementFile(String file_name)
        {
            TextReader     read  = new StreamReader(file_name);
            Queue <string> lines = new Queue <string>();
            String         line  = read.ReadLine();

            while (line != null)
            {
                lines.Enqueue(line);
                line = read.ReadLine();
            }

            while (lines.Count > 0)
            {
                NestedElement ele = new NestedElement(lines);
                if (ele.Ready)
                {
                    Elements.Add(ele.Name, ele);
                }
            }
            System.Console.Out.WriteLine("adas");
        }
예제 #5
0
        public NestedElement(Queue<string> read) {
            Children = new Dictionary<string, NestedElement>();
            String line = read.Dequeue();
            MatchCollection matches = name_value_regex.Matches(line);

            if (string.IsNullOrWhiteSpace(line.TrimEnd('}')))
                return;

            if (matches.Count == 0) {
                throw new Exception("WHT THE HELL");
            }

            Name = matches[0].Value.Trim('\"');
            if (matches.Count > 1) {
                Value = matches[1].Value.Trim('\"');
            }


            Ready = true;
            line = read.Peek();
            if (open_regex.IsMatch(line)) {
                read.Dequeue();
                while (true) {
                    NestedElement ele = new NestedElement(read);
                    if (ele.Ready) {
                        Children.Add(ele.Name, ele);
                    }
                    if (read.Count == 0 && line == "{")
                        break;

                    line = read.Peek();
                    if (close_regex.IsMatch(line)) {
                        read.Dequeue();
                        return;
                    }
                }
            }
        }
예제 #6
0
 public SteamAccount(NestedElement uele) {
     Name = uele.Name;
     if (uele.Children.ContainsKey("SteamID")) {
         SteamID = uele.Children["SteamID"].Value;
     }
 }