Ejemplo n.º 1
0
        private static void ConvertInfo(ProjectFile pf)
        {
            GMChunkGEN8 info = (GMChunkGEN8)pf.DataHandle.Chunks["GEN8"];

            int GetInt(string propertyName)
            {
                return(((JsonElement)pf.JsonFile.Info[propertyName]).GetInt32());
            }

            GMString GetString(string propertyName)
            {
                return(pf.DataHandle.DefineString(((JsonElement)pf.JsonFile.Info[propertyName]).GetString()));
            }

            info.DisableDebug = ((JsonElement)pf.JsonFile.Info["DisableDebug"]).GetBoolean();
            info.FormatID     = ((JsonElement)pf.JsonFile.Info["FormatID"]).GetByte();
            info.Unknown      = ((JsonElement)pf.JsonFile.Info["Unknown"]).GetInt16();
            info.Filename     = GetString("Filename");
            info.Config       = GetString("Config");
            info.LastObjectID = GetInt("LastObjectID");
            info.LastTileID   = GetInt("LastTileID");
            info.GameID       = GetInt("GameID");
            if (pf.DataHandle.VersionInfo.IsNumberAtLeast(2))
            {
                info.GMS2_FPS             = ((JsonElement)pf.JsonFile.Info["FPS"]).GetSingle();
                info.GMS2_AllowStatistics = ((JsonElement)pf.JsonFile.Info["AllowStatistics"]).GetBoolean();
                info.GMS2_GameGUID        = ((JsonElement)pf.JsonFile.Info["GUID"]).GetGuid();
            }
            else
            {
                info.LegacyGUID = ((JsonElement)pf.JsonFile.Info["GUID"]).GetGuid();
            }
            info.GameName            = GetString("Name");
            info.Major               = GetInt("Major");
            info.Minor               = GetInt("Minor");
            info.Release             = GetInt("Release");
            info.Build               = GetInt("Build");
            info.DefaultWindowWidth  = GetInt("DefaultWindowWidth");
            info.DefaultWindowHeight = GetInt("DefaultWindowHeight");
            info.Info                    = Enum.Parse <GMChunkGEN8.InfoFlags>(((JsonElement)pf.JsonFile.Info["Info"]).GetString());
            info.LicenseCRC32            = GetInt("LicenseCRC32");
            info.LicenseMD5              = ((JsonElement)pf.JsonFile.Info["LicenseMD5"]).GetBytesFromBase64();
            info.Timestamp               = ((JsonElement)pf.JsonFile.Info["Timestamp"]).GetInt64();
            info.DisplayName             = GetString("DisplayName");
            info.ActiveTargets           = ((JsonElement)pf.JsonFile.Info["ActiveTargets"]).GetInt64();
            info.FunctionClassifications = Enum.Parse <GMChunkGEN8.FunctionClassification>(((JsonElement)pf.JsonFile.Info["FunctionClassifications"]).GetString());
            info.SteamAppID              = GetInt("SteamAppID");
            info.DebuggerPort            = GetInt("DebuggerPort");
        }
