Exemplo n.º 1
0
 public void Start(NetServer server_, string saveFilename_, GamePlatform platform_)
 {
     server = server_;
     saveFilename = saveFilename_;
     platform = platform_;
     mainThreadActionsLock = platform.MonitorCreate();
 }
Exemplo n.º 2
0
 public static BitmapData_ CreateFromBitmap(GamePlatform p, BitmapCi atlas2d_)
 {
     BitmapData_ b = new BitmapData_();
     b.width = p.FloatToInt(p.BitmapGetWidth(atlas2d_));
     b.height = p.FloatToInt(p.BitmapGetHeight(atlas2d_));
     b.argb = new int[b.width * b.height];
     p.BitmapGetPixelsArgb(atlas2d_, b.argb);
     return b;
 }
Exemplo n.º 3
0
 public static float InterpolateAngle360(GamePlatform platform, float a, float b, float progress)
 {
     if (progress != 0 && b != a)
     {
         float diff = NormalizeAngle360(platform, b - a);
         if (diff >= CircleHalf360)
         {
             diff -= CircleFull360;
         }
         a += (progress * diff);
     }
     return NormalizeAngle360(platform, a);
 }
Exemplo n.º 4
0
 public static Packet_Client CreateLoginPacket(GamePlatform platform, string username, string verificationKey)
 {
     Packet_ClientIdentification p = new Packet_ClientIdentification();
     {
         p.Username = username;
         p.MdProtocolVersion = platform.GetGameVersion();
         p.VerificationKey = verificationKey;
     }
     Packet_Client pp = new Packet_Client();
     pp.Id = Packet_ClientIdEnum.PlayerIdentification;
     pp.Identification = p;
     return pp;
 }
Exemplo n.º 5
0
 public static int InterpolateAngle256(GamePlatform platform, int a, int b, float progress)
 {
     if (progress != 0 && b != a)
     {
         int diff = NormalizeAngle256(b - a);
         if (diff >= CircleHalf256)
         {
             diff -= CircleFull256;
         }
         a += platform.FloatToInt(progress * diff);
     }
     return NormalizeAngle256(a);
 }
        private static List<Tone.Tone> extractTones(string packagePath, GamePlatform platform)
        {
            List<Tone.Tone> tones = new List<Tone.Tone>();
            string appDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            Packer.Unpack(packagePath, appDir, true);
            string unpackedDir = Path.Combine(appDir, Path.GetFileNameWithoutExtension(packagePath) + String.Format("_{0}", platform.ToString()));
            string[] toneManifestFiles = Directory.GetFiles(unpackedDir, "tone*.manifest.json", SearchOption.AllDirectories);

            foreach (var file in toneManifestFiles)
            {
                tones.Add(readManifest(file));
            }
            if (Directory.Exists(unpackedDir))
                Directory.Delete(unpackedDir, true);

            return tones;
        }
 public static string GetPlatformTagDescription(GamePlatform platform)
 {
     switch (platform)
     {
         case GamePlatform.Pc:
             return TagValue.DX9.GetDescription();
         case GamePlatform.Mac:
             return TagValue.MacOS.GetDescription();
         case GamePlatform.XBox360:
             return TagValue.Xbox360.GetDescription();
         case GamePlatform.PS3:
             return TagValue.PS3.GetDescription();
         default:
             throw new InvalidOperationException("Unexpected game platform value");
     }
 }
Exemplo n.º 8
0
 public static bool StringStartsWith(GamePlatform p, string s, string b)
 {
     return StringSubstring(p, s, 0, StringLength(p, b)) == b;
 }
Exemplo n.º 9
0
 public static string StringSubstringToEnd(GamePlatform p, string a, int start)
 {
     return StringSubstring(p, a, start, StringLength(p, a) - start);
 }
Exemplo n.º 10
0
    public override void Render(float dt)
    {
        if (!loaded)
        {
            preferences_ip   = menu.p.GetPreferences().GetString("ConnectToIpIp", "127.0.0.1");
            preferences_port = menu.p.GetPreferences().GetString("ConnectToIpPort", "25565");
            textboxIp.text   = preferences_ip;
            textboxPort.text = preferences_port;
            loaded           = true;
        }

        if (textboxIp.text != preferences_ip ||
            textboxPort.text != preferences_port)
        {
            preferences_ip   = textboxIp.text;
            preferences_port = textboxPort.text;
            Preferences preferences = menu.p.GetPreferences();
            preferences.SetString("ConnectToIpIp", preferences_ip);
            preferences.SetString("ConnectToIpPort", preferences_port);
            menu.p.SetPreferences(preferences);
        }

        GamePlatform p     = menu.p;
        float        scale = menu.GetScale();

        menu.DrawBackground();


        float leftx = p.GetCanvasWidth() / 2 - 400 * scale;
        float y     = p.GetCanvasHeight() / 2 - 250 * scale;

        string loginResultText = null;

        if (errorText != null)
        {
            menu.DrawText(loginResultText, 14 * scale, leftx, y - 50 * scale, TextAlign.Left, TextBaseline.Top);
        }

        menu.DrawText(title, 14 * scale, leftx, y + 50 * scale, TextAlign.Left, TextBaseline.Top);

        textboxIp.x        = leftx;
        textboxIp.y        = y + 100 * scale;
        textboxIp.sizex    = 256 * scale;
        textboxIp.sizey    = 64 * scale;
        textboxIp.fontSize = 14 * scale;

        textboxPort.x        = leftx;
        textboxPort.y        = y + 200 * scale;
        textboxPort.sizex    = 256 * scale;
        textboxPort.sizey    = 64 * scale;
        textboxPort.fontSize = 14 * scale;

        buttonConnect.x        = leftx;
        buttonConnect.y        = y + 400 * scale;
        buttonConnect.sizex    = 256 * scale;
        buttonConnect.sizey    = 64 * scale;
        buttonConnect.fontSize = 14 * scale;

        back.x        = 40 * scale;
        back.y        = p.GetCanvasHeight() - 104 * scale;
        back.sizex    = 256 * scale;
        back.sizey    = 64 * scale;
        back.fontSize = 14 * scale;

        DrawWidgets();
    }
Exemplo n.º 11
0
    public override void OnNewFrameDraw2d(Game game, float deltaTime)
    {
        if (game.guistate != GuiState.MapLoading)
        {
            return;
        }

        GamePlatform platform = game.platform;
        float        one      = 1;

        Width  = platform.GetCanvasWidth();
        Height = platform.GetCanvasHeight();
        DrawBackground(game);

        string connecting = game.language.Connecting();

        if (game.issingleplayer && (!platform.SinglePlayerServerLoaded()))
        {
            connecting = "Starting game...";
        }
        if (game.maploadingprogress.ProgressStatus != null)
        {
            connecting = game.maploadingprogress.ProgressStatus;
        }

        if (game.invalidVersionDrawMessage != null)
        {
            game.Draw2dText(game.invalidVersionDrawMessage, game.fontMapLoading, game.xcenter(game.TextSizeWidth(game.invalidVersionDrawMessage, game.fontMapLoading)), Height / 2 - 50, null, false);
            string connect = "Click to connect";
            game.Draw2dText(connect, game.fontMapLoading, game.xcenter(game.TextSizeWidth(connect, game.fontMapLoading)), Height / 2 + 50, null, false);
            return;
        }

        IntRef serverNameWidth  = new IntRef();
        IntRef serverNameHeight = new IntRef();

        platform.TextSize(game.ServerInfo.ServerName, game.fontMapLoading, serverNameWidth, serverNameHeight);
        game.Draw2dText(game.ServerInfo.ServerName, game.fontMapLoading, game.xcenter(serverNameWidth.value), Height / 2 - 150, null, false);

        if (game.ServerInfo.ServerMotd != null)
        {
            IntRef serverMotdWidth  = new IntRef();
            IntRef serverMotdHeight = new IntRef();
            platform.TextSize(game.ServerInfo.ServerMotd, game.fontMapLoading, serverMotdWidth, serverMotdHeight);
            game.Draw2dText(game.ServerInfo.ServerMotd, game.fontMapLoading, game.xcenter(serverMotdWidth.value), Height / 2 - 100, null, false);
        }

        IntRef connectingWidth  = new IntRef();
        IntRef connectingHeight = new IntRef();

        platform.TextSize(connecting, game.fontMapLoading, connectingWidth, connectingHeight);
        game.Draw2dText(connecting, game.fontMapLoading, game.xcenter(connectingWidth.value), Height / 2 - 50, null, false);

        string progress  = platform.StringFormat(game.language.ConnectingProgressPercent(), platform.IntToString(game.maploadingprogress.ProgressPercent));
        string progress1 = platform.StringFormat(game.language.ConnectingProgressKilobytes(), platform.IntToString(game.maploadingprogress.ProgressBytes / 1024));

        if (game.maploadingprogress.ProgressPercent > 0)
        {
            IntRef progressWidth  = new IntRef();
            IntRef progressHeight = new IntRef();
            platform.TextSize(progress, game.fontMapLoading, progressWidth, progressHeight);
            game.Draw2dText(progress, game.fontMapLoading, game.xcenter(progressWidth.value), Height / 2 - 20, null, false);

            IntRef progress1Width  = new IntRef();
            IntRef progress1Height = new IntRef();
            platform.TextSize(progress1, game.fontMapLoading, progress1Width, progress1Height);
            game.Draw2dText(progress1, game.fontMapLoading, game.xcenter(progress1Width.value), Height / 2 + 10, null, false);

            float progressratio = one * game.maploadingprogress.ProgressPercent / 100;
            int   sizex         = 400;
            int   sizey         = 40;
            game.Draw2dTexture(game.WhiteTexture(), game.xcenter(sizex), Height / 2 + 70, sizex, sizey, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
            int   red    = Game.ColorFromArgb(255, 255, 0, 0);
            int   yellow = Game.ColorFromArgb(255, 255, 255, 0);
            int   green  = Game.ColorFromArgb(255, 0, 255, 0);
            int[] colors = new int[3];
            colors[0] = red;
            colors[1] = yellow;
            colors[2] = green;
            int c = InterpolationCi.InterpolateColor(platform, progressratio, colors, 3);
            game.Draw2dTexture(game.WhiteTexture(), game.xcenter(sizex), Height / 2 + 70, progressratio * sizex, sizey, null, 0, c, false);
        }
    }
Exemplo n.º 12
0
 internal string GetString(GamePlatform platform)
 {
     return platform.StringFromUtf8ByteArray(value, valueLength);
 }
        private static void WriteTmpFile(this Stream ms, string fileName, GamePlatform platform)
        {
            if (platform == GamePlatform.XBox360 || platform == GamePlatform.PS3)
            {
                string workDir = platform == GamePlatform.XBox360 ? xboxWorkDir : ps3WorkDir;
                string filePath = Path.Combine(workDir, fileName);

                FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write);
                byte[] bytes = new byte[ms.Length];
                ms.Read(bytes, 0, (int)ms.Length);
                file.Write(bytes, 0, bytes.Length);
                file.Close();

                switch (platform)
                {
                    case GamePlatform.XBox360:
                        XBox360Files.Add(filePath);
                        break;
                    case GamePlatform.PS3:
                        PS3Files.Add(filePath);
                        break;
                }
            }
        }
Exemplo n.º 14
0
 public async Task InsertAsync(GamePlatform entity)
 {
     await _db.GamePlatforms.AddAsync(entity);
 }
Exemplo n.º 15
0
 public void Insert(GamePlatform entity)
 {
     _db.GamePlatforms.Add(entity);
 }
