コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("LibraryGameId,MemberId,GameId")] GamesLibrary gamesLibrary)
        {
            if (id != gamesLibrary.LibraryGameId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gamesLibrary);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GamesLibraryExists(gamesLibrary.LibraryGameId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GameId"]   = new SelectList(_context.Games, "GameId", "AvailablePlatforms", gamesLibrary.GameId);
            ViewData["MemberId"] = new SelectList(_context.Members, "MemberId", "MemberId", gamesLibrary.MemberId);
            return(View(gamesLibrary));
        }
コード例 #2
0
        public GamesLibrary GameLibrary(List <Item> cart, string memberId, int i)
        {
            GamesLibrary gamesLibrary = new GamesLibrary();

            gamesLibrary.GameId   = cart[i].Game.GameId;
            gamesLibrary.MemberId = memberId;
            return(gamesLibrary);
        }
コード例 #3
0
 public void OnGet()
 {
     Games = new GamesLibrary(new List <Game>
     {
         new Game("Thoughts and crosses", "/thoughtsandcrosses2", "9 categories, 1 starting letter - mission: ensure each answer is unique to win big"),
         new Game("The word game", "/letters2", "A bunch of random letters, a short amount of time - mission: come up with as many words as possible before you're out of time")
     });
 }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("LibraryGameId,MemberId,GameId")] GamesLibrary gamesLibrary)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gamesLibrary);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GameId"]   = new SelectList(_context.Games, "GameId", "AvailablePlatforms", gamesLibrary.GameId);
            ViewData["MemberId"] = new SelectList(_context.Members, "MemberId", "MemberId", gamesLibrary.MemberId);
            return(View(gamesLibrary));
        }
コード例 #5
0
        public void Activated(PluginRuntime pluginRuntime)
        {
            string absolutePlatformDir;

            if (!NativeMethods.SetPlatformSearchDirectories(out absolutePlatformDir))
            {
                throw new Exception("Error adding dll probe path");
            }

            GamesLibrary.RegisterOnMediaLibrary();

            // Init OpenGl here as it creates a hidden window which we later
            // use to create an opengl context for cores that support hardware
            // rendering. The window should be created on the main thread, which
            // we should be on here, otherwise the window's device context
            // becomes invalid when the thread that created it dies.
            OpenGL.Gl.Initialize();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            const int PORT   = 1234;
            Server    server = new Server
            {
                Services = { GamesLibrary.BindService(new GamesLibraryImplement()) },
                Ports    = { new ServerPort("localhost", PORT, ServerCredentials.Insecure) }
            };

            server.Start();
            gameDatabase.DatabaseName = "gamesdatabase";
            userDatabase.DatabaseName = "gamesdatabase";
            Console.WriteLine("{0}: Server started, port: {1}", DateTime.Now.ToString(), PORT);
            Console.WriteLine("Press ENTER to stop the server...");
            Console.WriteLine();
            Console.ReadLine();
            server.ShutdownAsync().Wait();
        }
コード例 #7
0
        public static async Task LoadLibrary()
        {
            if (Library == null)
            {
                UploadProgressForm uploadForm = new UploadProgressForm();
                uploadForm.uploadLabel.Text        = (string)lang["downloading_library"];
                uploadForm.Text                    = (string)lang["download_progress"];
                uploadForm.uploadValueLabel.Text   = "";
                uploadForm.uploadProgressBar.Value = 100;
                try
                {
                    Library = (GamesLibrary)Deserialize(AppDomain.CurrentDomain.BaseDirectory + "Library.bin");
                }
                catch (FileNotFoundException)
                {
                    DialogResult response = MessageBox.Show((string)lang["library_not_found"], (string)lang["warning"], MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (response == DialogResult.Yes)
                    {
                        uploadForm.Show();
                        byte[] libraryData = await OnedriveHelper.Instance.ReadItem("GameLinker/Library.bin");

                        uploadForm.Hide();
                        if (libraryData == null)
                        {
                            Library = new GamesLibrary();
                            MessageBox.Show((string)lang["library_being_created"], (string)lang["warning"], MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            SaveLibrary();
                        }
                        else
                        {
                            Library = (GamesLibrary)DeserializeBytes(libraryData);
                            SaveLibrary();
                            MessageBox.Show((string)lang["library_restored"], (string)lang["success"], MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        Library = new GamesLibrary();
                        MessageBox.Show((string)lang["library_being_created"], (string)lang["warning"], MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        SaveLibrary();
                    }
                }
                catch (InvalidCastException)
                {
                    DialogResult response = MessageBox.Show((string)lang["library_corrupted"], (string)lang["warning"], MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (response == DialogResult.Yes)
                    {
                        uploadForm.Show();
                        byte[] libraryData = await OnedriveHelper.Instance.ReadItem("GameLinker/Library.bin");

                        uploadForm.Hide();
                        if (libraryData == null)
                        {
                            Library = new GamesLibrary();
                            MessageBox.Show((string)lang["library_being_created"], (string)lang["warning"], MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            SaveLibrary();
                        }
                        else
                        {
                            Library = (GamesLibrary)DeserializeBytes(libraryData);
                            SaveLibrary();
                            MessageBox.Show((string)lang["library_restored"], (string)lang["success"], MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        Library = new GamesLibrary();
                        MessageBox.Show((string)lang["library_being_created"], (string)lang["warning"], MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        SaveLibrary();
                    }
                }
            }
        }