Example #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            // Stop spamming debug msgs on error
            if (Dbg.bErrorMsg)
            {
                return;
            }



            //ScreenCapture.setDebugImageFile( @"C:\temp\DBD\problems\Screenshot_1.jpg" );
            //var bp11 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor1 );
            //var bp22 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor2 );
            //var bp33 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor3 );
            //var bp44 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor4 );
            //var bpKiller5 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Killer );

            //var v0 =ScreenParser.hasKillerCancelButton();
            //var bHasCrossplayIcon = hasCrossplayIcon();
            //var v = ScreenParser.hasReadyGfx();
            //var v1 = ScreenParser.hasUnGfx();
            //var v2 = ScreenParser.hasShopIcon();
            //var v3 = ScreenParser.hasSurvivorLookingForMatchText();
            //var v4 = ScreenParser.isAnyPlayerInLobbyOrPrelobby();
            //var v5 = Gfx.unknownErrorMsg.recognize();
            //var v6 = Gfx.overlayDarkBlueMsg.recognize();


            //var v = hasAllPlayersClickedReady();

            //StateManager.beforeAnyStateUpdates();

            this.Text = title + " " + stopWatch.Elapsed.ToString(@"hh\:mm\:ss");

            bool bSuccess = ScreenParser.tick();


            //var b = ScreenParser.hasAllPlayersEnteredLobby();

            //var player2 = ScreenParser.getScoreboardSelectedPlayer(true);

            //var icon2 = getEndgameScoreboardSurvIcon( player2 );



            //var jpgFiles = Directory.GetFiles( @"C:\Users\temp\OneDrive\Pictures\Screenshots\Wraith",
            //    "*.png", SearchOption.TopDirectoryOnly);

            //int numScoreboardFiles = 0;
            //foreach ( var jpgFile in jpgFiles )
            //{
            //    ScreenCapture.setDebugImageFile( jpgFile );
            //    ScreenCapture.makeGameScreenshot();

            //    if ( hasEndgameScoreboard() )
            //    {
            //        numScoreboardFiles++;

            //        //if ( jpgFile == "C:\\temp\\DBD\\1080p\\End-Game\\Scoreboard\\Killer DC 1080p.jpg" )
            //        //{
            //        //    //Dbg.bTest = true;
            //        //    Debugger.Break();
            //        //}

            //        var player = ScreenParser.recognizeScoreboardSelectedPlayer( true );

            //        Dbg.assert( player != PlayerIndex.Error );

            //        //var icon1 = ScreenParser.recognizeEndgameScoreboardSurvIcon( PlayerIndex.Survivor1 );
            //        //var icon2 = ScreenParser.recognizeEndgameScoreboardSurvIcon( PlayerIndex.Survivor2 );
            //        //var icon3 = ScreenParser.recognizeEndgameScoreboardSurvIcon( PlayerIndex.Survivor3 );
            //        //var icon4 = ScreenParser.recognizeEndgameScoreboardSurvIcon( PlayerIndex.Survivor4 );

            //        var bp1 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor1 );
            //        var bp2 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor2 );
            //        var bp3 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor3 );
            //        var bp4 = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Survivor4 );
            //        var bpKiller = EndscoreBpDigitGfx.recognizePlayerBPNumber( PlayerIndex.Killer );

            //        Dbg.assert( bp1 != -1 && bp2 != -1 && bp3 != -1 && bp4 != -1 && bpKiller != -1 );

            //        Log.log( numScoreboardFiles + " (" + jpgFile + ")\nSelectedPlayer: " + player.ToString() );
            //        //Log.log( "Icons1: " + icon1.ToString() + ", icon2: " + icon2.ToString() +
            //        //    ", icon3: " + icon3.ToString() + ", icon4: " + icon4.ToString() + "\n" );

            //        Log.log( "Bp1: " + bp1.ToString() + ", Bp2: " + bp2.ToString() +
            //             ", bp3: " + bp3.ToString() + ", bp4: " + bp4.ToString() +
            //             ", killer: " + bpKiller.ToString()  + "\n" );

            //        //Debug.Assert(icon1 != EndgameSurvivorIcon.Error && icon2 != EndgameSurvivorIcon.Error &&
            //        //    icon3 != EndgameSurvivorIcon.Error && icon4 != EndgameSurvivorIcon.Error);

            //        //Log.log(numScoreboardFiles + " (" + pngFile + ")\n" + ": \nSurvivor1: " + icon1.ToString() +
            //        //    "\nSurvivor2: " + icon2.ToString() + "\nSurvivor3: " +
            //        //    icon3.ToString() + "\nSurvivor4: " + icon4.ToString() +
            //        //    "\nKiller: " + icon5.ToString() );
            //    }
            //    //else
            //    //{
            //    //    Dbg.onError( "" );
            //    //    Log.log( "Not scoreboard: " + jpgFile );
            //    //}

            //}

            managePreviewWindow();

            if (!bSuccess || (!ScreenCapture.haveGameHwnd() && !ScreenCapture.haveDebugPicture()))
            {
                return;
            }


            //ScreenParser.parseScreenshot();
            var r = ScreenParser.bHasReadyButton;

            if (r)
            {
                label1.Text = "READY";
            }
            else
            {
                label1.Text = "no ready icon";
            }

            if (ScreenParser.bHasCrossplayIcon)
            {
                label2.Text = "CROSSPLAY ICON";
            }
            else
            {
                label2.Text = "no crossplay icon";
            }

            if (ScreenParser.bKillerCancelButton)
            {
                label3.Text = "KILLER CANCEL";
            }
            else
            {
                label3.Text = "no killer cancel";
            }

            if (ScreenParser.bSurvivorCancelButton)
            {
                label4.Text = "SURVIVOR CANCEL";
            }
            else
            {
                label4.Text = "no survivor cancel";
            }

            if (ScreenParser.bHasUnTextGfx)
            {
                label5.Text = "HAS UN";
            }
            else
            {
                label5.Text = "no un";
            }

            if (ScreenParser.bHasUnreadyButton)
            {
                label6.Text = "HAS UNREADY";
            }
            else
            {
                label6.Text = "no unready";
            }

            if (ScreenParser.bHasSurvivorLookingForMatchText)
            {
                label7.Text = "LOOKING FOR MATCH";
            }
            else
            {
                label7.Text = "not looking for match";
            }

            if (ScreenParser.bHasShopIcon)
            {
                label8.Text = "SHOP ICON";
            }
            else
            {
                label8.Text = "no shop icon";
            }

            if (isDBDWindowFocused())
            {
                label10.Text = "DBD ACTIVE";
            }
            else
            {
                label10.Text = "dbd not active";
            }

            lblDbgState.Text = StateManager.getState().ToString();
            lblgameType.Text = StateManager.getGameType().ToString();

            label9.Text = "Killer: " + getPlayerLobbyStatus(PlayerIndex.Killer) +
                          ", Surv1: " + getPlayerLobbyStatus(PlayerIndex.Survivor1) +
                          ", Surv2: " + getPlayerLobbyStatus(PlayerIndex.Survivor2) +
                          ", Surv3: " + getPlayerLobbyStatus(PlayerIndex.Survivor3) +
                          ", Surv4: " + getPlayerLobbyStatus(PlayerIndex.Survivor4);
        }