Exemplo n.º 16
0
    public override void Render(float dt)
    {
        GamePlatform p = menu.p;

        float scale = menu.GetScale();

        menu.DrawBackground();
        menu.DrawText(title, 20 * scale, p.GetCanvasWidth() / 2, 10, TextAlign.Center, TextBaseline.Top);

        float leftx = p.GetCanvasWidth() / 2 - 128 * scale;
        float y     = p.GetCanvasHeight() / 2 + 0 * scale;

        play.x        = leftx;
        play.y        = y + 100 * scale;
        play.sizex    = 256 * scale;
        play.sizey    = 64 * scale;
        play.fontSize = 14 * scale;

        newWorld.x        = leftx;
        newWorld.y        = y + 170 * scale;
        newWorld.sizex    = 256 * scale;
        newWorld.sizey    = 64 * scale;
        newWorld.fontSize = 14 * scale;

        modify.x        = leftx;
        modify.y        = y + 240 * scale;
        modify.sizex    = 256 * scale;
        modify.sizey    = 64 * scale;
        modify.fontSize = 14 * scale;

        back.x        = 40 * scale;
        back.y        = p.GetCanvasHeight() - 104 * scale;
        back.sizex    = 256 * scale;
        back.sizey    = 64 * scale;
        back.fontSize = 14 * scale;

        open.x        = leftx;
        open.y        = y + 0 * scale;
        open.sizex    = 256 * scale;
        open.sizey    = 64 * scale;
        open.fontSize = 14 * scale;

        if (savegames == null)
        {
            IntRef savegamesCount_ = new IntRef();
            savegames      = menu.GetSavegames(savegamesCount_);
            savegamesCount = savegamesCount_.value;
        }

        for (int i = 0; i < 10; i++)
        {
            worldButtons[i].visible = false;
        }
        for (int i = 0; i < savegamesCount; i++)
        {
            worldButtons[i].visible  = true;
            worldButtons[i].text     = menu.p.FileName(savegames[i]);
            worldButtons[i].x        = leftx;
            worldButtons[i].y        = 100 + 100 * scale * i;
            worldButtons[i].sizex    = 256 * scale;
            worldButtons[i].sizey    = 64 * scale;
            worldButtons[i].fontSize = 14 * scale;
        }

        open.visible     = menu.p.SinglePlayerServerAvailable();
        play.visible     = false;
        newWorld.visible = false;
        modify.visible   = false;
        for (int i = 0; i < savegamesCount; i++)
        {
            worldButtons[i].visible = false;
        }

        DrawWidgets();

        if (!menu.p.SinglePlayerServerAvailable())
        {
            menu.DrawText("Singleplayer is only available on desktop (Windows, Linux, Mac) version of game.", 16 * scale, menu.p.GetCanvasWidth() / 2, menu.p.GetCanvasHeight() / 2, TextAlign.Center, TextBaseline.Middle);
        }
    }
Exemplo n.º 17
0
    public override void Render(float dt)
    {
        if (!loaded)
        {
            menu.p.WebClientDownloadDataAsync("http://manicdigger.sourceforge.net/serverlistcsv.php", serverListAddress);
            loaded = true;
        }
        if (serverListAddress.done)
        {
            serverListAddress.done = false;
            menu.p.WebClientDownloadDataAsync(serverListAddress.GetString(menu.p), serverListCsv);
        }
        if (serverListCsv.done)
        {
            loading            = false;
            serverListCsv.done = false;
            for (int i = 0; i < serversOnListCount; i++)
            {
                serversOnList[i]  = null;
                thumbResponses[i] = null;
            }
            IntRef   serversCount = new IntRef();
            string[] servers      = menu.p.StringSplit(serverListCsv.GetString(menu.p), "\n", serversCount);
            for (int i = 0; i < serversCount.value; i++)
            {
                IntRef   ssCount = new IntRef();
                string[] ss      = menu.p.StringSplit(servers[i], "\t", ssCount);
                if (ssCount.value < 10)
                {
                    continue;
                }
                ServerOnList s = new ServerOnList();
                s.hash           = ss[0];
                s.name           = menu.p.DecodeHTMLEntities(ss[1]);
                s.motd           = menu.p.DecodeHTMLEntities(ss[2]);
                s.port           = menu.p.IntParse(ss[3]);
                s.ip             = ss[4];
                s.version        = ss[5];
                s.users          = menu.p.IntParse(ss[6]);
                s.max            = menu.p.IntParse(ss[7]);
                s.gamemode       = ss[8];
                s.players        = ss[9];
                serversOnList[i] = s;
            }
        }

        GamePlatform p = menu.p;

        float scale = menu.GetScale();

        back.x        = 40 * scale;
        back.y        = p.GetCanvasHeight() - 104 * scale;
        back.sizex    = 256 * scale;
        back.sizey    = 64 * scale;
        back.fontSize = 14 * scale;

        connect.x        = p.GetCanvasWidth() / 2 - 300 * scale;
        connect.y        = p.GetCanvasHeight() - 104 * scale;
        connect.sizex    = 256 * scale;
        connect.sizey    = 64 * scale;
        connect.fontSize = 14 * scale;

        connectToIp.x        = p.GetCanvasWidth() / 2 - 0 * scale;
        connectToIp.y        = p.GetCanvasHeight() - 104 * scale;
        connectToIp.sizex    = 256 * scale;
        connectToIp.sizey    = 64 * scale;
        connectToIp.fontSize = 14 * scale;

        refresh.x        = p.GetCanvasWidth() / 2 + 350 * scale;
        refresh.y        = p.GetCanvasHeight() - 104 * scale;
        refresh.sizex    = 256 * scale;
        refresh.sizey    = 64 * scale;
        refresh.fontSize = 14 * scale;

        pageUp.x     = p.GetCanvasWidth() - 94 * scale;
        pageUp.y     = 100 * scale + (serversPerPage - 1) * 70 * scale;
        pageUp.sizex = 64 * scale;
        pageUp.sizey = 64 * scale;
        pageUp.image = "serverlist_nav_down.png";

        pageDown.x     = p.GetCanvasWidth() - 94 * scale;
        pageDown.y     = 100 * scale;
        pageDown.sizex = 64 * scale;
        pageDown.sizey = 64 * scale;
        pageDown.image = "serverlist_nav_up.png";

        loggedInName.x        = p.GetCanvasWidth() - 228 * scale;
        loggedInName.y        = 32 * scale;
        loggedInName.sizex    = 128 * scale;
        loggedInName.sizey    = 32 * scale;
        loggedInName.fontSize = 12 * scale;
        if (loggedInName.text == "")
        {
            if (p.GetPreferences().GetString("Password", "") != "")
            {
                loggedInName.text = p.GetPreferences().GetString("Username", "Invalid");
            }
        }
        logout.visible = loggedInName.text != "";

        logout.x        = p.GetCanvasWidth() - 228 * scale;
        logout.y        = 62 * scale;
        logout.sizex    = 128 * scale;
        logout.sizey    = 32 * scale;
        logout.fontSize = 12 * scale;
        logout.text     = "Logout";

        menu.DrawBackground();
        menu.DrawText(title, 20 * scale, p.GetCanvasWidth() / 2, 10, TextAlign.Center, TextBaseline.Top);
        menu.DrawText(p.IntToString(page + 1), 14 * scale, p.GetCanvasWidth() - 68 * scale, p.GetCanvasHeight() / 2, TextAlign.Center, TextBaseline.Middle);

        if (loading)
        {
            menu.DrawText(menu.lang.Get("MainMenu_MultiplayerLoading"), 14 * scale, 100 * scale, 50 * scale, TextAlign.Left, TextBaseline.Top);
        }

        UpdateThumbnails();
        for (int i = 0; i < serverButtonsCount; i++)
        {
            serverButtons[i].visible = false;
        }

        serversPerPage = menu.p.FloatToInt((menu.p.GetCanvasHeight() - (2 * 100 * scale)) / 70 * scale);
        for (int i = 0; i < serversPerPage; i++)
        {
            int index = i + (serversPerPage * page);
            if (index > serversOnListCount)
            {
                //Reset to first page
                page  = 0;
                index = i + (serversPerPage * page);
            }
            ServerOnList s = serversOnList[index];
            if (s == null)
            {
                continue;
            }
            string t = menu.p.StringFormat2("{1}", menu.p.IntToString(index), s.name);
            t = menu.p.StringFormat2("{0}\n{1}", t, s.motd);
            t = menu.p.StringFormat2("{0}\n{1}", t, s.gamemode);
            t = menu.p.StringFormat2("{0}\n{1}", t, menu.p.IntToString(s.users));
            t = menu.p.StringFormat2("{0}/{1}", t, menu.p.IntToString(s.max));
            t = menu.p.StringFormat2("{0}\n{1}", t, s.version);

            serverButtons[i].text        = t;
            serverButtons[i].x           = 100 * scale;
            serverButtons[i].y           = 100 * scale + i * 70 * scale;
            serverButtons[i].sizex       = p.GetCanvasWidth() - 200 * scale;
            serverButtons[i].sizey       = 64 * scale;
            serverButtons[i].visible     = true;
            serverButtons[i].buttonStyle = ButtonStyle.ServerEntry;
            if (s.thumbnailError)
            {
                //Server did not respond to ServerQuery. Maybe not reachable?
                serverButtons[i].description = "Server did not respond to query!";
            }
            else
            {
                serverButtons[i].description = null;
            }
            if (s.thumbnailFetched && !s.thumbnailError)
            {
                serverButtons[i].image = menu.p.StringFormat("serverlist_entry_{0}.png", s.hash);
            }
            else
            {
                serverButtons[i].image = "serverlist_entry_noimage.png";
            }
        }
        UpdateScrollButtons();
        DrawWidgets();
    }
Exemplo n.º 18
0
 public void SetPlatform(GamePlatform platform_)
 {
     platform = platform_;
 }
Exemplo n.º 19
0
        private IEnumerable <Models.Apply> GetFakeApplies()
        {
            var gamePlatform = new GamePlatform
            {
                Game = new Models.Game {
                    GameId = 2, Name = "Overwatch", ImageSource = "http://fullhdpictures.com/wp-content/uploads/2016/03/Magnificent-Overwatch-Wallpaper.png", IconSource = "https://static-cdn.jtvnw.net/jtv_user_pictures/flawedbot-profile_image-815076ff68773420-300x300.jpeg"
                },
                Platform = new Models.Platform {
                    Name = "PC"
                }
            };

            yield return(new Models.Apply
            {
                ApplyId = 1,
                Text = "Texto para ser aprovado na vaga.",
                PlayerId = 4,
                Player = new Models.Player
                {
                    Name = "Jogador 1",
                    Nickname = "PlayerOne",
                    DateOfBirth = new System.DateTime(1999, 12, 10),
                    Gender = new Models.Gender {
                        Name = "Masculino"
                    },
                    AvatarSource = "https://pbs.twimg.com/profile_images/949941380259991552/C4b4NckD_400x400.jpg",
                    Deleted = false,
                    PlayerId = 4
                },
                VacancyId = 1,
                Vacancy = new Models.Vacancy
                {
                    Title = "Vaga suporte",
                    Roles = new List <Models.Role>
                    {
                        new Models.Role
                        {
                            Name = "Agressivo",
                            RoleType = new Models.RoleType
                            {
                                RoleTypeId = 1,
                                Name = "Papel primário",
                                IconSource = "ic_primaryRole.png"
                            }
                        },
                        new Models.Role
                        {
                            Name = "DPS",
                            RoleType = new Models.RoleType
                            {
                                RoleTypeId = 2,
                                Name = "Papel secundário",
                                IconSource = "ic_secondaryRole.png"
                            }
                        }, new Models.Role
                        {
                            Name = "Tank",
                            RoleType = new Models.RoleType
                            {
                                RoleTypeId = 2,
                                Name = "Papel secundário",
                                IconSource = "ic_secondaryRole.png"
                            }
                        }
                    },
                    Skills = new List <Models.Skill> {
                        new Models.Skill {
                            Name = "tiro"
                        }, new Models.Skill {
                            Name = "healing"
                        }, new Models.Skill {
                            Name = "suporte"
                        }, new Models.Skill {
                            Name = "sniper"
                        }, new Models.Skill {
                            Name = "estratégia"
                        }
                    },
                    Team = new Models.Team
                    {
                        TeamId = 10,
                        Name = "To do",
                        GamePlatform = gamePlatform,
                        IconSource = "https://image.moboplay.com/images/apk/725/com.musSharApp.myToDoList_icon.png"
                    },
                    MinAge = 16,
                    MaxAge = 23,
                    VacancyId = 1,
                    Description = "Descrição completa da vaga que está sendo oferecida pela equipe e alguns de seus requisitos explicados pelo membro que oferta tal vaga, além de questões comportamentais que estão a procura nos cadidatos e etc.",
                },
                Roles = new List <Models.Role>
                {
                    new Models.Role
                    {
                        Name = "Agressivo",
                        RoleType = new Models.RoleType
                        {
                            RoleTypeId = 1,
                            Name = "Papel primário",
                            IconSource = "ic_primaryRole.png"
                        }
                    },
                    new Models.Role
                    {
                        Name = "DPS",
                        RoleType = new Models.RoleType
                        {
                            RoleTypeId = 2,
                            Name = "Papel secundário",
                            IconSource = "ic_secondaryRole.png"
                        }
                    }
                },
                Approved = null
            });

            yield return(new Models.Apply
            {
                ApplyId = 2,
                Text = "Texto para ser aprovado na vaga.",
                PlayerId = 4,
                Player = new Models.Player
                {
                    Name = "Jogador 1",
                    Nickname = "PlayerOne",
                    Gender = new Models.Gender {
                        Name = "Masculino"
                    },
                    AvatarSource = "https://pbs.twimg.com/profile_images/949941380259991552/C4b4NckD_400x400.jpg",
                    Deleted = false,
                    PlayerId = 4
                },
                VacancyId = 1,
                Vacancy = new Models.Vacancy
                {
                    Title = "Vaga suporte, papeis",
                    Roles = new List <Models.Role> {
                        new Models.Role {
                            Name = "Agressivo", RoleType = new Models.RoleType {
                                RoleTypeId = 1, Name = "Papel primário"
                            }
                        }, new Models.Role {
                            Name = "DPS", RoleType = new Models.RoleType {
                                RoleTypeId = 2, Name = "Papel secundário"
                            }
                        }, new Models.Role {
                            Name = "Tank", RoleType = new Models.RoleType {
                                RoleTypeId = 2, Name = "Papel secundário"
                            }
                        }
                    },
                    Skills = new List <Models.Skill> {
                        new Models.Skill {
                            Name = "skill1"
                        }, new Models.Skill {
                            Name = "skill1"
                        }, new Models.Skill {
                            Name = "skill1"
                        }
                    },
                    Team = new Models.Team {
                        Name = "Commander eSports", GamePlatform = gamePlatform, IconSource = "https://static-cdn.jtvnw.net/jtv_user_pictures/flawedbot-profile_image-815076ff68773420-300x300.jpeg"
                    },
                    VacancyId = 1,
                    Description = "vaga...."
                },
                Roles = new List <Models.Role> {
                    new Models.Role {
                        Name = "Agressivo", RoleType = new Models.RoleType {
                            RoleTypeId = 1, Name = "Papel primário"
                        }
                    }
                },
                Approved = true
            });
        }
