string AddToStringIfFileExists(string str, string path)
        {
            if (File.Exists(path))
                return str + Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + path);

            return str;
        }
        public void CalculateHashes(List <GameMode> gameModes)
        {
            fh = new FileHashes
            {
                GameOptionsHash = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ProgramConstants.BASE_RESOURCE_PATH + "GameOptions.ini"),
                ClientDXHash    = Utilities.CalculateSHA1ForFile(ProgramConstants.GetBaseResourcePath() + "clientdx.exe"),
                ClientXNAHash   = Utilities.CalculateSHA1ForFile(ProgramConstants.GetBaseResourcePath() + "clientxna.exe"),
                ClientOGLHash   = Utilities.CalculateSHA1ForFile(ProgramConstants.GetBaseResourcePath() + "clientogl.exe"),
                MainExeHash     = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ClientConfiguration.Instance.GetGameExecutableName()),
                LauncherExeHash = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ClientConfiguration.Instance.GetGameLauncherExecutableName),
                MPMapsHash      = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ClientConfiguration.Instance.MPMapsIniPath),
                INIHashes       = string.Empty
            };

            foreach (string filePath in fileNamesToCheck)
            {
                fh.INIHashes = AddToStringIfFileExists(fh.INIHashes, filePath);
                Logger.Log("Hash for " + filePath + ": " +
                           Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + filePath));
            }

            #if !YR
            if (Directory.Exists(ProgramConstants.GamePath + "INI\\Map Code"))
            {
                foreach (GameMode gameMode in gameModes)
                {
                    fh.INIHashes = AddToStringIfFileExists(fh.INIHashes, "INI\\Map Code\\" + gameMode.Name + ".ini");
                    Logger.Log("Hash for INI\\Map Code\\" + gameMode.Name + ".ini :" +
                               Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + "INI\\Map Code\\" + gameMode.Name + ".ini"));
                }
            }
            #endif

            if (Directory.Exists(ProgramConstants.GamePath + "INI\\Game Options"))
            {
                List <string> files = Directory.GetFiles(
                    ProgramConstants.GamePath + "INI\\Game Options",
                    "*", SearchOption.AllDirectories).ToList();

                files.Sort();

                foreach (string fileName in files)
                {
                    fh.INIHashes = fh.INIHashes + Utilities.CalculateSHA1ForFile(fileName);
                    Logger.Log("Hash for " + fileName + ": " +
                               Utilities.CalculateSHA1ForFile(fileName));
                }
            }

            fh.INIHashes = Utilities.CalculateSHA1ForString(fh.INIHashes);
        }
