コード例 #1
0
        public async Task <List <DLCList> > GetDLCList()
        {
            List <DLCList> result = new List <DLCList>();

            try
            {
                if (await Get_AppDetails(AppID))
                {
                    if (JSON_data == null)
                    {
                        return(result);
                    }
                    JObject json = JObject.Parse(JSON_data.ToString());
                    JToken  dlc_data;
                    if (!json.TryGetValue("dlc", out dlc_data))
                    {
                        return(result);
                    }
                    foreach (var item in dlc_data)
                    {
                        int dlc_id = Convert.ToInt32(item);
                        if (await Get_AppDetails(dlc_id))
                        {
                            if (JSON_data == null)
                            {
                                continue;
                            }
                            JObject _json = JObject.Parse(JSON_data.ToString());
                            JToken  _type;
                            if (_json.TryGetValue("type", out _type))
                            {
                                if (_type.ToString() == "dlc")
                                {
                                    DLCList dlc = new DLCList
                                    {
                                        ID     = dlc_id,
                                        Name   = JSON_data["name"].ToString(),
                                        Enable = true
                                    };
                                    result.Add(dlc);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
コード例 #2
0
ファイル: INIFile.cs プロジェクト: Hill-98/DLC-To-SSE
        public List <DLCList> GetDLCList()
        {
            List <DLCList> result  = new List <DLCList>();
            string         section = "";

            foreach (var value in DLC_Sections)
            {
                if (IniData[value].Count != 0)
                {
                    section = value;
                }
            }
            if (string.IsNullOrEmpty(section))
            {
                return(result);
            }
            foreach (var item in IniData[section])
            {
                int dlc_id;
                try
                {
                    dlc_id = Convert.ToInt32(item.KeyName);
                }
                catch (Exception)
                {
                    continue;
                }
                if (string.IsNullOrEmpty(item.Value))
                {
                    continue;
                }
                DLCList dlc = new DLCList
                {
                    ID     = dlc_id,
                    Name   = item.Value,
                    Enable = true
                };
                result.Add(dlc);
            }
            return(result);
        }