コード例 #1
0
        public static bool CabCheck(Dictionary <string, string> preFabDictionary, string file)
        {
            bool result = false;

            string[] filelines = System.IO.File.ReadAllLines(file);
            if (filelines[3].Contains("Biped"))
            {
                var cabCheck = new List <string>(Reuse.CabCheck(filelines[0]));
                for (int i = 0; i < cabCheck.Count; i++)
                {
                    if (preFabDictionary.ContainsKey(cabCheck[i]))
                    {
                        result = true;
                        break;
                    }
                    if (i + 1 < cabCheck.Count)
                    {
                        if (preFabDictionary.ContainsKey(cabCheck[i] + cabCheck[i + 1]))
                        {
                            result = true;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        public static List <string> CabCheck(string cc)
        {
            var cabCheck = new List <string>(cc.Split(','));
            var newArray = cabCheck.ToArray();

            newArray = newArray[1].Split(' ');
            for (int i = 0; i < newArray.Length; i++)
            {
                newArray[i] = Reuse.RemoveSpecialCharacters(newArray[i].ToLower());
            }
            return(newArray.ToList());
        }
コード例 #3
0
        public static Dictionary <string, string> PreFabDicPop(string[] files)
        {
            var dic = new Dictionary <string, string> {
            };

            try
            {
                foreach (string prefabs in files)
                {
                    string filename = Path.GetFileName(prefabs);
                    string mechname = filename.Replace("chrprfmech_", "").Replace("base-001", "");
                    dic.Add(mechname, filename);
                }
            }
            catch (Exception e)
            {
                Reuse.EndProgram(e.ToString());
            }
            return(dic);
        }
コード例 #4
0
        public static Settings LoadSettings()
        {
            string filepath = Directory.GetCurrentDirectory();

            string settingfile = Path.Combine(filepath, "settings.json");
            var    fullPath    = Path.Combine(filepath, settingfile);
            //var settings = new Settings();
            var settings = new Settings();

            if (File.Exists(fullPath))
            {
                string jsonString = File.ReadAllText(settingfile);
                settings = Settings.FromJson(jsonString);
            }
            else
            {
                File.WriteAllText(fullPath, JsonConvert.SerializeObject(settings, Formatting.Indented));
                Reuse.EndProgram("Settings file not found, created new default.");
            }
            if (!Directory.Exists(settings.BtInstallDir))
            {
                Reuse.EndProgram("BT Direcotry not found at " + settings.BtInstallDir);
            }
            if (!Directory.Exists(settings.BedPath))
            {
                Reuse.EndProgram("BED Files not found at " + settings.BedPath);
            }
            //if (!Directory.Exists(settings.ChassisDefpath)) Reuse.EndProgram("Chassis Files not found at " + settings.ChassisDefpath);
            try
            {
                if (!Directory.Exists(settings.OutputDir))
                {
                    Directory.CreateDirectory(settings.OutputDir);
                }
            }
            catch (Exception e)
            {
                Reuse.EndProgram("Error Creating Directory: " + settings.OutputDir + " " + e);
            }
            return(settings);
        }
コード例 #5
0
        public static Dictionary <string, (string, ComponentDefType)> ComDefDicPop(string[] file)
        {
            var cDDic  = new Dictionary <string, ComponentDefType>();
            var CDDicT = new Dictionary <string, (string, ComponentDefType)>();

            foreach (string files in file)
            {
                string[] filelines           = System.IO.File.ReadAllLines(files);
                string   filename            = Path.GetFileName(files);
                string   jsonString          = File.ReadAllText(files);
                int      indexcompontentType = Array.FindIndex(filelines, x => x.Contains("\"ComponentType\""));
                //int indexType = Array.IndexOf(filelines, "\"ComponentType\"");
                //Console.WriteLine(files);
                if (indexcompontentType > -1)
                {
                    //var componentDefType = new ComponentDefType();
                    string cdt = filelines[indexcompontentType];
                    cdt = Reuse.RemoveSpecialCharacters(cdt);
                    cdt = cdt.Trim();
                    cdt = cdt.Replace("  ", " ");
                    string[] split = cdt.Split(' ');
                    split[1] = split[1].Replace(",", "");
                    //var componentKeyAmmo = new AmmunitionBox();
                    //var ammoDescrption = new Description();
                    try
                    {
                        switch (split[1])
                        {
                        case "AmmunitionBox":
                        {
                            var componentKeyAmmo = BattleEngineJsonCreation.AmmunitionBox.FromJson(jsonString);
                            //ammoDescrption = componentKeyAmmo.Description;

                            if (componentKeyAmmo.Description == null)
                            {
                                break;
                            }
                            if (componentKeyAmmo.Description.Model == null)
                            {
                                break;
                            }
                            if (componentKeyAmmo.Description.UiName.Contains("__"))
                            {
                                break;
                            }
                            if (!cDDic.ContainsKey(componentKeyAmmo.Description.Id))
                            {
                                cDDic.Add(componentKeyAmmo.Description.Id, BattleEngineJsonCreation.ComponentDefType.AmmunitionBox);
                            }
                            string[] splitAmmo = componentKeyAmmo.Description.UiName.Split(' ');

                            if (splitAmmo.Length == 2)
                            {
                                if (splitAmmo[0].Contains("MG"))
                                {
                                    CDDicT.Add(splitAmmo[1] + " " + "Machine Gun", (componentKeyAmmo.Description.Id, BattleEngineJsonCreation.ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                if (splitAmmo[0].Contains("Gauss"))
                                {
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " Rifle", (componentKeyAmmo.Description.Id, BattleEngineJsonCreation.ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                if (splitAmmo[0].Contains("SRM"))
                                {
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " 2", (componentKeyAmmo.Description.Id, BattleEngineJsonCreation.ComponentDefType.AmmunitionBox));
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " 4", (componentKeyAmmo.Description.Id, BattleEngineJsonCreation.ComponentDefType.AmmunitionBox));
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " 6", (componentKeyAmmo.Description.Id, BattleEngineJsonCreation.ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                if (splitAmmo[0].Contains("LRM"))
                                {
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " 5", (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " 10", (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " 15", (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0] + " 20", (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                if (splitAmmo[1].Contains("Ammo"))
                                {
                                    CDDicT.Add(splitAmmo[1] + " " + splitAmmo[0], (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                if (splitAmmo[0].Contains("Ammo"))
                                {
                                    CDDicT.Add(splitAmmo[0] + " " + splitAmmo[1], (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                CDDicT.Add("Ammo" + " " + splitAmmo[0], (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                break;
                            }
                            if (splitAmmo.Length == 3)
                            {
                                if (splitAmmo[0].Contains("LB"))
                                {
                                    CDDicT.Add(splitAmmo[2] + " " + splitAmmo[0] + " " + splitAmmo[1] + " AC", (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                if (splitAmmo[0].Contains("MG"))
                                {
                                    CDDicT.Add(splitAmmo[1] + " " + "Machine Gun: " + splitAmmo[2], (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    break;
                                }
                                if (splitAmmo[0].Contains("Half"))
                                {
                                    CDDicT.Add(splitAmmo[1] + " " + "Machine Gun: " + splitAmmo[2], (componentKeyAmmo.Description.Id, ComponentDefType.AmmunitionBox));
                                    break;
                                }
                            }
                            break;
                        }

                        case "HeatSink":
                        {
                            var componentKeyHeatSink = HeatSink.FromJson(jsonString);
                            if (componentKeyHeatSink.Description == null)
                            {
                                break;
                            }
                            if (componentKeyHeatSink.Description.UiName == null)
                            {
                                break;
                            }
                            if (componentKeyHeatSink.Description.UiName.Contains("__"))
                            {
                                break;
                            }
                            if (!cDDic.ContainsKey(componentKeyHeatSink.Description.Id))
                            {
                                cDDic.Add(componentKeyHeatSink.Description.Id, ComponentDefType.HeatSink);
                            }
                            string[] splitHeatSink = componentKeyHeatSink.Description.UiName.Split(' ');
                            if (splitHeatSink.Length == 2)
                            {
                                CDDicT.Add(splitHeatSink[0] + " " + splitHeatSink[1], (componentKeyHeatSink.Description.Id, ComponentDefType.HeatSink));
                                break;
                            }
                            if (splitHeatSink.Length == 3)
                            {
                                if (splitHeatSink[2].Contains("CD"))
                                {
                                    CDDicT.Add("Clan Double Heat Sink", (componentKeyHeatSink.Description.Id, ComponentDefType.HeatSink));
                                    break;
                                }
                                if (splitHeatSink[2].Contains("D"))
                                {
                                    CDDicT.Add("Double Heat Sink", (componentKeyHeatSink.Description.Id, ComponentDefType.HeatSink));
                                    break;
                                }
                                break;
                            }
                            break;
                        }

                        case "JumpJet":
                        {
                            var componentKeyJumpjet = Jumpjet.FromJson(jsonString);
                            if (componentKeyJumpjet.Description == null)
                            {
                                break;
                            }
                            if (componentKeyJumpjet.Description.UiName == null)
                            {
                                break;
                            }
                            if (componentKeyJumpjet.Description.UiName.Contains("__"))
                            {
                                break;
                            }
                            if (!cDDic.ContainsKey(componentKeyJumpjet.Description.Id))
                            {
                                cDDic.Add(componentKeyJumpjet.Description.Id, ComponentDefType.JumpJet);
                            }
                            break;
                        }

                        case "Upgrade":
                        {
                            var componentKeyUpgrade = Upgrade.FromJson(jsonString);
                            if (componentKeyUpgrade.Description == null)
                            {
                                break;
                            }
                            if (componentKeyUpgrade.Description.UiName == null)
                            {
                                break;
                            }
                            if (componentKeyUpgrade.Description.UiName.Contains("__"))
                            {
                                break;
                            }
                            if (!cDDic.ContainsKey(componentKeyUpgrade.Description.Id))
                            {
                                cDDic.Add(componentKeyUpgrade.Description.Id, ComponentDefType.Upgrade);
                                CDDicT.Add(componentKeyUpgrade.Description.UiName, (componentKeyUpgrade.Description.Id, ComponentDefType.Upgrade));
                                break;
                            }
                            break;
                        }

                        case "Weapon":
                        {
                            var componentKeyWeapon = Weapon.FromJson(jsonString);
                            if (componentKeyWeapon.Description == null)
                            {
                                break;
                            }
                            if (componentKeyWeapon.Description.Model == null)
                            {
                                break;
                            }
                            if (componentKeyWeapon.Description.UiName.Contains("__"))
                            {
                                break;
                            }
                            if (!cDDic.ContainsKey(componentKeyWeapon.Description.Id))
                            {
                                cDDic.Add(componentKeyWeapon.Description.Id, ComponentDefType.Weapon);
                                if (componentKeyWeapon.Description.UiName.Contains("__"))
                                {
                                    break;
                                }
                                if (componentKeyWeapon.Description.UiName.Contains("UAC"))
                                {
                                    componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace("UAC", "Ultra AC");
                                }
                                if (componentKeyWeapon.Description.UiName.Contains("LB"))
                                {
                                    componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName + " AC";
                                }
                                if (componentKeyWeapon.Description.UiName.Contains("LRM"))
                                {
                                    string LRM = componentKeyWeapon.Description.UiName.Replace("LRM", "LRM ");
                                    CDDicT.Add(LRM, (componentKeyWeapon.Description.Id, ComponentDefType.Weapon));
                                    break;
                                }
                                if (componentKeyWeapon.Description.UiName.Contains("SRM"))
                                {
                                    string LRM = componentKeyWeapon.Description.UiName.Replace("SRM", "SRM ");
                                    CDDicT.Add(LRM, (componentKeyWeapon.Description.Id, ComponentDefType.Weapon));
                                    break;
                                }
                                if (componentKeyWeapon.Description.UiName.Contains("Laser") || (componentKeyWeapon.Description.UiName.Contains("Pulse")))
                                {
                                    string[] splitWeapon = componentKeyWeapon.Description.UiName.Split(' ');
                                    if (splitWeapon[1] == "L")
                                    {
                                        componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace(" L ", " Large ");
                                        componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace(" M ", " Medium ");
                                        componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace(" S ", " Small ");
                                    }
                                    else
                                    {
                                        componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace("L ", "Large ");
                                        componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace("M ", "Medium ");
                                        componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace("S ", "Small ");
                                    }
                                    if (componentKeyWeapon.Description.UiName.Contains("Pulse"))
                                    {
                                        componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace("Pulse", "Pulse Laser");
                                    }
                                }
                                if (componentKeyWeapon.Description.UiName.Contains("Snub"))
                                {
                                    componentKeyWeapon.Description.UiName = componentKeyWeapon.Description.UiName.Replace("Snub", "Snub-Nose");
                                }
                                CDDicT.Add(componentKeyWeapon.Description.UiName, (componentKeyWeapon.Description.Id, ComponentDefType.Weapon));
                                break;
                            }
                            break;
                        }
                        }
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            //String csv = String.Join(Environment.NewLine, cDDic.Select(d => $"{d.Key},{d.Value}"));
            return(CDDicT);
        }
コード例 #6
0
        public static string[] ChassisName(string filename)
        {
            string chassisName;
            string chassisVariantName;
            string chassisShortName;

            string[] filelines = System.IO.File.ReadAllLines(filename);
            string[] words     = Reuse.RemoveSpecialCharacters(filelines[0]).Split(',');
            string[] split     = words[1].Split(' ');
            switch (split.Length)
            {
            case 5:
                if (split[3] == "II")
                {
                    chassisName        = split[0] + " " + split[1] + " " + split[2] + " " + split[3];
                    chassisVariantName = split[4];
                    chassisShortName   = split[0];

                    break;
                }
                chassisName        = split[0] + " " + split[1];
                chassisVariantName = split[4];
                chassisShortName   = split[0];
                break;

            case 4:
                if (split[3] == "Hunter")
                {
                    chassisName        = split[0] + " " + split[1];
                    chassisVariantName = split[2] + " " + split[3];
                    chassisShortName   = split[0];
                    break;
                }
                chassisName        = split[0] + " " + split[1] + " " + split[2];
                chassisVariantName = split[3];
                chassisShortName   = split[0];
                break;

            case 3:
            {
                if (split[1] == "Huntsman")
                {
                    chassisName        = split[1] + " " + split[0];
                    chassisVariantName = split[2];
                    chassisShortName   = split[1];
                    break;
                }
                if (split[2] == "Hunter")
                {
                    chassisName        = split[0];
                    chassisVariantName = split[1] + " " + split[2];
                    chassisShortName   = split[0];
                    break;
                }
                if (split[0] == "Puma")
                {
                    chassisName        = split[1];
                    chassisVariantName = split[2];
                    chassisShortName   = split[1];
                    break;
                }
                if (split[1] == "Viper")
                {
                    chassisName        = split[0] + " " + split[1];
                    chassisVariantName = split[2];
                    chassisShortName   = split[1];
                    break;
                }
                if (split[1] == "Executioner")
                {
                    chassisName        = split[1];
                    chassisVariantName = split[2];
                    chassisShortName   = split[1];
                    break;
                }
                if ((split[2] == "Standard") || (split[2].Length == 1))
                {
                    chassisName        = split[0] + " " + split[1];
                    chassisVariantName = split[2];
                    chassisShortName   = split[0];
                    break;
                }
                //Default 3s
                chassisName        = split[1] + " " + split[2];
                chassisVariantName = split[0];
                chassisShortName   = split[1];
                break;
            }

            default:     //Default 2s
                if (split[1] == "Standard")
                {
                    chassisName        = split[0] + " " + split[1];
                    chassisVariantName = split[1];
                    chassisShortName   = split[0];
                    break;
                }
                if (split[1].Length == 1)
                {
                    chassisName        = split[0];
                    chassisVariantName = split[1];
                    chassisShortName   = split[0];
                    break;
                }
                chassisName        = split[1];
                chassisVariantName = split[0];
                chassisShortName   = split[1];
                break;
            }
            if (chassisShortName.Contains("Vulcan"))
            {
                string something = "broken";
            }
            return(new string[] { chassisName, chassisVariantName, chassisShortName });
        }
コード例 #7
0
        public static MechDef MechDefs(ChassisDef chassisDef, string bedfile)
        {
            var mechdef = new MechDef
            {
                ChassisId   = chassisDef.Description.Id,
                HeraldryId  = null,
                Description = new DefDescription
                {
                    Cost        = chassisDef.Description.Cost,
                    Rarity      = chassisDef.Description.Rarity,
                    Purchasable = chassisDef.Description.Purchasable,
                    UiName      = chassisDef.Description.UiName + " " + chassisDef.VariantName,
                    Id          = chassisDef.Description.Id.Replace("chassisdef", "mechdef"),
                    Name        = chassisDef.Description.Name,
                    Details     = chassisDef.Description.Details,
                    Icon        = chassisDef.Description.Icon
                },
                SimGameMechPartCost = chassisDef.Description.Cost,
                Version             = 1,
                Locations           = new List <MechDefLocation>(),
                Inventory           = new List <Inventory>(),
            };

            string[] filelines         = File.ReadAllLines(bedfile);
            string   armorline         = "";
            string   armortypeline     = "";
            string   sturcturetypeline = "";
            int      internalStructre  = -1;

            foreach (string lines in filelines)
            {
                string newl = Reuse.RemoveSpecialCharacters(lines);
                newl = newl.Replace("\"", "");
                if (newl.Contains("ArmorVals"))
                {
                    armorline = newl;

                    break;
                }
                if (newl.Contains("Armor"))
                {
                    armortypeline = newl;
                }
                if (newl.Contains("Internal"))
                {
                    sturcturetypeline = newl;
                }
            }
            if (!armorline.Contains("ArmorVals"))
            {
                Reuse.EndProgram("FATAL ERROR: Unable to parse ArmorVals from Bedfile");
            }
            string[] armorvaulewords = armorline.Split(',');
            foreach (Location location in Enum.GetValues(typeof(Location)))
            {
                //ArmorVaule to Location  If Array
                int frontarmorvaule = -1;
                int reararmorvaule  = -1;
                if ((int)location == 0)
                {
                    frontarmorvaule = 45;
                }
                else
                {
                    frontarmorvaule = Convert.ToInt32(armorvaulewords[(int)location]) * 5;
                }
                if (((int)location == 3) || ((int)location == 4))
                {
                    reararmorvaule = Convert.ToInt32(armorvaulewords[6]) * 5;
                }
                if ((int)location == 5)
                {
                    reararmorvaule = Convert.ToInt32(armorvaulewords[8]) * 5;
                }
                if (((int)location == 6) || ((int)location == 7))
                {
                    frontarmorvaule = Convert.ToInt32(armorvaulewords[10]) * 5;
                }
                foreach (Location chassislocation in Enum.GetValues(typeof(Location)))
                {
                    if (chassisDef.Locations[(int)chassislocation].Location == location)
                    {
                        internalStructre = chassisDef.Locations[(int)chassislocation].InternalStructure;
                    }
                }
                mechdef.Locations.Add(new MechDefLocation
                {
                    DamageLevel              = DamageLevel.Functional,
                    Location                 = location,
                    CurrentArmor             = frontarmorvaule,
                    CurrentRearArmor         = reararmorvaule,
                    CurrentInternalStructure = internalStructre,
                    AssignedArmor            = frontarmorvaule,
                    AssignedRearArmor        = reararmorvaule,
                });
            }
            string armortype = "";

            if (armortypeline.Contains("Standard"))
            {
                armortype = "emod_armorslots_standard";
            }
            if (armortypeline.Contains("Ferro"))
            {
                armortype = "emod_armorslots_ferrosfibrous";
            }
            mechdef.Inventory.Add(new Inventory
            {
                MountedLocation  = Location.CenterTorso,
                ComponentDefId   = armortype,
                ComponentDefType = ComponentDefType.Upgrade,
                HardpointSlot    = -1,
                DamageLevel      = "Functional",
                PrefabName       = null,
                HasPrefabName    = false,
                SimGameUid       = "",
                Guid             = null
            });
            string sturcturetype = "";

            if (sturcturetypeline.Contains("Standard"))
            {
                sturcturetype = "emod_structureslots_standard";
            }
            if (sturcturetypeline.Contains("Endo"))
            {
                sturcturetype = "emod_structureslots_endosteel";
            }
            mechdef.Inventory.Add(new Inventory
            {
                MountedLocation  = Location.CenterTorso,
                ComponentDefId   = sturcturetype,
                ComponentDefType = ComponentDefType.Upgrade,
                HardpointSlot    = -1,
                DamageLevel      = "Functional",
                PrefabName       = null,
                HasPrefabName    = false,
                SimGameUid       = "",
                Guid             = null
            });
            return(mechdef);
        }
コード例 #8
0
        static void Main()
        {
            string logMemory     = "";
            var    settings      = settingsLoad.LoadSettings();
            var    dlcDictionary = new Dictionary <string, string> {
            };
            var cabDictionary    = new Dictionary <string, string> {
            };
            var btDictionary     = new Dictionary <string, string> {
            };
            var preFabDictionary = new Dictionary <string, string> {
            };
            var gearDic          = new Dictionary <string, (string, ComponentDefType)> {
            };

            if (settings.UpdateCSV == true)
            {
                dlcDictionary = new Dictionary <string, string>             {
                    //DLCs these files are hidden in assest and have to be added by hand
                    { "crab", "chrprfmech_crabbase-001" },
                    { "cyclops", "chrprfmech_cyclopsbase-001" },
                    { "hatchetman", "chrprfmech_hatchetmanbase-001" },
                    { "annihilator", "chrprfmech_annihilatorbase-001" },
                    { "archer", "chrprfmech_archerbase-001" },
                    { "assassin", "chrprfmech_assassinbase-001" },
                    { "bullshark", "chrprfmech_bullsharkbase-001" },
                    { "flea", "chrprfmech_fleabase-001" },
                    { "phoenixhawk", "chrprfmech_phoenixhawkbase-001" },
                    { "rifleman", "chrprfmech_riflemanbase-001" },
                    { "vulcan", "chrprfmech_vulcanbase-001" },
                    { "javelin", "chrprfmech_javelinmanbase-001" },
                    { "raven", "chrprfmech_ravenbase-001" },
                };
                cabDictionary = Reuse.PreFabDicPop(Directory.GetFiles(Path.Combine(settings.BtInstallDir, "mods\\CommunityAssets"), "chrprfmech*", SearchOption.AllDirectories));
                btDictionary  = Reuse.PreFabDicPop(Directory.GetFiles(Path.Combine(settings.BtInstallDir, "BattleTech_Data\\StreamingAssets\\data\\assetbundles"), "chrprfmech*", SearchOption.AllDirectories));
                //(Count should be 177)
                preFabDictionary = dlcDictionary.Concat(cabDictionary).Concat(btDictionary).ToDictionary(k => k.Key, k => k.Value);
                //Populate Gear Dictionary Tuple (key, vaule, componentDefType)
                gearDic = ComponetDictionaryParse.ComDefDicPop(Directory.GetFiles(settings.BtInstallDir, "*.json", SearchOption.AllDirectories));
                String csv = String.Join(Environment.NewLine, preFabDictionary.Select(d => $"{d.Key},{d.Value}"));
                csv = csv.Replace("(", "");
                csv = csv.Replace(")", "");
                String csv2 = String.Join(Environment.NewLine, gearDic.Select(d => $"{d.Key},{d.Value}"));
                csv2 = csv2.Replace("(", "");
                csv2 = csv2.Replace(")", "");
                File.WriteAllText(Path.Combine(settings.OutputDir, "preFabDictionary.csv"), csv);
                File.WriteAllText(Path.Combine(settings.OutputDir, "gearDic.csv"), csv2);
                Reuse.EndProgram("CSV files have been updated, pleaes change the settings.json to UpdateCSV=false");
            }
            else
            {
                preFabDictionary = File.ReadLines("preFabDictionary.csv").Select(line => line.Split(',')).ToDictionary(line => line[0], line => line[1]);
                //gearDic = File.ReadLines("preFabDictionary.csv").Select(line => line.Split('|')).ToDictionary(line => line[0], line => line[1]);
                //gearDic = ComponetDictionaryParse.ComDefDicPop(Directory.GetFiles(settings.BtInstallDir, "*.json", SearchOption.AllDirectories));

                /*string[] gearDicLines = File.ReadAllLines("gearDic.csv");
                 * foreach (string line in gearDicLines)
                 * {
                 *  string[] split = line.Split(',');
                 *  gearDic.Add(split[0],(split[1], (ComponentDefType)Enum.Parse(typeof(ComponentDefType), split[2])));
                 * }*/

                gearDic = File.ReadLines("gearDic.csv").Select(line => line.Split(',')).ToDictionary(line => line[0], line =>
                                                                                                     (line[1], (ComponentDefType)Enum.Parse(typeof(ComponentDefType), line[2])));
            }
            string[] chassisFiles = Directory.GetFiles(settings.ChassisDefpath, "chassis*.json", SearchOption.AllDirectories);
            string[] chassisNames = null;
            string[] bedfiles     = Directory.GetFiles(settings.BedPath, "*.bed", SearchOption.AllDirectories);
            //Parallel.ForEach(bedfiles, (file) =>
            foreach (var file in Directory.GetFiles(settings.BedPath, "*.bed", SearchOption.AllDirectories))
            {
                Console.WriteLine($"Processing {file} on thread {Thread.CurrentThread.ManagedThreadId}");
                bool cabCheck = MechBuilder.CabCheck(preFabDictionary, file);
                if (cabCheck == true)
                {
                    chassisNames = MechBuilder.ChassisName(file);
                    var chassisDef = MechBuilder.ChassisDefs(chassisNames, chassisFiles, false);
                    if (chassisDef.Description != null)
                    {
                        //Console.WriteLine(file + " " + chassisDef.Description.Id);
                        //Build MechDef from ChassisFile
                        var mechDef = MechBuilder.MechDefs(chassisDef, file);
                        //Add Mech Tags
                        mechDef = MechBuilder.Tags(chassisDef, mechDef);
                        //Add Mech Inventory "Parts"
                        mechDef = MechBuilder.MechLocations(gearDic, mechDef, file, chassisDef);
                        //Add Mech Engine = TTWalk * Tonnage
                        mechDef = MechBuilder.Engines(chassisDef, mechDef, file);
                        mechDef = MechBuilder.RoleTag(chassisDef, mechDef);
                        string outputmechDef = Newtonsoft.Json.JsonConvert.SerializeObject(mechDef, Newtonsoft.Json.Formatting.Indented, Converter.Settings);
                        File.WriteAllText(Path.Combine(settings.OutputDir, mechDef.Description.Id + ".json"), outputmechDef);
                        logMemory = logMemory + Path.GetFileName(file) + "," + mechDef.Description.Id + ",Generated\r\n";
                        //var mechDef = MechBuilder.MechDefs(chassisDef);
                        //break;
                    }
                    else
                    {
                        logMemory = logMemory + Path.GetFileName(file) + ",NO ChassisDef File,Not Generated\r\n";
                    }
                }
                else
                {
                    logMemory = logMemory + Path.GetFileName(file) + ",NO CAB,Not Generated\r\n";
                }
                //});
            }
            Log(logMemory, settings.OutputDir);
        }