public override TranslatorResult Translate(Section.SectionProperty INIProperty) { if ( INIProperty.Name == "tileset" ) { if ( INIProperty.Value.ToLower() == "arizona" ) { Tileset = App.Tileset_Arizona; } else if ( INIProperty.Value.ToLower() == "urban" ) { Tileset = App.Tileset_Urban; } else if ( INIProperty.Value.ToLower() == "rockies" ) { Tileset = App.Tileset_Rockies; } else { return TranslatorResult.ValueInvalid; } } else if ( (string)INIProperty.Name == "size" ) { string[] CommaText = INIProperty.Value.Split(','); if ( CommaText.GetUpperBound(0) + 1 < 2 ) { return TranslatorResult.ValueInvalid; } int A = 0; for ( A = 0; A <= CommaText.GetUpperBound(0); A++ ) { CommaText[A] = CommaText[A].Trim(); } sXY_int NewSize = new sXY_int(); if ( !IOUtil.InvariantParse(CommaText[0], ref NewSize.X) ) { return TranslatorResult.ValueInvalid; } if ( !IOUtil.InvariantParse(CommaText[1], ref NewSize.Y) ) { return TranslatorResult.ValueInvalid; } if ( NewSize.X < 1 | NewSize.Y < 1 | NewSize.X > Constants.MapMaxSize | NewSize.Y > Constants.MapMaxSize ) { return TranslatorResult.ValueInvalid; } TerrainSize = NewSize; } else if ( (string)INIProperty.Name == "autoscrolllimits" ) { if ( !IOUtil.InvariantParse(Convert.ToString(INIProperty.Value), ref InterfaceOptions.AutoScrollLimits) ) { return TranslatorResult.ValueInvalid; } } else if ( (string)INIProperty.Name == "scrollminx" ) { if ( !IOUtil.InvariantParse(Convert.ToString(INIProperty.Value), ref InterfaceOptions.ScrollMin.X) ) { return TranslatorResult.ValueInvalid; } } else if ( (string)INIProperty.Name == "scrollminy" ) { if ( !IOUtil.InvariantParse(Convert.ToString(INIProperty.Value), ref InterfaceOptions.ScrollMin.Y) ) { return TranslatorResult.ValueInvalid; } } else if ( (string)INIProperty.Name == "scrollmaxx" ) { if ( !IOUtil.InvariantParse(Convert.ToString(INIProperty.Value), InterfaceOptions.ScrollMax.X) ) { return TranslatorResult.ValueInvalid; } } else if ( (string)INIProperty.Name == "scrollmaxy" ) { if ( !IOUtil.InvariantParse(Convert.ToString(INIProperty.Value), InterfaceOptions.ScrollMax.Y) ) { return TranslatorResult.ValueInvalid; } } else if ( (string)INIProperty.Name == "name" ) { InterfaceOptions.CompileName = Convert.ToString(INIProperty.Value); } else if ( (string)INIProperty.Name == "players" ) { InterfaceOptions.CompileMultiPlayers = Convert.ToString(INIProperty.Value); } else if ( (string)INIProperty.Name == "xplayerlev" ) { if ( !IOUtil.InvariantParse(Convert.ToString(INIProperty.Value), ref InterfaceOptions.CompileMultiXPlayers) ) { return TranslatorResult.ValueInvalid; } } else if ( (string)INIProperty.Name == "author" ) { InterfaceOptions.CompileMultiAuthor = Convert.ToString(INIProperty.Value); } else if ( (string)INIProperty.Name == "license" ) { InterfaceOptions.CompileMultiLicense = Convert.ToString(INIProperty.Value); } else if ( (string)INIProperty.Name == "camptime" ) { //allow and ignore } else if ( (string)INIProperty.Name == "camptype" ) { if ( !IOUtil.InvariantParse(Convert.ToString(INIProperty.Value), ref InterfaceOptions.CampaignGameType) ) { return TranslatorResult.ValueInvalid; } } else { return TranslatorResult.NameUnknown; } return TranslatorResult.Translated; }
public static clsResult LoadTilesets(string TilesetsPath) { var ReturnResult = new clsResult("Loading tilesets", false); logger.Info("Loading tilesets"); string[] TilesetDirs = null; try { TilesetDirs = Directory.GetDirectories(TilesetsPath); } catch ( Exception ex ) { ReturnResult.ProblemAdd(ex.Message); return ReturnResult; } if ( TilesetDirs == null ) { return ReturnResult; } var Result = default(clsResult); var Path = ""; var Tileset = default(clsTileset); foreach ( var tempLoopVar_Path in TilesetDirs ) { Path = tempLoopVar_Path; Tileset = new clsTileset(); Result = Tileset.LoadDirectory(Path); ReturnResult.Add(Result); if ( !Result.HasProblems ) { Tilesets.Add(Tileset); } } foreach ( var tempLoopVar_Tileset in Tilesets ) { Tileset = tempLoopVar_Tileset; if ( Tileset.Name == "tertilesc1hw" ) { Tileset.Name = "Arizona"; Tileset_Arizona = Tileset; Tileset.IsOriginal = true; Tileset.BGColour = new sRGB_sng(204.0f / 255.0f, 149.0f / 255.0f, 70.0f / 255.0f); } else if ( Tileset.Name == "tertilesc2hw" ) { Tileset.Name = "Urban"; Tileset_Urban = Tileset; Tileset.IsOriginal = true; Tileset.BGColour = new sRGB_sng(118.0f / 255.0f, 165.0f / 255.0f, 203.0f / 255.0f); } else if ( Tileset.Name == "tertilesc3hw" ) { Tileset.Name = "Rocky Mountains"; Tileset_Rockies = Tileset; Tileset.IsOriginal = true; Tileset.BGColour = new sRGB_sng(182.0f / 255.0f, 225.0f / 255.0f, 236.0f / 255.0f); } } if ( Tileset_Arizona == null ) { ReturnResult.WarningAdd("Arizona tileset is missing."); } if ( Tileset_Urban == null ) { ReturnResult.WarningAdd("Urban tileset is missing."); } if ( Tileset_Rockies == null ) { ReturnResult.WarningAdd("Rocky Mountains tileset is missing."); } return ReturnResult; }