コード例 #1
0
        private void ScanSteamGames()
        {
            lvGames.BeginUpdate();
            SteamApps.Clear();
            lvGames.SmallImageList.Images.Clear();
            CheckedItemMap.Clear();
            //clearImageIndex = 0;
            //ImageIndexMap.Clear();
            //ListItems.Clear();
            List <SteamLaunchableApp>        apps  = context.GetOwnedApps().Where(dr => new[] { "game", "demo", "application" }.Contains(dr.appType)).ToList();
            List <SteamLaunchableModGoldSrc> gmods = context.GetGoldSrcMods();
            List <SteamLaunchableModSource>  smods = context.GetSourceMods();

            SteamApps.AddRange(apps);
            SteamApps.AddRange(gmods);
            SteamApps.AddRange(smods);

            /*foreach(SteamLaunchable app in SteamApps)
             * {
             *  ListItems.Add(new SteamLaunchableListViewitem(app));
             * }*/

            //lvGames.VirtualListSize = ListItems.Count;
            lvGames.VirtualListSize = SteamApps.Count;
            lvGames.EndUpdate();

            SortList();
        }
コード例 #2
0
        public void HandleRequest(string uri, HttpRequest request, HttpResponse response, HttpContext httpcontext)
        {
            string[] uriParts = uri.Split('/');
            System.Collections.Specialized.NameValueCollection query = System.Web.HttpUtility.ParseQueryString(request.QueryString);

            if (uriParts.Length <= 1)
            {
                if (request.Method != HttpMethod.Get)
                {
                    throw new HttpMethodNotAllowedException();
                }

                //response.Headers[HttpHeaders.ContentType] = @"text/html; charset=UTF-8";
                //response.ResponseCode = HttpResponseCode.Ok;

                //byte[] raw = Encoding.UTF8.GetBytes(Resources.index);
                //response.Content.Write(raw, 0, raw.Length);

                throw new HttpNotFoundException();

                return;
            }

            switch (uriParts[0])
            {
            case "System":
                if (uriParts.Length > 1)
                {
                    switch (uriParts[1])
                    {
                    case "Exit":
                        Application.Exit();
                        return;
                    }
                }
                break;

            case "SteamContext":
                if (uriParts.Length > 1)
                {
                    switch (uriParts[1])
                    {
                    case "IsInstalled":
                        SendReponseData(request, response, context.IsInstalled(UInt64.Parse(query["GameID"])));
                        return;

                    case "GetGameLibraries":
                        SendReponseData(request, response, context.GetGameLibraries());
                        return;

                    case "InstallGame":
                    {
                        Steam4NET.EAppUpdateError?rawReturn = context.InstallGame(UInt64.Parse(query["GameID"]), int.Parse(query["GameLibraryIndex"]));
                        SendReponseData(request, response, rawReturn.HasValue ? (int?)rawReturn.Value : null);
                    }
                        return;

                    case "GetOwnedApps":
                        SendReponseData(request, response, context.GetOwnedApps());
                        return;

                    case "GetGoldSrcMods":
                        SendReponseData(request, response, context.GetGoldSrcMods());
                        return;

                    case "GetSourceMods":
                        SendReponseData(request, response, context.GetSourceMods());
                        return;

                    default:
                        throw new HttpNotFoundException();
                    }
                }
                else
                {
                    // readme?
                }
                break;
            }

            throw new HttpNotFoundException();
        }