Пример #3
0
        /// <summary>
        /// Loads map information from a TS/RA2 map INI file.
        /// Returns true if succesful, otherwise false.
        /// </summary>
        /// <param name="path">The full path to the map INI file.</param>
        public bool SetInfoFromMap(string path)
        {
            if (!File.Exists(path))
            {
                return(false);
            }

            try
            {
                IniFile iniFile = new IniFile();
                iniFile.FileName = path;
                iniFile.AddSection("Basic");
                iniFile.AddSection("Map");
                iniFile.AddSection("Waypoints");
                iniFile.AddSection("Preview");
                iniFile.AddSection("PreviewPack");
                iniFile.AddSection("ForcedOptions");
                iniFile.AddSection("ForcedSpawnIniOptions");
                iniFile.AllowNewSections = false;

                iniFile.Parse();

                mapIni = iniFile;

                var basicSection = iniFile.GetSection("Basic");

                Name   = basicSection.GetStringValue("Name", "Unnamed map");
                Author = basicSection.GetStringValue("Author", "Unknown author");

                string gameModesString = basicSection.GetStringValue("GameModes", string.Empty);
                if (string.IsNullOrEmpty(gameModesString))
                {
                    gameModesString = basicSection.GetStringValue("GameMode", "Default");
                }

                GameModes = gameModesString.Split(',');

                if (GameModes.Length == 0)
                {
                    Logger.Log("Custom map " + path + " has no game modes!");
                    return(false);
                }

                for (int i = 0; i < GameModes.Length; i++)
                {
                    string gameMode = GameModes[i].Trim();
                    GameModes[i] = gameMode.Substring(0, 1).ToUpperInvariant() + gameMode.Substring(1);
                }

                MinPlayers = 0;
                if (basicSection.KeyExists("ClientMaxPlayer"))
                {
                    MaxPlayers = basicSection.GetIntValue("ClientMaxPlayer", 0);
                }
                else
                {
                    MaxPlayers = basicSection.GetIntValue("MaxPlayer", 0);
                }
                EnforceMaxPlayers = basicSection.GetBooleanValue("EnforceMaxPlayers", true);
                //PreviewPath = Path.GetDirectoryName(BaseFilePath) + "/" +
                //    iniFile.GetStringValue(BaseFilePath, "PreviewImage", Path.GetFileNameWithoutExtension(BaseFilePath) + ".png");
                Briefing                  = basicSection.GetStringValue("Briefing", string.Empty).Replace("@", Environment.NewLine);
                SHA1                      = Utilities.CalculateSHA1ForFile(path);
                IsCoop                    = basicSection.GetBooleanValue("IsCoopMission", false);
                Credits                   = basicSection.GetIntValue("Credits", -1);
                UnitCount                 = basicSection.GetIntValue("UnitCount", -1);
                NeutralHouseColor         = basicSection.GetIntValue("NeutralColor", -1);
                SpecialHouseColor         = basicSection.GetIntValue("SpecialColor", -1);
                HumanPlayersOnly          = basicSection.GetBooleanValue("HumanPlayersOnly", false);
                ForceRandomStartLocations = basicSection.GetBooleanValue("ForceRandomStartLocations", false);
                ForceNoTeams              = basicSection.GetBooleanValue("ForceNoTeams", false);
                PreviewPath               = Path.ChangeExtension(path.Substring(ProgramConstants.GamePath.Length), ".png");
                MultiplayerOnly           = basicSection.GetBooleanValue("ClientMultiplayerOnly", false);

                string bases = basicSection.GetStringValue("Bases", string.Empty);
                if (!string.IsNullOrEmpty(bases))
                {
                    Bases = Convert.ToInt32(Conversions.BooleanFromString(bases, false));
                }

                if (IsCoop)
                {
                    CoopInfo = new CoopMapInfo();
                    string[] disallowedSides = iniFile.GetStringValue("Basic", "DisallowedPlayerSides", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string sideIndex in disallowedSides)
                    {
                        CoopInfo.DisallowedPlayerSides.Add(int.Parse(sideIndex));
                    }

                    string[] disallowedColors = iniFile.GetStringValue("Basic", "DisallowedPlayerColors", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string colorIndex in disallowedColors)
                    {
                        CoopInfo.DisallowedPlayerColors.Add(int.Parse(colorIndex));
                    }

                    CoopInfo.SetHouseInfos(basicSection);
                }

                localSize  = iniFile.GetStringValue("Map", "LocalSize", "0,0,0,0").Split(',');
                actualSize = iniFile.GetStringValue("Map", "Size", "0,0,0,0").Split(',');

                for (int i = 0; i < MAX_PLAYERS; i++)
                {
                    string waypoint = mapIni.GetStringValue("Waypoints", i.ToString(), string.Empty);

                    if (string.IsNullOrEmpty(waypoint))
                    {
                        break;
                    }

                    waypoints.Add(waypoint);
                }

                ParseForcedOptions(iniFile, "ForcedOptions");
                ParseSpawnIniOptions(iniFile, "ForcedSpawnIniOptions");

                return(true);
            }
            catch
            {
                Logger.Log("Loading custom map " + path + " failed!");
                return(false);
            }
        }