Exemplo n.º 20
0
 internal void SetPlatform(GamePlatform platform)
 {
     p = platform;
 }
        public static string GenerateSoundBank(string dlcName, Stream audioStream, Stream outStream, decimal volume, GamePlatform platform)
        {
            string eventName = PLAY + dlcName;
            string previewName = PLAY30SEC + dlcName;
            string bankName = SONG + dlcName;
            var id = RandomGenerator.NextInt();

            byte[] soundbank = null;
            switch (platform)
            {
                case GamePlatform.Pc:
                    soundbank = Resources.PC_soundbank;
                    break;
                case GamePlatform.XBox360:
                case GamePlatform.PS3:
                    soundbank = Resources.Console_soundbank;
                    break;
                default:
                    throw new InvalidOperationException("Unexpected game platform value");
            }

            var bitConverter = platform == GamePlatform.Pc
                    ? (EndianBitConverter)EndianBitConverter.Little
                    : (EndianBitConverter)EndianBitConverter.Big;

            using (var bankStream = new MemoryStream(soundbank))
            using (var bankReader = new EndianBinaryReader(bitConverter, bankStream))
            {
                var audioReader = new EndianBinaryReader(bitConverter, audioStream);
                var bankWriter = new EndianBinaryWriter(bitConverter, outStream);
                bankWriter.Write(bankReader.ReadBytes(platform.GetOffsets()[0]));
                bankReader.ReadInt32();
                bankWriter.Write(id);
                bankWriter.Write(bankReader.ReadInt32());
                int dataSize = bankReader.ReadInt32();
                bankWriter.Write(dataSize);
                bankWriter.Write(bankReader.ReadInt32());
                bankWriter.Write(bankReader.ReadInt32());
                bankWriter.Write(audioReader.ReadBytes(dataSize));
                bankReader.BaseStream.Seek(dataSize, SeekOrigin.Current);
                bankWriter.Write(bankReader.ReadBytes(platform.GetOffsets()[1]));
                bankWriter.Write(id);
                bankWriter.Write(id);
                bankReader.BaseStream.Seek(8, SeekOrigin.Current);
                bankWriter.Write(bankReader.ReadBytes(platform.GetOffsets()[2]));
                bankWriter.Write((float)volume);
                bankReader.ReadInt32();
                bankWriter.Write(bankReader.ReadBytes(platform.GetOffsets()[3]));
                bankReader.ReadInt32();
                bankWriter.Write(HashString(eventName));
                bankWriter.Write(bankReader.ReadBytes(platform.GetOffsets()[4]));
                bankReader.ReadInt32();
                bankWriter.Write(HashString(previewName));
                bankWriter.Write(bankReader.ReadBytes(platform.GetOffsets()[5]));
                bankWriter.Write(12 + bankName.Length + 1);
                bankReader.ReadInt32();
                bankWriter.Write(bankReader.ReadBytes(platform.GetOffsets()[6]));
                bankWriter.Write((byte)bankName.Length);
                bankWriter.Write(Encoding.ASCII.GetBytes(bankName));
                bankWriter.Flush();
            }
            return id.ToString();
        }
Exemplo n.º 22
0
    public override void Render(float dt)
    {
        if (!triedSavedLogin)
        {
            Preferences preferences = menu.p.GetPreferences();
            loginUsername.text = preferences.GetString("Username", "");
            loginPassword.text = "";
            string token = preferences.GetString("Password", "");

            loginResultData = new LoginData();
            if (serverHash != null && token != "")
            {
                menu.Login(loginUsername.text, loginPassword.text, serverHash, token, loginResult, loginResultData);
            }

            triedSavedLogin = true;
        }
        if (loginResultData != null
            && loginResultData.ServerCorrect
            && loginResultData.PasswordCorrect)
        {
            if (loginRememberMe.text == menu.lang.Get("MainMenu_ChoiceYes"))
            {
                Preferences preferences = menu.p.GetPreferences();
                preferences.SetString("Username", loginUsername.text);
                if (loginResultData.Token != null && loginResultData.Token != "")
                {
                    preferences.SetString("Password", loginResultData.Token);
                }
                menu.p.SetPreferences(preferences);
            }
            menu.ConnectToGame(loginResultData, loginUsername.text);
        }

        GamePlatform p = menu.p;
        float scale = menu.GetScale();

        menu.DrawBackground();

        float leftx = p.GetCanvasWidth() / 2 - 400 * scale;
        float y = p.GetCanvasHeight() / 2 - 250 * scale;

        string loginResultText = null;
        if (loginResult.value == LoginResult.Failed)
        {
            loginResultText = menu.lang.Get("MainMenu_LoginInvalid");
        }
        if (loginResult.value == LoginResult.Connecting)
        {
            loginResultText = menu.lang.Get("MainMenu_LoginConnecting");
        }
        if (loginResultText != null)
        {
            menu.DrawText(loginResultText, 14 * scale, leftx, y - 50 * scale, TextAlign.Left, TextBaseline.Top);
        }

        menu.DrawText(title, 14 * scale, leftx, y + 50 * scale, TextAlign.Left, TextBaseline.Top);

        loginUsername.x = leftx;
        loginUsername.y = y + 100 * scale;
        loginUsername.sizex = 256 * scale;
        loginUsername.sizey = 64 * scale;
        loginUsername.fontSize = 14 * scale;

        loginPassword.x = leftx;
        loginPassword.y = y + 200 * scale;
        loginPassword.sizex = 256 * scale;
        loginPassword.sizey = 64 * scale;
        loginPassword.fontSize = 14 * scale;

        loginRememberMe.x = leftx;
        loginRememberMe.y = y + 300 * scale;
        loginRememberMe.sizex = 256 * scale;
        loginRememberMe.sizey = 64 * scale;
        loginRememberMe.fontSize = 14 * scale;

        login.x = leftx;
        login.y = y + 400 * scale;
        login.sizex = 256 * scale;
        login.sizey = 64 * scale;
        login.fontSize = 14 * scale;

        float rightx = p.GetCanvasWidth() / 2 + 150 * scale;

        // menu.DrawText("Create account", 14 * scale, rightx, y + 50 * scale, TextAlign.Left, TextBaseline.Top);

        createAccountUsername.x = rightx;
        createAccountUsername.y = y + 100 * scale;
        createAccountUsername.sizex = 256 * scale;
        createAccountUsername.sizey = 64 * scale;
        createAccountUsername.fontSize = 14 * scale;

        createAccountPassword.x = rightx;
        createAccountPassword.y = y + 200 * scale;
        createAccountPassword.sizex = 256 * scale;
        createAccountPassword.sizey = 64 * scale;
        createAccountPassword.fontSize = 14 * scale;

        createAccountRememberMe.x = rightx;
        createAccountRememberMe.y = y + 300 * scale;
        createAccountRememberMe.sizex = 256 * scale;
        createAccountRememberMe.sizey = 64 * scale;
        createAccountRememberMe.fontSize = 14 * scale;

        createAccount.x = rightx;
        createAccount.y = y + 400 * scale;
        createAccount.sizex = 256 * scale;
        createAccount.sizey = 64 * scale;
        createAccount.fontSize = 14 * scale;

        createAccountUsername.visible = false;
        createAccountPassword.visible = false;
        createAccountRememberMe.visible = false;
        createAccount.visible = false;

        back.x = 40 * scale;
        back.y = p.GetCanvasHeight() - 104 * scale;
        back.sizex = 256 * scale;
        back.sizey = 64 * scale;
        back.fontSize = 14 * scale;

        DrawWidgets();
    }
Exemplo n.º 23
0
 public GameID(String name, GamePlatform platform, String country)
 {
     this.name = name;
     this.platform = platform;
     this.country = country;
 }
Exemplo n.º 24
0
 public BitmapCi ToBitmap(GamePlatform p)
 {
     BitmapCi bmp = p.BitmapCreate(width, height);
     p.BitmapSetPixelsArgb(bmp, argb);
     return bmp;
 }
        private static void GeneratePackagePsarc(Stream output, DLCPackageData info, GamePlatform platform)
        {
            IList<Stream> toneStreams = new List<Stream>();
            using (var appIdStream = new MemoryStream())
            using (var packageListStream = new MemoryStream())
            using (var songPsarcStream = new MemoryStream())
            {
                try
                {
                    var packPsarc = new PSARC.PSARC();
                    var packageListWriter = new StreamWriter(packageListStream);

                    if (platform == GamePlatform.Pc)
                    {
                        GenerateAppId(appIdStream, info.AppId);
                        packPsarc.AddEntry("APP_ID", appIdStream);
                    }

                    packageListWriter.WriteLine(info.Name);

                    GenerateSongPsarc(songPsarcStream, info, platform);
                    string songFileName = String.Format("{0}.psarc", info.Name);
                    packPsarc.AddEntry(songFileName, songPsarcStream);
                    songPsarcStream.WriteTmpFile(songFileName, platform);

                    for (int i = 0; i < info.Tones.Count; i++)
                    {
                        var tone = info.Tones[i];
                        var tonePsarcStream = new MemoryStream();
                        toneStreams.Add(tonePsarcStream);

                        var toneKey = info.Name + "_" + tone.Name == null ? "Default" : tone.Name.Replace(' ', '_');

                        GenerateTonePsarc(tonePsarcStream, toneKey, tone);
                        string toneEntry = String.Format("DLC_Tone_{0}.psarc", toneKey);
                        packPsarc.AddEntry(toneEntry, tonePsarcStream);
                        tonePsarcStream.WriteTmpFile(toneEntry, platform);
                        if (i + 1 != info.Tones.Count)
                            packageListWriter.WriteLine("DLC_Tone_{0}", toneKey);
                        else
                            packageListWriter.Write("DLC_Tone_{0}", toneKey);
                    }

                    packageListWriter.Flush();
                    packageListStream.Seek(0, SeekOrigin.Begin);
                    if (platform != GamePlatform.PS3)
                    {
                        string packageList = "PackageList.txt";
                        packPsarc.AddEntry(packageList, packageListStream);
                        packageListStream.WriteTmpFile(packageList, platform);
                    }
                    packPsarc.Write(output);
                    output.Flush();
                    output.Seek(0, SeekOrigin.Begin);
                }
                finally
                {
                    foreach (var stream in toneStreams)
                    {
                        try
                        {
                            stream.Dispose();
                        }
                        catch { }
                    }
                }
            }
        }