Ejemplo n.º 2
0
        private static Dictionary <string, object> ConvertInfo(ProjectFile pf)
        {
            GMChunkGEN8 generalInfo = (GMChunkGEN8)pf.DataHandle.Chunks["GEN8"];

            Dictionary <string, object> info = new Dictionary <string, object>();

            info["DisableDebug"] = generalInfo.DisableDebug;
            info["FormatID"]     = generalInfo.FormatID;
            info["Unknown"]      = generalInfo.Unknown;
            info["Filename"]     = generalInfo.Filename.Content;
            info["Config"]       = generalInfo.Config.Content;
            info["LastObjectID"] = generalInfo.LastObjectID;
            info["LastTileID"]   = generalInfo.LastTileID;
            info["GameID"]       = generalInfo.GameID;
            if (pf.DataHandle.VersionInfo.IsNumberAtLeast(2))
            {
                info["FPS"]             = generalInfo.GMS2_FPS;
                info["AllowStatistics"] = generalInfo.GMS2_AllowStatistics;
                info["GUID"]            = generalInfo.GMS2_GameGUID;
            }
            else
            {
                info["GUID"] = generalInfo.LegacyGUID;
            }
            info["Name"]                    = generalInfo.GameName.Content;
            info["Major"]                   = generalInfo.Major;
            info["Minor"]                   = generalInfo.Minor;
            info["Release"]                 = generalInfo.Release;
            info["Build"]                   = generalInfo.Build;
            info["DefaultWindowWidth"]      = generalInfo.DefaultWindowWidth;
            info["DefaultWindowHeight"]     = generalInfo.DefaultWindowHeight;
            info["Info"]                    = generalInfo.Info.ToString();
            info["LicenseCRC32"]            = generalInfo.LicenseCRC32;
            info["LicenseMD5"]              = generalInfo.LicenseMD5;
            info["Timestamp"]               = generalInfo.Timestamp;
            info["DisplayName"]             = generalInfo.DisplayName.Content;
            info["ActiveTargets"]           = generalInfo.ActiveTargets;
            info["FunctionClassifications"] = generalInfo.FunctionClassifications.ToString();
            info["SteamAppID"]              = generalInfo.SteamAppID;
            info["DebuggerPort"]            = generalInfo.DebuggerPort;

            return(info);
        }
Ejemplo n.º 3
0
        public void ConvertProject(ProjectFile pf)
        {
            GMChunkGEN8 info = pf.DataHandle.GetChunk <GMChunkGEN8>();

            info.DisableDebug = pf.Info.GetBool("DisableDebug");
            info.FormatID     = pf.Info.GetByte("FormatID");
            info.Unknown      = pf.Info.GetShort("Unknown");
            info.Filename     = pf.Info.GetString(pf, "Filename");
            info.Config       = pf.Info.GetString(pf, "Config");
            info.LastObjectID = pf.Info.GetInt("LastObjectID");
            info.LastTileID   = pf.Info.GetInt("LastTileID");
            info.GameID       = pf.Info.GetInt("GameID");
            if (pf.DataHandle.VersionInfo.IsNumberAtLeast(2))
            {
                if (pf.Info.ContainsKey("FPS"))
                {
                    info.GMS2_FPS             = pf.Info.GetFloat("FPS");
                    info.GMS2_AllowStatistics = pf.Info.GetBool("AllowStatistics");
                    info.GMS2_GameGUID        = pf.Info.GetGUID("GUID");
                }
            }
            else
            {
                info.LegacyGUID = pf.Info.GetGUID("GUID");
            }
            info.GameName            = pf.Info.GetString(pf, "Name");
            info.Major               = pf.Info.GetInt("Major");
            info.Minor               = pf.Info.GetInt("Minor");
            info.Release             = pf.Info.GetInt("Release");
            info.Build               = pf.Info.GetInt("Build");
            info.DefaultWindowWidth  = pf.Info.GetInt("DefaultWindowWidth");
            info.DefaultWindowHeight = pf.Info.GetInt("DefaultWindowHeight");
            info.Info                    = Enum.Parse <GMChunkGEN8.InfoFlags>(pf.Info.GetString("Info"));
            info.LicenseCRC32            = pf.Info.GetInt("LicenseCRC32");
            info.LicenseMD5              = new BufferRegion(pf.Info.GetBytes("LicenseMD5"));
            info.Timestamp               = pf.Info.GetLong("Timestamp");
            info.DisplayName             = pf.Info.GetString(pf, "DisplayName");
            info.ActiveTargets           = pf.Info.GetLong("ActiveTargets");
            info.FunctionClassifications = Enum.Parse <GMChunkGEN8.FunctionClassification>(pf.Info.GetString("FunctionClassifications"));
            info.SteamAppID              = pf.Info.GetInt("SteamAppID");
            info.DebuggerPort            = pf.Info.GetInt("DebuggerPort");
        }