Пример #4
0
        public bool SetInfoFromINI(IniFile iniFile)
        {
            try
            {
                string baseSectionName = iniFile.GetStringValue(BaseFilePath, "BaseSection", string.Empty);

                if (!string.IsNullOrEmpty(baseSectionName))
                {
                    iniFile.CombineSections(baseSectionName, BaseFilePath);
                }

                var section = iniFile.GetSection(BaseFilePath);

                Name      = section.GetStringValue("Description", "Unnamed map");
                Author    = section.GetStringValue("Author", "Unknown author");
                GameModes = section.GetStringValue("GameModes", "Default").Split(',');

                MinPlayers        = section.GetIntValue("MinPlayers", 0);
                MaxPlayers        = section.GetIntValue("MaxPlayers", 0);
                EnforceMaxPlayers = section.GetBooleanValue("EnforceMaxPlayers", false);
                PreviewPath       = Path.GetDirectoryName(BaseFilePath) + "/" +
                                    section.GetStringValue("PreviewImage", Path.GetFileNameWithoutExtension(BaseFilePath) + ".png");
                Briefing                  = section.GetStringValue("Briefing", string.Empty).Replace("@", Environment.NewLine);
                SHA1                      = Utilities.CalculateSHA1ForFile(CompleteFilePath);
                IsCoop                    = section.GetBooleanValue("IsCoopMission", false);
                Credits                   = section.GetIntValue("Credits", -1);
                UnitCount                 = section.GetIntValue("UnitCount", -1);
                NeutralHouseColor         = section.GetIntValue("NeutralColor", -1);
                SpecialHouseColor         = section.GetIntValue("SpecialColor", -1);
                MultiplayerOnly           = section.GetBooleanValue("MultiplayerOnly", false);
                HumanPlayersOnly          = section.GetBooleanValue("HumanPlayersOnly", false);
                ForceRandomStartLocations = section.GetBooleanValue("ForceRandomStartLocations", false);
                ForceNoTeams              = section.GetBooleanValue("ForceNoTeams", false);
                ExtraININame              = section.GetStringValue("ExtraININame", string.Empty);
                string bases = section.GetStringValue("Bases", string.Empty);
                if (!string.IsNullOrEmpty(bases))
                {
                    Bases = Convert.ToInt32(Conversions.BooleanFromString(bases, false));
                }

                if (IsCoop)
                {
                    CoopInfo = new CoopMapInfo();
                    string[] disallowedSides = section.GetStringValue("DisallowedPlayerSides", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string sideIndex in disallowedSides)
                    {
                        CoopInfo.DisallowedPlayerSides.Add(int.Parse(sideIndex));
                    }

                    string[] disallowedColors = section.GetStringValue("DisallowedPlayerColors", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string colorIndex in disallowedColors)
                    {
                        CoopInfo.DisallowedPlayerColors.Add(int.Parse(colorIndex));
                    }

                    CoopInfo.SetHouseInfos(section);
                }

                localSize  = section.GetStringValue("LocalSize", "0,0,0,0").Split(',');
                actualSize = section.GetStringValue("Size", "0,0,0,0").Split(',');

                for (int i = 0; i < MAX_PLAYERS; i++)
                {
                    string waypoint = section.GetStringValue("Waypoint" + i, string.Empty);

                    if (String.IsNullOrEmpty(waypoint))
                    {
                        break;
                    }

                    waypoints.Add(waypoint);
                }

#if !WINDOWSGL
                if (UserINISettings.Instance.PreloadMapPreviews)
                {
                    PreviewTexture = LoadPreviewTexture();
                }
#endif
                // Parse forced options

                string forcedOptionsSections = iniFile.GetStringValue(BaseFilePath, "ForcedOptions", string.Empty);

                if (!string.IsNullOrEmpty(forcedOptionsSections))
                {
                    string[] sections = forcedOptionsSections.Split(',');
                    foreach (string foSection in sections)
                    {
                        ParseForcedOptions(iniFile, foSection);
                    }
                }

                string forcedSpawnIniOptionsSections = iniFile.GetStringValue(BaseFilePath, "ForcedSpawnIniOptions", string.Empty);

                if (!string.IsNullOrEmpty(forcedSpawnIniOptionsSections))
                {
                    string[] sections = forcedSpawnIniOptionsSections.Split(',');
                    foreach (string fsioSection in sections)
                    {
                        ParseSpawnIniOptions(iniFile, fsioSection);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Setting info for " + BaseFilePath + " failed! Reason: " + ex.Message);
                return(false);
            }
        }
Пример #5
0
        /// <summary>
        /// Loads map information from a TS/RA2 map INI file.
        /// Returns true if succesful, otherwise false.
        /// </summary>
        /// <param name="path">The full path to the map INI file.</param>
        public bool SetInfoFromMap(string path)
        {
            try
            {
                IniFile iniFile = new IniFile();
                iniFile.FileName = path;
                iniFile.AddSection("Basic");
                iniFile.AddSection("Map");
                iniFile.AddSection("Waypoints");
                iniFile.AddSection("Preview");
                iniFile.AddSection("PreviewPack");
                iniFile.AllowNewSections = false;

                iniFile.Parse();

                mapIni = iniFile;

                Name      = iniFile.GetStringValue("Basic", "Name", "Unnamed map");
                Author    = iniFile.GetStringValue("Basic", "Author", "Unknown author");
                GameModes = iniFile.GetStringValue("Basic", "GameMode", "Default").Split(',');
                for (int i = 0; i < GameModes.Length; i++)
                {
                    string gameMode = GameModes[i].Trim();
                    gameMode     = gameMode.Substring(0, 1).ToUpperInvariant() + gameMode.Substring(1);
                    GameModes[i] = gameMode;
                }

                MinPlayers        = 0;
                MaxPlayers        = iniFile.GetIntValue("Basic", "MaxPlayer", 0);
                EnforceMaxPlayers = iniFile.GetBooleanValue("Basic", "EnforceMaxPlayers", true);
                //PreviewPath = Path.GetDirectoryName(BaseFilePath) + "\\" +
                //    iniFile.GetStringValue(BaseFilePath, "PreviewImage", Path.GetFileNameWithoutExtension(BaseFilePath) + ".png");
                Briefing          = iniFile.GetStringValue("Basic", "Briefing", string.Empty).Replace("@", Environment.NewLine);
                SHA1              = Utilities.CalculateSHA1ForFile(path);
                IsCoop            = iniFile.GetBooleanValue("Basic", "IsCoopMission", false);
                Credits           = iniFile.GetIntValue("Basic", "Credits", -1);
                UnitCount         = iniFile.GetIntValue("Basic", "UnitCount", -1);
                NeutralHouseColor = iniFile.GetIntValue("Basic", "NeutralColor", -1);
                SpecialHouseColor = iniFile.GetIntValue("Basic", "SpecialColor", -1);
                PreviewPath       = Path.ChangeExtension(path.Substring(ProgramConstants.GamePath.Length + 1), ".png");

                string bases = iniFile.GetStringValue("Basic", "Bases", string.Empty);
                if (!string.IsNullOrEmpty(bases))
                {
                    Bases = Convert.ToInt32(Conversions.BooleanFromString(bases, false));
                }

                if (IsCoop)
                {
                    CoopInfo = new CoopMapInfo();
                    string[] disallowedSides = iniFile.GetStringValue("Basic", "DisallowedPlayerSides", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string sideIndex in disallowedSides)
                    {
                        CoopInfo.DisallowedPlayerSides.Add(Int32.Parse(sideIndex));
                    }

                    string[] disallowedColors = iniFile.GetStringValue("Basic", "DisallowedPlayerColors", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string colorIndex in disallowedColors)
                    {
                        CoopInfo.DisallowedPlayerColors.Add(Int32.Parse(colorIndex));
                    }

                    CoopInfo.SetHouseInfos(iniFile, "Basic");
                }

                localSize  = iniFile.GetStringValue("Map", "LocalSize", "0,0,0,0").Split(',');
                actualSize = iniFile.GetStringValue("Map", "Size", "0,0,0,0").Split(',');

                RefreshStartingLocationPositions();

                //string forcedOptionsSection = iniFile.GetStringValue("Basic", "ForcedOptions", String.Empty);

                //if (!string.IsNullOrEmpty(forcedOptionsSection))
                //{
                //    string[] sections = forcedOptionsSection.Split(',');
                //    foreach (string section in sections)
                //        ParseForcedOptions(iniFile, section);
                //}

                //string forcedSpawnIniOptionsSection = iniFile.GetStringValue("Basic", "ForcedSpawnIniOptions", String.Empty);

                //if (!string.IsNullOrEmpty(forcedSpawnIniOptionsSection))
                //{
                //    string[] sections = forcedSpawnIniOptionsSection.Split(',');
                //    foreach (string section in sections)
                //        ParseSpawnIniOptions(iniFile, section);
                //}

                return(true);
            }
            catch
            {
                Logger.Log("Loading custom map " + path + " failed!");
                return(false);
            }
        }
Пример #6
0
        public void CalculateHashes(List <GameMode> gameModes)
        {
            fh = new FileHashes
            {
                GameOptionsHash = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ProgramConstants.BASE_RESOURCE_PATH + "GameOptions.ini"),
                ClientDXHash    = Utilities.CalculateSHA1ForFile(ProgramConstants.GetBaseResourcePath() + "clientdx.exe"),
                ClientXNAHash   = Utilities.CalculateSHA1ForFile(ProgramConstants.GetBaseResourcePath() + "clientxna.exe"),
                ClientOGLHash   = Utilities.CalculateSHA1ForFile(ProgramConstants.GetBaseResourcePath() + "clientogl.exe"),
                GameExeHash     = calculateGameExeHash ?
                                  Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ClientConfiguration.Instance.GetGameExecutableName()) : string.Empty,
                LauncherExeHash = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ClientConfiguration.Instance.GameLauncherExecutableName),
                MPMapsHash      = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + ClientConfiguration.Instance.MPMapsIniPath),
                FHCConfigHash   = Utilities.CalculateSHA1ForFile(ProgramConstants.BASE_RESOURCE_PATH + CONFIGNAME),
                INIHashes       = string.Empty
            };

            Logger.Log("Hash for " + ProgramConstants.BASE_RESOURCE_PATH + CONFIGNAME + ": " + fh.FHCConfigHash);
            Logger.Log("Hash for " + ProgramConstants.BASE_RESOURCE_PATH + "GameOptions.ini: " + fh.GameOptionsHash);
            Logger.Log("Hash for " + ProgramConstants.BASE_RESOURCE_PATH + "clientdx.exe: " + fh.ClientDXHash);
            Logger.Log("Hash for " + ProgramConstants.BASE_RESOURCE_PATH + "clientxna.exe: " + fh.ClientXNAHash);
            Logger.Log("Hash for " + ProgramConstants.BASE_RESOURCE_PATH + "clientogl.exe: " + fh.ClientOGLHash);
            Logger.Log("Hash for " + ClientConfiguration.Instance.MPMapsIniPath + ": " + fh.MPMapsHash);
            if (calculateGameExeHash)
            {
                Logger.Log("Hash for " + ClientConfiguration.Instance.GetGameExecutableName() + ": " + fh.GameExeHash);
            }
            if (!string.IsNullOrEmpty(ClientConfiguration.Instance.GameLauncherExecutableName))
            {
                Logger.Log("Hash for " + ClientConfiguration.Instance.GameLauncherExecutableName + ": " + fh.LauncherExeHash);
            }

            foreach (string filePath in fileNamesToCheck)
            {
                fh.INIHashes = AddToStringIfFileExists(fh.INIHashes, filePath);
                Logger.Log("Hash for " + filePath + ": " +
                           Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + filePath));
            }

            string[] iniPaths = new string[]
            {
#if !YR
                ProgramConstants.GamePath + "INI/Map Code",
#endif
                ProgramConstants.GamePath + "INI/Game Options"
            };

            foreach (string path in iniPaths)
            {
                if (!string.IsNullOrEmpty(path) && Directory.Exists(path))
                {
                    List <string> files = Directory.GetFiles(path, "*", SearchOption.AllDirectories).
                                          Select(s => s.Replace(ProgramConstants.GamePath, "").Replace("\\", "/")).ToList();

                    files.Sort();

                    foreach (string filename in files)
                    {
                        string sha1 = Utilities.CalculateSHA1ForFile(ProgramConstants.GamePath + filename);
                        fh.INIHashes += sha1;
                        Logger.Log("Hash for " + filename + ": " + sha1);
                    }
                }
            }

            fh.INIHashes = Utilities.CalculateSHA1ForString(fh.INIHashes);
        }
