//Get translation line private string GetranslatedString(string _key) { if (_key == "") { return(""); } CultureInfo ci = Thread.CurrentThread.CurrentUICulture; try { PlainTXTResourceManager rm = new PlainTXTResourceManager(); string resultString = rm.GetString(_key, ci); if (resultString != null) { return(resultString); } else { return(_key); } } catch { return(_key); } }
private void HelpTranslateMenuStripMethod(MenuStrip parent, PlainTXTResourceManager _rm, CultureInfo _ci) { foreach (ToolStripMenuItem c in parent.Items) { try { string translatedString = _rm.GetString(c.Name, _ci); if (translatedString != null) { c.Text = translatedString; } } catch { } HelpTranslateMenuStripDDMethod(c, _rm, _ci); } }
private void HelpTranslateFormMethod(Control parent, PlainTXTResourceManager _rm, CultureInfo _ci) { foreach (Control c in parent.Controls) { try { string translatedString = _rm.GetString(c.Name, _ci); if (translatedString != null) { c.Text = translatedString; } } catch { } HelpTranslateFormMethod(c, _rm, _ci); } }
//Help methods for searching controls internal void HelpTranslateFormMethod(Control parent, PlainTXTResourceManager _rm, CultureInfo _ci) { char[] charsToTrim = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; foreach (Control c in parent.Controls) { try { string translatedString = _rm.GetString(c.Name.TrimEnd(charsToTrim), _ci); if (translatedString != null) { c.Text = translatedString; } } catch { } HelpTranslateFormMethod(c, _rm, _ci); } }
private void HelpTranslateMenuStripDDMethod(ToolStripDropDownItem parent, PlainTXTResourceManager _rm, CultureInfo _ci) { try { foreach (object c in parent.DropDownItems) { if (c is ToolStripDropDownItem) { ToolStripDropDownItem thisbutton = c as ToolStripDropDownItem; string translatedString = _rm.GetString(thisbutton.Name, _ci); if (translatedString != null) { thisbutton.Text = translatedString; } HelpTranslateMenuStripDDMethod(thisbutton, _rm, _ci); } } } catch { } }
public void SetDefaultValues(bool _initial) { if (_initial) { ResourceManagerMain = new PlainTXTResourceManager(); ProgSettingsV = new ProgSettings(); ProgSettingsV.ProgramVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); SavefileVersion = 0; SupportedSavefileVersionETS2 = new int[] { 39, 46 }; //Supported save version SupportedGameVersionETS2 = "1.33.x - 1.37.x"; //Last game version Tested on //SupportedSavefileVersionATS; SupportedGameVersionATS = "1.33.x - 1.37.x"; //Last game version Tested on comboBoxPrevProfiles.FlatStyle = comboBoxProfiles.FlatStyle = comboBoxSaves.FlatStyle = FlatStyle.Flat; ProfileETS2 = @"\Euro Truck Simulator 2"; ProfileATS = @"\American Truck Simulator"; dictionaryProfiles = new Dictionary <string, string> { { "ETS2", ProfileETS2 }, { "ATS", ProfileATS } }; GameType = "ETS2"; //Globals.CurrentGame = dictionaryProfiles[GameType]; CompaniesLngDict = new Dictionary <string, string>(); CitiesLngDict = new Dictionary <string, string>(); CountriesLngDict = new Dictionary <string, string>(); CargoLngDict = new Dictionary <string, string>(); UrgencyLngDict = new Dictionary <string, string>(); //CustomStringsDict = new Dictionary<string, string>(); TruckBrandsLngDict = new Dictionary <string, string>(); DriverNames = new Dictionary <string, string>(); DistancesTable = new DataTable(); DistancesTable.Columns.Add("SourceCity", typeof(string)); DistancesTable.Columns.Add("SourceCompany", typeof(string)); DistancesTable.Columns.Add("DestinationCity", typeof(string)); DistancesTable.Columns.Add("DestinationCompany", typeof(string)); DistancesTable.Columns.Add("Distance", typeof(int)); DistancesTable.Columns.Add("FerryTime", typeof(int)); DistancesTable.Columns.Add("FerryPrice", typeof(int)); CountryDictionary = new CountryDictionary(); CountriesDataList = new Dictionary <string, Country>(); PlayerLevelNames = new List <LevelNames>(); #region Player level names LevelNames lvl_name0 = new LevelNames(0, "Newbie", "FFE0E0E0"); LevelNames lvl_name1 = new LevelNames(5, "Enthusiast", "FF45C294"); LevelNames lvl_name2 = new LevelNames(10, "Workhorse", "FF75BAEA"); LevelNames lvl_name3 = new LevelNames(15, "Entrepeneur", "FF3A88F4"); LevelNames lvl_name4 = new LevelNames(20, "Master", "FF5847F0"); LevelNames lvl_name5 = new LevelNames(25, "Instructor", "FFDA9356"); LevelNames lvl_name6 = new LevelNames(30, "Elite", "FFF58493"); LevelNames lvl_name7 = new LevelNames(40, "King of the Road", "FFC99EF2"); LevelNames lvl_name8 = new LevelNames(50, "Legend", "FFC2F9FF"); LevelNames lvl_name9 = new LevelNames(100, "Divine Champion", "FFF1DEA5"); PlayerLevelNames.Add(lvl_name0); PlayerLevelNames.Add(lvl_name1); PlayerLevelNames.Add(lvl_name2); PlayerLevelNames.Add(lvl_name3); PlayerLevelNames.Add(lvl_name4); PlayerLevelNames.Add(lvl_name5); PlayerLevelNames.Add(lvl_name6); PlayerLevelNames.Add(lvl_name7); PlayerLevelNames.Add(lvl_name8); PlayerLevelNames.Add(lvl_name9); #endregion string curName = ""; string[] input; List <string> curLst = new List <string>(); #region Currency ETS2 curName = "EUR"; CurrencyDictConversionETS2.Add(curName, 1); input = new string[] { "", "€", "" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "CHF"; CurrencyDictConversionETS2.Add(curName, 1.142); input = new string[] { "", "", " CHF" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "CZK"; CurrencyDictConversionETS2.Add(curName, 25.88); input = new string[] { "", "", " Kč" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "GBP"; CurrencyDictConversionETS2.Add(curName, 0.875); input = new string[] { "", "£", "" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "PLN"; CurrencyDictConversionETS2.Add(curName, 4.317); input = new string[] { "", "", " zł" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "HUF"; CurrencyDictConversionETS2.Add(curName, 325.3); input = new string[] { "", "", " Ft" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "DKK"; CurrencyDictConversionETS2.Add(curName, 7.46); input = new string[] { "", "", " kr" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "SEK"; CurrencyDictConversionETS2.Add(curName, 10.52); input = new string[] { "", "", " kr" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "NOK"; CurrencyDictConversionETS2.Add(curName, 9.51); input = new string[] { "", "", " kr" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); curName = "RUB"; CurrencyDictConversionETS2.Add(curName, 77.05); input = new string[] { "", "₽", "" }; curLst = new List <string>(input); CurrencyDictFormatETS2.Add(curName, curLst); #endregion #region Currency ATS curName = "USD"; CurrencyDictConversionATS.Add(curName, 1); input = new string[] { "", "$", "" }; curLst = new List <string>(input); CurrencyDictFormatATS.Add(curName, curLst); curName = "CAD"; CurrencyDictConversionATS.Add(curName, 1.3); input = new string[] { "", "$", "" }; curLst = new List <string>(input); CurrencyDictFormatATS.Add(curName, curLst); curName = "MXN"; CurrencyDictConversionATS.Add(curName, 18.69); input = new string[] { "", "$", "" }; curLst = new List <string>(input); CurrencyDictFormatATS.Add(curName, curLst); curName = "EUR"; CurrencyDictConversionATS.Add(curName, 0.856); input = new string[] { "", "€", "" }; curLst = new List <string>(input); CurrencyDictFormatATS.Add(curName, curLst); #endregion //Urgency UrgencyArray = new int[] { 0, 1, 2 }; DistanceMultipliers = new Dictionary <string, double> { { "km", 1 }, { "mi", km_to_mileconvert } }; ADRImgS = new Image[6]; ADRImgSGrey = new Image[6]; SkillImgSBG = new Image[5]; SkillImgS = new Image[6]; GaragesImg = new Image[1]; GaragesHQImg = new Image[1]; CitiesImg = new Image[2]; UrgencyImg = new Image[3]; CargoTypeImg = new Image[3]; CargoType2Img = new Image[3]; GameIconeImg = new Image[2]; TruckPartsImg = new Image[5]; TrailerPartsImg = new Image[4]; ProgUIImgs = new Image[0]; TabpagesImages = new ImageList(); ADRbuttonArray = new CheckBox[6]; SkillButtonArray = new CheckBox[5, 6]; } unCertainRouteLength = ""; FileDecoded = false; SavefilePath = ""; tempInfoFileInMemory = null; tempSavefileInMemory = null; tempProfileFileInMemory = null; //Game dependant if (GameType == "ETS2") { Globals.PlayerLevelUps = new int[] { 200, 500, 700, 900, 1000, 1100, 1300, 1600, 1700, 2100, 2300, 2600, 2700, 2900, 3000, 3100, 3400, 3700, 4000, 4300, 4600, 4700, 4900, 5200, 5700, 5900, 6000, 6200, 6600, 6800 }; //Currency CurrencyDictFormat = CurrencyDictFormatETS2; CurrencyDictConversion = CurrencyDictConversionETS2; Globals.CurrencyName = ProgSettingsV.CurrencyMesETS2; } else { Globals.PlayerLevelUps = new int[] { 200, 500, 700, 900, 1100, 1300, 1500, 1700, 1900, 2100, 2300, 2500, 2700, 2900, 3100, 3300, 3500, 3700, 4000, 4300, 4600, 4900, 5200, 5500, 5800, 6100, 6400, 6700, 7000, 7300 }; //Currency CurrencyDictFormat = CurrencyDictFormatATS; CurrencyDictConversion = CurrencyDictConversionATS; Globals.CurrencyName = ProgSettingsV.CurrencyMesATS; } PlayerDataV = new PlayerData(); SFProfileData = new SaveFileProfileData(); UserCompanyAssignedTruckPlacementEdited = false; InfoDepContinue = false; CompaniesList = new List <string>(); CitiesList = new List <City>(); CountriesList = new List <string>(); CargoesList = new List <Cargo>(); TrailerDefinitionVariants = new Dictionary <string, List <string> >(); TrailerVariants = new List <string>(); HeavyCargoList = new List <string>(); CompanyTruckList = new List <CompanyTruck>(); CompanyTruckListDB = new List <CompanyTruck>(); CompanyTruckListDiff = new List <CompanyTruck>(); UserColorsList = new List <Color>(); GaragesList = new List <Garages>(); UserTruckDictionary = new Dictionary <string, UserCompanyTruckData>(); UserDriverDictionary = new Dictionary <string, UserCompanyDriverData>(); DriverPool = new List <string>(); UserTrailerDictionary = new Dictionary <string, UserCompanyTruckData>(); UserTrailerDefDictionary = new Dictionary <string, List <string> >(); extraVehicles = new List <string>(); extraDrivers = new List <string>(); VisitedCities = new List <VisitedCity>(); CargoesListDB = new List <Cargo>(); CitiesListDB = new List <string>(); CompaniesListDB = new List <string>(); CargoesListDiff = new List <Cargo>(); CitiesListDiff = new List <string>(); CompaniesListDiff = new List <string>(); DBDependencies = new List <string>(); SFDependencies = new List <string>(); ExternalCompanies = new List <ExtCompany>(); ExtCargoList = new List <ExtCargo>(); EconomyEventsTable = new string[0, 0]; EconomyEventUnitLinkStringList = new string[0]; JobsAmountAdded = 0; LastVisitedCity = ""; InGameTime = 0; RandomValue = new Random(); LastModifiedTimestamp = new DateTime(); AddedJobsDictionary = new Dictionary <string, List <JobAdded> >(); AddedJobsList = new List <JobAdded>(); GPSbehind = new Dictionary <string, List <string> >(); GPSahead = new Dictionary <string, List <string> >(); GPSAvoid = new Dictionary <string, List <string> >(); GPSbehindOnline = new Dictionary <string, List <string> >(); GPSaheadOnline = new Dictionary <string, List <string> >(); namelessList = new List <string>(); namelessLast = ""; LoopStartCity = ""; LoopStartCompany = ""; ProgPrevVersion = "0.0.1.0"; RouteList = new Routes(); DistancesTable.Clear(); components = null; }