コード例 #1
0
        public RegionMapper()
        {
            regionsMap     = new Dictionary <string, string[]>();
            alteredRegions = new List <string>();
            string converterInfo = ImportantPaths.conversionInfoPath();
            string regionMapFile = converterInfo + "\\region\\regionsMap.csv";

            using (var regionsMapReader = new StreamReader(regionMapFile)) {
                while (!regionsMapReader.EndOfStream)
                {
                    string[] kvPair = regionsMapReader.ReadLine().Split(',');
                    string   key    = kvPair[0];
                    string[] values = kvPair[1].Split(';');
                    regionsMap.Add(key, values);
                    alteredRegions.AddRange(values);
                }
            }
            alteredRegions.Sort();

            /*for (int i = 0; i < alteredRegions.Count - 1; i++) {
             *  if (alteredRegions[i] == alteredRegions[i + 1]) {
             *      bool trouble = true;
             *  }
             * }*/
        }
コード例 #2
0
ファイル: MoveCultures.cs プロジェクト: ijedi1234/Attila2CK2
        public static void move()
        {
            string searchDir = ImportantPaths.conversionInfoPath() + "\\cultures\\cultureFiles";
            string destDir   = ImportantPaths.getOutputPath() + "\\common\\cultures";

            string[] searchFiles = Directory.GetFiles(searchDir, "*.txt");
            foreach (string searchFile in searchFiles)
            {
                string absoluteFilename = Path.GetFileName(searchFile);
                string destFile         = destDir + "\\" + absoluteFilename;
                File.Copy(searchFile, destFile, true);
            }
        }
コード例 #3
0
ファイル: ReligionsInfo.cs プロジェクト: ijedi1234/Attila2CK2
        public ReligionsInfo()
        {
            religions = new Dictionary <string, ReligionInfo>();
            string converterInfo = ImportantPaths.conversionInfoPath();
            string religionFile  = converterInfo + "\\religion\\religions.csv";

            using (var religionsReader = new StreamReader(@religionFile)) {
                while (!religionsReader.EndOfStream)
                {
                    ReligionInfo religion = new ReligionInfo(religionsReader.ReadLine());
                    religions.Add(religion.getAttilaName(), religion);
                }
            }
        }
コード例 #4
0
        public CK2CountyRegionsInfo(RegionMapper map)
        {
            counties = new Dictionary <string, CK2CountyRegionInfo>();
            string provinceHistoryPath = ImportantPaths.conversionInfoPath() + "\\region\\provinceHistory";

            string[] histories = Directory.GetFiles(provinceHistoryPath);
            foreach (string historyPath in histories)
            {
                CK2CountyRegionInfo county = new CK2CountyRegionInfo(map, historyPath);
                if (county.countyShallBeAltered())
                {
                    counties.Add(county.getID(), county);
                }
            }
        }
コード例 #5
0
        private Dictionary <String, String> generateNameIDMap()
        {
            string nameMapFile = ImportantPaths.conversionInfoPath() + "\\characters\\namesMap.csv";
            Dictionary <String, String> nameIDMap = new Dictionary <String, String>();

            using (var nameMapReader = new StreamReader(nameMapFile)) {
                while (!nameMapReader.EndOfStream)
                {
                    var line       = nameMapReader.ReadLine();
                    var lineValues = line.Split(',');
                    nameIDMap.Add(lineValues[0], lineValues[1]);
                }
            }
            return(nameIDMap);
        }
コード例 #6
0
        private Dictionary <string, string> buildCultureMap()
        {
            Dictionary <string, string> map = new Dictionary <string, string>();
            string cultureMapFilename       = ImportantPaths.conversionInfoPath() + "\\cultures\\factionCultureMap.csv";

            using (var cultureMapReader = new StreamReader(cultureMapFilename)) {
                while (!cultureMapReader.EndOfStream)
                {
                    string[] pair    = cultureMapReader.ReadLine().Split(',');
                    string   faction = pair[0];
                    string   culture = pair[1];
                    map.Add(faction, culture);
                }
            }
            return(map);
        }
コード例 #7
0
ファイル: CultureMaps.cs プロジェクト: ijedi1234/Attila2CK2
        public void readCultureMaps()
        {
            cultureMaps = new Dictionary <string, List <string> >();
            string converterInfo = ImportantPaths.conversionInfoPath();
            string CMFile        = converterInfo + "\\cultures\\cultureNameMap.csv";

            using (var CGReader = new StreamReader(CMFile)) {
                while (!CGReader.EndOfStream)
                {
                    string[]      items        = CGReader.ReadLine().Split(',');
                    string        cultureTag   = items[0];
                    List <String> localisation = new List <string>();
                    for (int i = 1; i < items.Length; i++)
                    {
                        localisation.Add(items[i]);
                    }
                    cultureGroupMaps.Add(cultureTag, localisation);
                }
            }
        }