Example #2
0
        public static void load()
        {
            // Exit if no stats file
            if (!File.Exists(filePath))
            {
                return;
            }

            using (StreamReader file = new StreamReader(filePath))
            {
                while (!file.EndOfStream)
                {
                    var line = file.ReadLine();

                    line = line.Trim();

                    var v = line.Split(new string[] { Config.keyAndValueSeparatorForSaving },
                                       StringSplitOptions.None);

                    // Make sure we have both: field name and value
                    if (v.Length != 2)
                    {
                        continue;
                    }

                    string fieldName = v[0].Trim();
                    string value     = v[1].Trim();

                    // Make sure this is not a duplicate entry
                    Dbg.assert(!settingValues.ContainsKey(fieldName));

                    //settingValues[ fieldName ] = value;

                    // Get key and subkey
                    var keyAndSubkey = fieldName.Split(new string[] { Config.keyAndSubkeySeparatorForSaving },
                                                       StringSplitOptions.None);

                    Dbg.assert(keyAndSubkey.Length == 2);

                    string mainKey = keyAndSubkey[0].Trim();
                    string subKey  = keyAndSubkey[1].Trim();

                    if (mainKey == Config.keyPrefixGeneral)
                    {
                        parseGeneralSettingLine(subKey, value);
                    }
                    else
                    {
                        // This is a setting for an action
                        parseSettingLineForAction(mainKey, subKey, value);
                    }
                }
            }

            void parseGeneralSettingLine(string subKey, string setting)
            {
                subKey = subKey.Trim();

                Config.setConfigValue(subKey, bool.Parse(setting));
            }

            void parseSettingLineForAction(string mainKey, string subKey, string value)
            {
                string stateString = mainKey;
                var    state       = StateManager.getStateEnumFromStateEnumDescription(stateString);

                Dbg.assert(state != null);

                var action = Actions.getActions()[(StateManager.State)state];

                action.loadSettingValueFromConfig(subKey, value);
            }
        }