コード例 #1
0
        public static Backpack TranslateBackpackData()
        {
            if (MyBackpackDataRaw == null)
            {
                ParseBackpackJson();
            }
            if (Schema == null)
            {
                TranslateItemsData();
            }

            MyBackpackData = new Backpack(MyBackpackDataRaw, Schema);

            return MyBackpackData;
        }
コード例 #2
0
        public static bool LoadOtherBackpack(string steamID64)
        {
            VersatileIO.Debug("Requesting backpack data for user #{0} from Steam...", steamID64);
            string result = Util.DownloadString(GetBackbackUrl(steamID64),
                Settings.Instance.DownloadTimeout);
            if (result == null)
            {
                return false;
            }

            BackpackCaches.Put(steamID64, result);

            VersatileIO.Verbose("  Parsing backpack data...");
            TF2BackpackJson json = JsonConvert.DeserializeObject<TF2BackpackJson>(BackpackCaches[steamID64]);
            BackpackDataRaw.Put(steamID64, json);

            if (json.result.status != TF2BackpackResultJson.Status.SUCCESS)
            {
                VersatileIO.Fatal("  Error parsing backpack data: " + TF2BackpackResultJson.Status
                    .ErrorMessages[json.result.status]);
                return false;
            }

            if (Schema == null)
            {
                TranslateItemsData();
            }
            Backpack data = new Backpack(json, Schema);
            BackpackData.Put(steamID64, data);
            VersatileIO.Verbose("  Parse complete.");

            return true;
        }