コード例 #1
0
ファイル: GameLibrary.cs プロジェクト: IndiegameGarden/Wreckz
 /// <summary>
 /// (re)load information from given Json file
 /// </summary>
 /// <exception cref="">various IO exceptions may occur when library file could not be found/loaded</exception>
 public void LoadJson(string libraryFile)
 {
     json            = new JSONStore(libraryFile); // TODO use all json files in there?
     gamesCollection = new GameCollection(GardenSizeX, GardenSizeY, new List <GardenItem>());
     ParseJson(json);
     FinalizeGamelibForUse();
 }
コード例 #2
0
        /// <summary>
        /// create a new instance from a JSON representation
        /// </summary>
        /// <param name="j">the JSON data for one game</param>
        public GardenItem(JsonObject j)
        {
            try { GameID = j["ID"].ToString(); }
            catch (Exception) {; }
            try { Version = (int)((JsonNumber)j["Version"]).Value; }
            catch (Exception) {; }
            try { VisibilityLabel = (byte)((JsonNumber)j["Visible"]).Value; }
            catch (Exception) {; }
            try { PositionX = (int)((JsonNumber)j["X"]).Value; }
            catch (Exception) {; }
            try { PositionY = (int)((JsonNumber)j["Y"]).Value; }
            catch (Exception) {; }
            try { PositionDeltaX = (int)((JsonNumber)j["DX"]).Value; }
            catch (Exception) {; }
            try { PositionDeltaY = (int)((JsonNumber)j["DY"]).Value; }
            catch (Exception) {; }
            try { ScaleIcon = (float)((JsonNumber)j["Scale"]).Value; }
            catch (Exception) {; }
            try { Name = j["Name"].ToString(); }
            catch (Exception) {; }
            try { Description = j["Descr"].ToString(); }
            catch (Exception) {; }
            try { HelpText = j["Help"].ToString(); }
            catch (Exception) {; }
            try { ExeFile = j["Exe"].ToString(); }
            catch (Exception) {; }
            try { CdPath = j["Cd"].ToString(); }
            catch (Exception) {; }
            try { PackedFileURL = j["Zip"].ToString(); }
            catch (Exception) {; }
            try { thumbnailURL = j["ThumbURL"].ToString(); }
            catch (Exception) {; }
            try { DeveloperWebsiteURL = j["Site"].ToString(); }
            catch (Exception) {; }
            try {
                JsonArray am = (JsonArray)j["ZipMirrors"];
                packedFileMirrors = JSONStore.ToStringList(am);
            }
            catch (Exception) {; }

            // update with default mirror location, only if a main location is defined
            // if no main location is given, use default location as main DL location which assumes a .zip file type too.
            string defaultDownloadLoc = GardenConfig.Instance.PackedFilesServerURL + GardenConfig.Instance.GetPackedFileName(this);

            if (PackedFileURL.Length > 0)
            {
                packedFileMirrors.Add(defaultDownloadLoc);
            }
            else
            {
                PackedFileURL = defaultDownloadLoc;
            }
        }
コード例 #3
0
ファイル: GameLibrary.cs プロジェクト: IndiegameGarden/Wreckz
        // parse all games in the 'json' data
        private void ParseJson(JSONStore json)
        {
            JsonArray gl = (JsonArray)json.GetArray("gameslist");

            ParseJson(gl, Vector2.Zero);
        }
コード例 #4
0
 // parse all games in the 'json' data
 private void ParseJson(JSONStore json)
 {
     JsonArray gl = (JsonArray)json.GetArray("gameslist");
     ParseJson(gl,Vector2.Zero);
 }
コード例 #5
0
 /// <summary>
 /// (re)load information from given Json file
 /// </summary>
 /// <exception cref="">various IO exceptions may occur when library file could not be found/loaded</exception>
 public void LoadJson(string libraryFile)
 {
     json = new JSONStore(libraryFile); // TODO use all json files in there?
     gamesCollection = new GameCollection(GardenSizeX, GardenSizeY, new List<GardenItem>());
     ParseJson(json);
 }