Exemplo n.º 26
0
 public bool Send(GamePlatform platform)
 {
     if (!ready)
     {
         return false;
     }
     ready = false;
     this.timeSendMilliseconds = platform.TimeMillisecondsFromStart();
     return true;
 }
Exemplo n.º 27
0
 public Platform(GamePlatform platform, GameVersion version)
 {
     this.platform = platform;
     this.version = version;
 }
Exemplo n.º 28
0
    public static string StringAppend(GamePlatform p, string a, string b)
    {
        IntRef aLength = new IntRef();
        int[] aChars = p.StringToCharArray(a, aLength);
        IntRef bLength = new IntRef();
        int[] bChars = p.StringToCharArray(b, bLength);

        int[] cChars = new int[aLength.value + bLength.value];
        for (int i = 0; i < aLength.value; i++)
        {
            cChars[i] = aChars[i];
        }
        for (int i = 0; i < bLength.value; i++)
        {
            cChars[i + aLength.value] = bChars[i];
        }
        return p.CharArrayToString(cChars, aLength.value + bLength.value);
    }
Exemplo n.º 29
0
 public Game(string gameId, GamePlatform platform, string version)
 {
     this.gameId   = gameId;
     this.platform = platform;
     this.version  = version;
 }
 public GamePlatformAccessor(GamePlatform gamePlatform)
 {
     GamePlatform = gamePlatform;
 }
Exemplo n.º 31
0
 public static string StringSubstringToEnd(GamePlatform p, string a, int start)
 {
     return(StringSubstring(p, a, start, StringLength(p, a) - start));
 }
Exemplo n.º 32
0
 public static bool StringStartsWith(GamePlatform p, string s, string b)
 {
     return(StringSubstring(p, s, 0, StringLength(p, b)) == b);
 }
Exemplo n.º 33
0
 public bool Receive(GamePlatform platform)
 {
     if (ready)
     {
         return false;
     }
     this.RoundtripTimeMilliseconds = platform.TimeMillisecondsFromStart() - timeSendMilliseconds;
     ready = true;
     return true;
 }
Exemplo n.º 34
0
        public ActionResult Create([Bind(Include = "title,platformCode,publisher,price,qoh,relDate,genreCode,desc,phyCopy")] GameAndGameDetails gameAndGameDetails)
        {
            Account account = Session["account"] as Account;

            if (account == null)
            {
                TempData["infoMsg"] = "You must be logged in.";
                return(RedirectToAction("", "Login"));
            }
            if (account.roleCode != "employee")
            {
                throw new HttpException(403, "Access denied");
            }
            Game game = db.Games.Where(g => g.title == gameAndGameDetails.title).SingleOrDefault();

            if (game == null)
            {
                if (gameAndGameDetails.relDate > DateTime.Today)
                {
                    ModelState.AddModelError("relDate", "Release date cannot be later than today.");
                }
                if (gameAndGameDetails.phyCopy && gameAndGameDetails.qoh == null)
                {
                    ModelState.AddModelError("qoh", "Quantity on hand is required.");
                }

                if (ModelState.IsValid)
                {
                    try
                    {
                        game           = new Game();
                        game.title     = gameAndGameDetails.title;
                        game.relDate   = gameAndGameDetails.relDate;
                        game.desc      = gameAndGameDetails.desc;
                        game.publisher = gameAndGameDetails.publisher;
                        db.Games.Add(game);
                        db.SaveChanges();
                        GameDetail gameDetail = new GameDetail();
                        gameDetail.gameId  = game.gameId;
                        gameDetail.phyCopy = gameAndGameDetails.phyCopy;
                        gameDetail.price   = gameAndGameDetails.price;
                        if (gameDetail.phyCopy)
                        {
                            gameDetail.qoh = gameAndGameDetails.qoh;
                        }
                        else
                        {
                            gameDetail.qoh = null;
                        }
                        GamePlatform gamePlatform = new GamePlatform();
                        gamePlatform.gameId       = game.gameId;
                        gamePlatform.platformCode = gameAndGameDetails.platformCode;
                        GameGenre gameGenre = new GameGenre();
                        gameGenre.gameId    = game.gameId;
                        gameGenre.genreCode = gameAndGameDetails.genreCode;
                        db.GameDetails.Add(gameDetail);
                        db.GamePlatforms.Add(gamePlatform);
                        db.GameGenres.Add(gameGenre);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception)
                    {
                        TempData["errMsg"] = "An unexpected error has occurred. Please try again later.";
                    }
                }
            }
            else
            {
                if (game.GameDetails.Count > 1)
                {
                    ModelState.AddModelError("title", "Both a physical and downloadable copy of this game have already been created.");
                }
                else
                {
                    if (gameAndGameDetails.relDate > DateTime.Today)
                    {
                        ModelState.AddModelError("relDate", "Release date cannot be later than today.");
                    }
                    if (game.GameDetails.SingleOrDefault() != null && game.GameDetails.SingleOrDefault().phyCopy == gameAndGameDetails.phyCopy)
                    {
                        if (gameAndGameDetails.phyCopy)
                        {
                            ModelState.AddModelError("phyCopy", "A physical copy of this game has already been created.");
                        }
                        else
                        {
                            ModelState.AddModelError("phyCopy", "A downloadable copy of this game has already been created.");
                        }
                    }
                    else
                    {
                        if (gameAndGameDetails.phyCopy && gameAndGameDetails.qoh == null)
                        {
                            ModelState.AddModelError("qoh", "Quantity on hand is required.");
                        }
                        if (ModelState.IsValid)
                        {
                            try
                            {
                                GameDetail gameDetail = new GameDetail();
                                gameDetail.gameId  = game.gameId;
                                gameDetail.phyCopy = gameAndGameDetails.phyCopy;
                                gameDetail.price   = gameAndGameDetails.price;
                                if (gameDetail.phyCopy)
                                {
                                    gameDetail.qoh = gameAndGameDetails.qoh;
                                }
                                else
                                {
                                    gameDetail.qoh = null;
                                }
                                db.GameDetails.Add(gameDetail);
                                db.SaveChanges();
                                return(RedirectToAction("Index"));
                            }
                            catch (Exception)
                            {
                                TempData["errMsg"] = "An unexpected error has occurred. Please try again later.";
                            }
                        }
                    }
                }
            }
            ViewBag.genres     = new SelectList(db.Genres, "genreCode", "genreCode", gameAndGameDetails.genreCode);
            ViewBag.platforms  = new SelectList(db.Platforms, "platformCode", "platformCode", gameAndGameDetails.platformCode);
            ViewBag.publishers = new SelectList(Enum.GetValues(typeof(GameEnums.Publisher)), gameAndGameDetails.publisher);
            return(View(gameAndGameDetails));
        }
Exemplo n.º 35
0
 public bool Timeout(GamePlatform platform)
 {
     if ((platform.TimeMillisecondsFromStart() - timeSendMilliseconds) / 1000 > this.timeout)
     {
         this.ready = true;
         return true;
     }
     return false;
 }
Exemplo n.º 36
0
 internal string GetString(GamePlatform platform)
 {
     return(platform.StringFromUtf8ByteArray(value, valueLength));
 }
Exemplo n.º 37
0
 public static int StringLength(GamePlatform p, string a)
 {
     IntRef aLength = new IntRef();
     int[] aChars = p.StringToCharArray(a, aLength);
     return aLength.value;
 }
Exemplo n.º 38
0
 public static string Serialize(GamePlatform p, AnimatedModel m)
 {
     return(null);
 }
Exemplo n.º 39
0
    public static string StringSubstring(GamePlatform p, string a, int start, int count)
    {
        IntRef aLength = new IntRef();
        int[] aChars = p.StringToCharArray(a, aLength);

        int[] bChars = new int[count];
        for (int i = 0; i < count; i++)
        {
            bChars[i] = aChars[start + i];
        }
        return p.CharArrayToString(bChars, count);
    }
Exemplo n.º 40
0
 static float NormalizeAngle360(GamePlatform platform, float v)
 {
     return(platform.FloatModulo(v + ((shortMaxValue / 2) / 360) * 360, 360));
 }
Exemplo n.º 41
0
    //tiles = 16 means 16 x 16 atlas
    public BitmapCi[] Atlas2dInto1d(GamePlatform p, BitmapCi atlas2d_, int tiles, int atlassizezlimit, IntRef retCount)
    {
        BitmapData_ orig = BitmapData_.CreateFromBitmap(p, atlas2d_);

        int tilesize = orig.width / tiles;

        int atlasescount = MathCi.MaxInt(1, (tiles * tiles * tilesize) / atlassizezlimit);
        BitmapCi[] atlases = new BitmapCi[128];
        int atlasesCount = 0;

        BitmapData_ atlas1d = null;

        for (int i = 0; i < tiles * tiles; i++)
        {
            int x = i % tiles;
            int y = i / tiles;
            int tilesinatlas = (tiles * tiles / atlasescount);
            if (i % tilesinatlas == 0)
            {
                if (atlas1d != null)
                {
                    atlases[atlasesCount++] = atlas1d.ToBitmap(p);
                }
                atlas1d = BitmapData_.Create(tilesize, atlassizezlimit);
            }
            for (int xx = 0; xx < tilesize; xx++)
            {
                for (int yy = 0; yy < tilesize; yy++)
                {
                    int c = orig.GetPixel(x * tilesize + xx, y * tilesize + yy);
                    atlas1d.SetPixel(xx, (i % tilesinatlas) * tilesize + yy, c);
                }
            }
        }
        atlases[atlasesCount++] = atlas1d.ToBitmap(p);
        retCount.value = atlasescount;
        return atlases;
    }