Пример #7
0
 public void CalculateSHA()
 {
     SHA1 = Utilities.CalculateSHA1ForFile(CompleteFilePath);
 }
Пример #8
0
        public bool SetInfoFromINI(IniFile iniFile)
        {
            try
            {
                string baseSectionName = iniFile.GetStringValue(BaseFilePath, "BaseSection", string.Empty);

                if (!string.IsNullOrEmpty(baseSectionName))
                {
                    iniFile.CombineSections(baseSectionName, BaseFilePath);
                }

                var section = iniFile.GetSection(BaseFilePath);

                Name      = section.GetStringValue("Description", "Unnamed map");
                Author    = section.GetStringValue("Author", "Unknown author");
                GameModes = section.GetStringValue("GameModes", "Default").Split(',');

                MinPlayers        = section.GetIntValue("MinPlayers", 0);
                MaxPlayers        = section.GetIntValue("MaxPlayers", 0);
                EnforceMaxPlayers = section.GetBooleanValue("EnforceMaxPlayers", false);
                PreviewPath       = Path.GetDirectoryName(BaseFilePath) + "/" +
                                    section.GetStringValue("PreviewImage", Path.GetFileNameWithoutExtension(BaseFilePath) + ".png");
                Briefing                  = section.GetStringValue("Briefing", string.Empty).Replace("@", Environment.NewLine);
                SHA1                      = Utilities.CalculateSHA1ForFile(CompleteFilePath);
                IsCoop                    = section.GetBooleanValue("IsCoopMission", false);
                Credits                   = section.GetIntValue("Credits", -1);
                UnitCount                 = section.GetIntValue("UnitCount", -1);
                NeutralHouseColor         = section.GetIntValue("NeutralColor", -1);
                SpecialHouseColor         = section.GetIntValue("SpecialColor", -1);
                MultiplayerOnly           = section.GetBooleanValue("MultiplayerOnly", false);
                HumanPlayersOnly          = section.GetBooleanValue("HumanPlayersOnly", false);
                ForceRandomStartLocations = section.GetBooleanValue("ForceRandomStartLocations", false);
                ForceNoTeams              = section.GetBooleanValue("ForceNoTeams", false);
                ExtraININame              = section.GetStringValue("ExtraININame", string.Empty);
                string bases = section.GetStringValue("Bases", string.Empty);
                if (!string.IsNullOrEmpty(bases))
                {
                    Bases = Convert.ToInt32(Conversions.BooleanFromString(bases, false));
                }

                int i = 0;
                while (true)
                {
                    // Format example:
                    // ExtraTexture0=oilderrick.png,200,150,1
                    // Last value is map cell level and is optional, defaults to 0 if unspecified.

                    string value = section.GetStringValue("ExtraTexture" + i, null);

                    if (string.IsNullOrWhiteSpace(value))
                    {
                        break;
                    }

                    string[] parts = value.Split(',');

                    if (parts.Length < 3 || parts.Length > 4)
                    {
                        Logger.Log($"Invalid format for ExtraTexture{i} in map " + BaseFilePath);
                        continue;
                    }

                    bool success = int.TryParse(parts[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out int x);
                    success &= int.TryParse(parts[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out int y);

                    int level = 0;

                    if (parts.Length > 3)
                    {
                        int.TryParse(parts[3], NumberStyles.Integer, CultureInfo.InvariantCulture, out level);
                    }

                    extraTextures.Add(new ExtraMapPreviewTexture(parts[0], new Point(x, y), level));

                    i++;
                }

                if (IsCoop)
                {
                    CoopInfo = new CoopMapInfo();
                    string[] disallowedSides = section.GetStringValue("DisallowedPlayerSides", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string sideIndex in disallowedSides)
                    {
                        CoopInfo.DisallowedPlayerSides.Add(int.Parse(sideIndex));
                    }

                    string[] disallowedColors = section.GetStringValue("DisallowedPlayerColors", string.Empty).Split(
                        new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string colorIndex in disallowedColors)
                    {
                        CoopInfo.DisallowedPlayerColors.Add(int.Parse(colorIndex));
                    }

                    CoopInfo.SetHouseInfos(section);
                }

                localSize  = section.GetStringValue("LocalSize", "0,0,0,0").Split(',');
                actualSize = section.GetStringValue("Size", "0,0,0,0").Split(',');

                for (i = 0; i < MAX_PLAYERS; i++)
                {
                    string waypoint = section.GetStringValue("Waypoint" + i, string.Empty);

                    if (String.IsNullOrEmpty(waypoint))
                    {
                        break;
                    }

                    waypoints.Add(waypoint);
                }

#if !WINDOWSGL
                if (UserINISettings.Instance.PreloadMapPreviews)
                {
                    PreviewTexture = LoadPreviewTexture();
                }
#endif
                // Parse forced options

                string forcedOptionsSections = iniFile.GetStringValue(BaseFilePath, "ForcedOptions", string.Empty);

                if (!string.IsNullOrEmpty(forcedOptionsSections))
                {
                    string[] sections = forcedOptionsSections.Split(',');
                    foreach (string foSection in sections)
                    {
                        ParseForcedOptions(iniFile, foSection);
                    }
                }

                string forcedSpawnIniOptionsSections = iniFile.GetStringValue(BaseFilePath, "ForcedSpawnIniOptions", string.Empty);

                if (!string.IsNullOrEmpty(forcedSpawnIniOptionsSections))
                {
                    string[] sections = forcedSpawnIniOptionsSections.Split(',');
                    foreach (string fsioSection in sections)
                    {
                        ParseSpawnIniOptions(iniFile, fsioSection);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Setting info for " + BaseFilePath + " failed! Reason: " + ex.Message);
                return(false);
            }
        }