Beispiel #1
0
        private string LoadGameForRequest()
        {
            string folder   = null;
            string gameFile = Request["file"];
            string id       = Request["id"];

            if (string.IsNullOrEmpty(gameFile))
            {
                if (!string.IsNullOrEmpty(id))
                {
                    IFileManager fileManager = FileManagerLoader.GetFileManager();
                    if (fileManager != null)
                    {
                        gameFile = fileManager.GetFileForID(id);
                    }
                }
            }

            AzureFileManager.ApiGame apiGameData = null;

            var loadData = Session["LoadData"] as string;

            Session["LoadData"] = null;

            if (loadData != null)
            {
                apiGameData = AzureFileManager.GetGameData(id);
                if (apiGameData == null)
                {
                    throw new InvalidOperationException("No API data returned for game id " + id);
                }
            }

            return(LoadGame(gameFile, id, folder, loadData, apiGameData));
        }
Beispiel #2
0
        private async Task <string> LoadGameForRequest()
        {
            string folder     = null;
            string gameFile   = Request["file"];
            string id         = Request["id"];
            bool?  isCompiled = null;

            if (string.IsNullOrEmpty(gameFile))
            {
                if (!string.IsNullOrEmpty(id))
                {
                    IFileManager fileManager = FileManagerLoader.GetFileManager();
                    if (fileManager != null)
                    {
                        var result = await fileManager.GetFileForID(id);

                        gameFile   = result.Filename;
                        isCompiled = result.IsCompiled;
                    }
                }
            }

            AzureFileManager.ApiGame apiGameData = null;

            var loadData = Session["LoadData"] as string;

            Session["LoadData"] = null;

            if (loadData != null)
            {
                apiGameData = await AzureFileManager.GetGameData(id);

                if (apiGameData == null)
                {
                    throw new InvalidOperationException("No API data returned for game id " + id);
                }
            }

            return(LoadGame(gameFile, isCompiled, id, folder, loadData, apiGameData));
        }