Exemplo n.º 42
0
    public ModelData GetSphereModelData2(ModelData data,
                                         GamePlatform platform,
                                         float radius, float height, int segments, int rings,
                                         int[] skyPixels_, int[] glowPixels_,
                                         float sunX, float sunY, float sunZ)
    {
        int i = 0;

        if (data == null)
        {
            data      = new ModelData();
            data.xyz  = new float[rings * segments * 3];
            data.uv   = new float[rings * segments * 2];
            data.rgba = new byte[rings * segments * 4];
            data.SetVerticesCount(segments * rings);
            data.SetIndicesCount(segments * rings * 6);
            data.setIndices(SphereModelData.CalculateElements(radius, height, segments, rings));
        }

        // Load data into a vertex buffer or a display list afterwards.

        for (int y = 0; y < rings; y++)
        {
            float yFloat   = y;
            float phiFloat = (yFloat / (rings - 1)) * Game.GetPi();
            for (int x = 0; x < segments; x++)
            {
                float xFloat = x;
                float theta  = (xFloat / (segments - 1)) * 2 * Game.GetPi();
                float vx     = radius * Platform.Sin(phiFloat) * Platform.Cos(theta);
                float vy     = height * Platform.Cos(phiFloat);
                float vz     = radius * Platform.Sin(phiFloat) * Platform.Sin(theta);
                float u      = xFloat / (segments - 1);
                float v      = yFloat / (rings - 1);
                data.xyz[i * 3 + 0] = vx;
                data.xyz[i * 3 + 1] = vy;
                data.xyz[i * 3 + 2] = vz;
                data.uv[i * 2 + 0]  = u;
                data.uv[i * 2 + 1]  = v;

                float vertexLength      = platform.MathSqrt(vx * vx + vy * vy + vz * vz);
                float vertexXNormalized = vx / vertexLength;
                float vertexYNormalized = vy / vertexLength;
                float vertexZNormalized = vz / vertexLength;

                float sunLength = platform.MathSqrt(sunX * sunX + sunY * sunY + sunZ * sunZ);
                if (sunLength == 0)
                {
                    sunLength = 1;
                }
                float sunXNormalized = sunX / sunLength;
                float sunYNormalized = sunY / sunLength;
                float sunZNormalized = sunZ / sunLength;

                // Compute the proximity of this fragment to the sun.

                float dx             = vertexXNormalized - sunXNormalized;
                float dy             = vertexYNormalized - sunYNormalized;
                float dz             = vertexZNormalized - sunZNormalized;
                float proximityToSun = 1 - (platform.MathSqrt(dx * dx + dy * dy + dz * dz) / 2);

                // Look up the sky color and glow colors.
                float one = 1;

                int skyColor = Texture2d(platform, skyPixels_, (sunYNormalized + 2) / 4, 1 - ((vertexYNormalized + 1) / 2));

                float skyColorA = one * Game.ColorA(skyColor) / 255;
                float skyColorR = one * Game.ColorR(skyColor) / 255;
                float skyColorG = one * Game.ColorG(skyColor) / 255;
                float skyColorB = one * Game.ColorB(skyColor) / 255;

                int   glowColor  = Texture2d(platform, glowPixels_, (sunYNormalized + one) / 2, 1 - proximityToSun);
                float glowColorA = one * Game.ColorA(glowColor) / 255;
                float glowColorR = one * Game.ColorR(glowColor) / 255;
                float glowColorG = one * Game.ColorG(glowColor) / 255;
                float glowColorB = one * Game.ColorB(glowColor) / 255;

                // Combine the color and glow giving the pixel value.
                float colorR = skyColorR + glowColorR * glowColorA;
                float colorG = skyColorG + glowColorG * glowColorA;
                float colorB = skyColorB + glowColorB * glowColorA;
                float colorA = skyColorA;

                if (colorR > 1)
                {
                    colorR = 1;
                }
                if (colorG > 1)
                {
                    colorG = 1;
                }
                if (colorB > 1)
                {
                    colorB = 1;
                }
                if (colorA > 1)
                {
                    colorA = 1;
                }

                data.rgba[i * 4 + 0] = Game.IntToByte(platform.FloatToInt(colorR * 255));
                data.rgba[i * 4 + 1] = Game.IntToByte(platform.FloatToInt(colorG * 255));
                data.rgba[i * 4 + 2] = Game.IntToByte(platform.FloatToInt(colorB * 255));
                data.rgba[i * 4 + 3] = Game.IntToByte(platform.FloatToInt(colorA * 255));
                i++;
            }
        }
        //data.setMode(DrawModeEnum.Triangles);
        return(data);
    }
Exemplo n.º 43
0
 public ArticlePlatform(GamePlatform platform)
 {
     GamePlatform = platform;
 }
Exemplo n.º 44
0
        /// <summary>
        /// Decompresses a compressed package. Works with ME1/ME2/ME3/UDK
        /// </summary>
        /// <param name="raw"></param>
        /// <param name="compressionInfoOffset"></param>
        /// <param name="compressionType"></param>
        /// <param name="NumChunks"></param>
        /// <param name="game"></param>
        /// <param name="platform"></param>
        /// <returns></returns>
        public static MemoryStream DecompressPackage(EndianReader raw, long compressionInfoOffset, UnrealPackageFile.CompressionType compressionType = UnrealPackageFile.CompressionType.None, int NumChunks = 0, MEGame game = MEGame.Unknown, GamePlatform platform = GamePlatform.PC)
        {
            raw.BaseStream.JumpTo(compressionInfoOffset);
            if (compressionType == UnrealPackageFile.CompressionType.None)
            {
                compressionType = (UnrealPackageFile.CompressionType)raw.ReadUInt32();
            }

            if (NumChunks == 0)
            {
                NumChunks = raw.ReadInt32();
            }
            var Chunks          = new List <Chunk>();
            var chunkTableStart = raw.Position;

            //DebugOutput.PrintLn("Reading chunk headers...");
            for (int i = 0; i < NumChunks; i++)
            {
                Chunk c = new Chunk
                {
                    uncompressedOffset = raw.ReadInt32(),
                    uncompressedSize   = raw.ReadInt32(),
                    compressedOffset   = raw.ReadInt32(),
                    compressedSize     = raw.ReadInt32()
                };
                c.Compressed   = new byte[c.compressedSize];
                c.Uncompressed = new byte[c.uncompressedSize];
                Chunks.Add(c);
            }


            //DebugOutput.PrintLn("\tRead Chunks...");
            int count = 0;

            for (int i = 0; i < Chunks.Count; i++)
            {
                Chunk c = Chunks[i];
                //Debug.WriteLine($"Compressed offset at {c.compressedOffset:X8}");
                raw.Seek(c.compressedOffset, SeekOrigin.Begin);
                raw.Read(c.Compressed, 0, c.compressedSize);

                ChunkHeader h = new ChunkHeader
                {
                    magic = EndianReader.ToInt32(c.Compressed, 0, raw.Endian),
                    // must force block size for ME1 xbox cause in place of block size it seems to list package tag again which breaks loads of things
                    blocksize        = (platform == GamePlatform.Xenon && game == MEGame.ME1) ? 0x20000 : EndianReader.ToInt32(c.Compressed, 4, raw.Endian),
                    compressedsize   = EndianReader.ToInt32(c.Compressed, 8, raw.Endian),
                    uncompressedsize = EndianReader.ToInt32(c.Compressed, 12, raw.Endian)
                };

                if (h.magic != -1641380927)
                {
                    throw new FormatException("Chunk magic number incorrect");
                }
                //DebugOutput.PrintLn("Chunkheader read: Magic = " + h.magic + ", Blocksize = " + h.blocksize + ", Compressed Size = " + h.compressedsize + ", Uncompressed size = " + h.uncompressedsize);
                int pos        = 16;
                int blockCount = h.uncompressedsize / h.blocksize;
                if (h.uncompressedsize % h.blocksize != 0)
                {
                    blockCount++;
                }
                var BlockList = new List <Block>();
                //DebugOutput.PrintLn("\t\t" + count + " Read Blockheaders...");
                for (int j = 0; j < blockCount; j++)
                {
                    Block b = new Block
                    {
                        compressedsize   = EndianReader.ToInt32(c.Compressed, pos, raw.Endian),
                        uncompressedsize = EndianReader.ToInt32(c.Compressed, pos + 4, raw.Endian)
                    };
                    //DebugOutput.PrintLn("Block " + j + ", compressed size = " + b.compressedsize + ", uncompressed size = " + b.uncompressedsize);
                    pos += 8;
                    BlockList.Add(b);
                }
                int outpos   = 0;
                int blocknum = 0;
                //DebugOutput.PrintLn("\t\t" + count + " Read and decompress Blocks...");
                foreach (Block b in BlockList)
                {
                    //Debug.WriteLine("Decompressing block " + blocknum);
                    var datain  = new byte[b.compressedsize];
                    var dataout = new byte[b.uncompressedsize];
                    Buffer.BlockCopy(c.Compressed, pos, datain, 0, b.compressedsize);
                    //for (int j = 0; j < b.compressedsize; j++)
                    //    datain[j] = c.Compressed[pos + j];
                    pos += b.compressedsize;

                    switch (compressionType)
                    {
                    case UnrealPackageFile.CompressionType.LZO:
                    {
                        if (LZO2.Decompress(datain, (uint)datain.Length, dataout) != b.uncompressedsize)
                        {
                            throw new Exception("LZO decompression failed!");
                        }
                        break;
                    }

                    case UnrealPackageFile.CompressionType.Zlib:
                    {
                        if (Zlib.Decompress(datain, (uint)datain.Length, dataout) != b.uncompressedsize)
                        {
                            throw new Exception("Zlib decompression failed!");
                        }
                        break;
                    }

                    case UnrealPackageFile.CompressionType.LZMA:
                        dataout = LZMA.Decompress(datain, (uint)b.uncompressedsize);
                        if (dataout.Length != b.uncompressedsize)
                        {
                            throw new Exception("LZMA decompression failed!");
                        }
                        break;

                    case UnrealPackageFile.CompressionType.LZX:
                        if (LZX.Decompress(datain, (uint)datain.Length, dataout) != 0)
                        {
                            throw new Exception("LZX decompression failed!");
                        }
                        break;

                    default:
                        throw new Exception("Unknown compression type for this package.");
                    }
                    for (int j = 0; j < b.uncompressedsize; j++)
                    {
                        c.Uncompressed[outpos + j] = dataout[j];
                    }
                    outpos += b.uncompressedsize;
                    blocknum++;
                }
                c.header = h;
                c.blocks = BlockList;
                count++;
                Chunks[i] = c;
            }

            MemoryStream result = new MemoryStream();

            foreach (Chunk c in Chunks)
            {
                result.Seek(c.uncompressedOffset, SeekOrigin.Begin);
                result.WriteFromBuffer(c.Uncompressed);
            }

            // Reattach the original header
            result.Position = 0;
            raw.Position    = 0;
            raw.BaseStream.CopyToEx(result, Chunks.MinBy(x => x.uncompressedOffset).uncompressedOffset); // Copy the header in
            // Does header need adjusted here to be accurate?
            // Do we change it to show decompressed, as the actual state, or the state of what it was on disk?

            return(result);
        }
Exemplo n.º 45
0
 public GameID(String name, GamePlatform platform, String country, bool deprecated)
     : this(name,platform,country)
 {
     this.deprecated = deprecated;
 }
Exemplo n.º 46
0
 public Platform(GamePlatform platform, GameVersion version)
 {
     this.platform = platform;
     this.version  = version;
 }
Exemplo n.º 47
0
    public void Start(GamePlatform p_)
    {
        this.p = p_;

        //Initialize translations
        lang = new Language();
        lang.platform = p;
        lang.LoadTranslations();
        p.SetTitle(lang.GameName());

        textColorRenderer = new TextColorRenderer();
        textColorRenderer.platform = p_;
        p_.LoadAssetsAsyc(assets, assetsLoadProgress);

        overlap = 200;
        minspeed = 20;
        rnd = p.RandomCreate();

        xRot = 0;
        xInv = false;
        xSpeed = minspeed + rnd.MaxNext(5);

        yRot = 0;
        yInv = false;
        ySpeed = minspeed + rnd.MaxNext(5);

        z = -5;

        filter = 0;

        mvMatrix = Mat4.Create();
        pMatrix = Mat4.Create();

        currentlyPressedKeys = new bool[256];
        p.AddOnNewFrame(MainMenuNewFrameHandler.Create(this));
        p.AddOnKeyEvent(MainMenuKeyEventHandler.Create(this));
        p.AddOnMouseEvent(MainMenuMouseEventHandler.Create(this));
        p.AddOnTouchEvent(MainMenuTouchEventHandler.Create(this));
    }
