Exemplo n.º 1
0
        public void loadLanguage(XmlNode languagenode, LanguageFamily family)
        {
            String speakingName     = "";
            int    speakingComplex  = 0;
            int    speakingComplex2 = 0;
            String fontName         = "";
            int    fontComplex      = 0;
            int    fontComplex2     = 0;

            foreach (XmlNode node in languagenode)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.SpeakingName: speakingName = node.InnerText; break;

                case ManagmentXMLStrings.SpeakingComplex: Int32.TryParse(node.InnerText, out speakingComplex); break;

                case ManagmentXMLStrings.SpeakingComplexSecond: Int32.TryParse(node.InnerText, out speakingComplex2); break;

                case ManagmentXMLStrings.FontName: fontName = node.InnerText; break;

                case ManagmentXMLStrings.FontComplex: Int32.TryParse(node.InnerText, out fontComplex); break;

                case ManagmentXMLStrings.FontComplexSecond: Int32.TryParse(node.InnerText, out fontComplex2); break;
                }
            }

            FontTalent     ft;
            LanguageTalent lt;

            if (speakingComplex2 != 0)
            {
                lt = new LanguageTalent(speakingName, speakingComplex, speakingComplex2);
            }
            else
            {
                lt = new LanguageTalent(speakingName, speakingComplex);
            }

            if (fontComplex2 != 0)
            {
                ft = new FontTalent(fontName, fontComplex, fontComplex2);
            }
            else
            {
                ft = new FontTalent(fontName, fontComplex);
            }

            family.add(lt, ft);
        }
        //################################################################################################
        private void loadFamily(XmlNode LanguageFamilyElement)
        {
            foreach (XmlNode node in LanguageFamilyElement)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.Name:
                    FamilyName     = node.InnerText;
                    LanguageFamily = new LanguageFamily(FamilyName);
                    break;

                case ManagmentXMLStrings.Row: loadRow(node); break;
                }
            }
        }
Exemplo n.º 3
0
        public ControllLanguageFamily(Charakter charakter, String ResourcePath)
        {
            this.charakter = charakter;
            LoadFile_LanguageFamily loader = new LoadFile_LanguageFamily();

            list = new List <LanguageFamily>(0);

            LanguageTalentFileSystemLocation = Path.Combine(ResourcePath, ManagmentSaveStrings.LanguageTalentFileSystemLocation);
            LanguageTalentFileSystemLocation = Path.Combine(LanguageTalentFileSystemLocation, "LanguageFamily");

            String[] files = Directory.GetFiles(LanguageTalentFileSystemLocation);

            for (int i = 0; i < files.Length; i++)
            {
                LanguageFamily family = loader.loadFile(files[i], charakter);
                if (family != null)
                {
                    list.Add(family);
                }
            }
        }
Exemplo n.º 4
0
        public LanguageFamily loadFile(String fileName)
        {
            XmlDocument languageFile = new XmlDocument();

            languageFile.Load(fileName);

            XmlNode TalentLetterElement = languageFile.SelectSingleNode("/" + ManagmentXMLStrings.TalentLetterElement);
            XmlNode LanguageElement     = TalentLetterElement.SelectSingleNode(ManagmentXMLStrings.LanguageFamily);

            LanguageFamily family = new LanguageFamily();

            foreach (XmlNode node in LanguageElement)
            {
                switch (node.Name)
                {
                case ManagmentXMLStrings.FamilyName: family.setName(node.InnerText); break;

                case ManagmentXMLStrings.Language: loadLanguage(node, family); break;

                default: throw new Exception("No such case");
                }
            }
            return(family);
        }
 private void clear()
 {
     LanguageFamily = null;
     charakter      = null;
     FileName       = "";
 }
Exemplo n.º 6
0
        private static void loadTalentLanguage(XmlNode TalentNode, Charakter charakter)
        {
            foreach (XmlNode LanguageFamily in TalentNode)
            {
                String  familyName = "";
                XmlNode innerNode  = null;

                foreach (XmlNode Node in LanguageFamily)
                {
                    switch (Node.Name)
                    {
                    case (ManagmentXMLStrings.FamilyName): familyName = Node.InnerText; break;

                    case (ManagmentXMLStrings.Language): innerNode = Node; break;
                    }

                    if (String.Compare(familyName, "") != 0 && innerNode != null)
                    {
                        if (String.Compare(familyName, "Zwergisch-Familie") == 0)
                        {
                            Console.WriteLine("Test");
                        }


                        int            x      = charakter.getFamilyCount();
                        LanguageFamily family = null;

                        for (int i = 0; i < x; i++)
                        {
                            LanguageFamily fam = charakter.getFamily(i);
                            if (String.Compare(fam.getName(), familyName) == 0)
                            {
                                family = fam;
                                break;
                            }
                        }
                        if (family != null)
                        {
                            String Speakingname   = "";
                            String SpeakingTaW    = "";
                            String SpeakingMother = "";
                            String FontName       = "";
                            String FontTaW        = "";

                            foreach (XmlNode node in innerNode)
                            {
                                switch (node.Name)
                                {
                                case (ManagmentXMLStrings.SpeakingName): Speakingname = node.InnerText; break;

                                case (ManagmentXMLStrings.SpeakingTaW): SpeakingTaW = node.InnerText; break;

                                case (ManagmentXMLStrings.SpeakingMother): SpeakingMother = node.InnerText; break;

                                case (ManagmentXMLStrings.FontName): FontName = node.InnerText; break;

                                case (ManagmentXMLStrings.FontTaW): FontTaW = node.InnerText; break;
                                }
                            }

                            for (int i = 0; i < family.count(); i++)
                            {
                                LanguageTalent lt = family.getlanguageTalent(i);
                                FontTalent     ft = family.getFontTalent(i);

                                if (String.Compare(Speakingname, lt.getName()) == 0 && String.Compare(FontName, ft.getName()) == 0)
                                {
                                    lt.setTaw(SpeakingTaW);
                                    lt.setMotherMark(SpeakingMother);
                                    ft.setTaw(FontTaW);
                                }
                            }
                        }
                    }
                }
            }
        }