Exemplo n.º 1
0
        public static void XMLReader(ref AUTH Data, string file)
        {
            KKtXml Xml = new KKtXml();

            Xml.OpenXml(file + ".xml", true);
            foreach (XElement AuthDB in Xml.doc.Elements("AuthDB"))
            {
                foreach (XAttribute Entry in AuthDB.Attributes())
                {
                    if (Entry.Name == "Signature")
                    {
                        Data.Signature = BitConverter.ToInt32(KKtText.ToASCII(Entry.Value), 0);
                    }
                }

                foreach (XElement Child0 in AuthDB.Elements())
                {
                    if (Child0.Name == "Categories")
                    {
                        foreach (XAttribute Entry in Child0.Attributes())
                        {
                            if (Entry.Name == "Length")
                            {
                                Data.Category = new string[int.Parse(Entry.Value)];
                            }
                        }
                        int i = 0;
                        foreach (XElement Category in Child0.Elements())
                        {
                            Data.Category[i] = "";
                            foreach (XAttribute Entry in Category.Attributes())
                            {
                                if (Entry.Name == "Value")
                                {
                                    Data.Category[i] = Entry.Value;
                                }
                            }
                            i++;
                        }
                    }

                    if (Child0.Name == "UIDs")
                    {
                        foreach (XAttribute Entry in Child0.Attributes())
                        {
                            if (Entry.Name == "Length")
                            {
                                Data.UID = new UID[int.Parse(Entry.Value)];
                            }
                        }
                        int i = 0;
                        foreach (XElement UID in Child0.Elements())
                        {
                            Data.UID[i].Category = "";
                            Data.UID[i].Size     = -1;
                            Data.UID[i].Value    = "";
                            foreach (XAttribute Entry in UID.Attributes())
                            {
                                if (Entry.Name == "Category")
                                {
                                    Data.UID[i].Category = Entry.Value;
                                }
                                if (Entry.Name == "Size")
                                {
                                    Data.UID[i].Size = int.Parse(Entry.Value);
                                }
                                if (Entry.Name == "Value")
                                {
                                    Data.UID[i].Value = Entry.Value;
                                }
                            }
                            i++;
                        }
                    }
                }
            }
        }