Exemplo n.º 48
0
    void Connect(GamePlatform platform)
    {
        if (singleplayer)
        {
            if (platform.SinglePlayerServerAvailable())
            {
                platform.SinglePlayerServerStart(singleplayerSavePath);
            }
            else
            {
                serverSimple = new ServerSimple();
                DummyNetwork network = platform.SinglePlayerServerGetNetwork();
                network.Start(platform.MonitorCreate(), platform.MonitorCreate());
                DummyNetServer server = new DummyNetServer();
                server.network  = network;
                server.platform = platform;
                server.Start();
                serverSimple.Start(server, singleplayerSavePath, platform);

                serverSimpleMod        = new ModServerSimple();
                serverSimpleMod.server = serverSimple;
                game.AddMod(serverSimpleMod);
                platform.SinglePlayerServerGetNetwork().ServerReceiveBuffer.Enqueue(new ByteArray());
            }

            connectData          = new ConnectData();
            connectData.Username = "******";
            game.connectdata     = connectData;

            DummyNetClient netclient = new DummyNetClient();
            netclient.SetPlatform(platform);
            netclient.SetNetwork(platform.SinglePlayerServerGetNetwork());
            game.main = netclient;
        }
        else
        {
            game.connectdata = connectData;
            if (platform.EnetAvailable())
            {
                EnetNetClient client = new EnetNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.TcpAvailable())
            {
                TcpNetClient client = new TcpNetClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else if (platform.WebSocketAvailable())
            {
                WebSocketClient client = new WebSocketClient();
                client.SetPlatform(platform);
                game.main = client;
            }
            else
            {
                platform.ThrowException("Network not implemented");
            }
        }
    }
 public static void GenerateSNG(Arrangement arrangement, GamePlatform platform)
 {
     string sngFile = Path.Combine(Path.GetDirectoryName(arrangement.SongXml.File), arrangement.SongXml.Name + ".sng");
     InstrumentTuning tuning = InstrumentTuning.Standard;
     Enum.TryParse<InstrumentTuning>(arrangement.Tuning, true, out tuning);
     SngFileWriter.Write(arrangement.SongXml.File, sngFile, arrangement.ArrangementType, platform, tuning);
     if (arrangement.SongFile == null)
         arrangement.SongFile = new SongFile();
     arrangement.SongFile.File = sngFile;
     SNGTmpFiles.Add(sngFile);
 }
Exemplo n.º 50
0
        private IEnumerable <Models.Vacancy> GetFakeVacancies()
        {
            var gamePlatform = new GamePlatform
            {
                GameId = 2,
                Game   = new Models.Game
                {
                    GameId      = 2,
                    Name        = "Overwatch",
                    IconSource  = "https://i.imgur.com/0RIw2RB.png",
                    ImageSource = "http://www.base2.com.br/wp-content/uploads/2017/04/overwatch1280jpg-6daa73_1280w.jpg"
                },
                Platform = new Models.Platform {
                    Name = "PC"
                }
            };
            var gamePlatform1 = new GamePlatform
            {
                GameId = 1,
                Game   = new Models.Game
                {
                    GameId      = 1,
                    Name        = "Rainbow Six Siege",
                    IconSource  = "https://i.redd.it/iznunq2m8vgy.png",
                    ImageSource = "https://www.torcedores.com/content/uploads/2018/02/erwmqs3hzvkfqudfutqdyh_tb7c.jpg"
                },
                Platform = new Models.Platform {
                    Name = "PC"
                }
            };

            yield return(new Models.Vacancy
            {
                Title = "Vaga suporte",
                Team = new Models.Team
                {
                    TeamId = 10,
                    Name = "To do",
                    GamePlatform = gamePlatform,
                    IconSource = "https://image.moboplay.com/images/apk/725/com.musSharApp.myToDoList_icon.png"
                },
                MinAge = 16,
                MaxAge = 23,
                Description = "Descrição completa da vaga que está sendo oferecida pela equipe e alguns de seus requisitos explicados pelo membro que oferta tal vaga, além de questões comportamentais que estão a procura nos cadidatos e etc.",
                VacancyId = 1,
                Roles = new List <Models.Role>
                {
                    new Models.Role
                    {
                        Name = "Agressivo",
                        RoleType = new Models.RoleType
                        {
                            RoleTypeId = 1,
                            Name = "Papel primário",
                            IconSource = "ic_primaryRole.png"
                        }
                    },
                    new Models.Role
                    {
                        Name = "DPS",
                        RoleType = new Models.RoleType
                        {
                            RoleTypeId = 2,
                            Name = "Papel secundário",
                            IconSource = "ic_secondaryRole.png"
                        }
                    }, new Models.Role
                    {
                        Name = "Tank",
                        RoleType = new Models.RoleType
                        {
                            RoleTypeId = 2,
                            Name = "Papel secundário",
                            IconSource = "ic_secondaryRole.png"
                        }
                    }
                },
                Skills = new List <Models.Skill> {
                    new Models.Skill {
                        Name = "tiro"
                    }, new Models.Skill {
                        Name = "healing"
                    }, new Models.Skill {
                        Name = "suporte"
                    }, new Models.Skill {
                        Name = "sniper"
                    }, new Models.Skill {
                        Name = "estratégia"
                    }
                }
            });

            yield return(new Models.Vacancy
            {
                Title = "Vaga tanque",
                Team = new Models.Team {
                    Name = "Tc Esports", GamePlatform = gamePlatform, IconSource = "http://esportsobserver.com/wp-content/uploads/2015/09/Tt-eSPORTS-logo.png"
                },
                VacancyId = 2,
                Description = "vaga...."
            });

            yield return(new Models.Vacancy
            {
                Title = "Vaga dps",
                Team = new Models.Team {
                    Name = "Tc Esports", GamePlatform = gamePlatform, IconSource = "http://esportsobserver.com/wp-content/uploads/2015/09/Tt-eSPORTS-logo.png"
                },
                VacancyId = 3,
                Description = "vaga...."
            });

            yield return(new Models.Vacancy
            {
                Title = "Vaga suporte",
                Team = new Models.Team {
                    Name = "Commander eSports2", GamePlatform = gamePlatform, IconSource = "https://static-cdn.jtvnw.net/jtv_user_pictures/flawedbot-profile_image-815076ff68773420-300x300.jpeg"
                },
                VacancyId = 4,
                Description = "vaga...."
            });

            yield return(new Models.Vacancy
            {
                Title = "Vaga suporte",
                Team = new Models.Team {
                    Name = "Commander eSports2", GamePlatform = gamePlatform, IconSource = "https://static-cdn.jtvnw.net/jtv_user_pictures/flawedbot-profile_image-815076ff68773420-300x300.jpeg"
                },
                VacancyId = 5,
                Description = "vaga...."
            });

            yield return(new Models.Vacancy
            {
                Title = "Vaga suporte",
                Team = new Models.Team {
                    Name = "Commander eSports2", GamePlatform = gamePlatform1, IconSource = "https://static-cdn.jtvnw.net/jtv_user_pictures/flawedbot-profile_image-815076ff68773420-300x300.jpeg"
                },
                VacancyId = 6,
                Description = "vaga...."
            });

            yield return(new Models.Vacancy
            {
                Title = "Vaga suporte",
                Team = new Models.Team {
                    Name = "Commander eSports2", GamePlatform = gamePlatform1, IconSource = "https://static-cdn.jtvnw.net/jtv_user_pictures/flawedbot-profile_image-815076ff68773420-300x300.jpeg"
                },
                VacancyId = 7,
                Description = "vaga...."
            });
        }
        private static void GenerateSongPsarc(Stream output, DLCPackageData info, GamePlatform platform)
        {
            var soundBankName = String.Format("Song_{0}", info.Name);
            Stream albumArtStream = null;
            try
            {
                if (File.Exists(info.AlbumArtPath))
                {
                    albumArtStream = File.OpenRead(info.AlbumArtPath);
                }
                else
                {
                    albumArtStream = new MemoryStream(Resources.albumart);
                }
                using (var aggregateGraphStream = new MemoryStream())
                using (var manifestStream = new MemoryStream())
                using (var xblockStream = new MemoryStream())
                using (var soundbankStream = new MemoryStream())
                using (var packageIdStream = new MemoryStream())
                using (var soundStream = OggFile.ConvertOgg(platform.GetOgg(info)))
                using (var arrangementFiles = new DisposableCollection<Stream>())
                {
                    var manifestBuilder = new ManifestBuilder
                    {
                        AggregateGraph = new AggregateGraph.AggregateGraph
                        {
                            SoundBank = new SoundBank { File = soundBankName + ".bnk" },
                            AlbumArt = new AlbumArt { File = info.AlbumArtPath }
                        }
                    };

                    foreach (var x in info.Arrangements)
                    {
                        //Generate sng file in execution time
                        GenerateSNG(x, platform);

                        manifestBuilder.AggregateGraph.SongFiles.Add(x.SongFile);
                        manifestBuilder.AggregateGraph.SongXMLs.Add(x.SongXml);
                    }
                    manifestBuilder.AggregateGraph.XBlock = new XBlockFile { File = info.Name + ".xblock" };
                    manifestBuilder.AggregateGraph.Write(info.Name, platform.GetPathName(), platform, aggregateGraphStream);
                    aggregateGraphStream.Flush();
                    aggregateGraphStream.Seek(0, SeekOrigin.Begin);

                    {
                        var manifestData = manifestBuilder.GenerateManifest(info.Name, info.Arrangements, info.SongInfo, platform);
                        var writer = new StreamWriter(manifestStream);
                        writer.Write(manifestData);
                        writer.Flush();
                        manifestStream.Seek(0, SeekOrigin.Begin);
                    }

                    XBlockGenerator.Generate(info.Name, manifestBuilder.Manifest, manifestBuilder.AggregateGraph, xblockStream);
                    xblockStream.Flush();
                    xblockStream.Seek(0, SeekOrigin.Begin);

                    var soundFileName = SoundBankGenerator.GenerateSoundBank(info.Name, soundStream, soundbankStream, info.Volume, platform);
                    soundbankStream.Flush();
                    soundbankStream.Seek(0, SeekOrigin.Begin);

                    GenerateSongPackageId(packageIdStream, info.Name);

                    var songPsarc = new PSARC.PSARC();
                    songPsarc.AddEntry("PACKAGE_ID", packageIdStream);
                    songPsarc.AddEntry("AggregateGraph.nt", aggregateGraphStream);
                    songPsarc.AddEntry("Manifests/songs.manifest.json", manifestStream);
                    songPsarc.AddEntry(String.Format("Exports/Songs/{0}.xblock", info.Name), xblockStream);
                    songPsarc.AddEntry(String.Format("Audio/{0}/{1}.bnk", platform.GetPathName()[0], soundBankName), soundbankStream);
                    songPsarc.AddEntry(String.Format("Audio/{0}/{1}.ogg", platform.GetPathName()[0], soundFileName), soundStream);
                    songPsarc.AddEntry(String.Format("GRAssets/AlbumArt/{0}.dds", manifestBuilder.AggregateGraph.AlbumArt.Name), albumArtStream);

                    foreach (var x in info.Arrangements)
                    {
                        var xmlFile = File.OpenRead(x.SongXml.File);
                        arrangementFiles.Add(xmlFile);
                        var sngFile = File.OpenRead(x.SongFile.File);
                        arrangementFiles.Add(sngFile);
                        songPsarc.AddEntry(String.Format("GR/Behaviors/Songs/{0}.xml", Path.GetFileNameWithoutExtension(x.SongXml.File)), xmlFile);
                        songPsarc.AddEntry(String.Format("GRExports/{0}/{1}.sng", platform.GetPathName()[1], Path.GetFileNameWithoutExtension(x.SongFile.File)), sngFile);
                    }
                    songPsarc.Write(output);
                    output.Flush();
                    output.Seek(0, SeekOrigin.Begin);
                }
            }
            finally
            {
                if (albumArtStream != null)
                {
                    albumArtStream.Dispose();
                }
            }
        }
Exemplo n.º 52
0
        public static void Initialize(FireteamDbContext context)
        {
            context.Database.EnsureCreated();

            if (context.Users.Any())
            {
                return; // Context has already been seeded
            }

            var users = new User[]
            {
                new User()
                {
                    ID                = 1,
                    UserName          = "******",
                    FirstName         = "Leroy",
                    LastName          = "Jenkins",
                    CanShowInSearches = true,
                    Email             = "*****@*****.**",
                    Password          = "******",
                    Salt              = "lkajsdlkajsdlkjasd",
                    TimeZone          = "Central Time",
                    Birthday          = DateTime.Parse("6/15/1983"),
                    Created           = DateTime.Now,
                    IsDeleted         = false
                },
                new User()
                {
                    ID                = 2,
                    UserName          = "******",
                    FirstName         = "Darth",
                    LastName          = "Maul",
                    CanShowInSearches = true,
                    Email             = "*****@*****.**",
                    Password          = "******",
                    Salt              = "lkajsdlkajsdlkjasd",
                    TimeZone          = "Pacific Time",
                    Birthday          = DateTime.Parse("9/02/1972"),
                    Created           = DateTime.Now,
                    IsDeleted         = false
                },
                new User()
                {
                    ID                = 3,
                    UserName          = "******",
                    FirstName         = "Kate",
                    LastName          = "Beckinsale",
                    CanShowInSearches = false,
                    Email             = "*****@*****.**",
                    Password          = "******",
                    Salt              = "lkajsdlkajsdlkjasd",
                    TimeZone          = "Eastern Time",
                    Birthday          = DateTime.Parse("8/06/1973"),
                    Created           = DateTime.Now,
                    IsDeleted         = false
                }
            };

            foreach (var user in users)
            {
                context.Users.Add(user);
            }

            var userFriends = new UserFriend[]
            {
                new UserFriend()
                {
                    ID = 1, UserID = 1, FriendID = 2, CanAddToActivities = true, Created = DateTime.Now, IsDeleted = false
                },
                new UserFriend()
                {
                    ID = 2, UserID = 1, FriendID = 3, CanAddToActivities = false, Created = DateTime.Now, IsDeleted = false
                },
                new UserFriend()
                {
                    ID = 3, UserID = 3, FriendID = 1, CanAddToActivities = true, Created = DateTime.Now, IsDeleted = false
                },
                new UserFriend()
                {
                    ID = 4, UserID = 2, FriendID = 1, CanAddToActivities = true, Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var userFriend in userFriends)
            {
                context.UserFriends.Add(userFriend);
            }
            context.SaveChanges();


            context.SaveChanges();

            var consoleModels = new ConsoleModel[]
            {
                new ConsoleModel()
                {
                    ID           = 1,
                    Name         = "Playstation 4",
                    Manufacturer = "Sony",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 2,
                    Name         = "Playstation 3",
                    Manufacturer = "Sony",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 3,
                    Name         = "PS Vita",
                    Manufacturer = "Sony",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 4,
                    Name         = "XBox 360",
                    Manufacturer = "Microsoft",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 5,
                    Name         = "XBox One",
                    Manufacturer = "Microsoft",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 6,
                    Name         = "Wii",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 7,
                    Name         = "Wii U",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 8,
                    Name         = "Switch",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new ConsoleModel()
                {
                    ID           = 9,
                    Name         = "DS/DSXL/3DS/2DS",
                    Manufacturer = "Nintendo",
                    Created      = DateTime.Now,
                    IsDeleted    = false
                }
            };

            foreach (var consoleModel in consoleModels)
            {
                context.ConsoleModels.Add(consoleModel);
            }
            context.SaveChanges();

            var groupTypes = new GroupType[]
            {
                new GroupType()
                {
                    ID          = 1,
                    Name        = "Clan",
                    Description = "A group of team mates with a loose but solid leadership structure",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new GroupType()
                {
                    ID          = 2,
                    Name        = "Guild",
                    Description =
                        "A group of team mates with a common set of skills that often teach or train newcomers",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new GroupType()
                {
                    ID          = 3,
                    Name        = "Friends",
                    Description = "A group of friends that enjoy playing games together",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                }
            };

            foreach (var groupType in groupTypes)
            {
                context.GroupTypes.Add(groupType);
            }
            context.SaveChanges();

            var groups = new Group[]
            {
                new Group()
                {
                    ID           = 1,
                    Name         = "Master Blasters",
                    Description  = "Two men enter, one man leaves...",
                    GroupTypeID  = 1,
                    IsHidden     = false,
                    IsInviteOnly = true,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new Group()
                {
                    ID          = 2,
                    Name        = "All_the_victories",
                    Description =
                        "A dedicated guild of PvP players who seek to hone their craft and help others learn it as well",
                    GroupTypeID  = 2,
                    IsHidden     = false,
                    IsInviteOnly = false,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new Group()
                {
                    ID          = 3,
                    Name        = "Colpeck Game Night Friends",
                    Description =
                        "A group of friends that meet at the Colpecks to play silly games and get a little drunk",
                    GroupTypeID  = 3,
                    IsHidden     = false,
                    IsInviteOnly = true,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                },
                new Group()
                {
                    ID          = 4,
                    Name        = "Death Dealers",
                    Description =
                        "We wage a war that has raged on for over a thousand years.  Only Vampires need apply.",
                    GroupTypeID  = 1,
                    IsHidden     = false,
                    IsInviteOnly = true,
                    Created      = DateTime.Now,
                    IsDeleted    = false
                }
            };

            foreach (var group in groups)
            {
                context.Groups.Add(group);
            }
            context.SaveChanges();

            var userGroups = new UserGroup[]
            {
                new UserGroup()
                {
                    ID        = 1,
                    GroupID   = 1,
                    UserID    = 2,
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new UserGroup()
                {
                    ID        = 2,
                    GroupID   = 2,
                    UserID    = 1,
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new UserGroup()
                {
                    ID        = 3,
                    GroupID   = 2,
                    UserID    = 1,
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new UserGroup()
                {
                    ID        = 4,
                    GroupID   = 3,
                    UserID    = 3,
                    Created   = DateTime.Now,
                    IsDeleted = false
                }
            };

            foreach (var userGroup in userGroups)
            {
                context.UserGroups.Add(userGroup);
            }
            context.SaveChanges();

            var groupUsers = new GroupUser[]
            {
                new GroupUser()
                {
                    ID = 1, GroupID = 4, UserID = 3, IsDeleted = false, IsGroupLeadership = true, Created = DateTime.Now
                },
                new GroupUser()
                {
                    ID = 2, GroupID = 1, UserID = 2, IsDeleted = false, IsGroupLeadership = true, Created = DateTime.Now
                },
                new GroupUser()
                {
                    ID = 3, GroupID = 2, UserID = 1, IsDeleted = false, IsGroupLeadership = true, Created = DateTime.Now
                },
                new GroupUser()
                {
                    ID = 4, GroupID = 2, UserID = 2, IsDeleted = false, IsGroupLeadership = false, Created = DateTime.Now
                }
            };

            foreach (var groupUser in groupUsers)
            {
                context.GroupUsers.Add(groupUser);
            }
            context.SaveChanges();

            var activityTypes = new ActivityType[]
            {
                new ActivityType()
                {
                    ID          = 1,
                    Name        = "Mission",
                    Description = "An in-game mission requring multi-player participation",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new ActivityType()
                {
                    ID          = 2,
                    Name        = "Quest",
                    Description = "A multi-part quest line that encompasses several missions",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new ActivityType()
                {
                    ID          = 3,
                    Name        = "Raid / Multi-player instance",
                    Description =
                        "An activity that requires specific fireteam composition and planning, usually granting end-game awards",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new ActivityType()
                {
                    ID          = 4,
                    Name        = "Player vs Player (PVP)",
                    Description =
                        "PvP activities like \"Death Matches\" as well as objective based activities like \"Capture the Flag\"",
                    Created   = DateTime.Now,
                    IsDeleted = false
                }
            };

            foreach (var activityType in activityTypes)
            {
                context.ActivityTypes.Add(activityType);
            }

            context.SaveChanges();

            var gameTypes = new GameType[]
            {
                new GameType()
                {
                    ID          = 1,
                    Name        = "Multiplayer FPS",
                    Description = "A multiplayer online first-person shooter",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                },
                new GameType()
                {
                    ID          = 2,
                    Name        = "PvP Arena",
                    Description = "A game that pits teams of players against each other who then battle for supremacy",
                    Created     = DateTime.Now,
                    IsDeleted   = false
                }
            };

            foreach (var gameType in gameTypes)
            {
                context.GameTypes.Add(gameType);
            }
            context.SaveChanges();

            var games = new Game[]
            {
                new Game()
                {
                    ID          = 1,
                    Title       = "Destiny",
                    Description =
                        "Guardians, the last hope of the light, battle darkness in and around the last city on Earth.",
                    GameTypeID = 1,
                    Publisher  = "Activision",
                    Created    = DateTime.Now,
                    IsDeleted  = false
                },
                new Game()
                {
                    ID          = 2,
                    Title       = "Overwatch",
                    Description =
                        "In a time of global crisis, an international task force of heroes banded together to restore peace to a war-torn world: OVERWATCH.",
                    GameTypeID = 1,
                    Publisher  = "Blizzard",
                    Created    = DateTime.Now,
                    IsDeleted  = false
                },
                new Game()
                {
                    ID          = 3,
                    Title       = "Mass Effect: Andromeda",
                    Description =
                        "Chart your own course in a dangerous new galaxy. Unravel the mysteries of the Andromeda galaxy as you discover rich, alien worlds in the search for humanity's new home",
                    GameTypeID = 1,
                    Publisher  = "Electronic Arts",
                    Created    = DateTime.Now,
                    IsDeleted  = false
                }
            };

            foreach (var game in games)
            {
                context.Games.Add(game);
            }
            context.SaveChanges();

            var platforms = new Platform[]
            {
                new Platform()
                {
                    ID        = 1,
                    Name      = "Playstation",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new Platform()
                {
                    ID        = 2,
                    Name      = "XBox",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new Platform()
                {
                    ID        = 3,
                    Name      = "Nintendo",
                    Created   = DateTime.Now,
                    IsDeleted = false
                },
                new Platform()
                {
                    ID        = 4,
                    Name      = "PC",
                    Created   = DateTime.Now,
                    IsDeleted = false
                }
            };

            foreach (var platform in platforms)
            {
                context.Platforms.Add(platform);
            }
            context.SaveChanges();

            var gamePlatforms = new GamePlatform[]
            {
                new GamePlatform()
                {
                    ID = 1, GameID = 1, PlatformID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new GamePlatform()
                {
                    ID = 2, GameID = 1, PlatformID = 2, Created = DateTime.Now, IsDeleted = false
                },
                new GamePlatform()
                {
                    ID = 3, GameID = 1, PlatformID = 4, Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var gamePlatform in gamePlatforms)
            {
                context.GamePlatforms.Add(gamePlatform);
            }
            context.SaveChanges();

            var platformAccounts = new PlatformAccount[]
            {
                new PlatformAccount()
                {
                    ID = 1, ConsoleModelID = 1, UserID = 3, PlatformID = 1, GamerTag = "selene", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 2, ConsoleModelID = 2, UserID = 3, PlatformID = 1, GamerTag = "selene", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 3, ConsoleModelID = 3, UserID = 3, PlatformID = 1, GamerTag = "selene", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 4, ConsoleModelID = 4, UserID = 2, PlatformID = 2, GamerTag = "XxDarthDudexX", Created = DateTime.Now, IsDeleted = false
                },
                new PlatformAccount()
                {
                    ID = 5, UserID = 1, PlatformID = 4, GamerTag = "lroy_JEENKINS", Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var platformAccount in platformAccounts)
            {
                context.PlatformAccounts.Add(platformAccount);
            }
            context.SaveChanges();

            var activities = new Activity[]
            {
                new Activity()
                {
                    ID             = 1,
                    ActivityTypeID = 1,
                    AvailableSlots = 2,
                    Description    = "Black Spindle mission.  Come have a chill run and get things done!  Looking for a good team to get through this.",
                    Duration       = "00:02:00",
                    GameID         = 1,
                    UserID         = 2,
                    Requirements   = "Must have Y4 Ice Breaker... just cuz.",
                    TimeZone       = "Central Time",
                    StartTime      = DateTime.Parse("5/02/2017 01:30:00 PM"),
                    IsHidden       = false,
                    IsInviteOnly   = false,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                },
                new Activity()
                {
                    ID             = 2,
                    ActivityTypeID = 2,
                    AvailableSlots = 2,
                    Description    = "Trying to get this stupid exotic quest done.  Need two to run some strikes with.",
                    Duration       = "00:01:30",
                    GameID         = 1,
                    UserID         = 2,
                    Requirements   = "Need a Hunter and a Warlock.  I'll bring my Titan",
                    TimeZone       = "Pacific Time",
                    StartTime      = DateTime.Parse("5/14/2017 04:00:00 PM"),
                    IsHidden       = false,
                    IsInviteOnly   = false,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                },
                new Activity()
                {
                    ID             = 3,
                    ActivityTypeID = 1,
                    AvailableSlots = 5,
                    Description    = "Private raid with 'Selene' to expterminate these Lycans.. I mean Fallen... once and for all.",
                    Duration       = "00:04:00",
                    GameID         = 1,
                    UserID         = 3,
                    GroupID        = 4,
                    Requirements   = "Request to join.  Your credentials will be checked at the door... by force, if necessary",
                    TimeZone       = "Eastern Time",
                    StartTime      = DateTime.Parse("5/28/2017 07:00:00 AM"),
                    IsHidden       = false,
                    IsInviteOnly   = true,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                }
            };

            foreach (var activity in activities)
            {
                context.Activities.Add(activity);
            }
            context.SaveChanges();


            var userGames = new UserGame[]
            {
                new UserGame()
                {
                    ID = 1, UserID = 2, GameID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new UserGame()
                {
                    ID = 2, UserID = 3, GameID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new UserGame()
                {
                    ID = 3, UserID = 1, GameID = 1, Created = DateTime.Now, IsDeleted = false
                },
            };

            foreach (var userGame in userGames)
            {
                context.UserGames.Add(userGame);
            }
            context.SaveChanges();


            var activityUsers = new ActivityUser[]
            {
                new ActivityUser()
                {
                    ID            = 1,
                    ActivityID    = 1,
                    Created       = DateTime.Now,
                    HasBeenBooted = false,
                    IsDeleted     = false,
                    IsTentative   = false,
                    ReasonForBoot = (int)BootReasons.None,
                    UserID        = 1
                },
                new ActivityUser()
                {
                    ID            = 2,
                    ActivityID    = 1,
                    Created       = DateTime.Now,
                    HasBeenBooted = true,
                    IsDeleted     = false,
                    IsTentative   = false,
                    ReasonForBoot = (int)BootReasons.Unfriendly,
                    UserID        = 2
                },
                new ActivityUser()
                {
                    ID            = 3,
                    ActivityID    = 1,
                    Created       = DateTime.Now,
                    HasBeenBooted = false,
                    IsDeleted     = false,
                    IsTentative   = false,
                    ReasonForBoot = (int)BootReasons.None,
                    UserID        = 3
                }
            };

            foreach (var activityUser in activityUsers)
            {
                context.ActivityUsers.Add(activityUser);
            }
            context.SaveChanges();

            var blockedUsers = new BlockedUser[]
            {
                new BlockedUser()
                {
                    ID         = 1,
                    ActivityID = 1,
                    UserID     = 2,
                    Created    = DateTime.Now,
                    IsDeleted  = false
                },
                new BlockedUser()
                {
                    ID             = 2,
                    BlockingUserID = 3,
                    UserID         = 2,
                    Created        = DateTime.Now,
                    IsDeleted      = false
                },
                new BlockedUser()
                {
                    ID = 3,
                    BlockingGroupID = 1,
                    UserID          = 2,
                    Created         = DateTime.Now,
                    IsDeleted       = false
                }
            };

            foreach (var blockedUser in blockedUsers)
            {
                context.BlockedUsers.Add(blockedUser);
            }
            context.SaveChanges();

            var gameConsoleModels = new GameConsoleModel[]
            {
                new GameConsoleModel()
                {
                    ID = 1, GameID = 1, ConsoleModelID = 1, Created = DateTime.Now, IsDeleted = false
                },
                new GameConsoleModel()
                {
                    ID = 2, GameID = 1, ConsoleModelID = 2, Created = DateTime.Now, IsDeleted = false
                },
                new GameConsoleModel()
                {
                    ID = 3, GameID = 1, ConsoleModelID = 4, Created = DateTime.Now, IsDeleted = false
                }
            };

            foreach (var gameConsoleModel in gameConsoleModels)
            {
                context.GameConsoleModels.Add(gameConsoleModel);
            }
            context.SaveChanges();
        }
        public static void Generate(string packagePath, DLCPackageData info, GamePlatform platform, PackageMagic? xboxPackageType)
        {
            switch (platform)
            {
                case GamePlatform.XBox360:
                    if (!Directory.Exists(xboxWorkDir))
                        Directory.CreateDirectory(xboxWorkDir);
                    break;
                case GamePlatform.PS3:
                    if (!Directory.Exists(ps3WorkDir))
                        Directory.CreateDirectory(ps3WorkDir);
                    break;
                }

            using (var packPsarcStream = new MemoryStream())
            {
                GeneratePackagePsarc(packPsarcStream, info, platform);
                switch (platform) {
                    case GamePlatform.Pc:
                        using (var fl = File.Create(packagePath))
                            RijndaelEncryptor.Encrypt(packPsarcStream, fl, RijndaelEncryptor.DLCKey);
                        break;
                    case GamePlatform.XBox360:
                        BuildXBox360Package(packagePath, info, XBox360Files, xboxPackageType);
                        break;
                    case GamePlatform.PS3:
                        EncryptPS3EdatFiles(packagePath);
                        break;
                }
            }

            try {
                foreach (var sngTmpFile in SNGTmpFiles)
                {
                    if (File.Exists(sngTmpFile))
                        File.Delete(sngTmpFile);
                }
            } catch { /*Have no problem if don't delete*/ }

            XBox360Files.Clear();
            PS3Files.Clear();
            SNGTmpFiles.Clear();
        }
Exemplo n.º 54
0
 public void SetPlatform(GamePlatform p_)
 {
     p = p_;
 }
        public static void Write(string inputFile, string outputFile, ArrangementType arrangementType, GamePlatform platform, InstrumentTuning tuning)
        {
            using (var reader = new StreamReader(inputFile))
            {
                var bitConverter = platform == GamePlatform.Pc
                    ? (EndianBitConverter)EndianBitConverter.Little
                    : (EndianBitConverter)EndianBitConverter.Big;

                if (arrangementType == ArrangementType.Vocal)
                {
                    var serializer = new XmlSerializer(typeof(Vocals));
                    var vocals = (Vocals)serializer.Deserialize(reader);
                    WriteRocksmithVocalsFile(vocals, outputFile, bitConverter);
                }
                else
                {
                    var serializer = new XmlSerializer(typeof(Song));
                    var song = (Song)serializer.Deserialize(reader);
                    WriteRocksmithSngFile(song, tuning, arrangementType, outputFile, bitConverter);
                }
            }
        }
Exemplo n.º 56
0
        public void GamePlatformDatabaseCommandsTest()
        {
            var connection = new SqlServerConnection();

            Assert.AreEqual(connection.IsConnected, false);

            var result = connection.Connect(ConnectionString, 0);

            Assert.AreEqual(result, true);


            // Add Games

            var game = new Game(
                0,
                "Name",
                "Description");

            var insertCommand = game.GenerateInsertStatement();

            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            var errorMessage = "";
            var insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out var newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            game.Id = newId;

            var updateGame = new Game(
                0,
                "Name1",
                "Description1");

            insertCommand = updateGame.GenerateInsertStatement();

            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            errorMessage = "";
            insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            updateGame.Id = newId;


            // Add Platforms

            var platform = new Platform(0, "Name", "Description");

            insertCommand = platform.GenerateInsertStatment();
            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            errorMessage = "";
            insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            platform.Id = newId;

            var updatePlatform = new Platform(0, "Name", "Description");

            insertCommand = updatePlatform.GenerateInsertStatment();
            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            errorMessage = "";
            insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            updatePlatform.Id = newId;


            // Select All

            var gamePlatform = new GamePlatform();

            var selectQuery = gamePlatform.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            var selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            var selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            if (selectResultList.Count > 0)
            {
                Assert.IsTrue(selectResultList.Count > 0);
            }


            // Insert

            gamePlatform = new GamePlatform(
                0,
                game.Id,
                platform.Id);

            insertCommand = gamePlatform.GenerateInsertStatement();

            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            errorMessage = "";

            insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            gamePlatform.Id = newId;


            // Exists

            var existsQuery = gamePlatform.GenerateExistsQuery();

            Assert.IsFalse(string.IsNullOrEmpty(existsQuery));

            errorMessage = "";
            var existsResult = connection.ExecuteQuery(existsQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(existsResult);

            var existsResultList = DataSetUtility.ToDictionaryList(existsResult.Tables[0]);

            var recordExists = existsResultList.Any(dictionary => (dictionary != null) && (dictionary.Count > 0));

            Assert.AreEqual(recordExists, true);


            // Select

            selectQuery = gamePlatform.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            GamePlatform foundGamePlatform = null;

            if (selectResultList.Count > 0)
            {
                foreach (var dictionary in selectResultList.Where(dictionary => (dictionary != null) && (dictionary.Count > 0)))
                {
                    foundGamePlatform = GamePlatform.FromDictionary(dictionary);
                    break;
                }
            }

            Assert.IsNotNull(foundGamePlatform);

            Assert.AreNotSame(gamePlatform, foundGamePlatform);

            Assert.AreEqual(gamePlatform.Id, foundGamePlatform.Id);
            Assert.AreEqual(gamePlatform.GameId, foundGamePlatform.GameId);
            Assert.AreEqual(gamePlatform.PlatformId, foundGamePlatform.PlatformId);


            // Update

            var updateGamePlatform = new GamePlatform(
                newId,
                updateGame.Id,
                updatePlatform.Id);

            var updateCommand = updateGamePlatform.GenerateUpdateStatement();

            Assert.IsFalse(string.IsNullOrEmpty(updateCommand));

            errorMessage = "";
            var updateResult = connection.ExecuteCommand(updateCommand, ref errorMessage);

            Assert.AreEqual(updateResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);


            // Exists

            existsQuery = updateGamePlatform.GenerateExistsQuery();

            Assert.IsFalse(string.IsNullOrEmpty(existsQuery));

            errorMessage = "";
            existsResult = connection.ExecuteQuery(existsQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(existsResult);

            existsResultList = DataSetUtility.ToDictionaryList(existsResult.Tables[0]);

            recordExists = existsResultList.Any(dictionary => (dictionary != null) && (dictionary.Count > 0));

            Assert.AreEqual(recordExists, true);


            // Select

            selectQuery = updateGamePlatform.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            foundGamePlatform = null;

            if (selectResultList.Count > 0)
            {
                foreach (var dictionary in selectResultList.Where(dictionary => (dictionary != null) && (dictionary.Count > 0)))
                {
                    foundGamePlatform = GamePlatform.FromDictionary(dictionary);
                    break;
                }
            }

            Assert.IsNotNull(foundGamePlatform);

            Assert.AreNotSame(updateGamePlatform, foundGamePlatform);

            Assert.AreEqual(updateGamePlatform.Id, foundGamePlatform.Id);
            Assert.AreEqual(updateGamePlatform.GameId, foundGamePlatform.GameId);
            Assert.AreEqual(updateGamePlatform.PlatformId, foundGamePlatform.PlatformId);


            // Delete

            var deleteCommand = gamePlatform.GenerateDeleteStatement();

            var deleteGenre = platform.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            var deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);


            // Exists

            existsQuery = gamePlatform.GenerateExistsQuery();

            Assert.IsFalse(string.IsNullOrEmpty(existsQuery));

            errorMessage = "";
            existsResult = connection.ExecuteQuery(existsQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(existsResult);

            existsResultList = DataSetUtility.ToDictionaryList(existsResult.Tables[0]);

            recordExists = existsResultList.Any(dictionary => (dictionary != null) && (dictionary.Count > 0));

            Assert.IsFalse(recordExists);


            // Select

            selectQuery = gamePlatform.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            foundGamePlatform = null;

            if (selectResultList.Count > 0)
            {
                foreach (var dictionary in selectResultList.Where(dictionary => (dictionary != null) && (dictionary.Count > 0)))
                {
                    foundGamePlatform = GamePlatform.FromDictionary(dictionary);
                    break;
                }
            }

            Assert.IsNull(foundGamePlatform);


            // Delete the platforms

            deleteCommand = platform.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            deleteCommand = updatePlatform.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);


            // Delete the games

            deleteCommand = game.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            deleteCommand = updateGame.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
        }