コード例 #8
0
        private void searchForFactionDynasty()
        {
            string conversionInfoPath   = ImportantPaths.conversionInfoPath();
            string factionDynastiesPath = conversionInfoPath + "\\factions\\ck2Titles\\titlesDynastiesMap.csv";

            using (var factionDynastiesReader = new StreamReader(@factionDynastiesPath)) {
                while (!factionDynastiesReader.EndOfStream)
                {
                    var    line       = factionDynastiesReader.ReadLine();
                    var    lineValues = line.Split(',');
                    string faction    = lineValues[0];
                    string dynastyStr = lineValues[1];
                    if (faction == id)
                    {
                        CK2Dynasty dynasty = new CK2Dynasty(dynastyStr);
                        this.dynasty = dynasty;
                    }
                }
            }
        }
コード例 #9
0
        private List <Tuple <string, string, bool> > readFactionCK2Equivalent()
        {
            string conversionInfoPath     = ImportantPaths.conversionInfoPath();
            string factionEquivalentsPath = conversionInfoPath + "\\factions\\ck2Titles\\titlesFactionMap.csv";
            List <Tuple <string, string, bool> > factionEquivalents = new List <Tuple <string, string, bool> >();

            using (var factionEquivalentsReader = new StreamReader(@factionEquivalentsPath)) {
                while (!factionEquivalentsReader.EndOfStream)
                {
                    var    line       = factionEquivalentsReader.ReadLine();
                    var    lineValues = line.Split(',');
                    string faction    = lineValues[0];
                    string ck2Title   = lineValues[1];
                    bool   isNewTitle = (Int32.Parse(lineValues[2]) == 1);
                    Tuple <string, string, bool> mapping = Tuple.Create <string, string, bool>(faction, ck2Title, isNewTitle);
                    factionEquivalents.Add(mapping);
                }
            }
            return(factionEquivalents);
        }
コード例 #10
0
        public ProjectSettingsReader()
        {
            string      settingsLoc = ImportantPaths.conversionInfoPath() + "\\settings.xml";
            XmlDocument doc         = new XmlDocument();

            try {
                doc.Load(settingsLoc);
            }
            catch (Exception) {
                return;
            }
            XmlNode root = doc.DocumentElement;

            for (XmlNode node = root.FirstChild; node != null; node = node.NextSibling)
            {
                if (node.Name == "savegameXMLLocation")
                {
                    this.savegameXMLLocation = node.InnerText;
                }
            }
        }
コード例 #11
0
ファイル: CK2Dynasty.cs プロジェクト: ijedi1234/Attila2CK2
        private static int deriveFirstDynastyID()
        {
            string      settingsLoc = ImportantPaths.conversionInfoPath() + "\\settings.xml";
            XmlDocument doc         = new XmlDocument();

            try {
                doc.Load(settingsLoc);
            }
            catch (Exception) {
                return(1000001);
            }
            XmlNode root = doc.DocumentElement;

            for (XmlNode node = root.FirstChild; node != null; node = node.NextSibling)
            {
                if (node.Name == "firstDynastyID")
                {
                    return(Int32.Parse(node.InnerText));
                }
            }
            return(1000001);
        }
コード例 #12
0
        private List <Tuple <string, string> > readFactionAdjectives()
        {
            string conversionInfoPath    = ImportantPaths.conversionInfoPath();
            string factionAdjectivesPath = conversionInfoPath + "\\factions\\faction_adjectives.csv";
            List <Tuple <string, string> > factionAdjectives = new List <Tuple <string, string> >();

            using (var factionAdjectivesReader = new StreamReader(@factionAdjectivesPath)) {
                while (!factionAdjectivesReader.EndOfStream)
                {
                    var    line       = factionAdjectivesReader.ReadLine();
                    var    lineValues = line.Split(',');
                    string a          = lineValues[0]; //att_fact_*
                    if (a.Substring(0, 3) != "att")
                    {
                        continue;
                    }
                    string b = lineValues[1]; //Adjective
                    Tuple <string, string> mapping = Tuple.Create <string, string>(a, b);
                    factionAdjectives.Add(mapping);
                }
            }
            return(factionAdjectives);
        }
コード例 #13
0
ファイル: MoveFlags.cs プロジェクト: ijedi1234/Attila2CK2
        public static void move(FactionsInfo factions)
        {
            string searchDir = ImportantPaths.conversionInfoPath() + "\\factions\\flags";
            string destDir   = ImportantPaths.getOutputPath() + "\\gfx\\flags";

            foreach (FactionInfo faction in factions.getFactions())
            {
                string ck2Title = faction.getCK2Title();
                if (ck2Title == null)
                {
                    continue;
                }
                string target = ck2Title.Substring(2) + ".tga";
                target = searchDir + "\\" + target;
                bool flagExists = File.Exists(target);
                if (!flagExists)
                {
                    continue;
                }
                string dest = destDir + "\\" + ck2Title + ".tga";
                File.Copy(target, dest, true);
            }
        }