Ejemplo n.º 1
0
        private Boolean CanUseHlae(Demo demo)
        {
            if (demo.Engine == Demo.Engines.HalfLifeSteam || (demo.Engine == Demo.Engines.HalfLife && ((HalfLifeDemo)demo).ConvertNetworkProtocol()))
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 2
0
        private static Launcher CreateLauncher(Demo demo, Boolean? sourceEngine)
        {
            Launcher launcher = null;

            if (demo == null)
            {
                Debug.Assert(sourceEngine != null);

                if (sourceEngine == true)
                {
                    return new SourceLauncher();
                }
                else
                {
                    return new HalfLifeSteamLauncher();
                }
            }
            else
            {
                switch (demo.Engine)
                {
                    case Demo.Engines.HalfLife:
                        if (((HalfLifeDemo)demo).ConvertNetworkProtocol())
                        {
                            launcher = new HalfLifeSteamLauncher();
                        }
                        else
                        {
                            launcher = new HalfLifeLauncher();
                        }
                        break;

                    case Demo.Engines.HalfLifeSteam:
                        launcher = new HalfLifeSteamLauncher();
                        break;

                    case Demo.Engines.Source:
                        launcher = new SourceLauncher();
                        break;
                }
            }

            if (launcher == null)
            {
                return null;
            }

            launcher.Demo = demo;

            if (sourceEngine != null)
            {
                launcher.ServerSourceEngine = (Boolean)sourceEngine;
            }

            return launcher;
        }
        public SourceAnalysisWindow(Demo demo)
        {
            this.demo = demo;

            playerTable = new Hashtable();
            titleTable = new Hashtable();

            // TextMsg
            AddTitle("#Target_Bombed", "Target Succesfully Bombed!");
            AddTitle("#VIP_Escaped", "The VIP has escaped!");
            AddTitle("#VIP_Assassinated", "VIP has been assassinated!");
            AddTitle("#Terrorists_Escaped", "The terrorists have escaped!");
            AddTitle("#CTs_PreventEscape", "The CTs have prevented most of the terrorists from escaping!");
            AddTitle("#Escaping_Terrorists_Neutralized", "Escaping terrorists have all been neutralized!");
            AddTitle("#Bomb_Defused", "The bomb has been defused!");
            AddTitle("#CTs_Win", "Counter-Terrorists Win!");
            AddTitle("#Terrorists_Win", "Terrorists Win!");
            AddTitle("#Round_Draw", "Round Draw!");
            AddTitle("#All_Hostages_Rescued", "All Hostages have been rescued!");
            AddTitle("#Target_Saved", "Target has been saved!");
            AddTitle("#Hostages_Not_Rescued", "Hostages have not been rescued!");
            AddTitle("#Terrorists_Not_Escaped", "Terrorists have not escaped!");
            AddTitle("#VIP_Not_Escaped", "VIP has not escaped!");
            AddTitle("#Terrorist_Escaped", "A terrorist has escaped!");
            AddTitle("#Bomb_Planted", "The bomb has been planted!");
            AddTitle("#Game_will_restart_in", "The game will restart in %s1 %s2");
            AddTitle("#Game_bomb_drop", "%s1 dropped the bomb");
            AddTitle("#Game_bomb_pickup", "%s1 picked up the bomb");
            AddTitle("#Game_connected", "%s1 connected");
            AddTitle("#Game_disconnected", "%s1 has left the game");
            AddTitle("#Game_join_ct", "%s1 is joining the Counter-Terrorist force");
            AddTitle("#Game_join_ct_auto", "%s1 is joining the Counter-Terrorist force (auto)");
            AddTitle("#Game_join_terrorist", "%s1 is joining the Terrorist force");
            AddTitle("#Game_join_terrorist_auto", "%s1 is joining the Terrorist force (auto)");
            AddTitle("#Game_kicked", "Kicked %s1");
            AddTitle("#Game_teammate_attack", "%s1 attacked a teammate");

            // SayText
            AddTitle("#Cstrike_Name_Change", "* %s1 changed name to %s2");
            AddTitle("#Cstrike_Chat_CT", "(Counter-Terrorist) ");
            AddTitle("#Cstrike_Chat_T", "(Terrorist) ");
            AddTitle("#Cstrike_Chat_CT_Dead", "*DEAD*(Counter-Terrorist) ");
            AddTitle("#Cstrike_Chat_T_Dead", "*DEAD*(Terrorist) ");
            AddTitle("#Cstrike_Chat_Spec", "(Spectator) ");
            AddTitle("#Cstrike_Chat_All", "");
            AddTitle("#Cstrike_Chat_AllDead", "*DEAD* ");
            AddTitle("#Cstrike_Chat_AllSpec", "*SPEC* ");

            NewRound();

            uiScoreboardTabItem.Visibility = Visibility.Collapsed;
            uiPlayersTabItem.Visibility = Visibility.Collapsed;
            uiNetworkGraphTabItem.Visibility = Visibility.Collapsed;
        }
        public HalfLifeAnalysisWindow(Demo demo)
        {
            this.demo = demo;

            uiPlayersListView.SelectionChanged += new SelectionChangedEventHandler(uiPlayersListView_SelectionChanged);
            uiPlayerInfoKeysListView.SelectionChanged += new SelectionChangedEventHandler(uiPlayerInfoKeysListView_SelectionChanged);
            uiScoreboardRoundsListView.SelectionChanged += new SelectionChangedEventHandler(uiScoreboardRoundsListView_SelectionChanged);
            uiNetworkGraphPlayersListView.SelectionChanged += new SelectionChangedEventHandler(uiNetworkGraphPlayersListView_SelectionChanged);

            // create the zedgraph control
            uiNetworkGraph.GraphPane.Title.Text = "";
            uiNetworkGraph.GraphPane.XAxis.Title.Text = "Time (%)";
            uiNetworkGraph.GraphPane.YAxis.Title.Text = "";
        }
        public static AnalysisWindow CreateAnalysisWindow(Demo demo)
        {
            AnalysisWindow window = null;

            switch (demo.Engine)
            {
                case Demo.Engines.HalfLife:
                case Demo.Engines.HalfLifeSteam:
                    window = new HalfLifeAnalysisWindow(demo);
                    break;

                case Demo.Engines.Source:
                    window = new SourceAnalysisWindow(demo);
                    break;
            }

            if (window == null)
            {
                return null;
            }

            //window.SetDemo(demo);
            return window;
        }
Ejemplo n.º 6
0
 public virtual Boolean CanConvertNetworkProtocol(Demo demo)
 {
     return false;
 }
Ejemplo n.º 7
0
 public static Launcher CreateLauncher(Demo demo)
 {
     return CreateLauncher(demo, null);
 }
Ejemplo n.º 8
0
 public virtual Int32 NewRoundEventId(Demo demo)
 {
     return(-1);
 }
Ejemplo n.º 9
0
 public virtual Boolean CanRemoveHltvAds(Demo demo)
 {
     return(false);
 }
Ejemplo n.º 10
0
        private Boolean UseHlae(Demo demo)
        {
            if (Config.Settings.PlaybackUseHlae && CanUseHlae(demo))
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 11
0
            public DemoListViewData(Demo demo, BitmapImage icon)
            {
                Icon = icon;
                Name = demo.Name;
                Game = demo.GameName;
                Perspective = demo.PerspectiveString;

                if (demo.Status == Demo.StatusEnum.Ok)
                {
                    Duration = Common.DurationString(demo.DurationInSeconds);
                }
                else
                {
                    Duration = "Unknown";
                }

                Demo = demo;
            }
Ejemplo n.º 12
0
 public virtual Boolean CanConvertNetworkProtocol(Demo demo)
 {
     return(false);
 }
Ejemplo n.º 13
0
        public void SetCurrentPath(String path, String demoNameToSelect)
        {
            // really should refresh the demo list

            /*if (path == currentPath)
             * {
             *  SelectDemo(demoNameToSelect);
             *  return;
             * }*/

            this.demoNameToSelect = demoNameToSelect;

            // clear control
            demoCollection.Clear();

            // abort all running threads from thread pool
            foreach (Thread t in threadPool)
            {
                Common.AbortThread(t);
            }

            // check that directory exists, that path isn't blank
            if (path == "" || !Directory.Exists(path))
            {
                return;
            }

            currentPath = path;

            // search folder for *.dem files
            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            threadPoolFull  = false;
            threadPoolCount = 0;
            FileInfo[] files = null;

            try
            {
                files = directoryInfo.GetFiles("*.dem", SearchOption.TopDirectoryOnly);
            }
            catch (UnauthorizedAccessException)
            {
                return;
            }

            foreach (FileInfo fi in files)
            {
                Thread thread;

                try
                {
                    Demo demo = DemoFactory.CreateDemo(fi.FullName);
                    thread = demo.Read((IMainWindow)((Grid)Parent).Parent, (IDemoListView)this);
                }
                catch (Exception ex)
                {
                    /*
                     * Only show an error message here if the user explicitly opened this demo.
                     * The only errors that should be happening are if the demo isn't a valid HL/Source engine demo or if there's some problem opening the file.
                     *
                     * Any errors that occur in the demo reading thread are always shown (the thread handles this).
                     */
                    if (String.Equals(System.IO.Path.GetFileNameWithoutExtension(fi.Name), demoNameToSelect))
                    {
                        Common.Message((Window)((Grid)Parent).Parent, "Error loading demo file \"" + fi.FullName + "\"", ex, MessageWindow.Flags.Error);
                    }

                    // don't add it to the thread pool
                    continue;
                }

                threadPool.Add(thread);
                threadPoolCount++;
            }

            threadPoolFull = true;
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Finds a game.
 /// </summary>
 /// <param name="demo">The demo that was recorded using the game that is being searched for.</param>
 /// <returns>A Game if successful, otherwise null.</returns>
 public static Game Find(Demo demo)
 {
     return(Find((demo.Engine == Demo.Engines.Source ? Game.Engines.Source : Game.Engines.HalfLife), demo.GameFolderName));
 }
Ejemplo n.º 15
0
 public static Launcher CreateLauncher(Demo demo)
 {
     return(CreateLauncher(demo, null));
 }
Ejemplo n.º 16
0
 public virtual Boolean CanAnalyse(Demo demo)
 {
     return false;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Handles demo conversion of the svc_resourcelist message.
 /// </summary>
 /// <returns>False if the resource should be removed from the resource list, otherwise false.</returns>
 public virtual Boolean ConvertResourceListCallback(Demo demo, UInt32 type, UInt32 index, ref String name)
 {
     return(true);
 }
Ejemplo n.º 18
0
        private static Launcher CreateLauncher(Demo demo, Boolean?sourceEngine)
        {
            Launcher launcher = null;

            if (demo == null)
            {
                Debug.Assert(sourceEngine != null);

                if (sourceEngine == true)
                {
                    return(new SourceLauncher());
                }
                else
                {
                    return(new HalfLifeSteamLauncher());
                }
            }
            else
            {
                switch (demo.Engine)
                {
                case Demo.Engines.HalfLife:
                    if (((HalfLifeDemo)demo).ConvertNetworkProtocol())
                    {
                        if (Config.Settings.PlaybackProgramOldCs == ProgramSettings.PlaybackProgram.CounterStrike)
                        {
                            launcher = new CounterStrikeLauncher();
                        }
                        else
                        {
                            launcher = new HalfLifeSteamLauncher();
                        }
                    }
                    else
                    {
                        launcher = new HalfLifeLauncher();
                    }
                    break;

                case Demo.Engines.HalfLifeSteam:
                    if (((HalfLifeDemo)demo).NetworkProtocol == 47 && demo.GameFolderName == "cstrike" && Config.Settings.PlaybackProgramOldCs == ProgramSettings.PlaybackProgram.CounterStrike)
                    {
                        launcher = new CounterStrikeLauncher();
                    }
                    else
                    {
                        launcher = new HalfLifeSteamLauncher();
                    }
                    break;

                case Demo.Engines.Source:
                    launcher = new SourceLauncher();
                    break;
                }
            }

            if (launcher == null)
            {
                return(null);
            }

            launcher.Demo = demo;
            return(launcher);
        }
Ejemplo n.º 19
0
 public virtual void ConvertEventCallback(Demo demo, HalfLifeDelta delta, UInt32 eventIndex)
 {
 }
Ejemplo n.º 20
0
 public virtual Boolean CanRemoveFadeToBlack(Demo demo)
 {
     return false;
 }
Ejemplo n.º 21
0
 public virtual Boolean CanRemoveHltvAds(Demo demo)
 {
     return false;
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Try to find the games' icon.
        /// </summary>
        /// <returns>The games' icon on success, a generic "unknown" icon on failure.</returns>
        private BitmapImage FindIcon(Demo demo)
        {
            String engineTypeName = "";

            if (demo.Engine == Demo.Engines.Source)
            {
                engineTypeName = "source";
            }
            else
            {
                engineTypeName = "goldsrc";
            }

            // Locally stored icon: "icons\engine\game folder.ico"
            BitmapImage icon = LoadIcon(Config.ProgramPath + "\\icons\\" + engineTypeName + "\\" + demo.GameFolderName + ".ico");

            if (icon != null)
            {
                return(icon);
            }

            // Queue up a bunch of different icon paths to try.
            Queue <String> iconPaths = new Queue <string>();

            if (demo.Engine == Demo.Engines.HalfLife)
            {
                // Can't do anything if the hl.exe path is not set.
                if (!File.Exists(Config.Settings.HlExeFullPath))
                {
                    return(unknownIcon);
                }

                // e.g. Half-Life\cstrike\cstrike.ico
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.HlExeFullPath) + "\\" + demo.GameFolderName + "\\" + demo.GameFolderName + ".ico");

                if (demo.GameFolderName == "tfc")
                {
                    // Special case: TFC.
                    iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.HlExeFullPath) + "\\TeamFortressClassic.ico");
                }
                else if (demo.GameFolderName == "valve")
                {
                    // Special case: HL.
                    iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.HlExeFullPath) + "\\valve.ico");
                }
            }
            else
            {
                // Check that steam.exe path is set and that the demo has corresponding Steam app information.
                Game game = GameManager.Find(demo);

                if (!File.Exists(Config.Settings.SteamExeFullPath) || game == null)
                {
                    return(unknownIcon);
                }

                // Steam\steam\games\x.ico, where x is the game name. e.g. counter-strike.
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.SteamExeFullPath) + "\\steam\\games\\" + game.FolderExtended + ".ico");

                // e.g. counter-strike\cstrike\game.ico
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.SteamExeFullPath) + "\\SteamApps\\" + Config.Settings.SteamAccountFolder + "\\" + game.FolderExtended + "\\" + demo.GameFolderName + "\\game.ico");

                // e.g. counter-strike\cstrike\resource\game.ico.
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.SteamExeFullPath) + "\\SteamApps\\" + Config.Settings.SteamAccountFolder + "\\" + game.FolderExtended + "\\" + demo.GameFolderName + "\\resource\\game.ico");
            }

            // Try all the queued paths.
            foreach (String iconFullPath in iconPaths)
            {
                icon = LoadIcon(iconFullPath);

                if (icon != null)
                {
                    return(icon);
                }
            }

            return(unknownIcon);
        }
Ejemplo n.º 23
0
 public virtual Boolean CanRemoveHltvSlowMotion(Demo demo)
 {
     return false;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Try to find the games' icon.
        /// </summary>
        /// <returns>The games' icon on success, a generic "unknown" icon on failure.</returns>
        private BitmapImage FindIcon(Demo demo)
        {
            String engineTypeName = "";

            if (demo.Engine == Demo.Engines.Source)
            {
                engineTypeName = "source";
            }
            else
            {
                engineTypeName = "goldsrc";
            }

            // Locally stored icon: "icons\engine\game folder.ico"
            BitmapImage icon = LoadIcon(Config.ProgramPath + "\\icons\\" + engineTypeName + "\\" + demo.GameFolderName + ".ico");

            if (icon != null)
            {
                return icon;
            }

            // Queue up a bunch of different icon paths to try.
            Queue<String> iconPaths = new Queue<string>();

            if (demo.Engine == Demo.Engines.HalfLife)
            {
                // Can't do anything if the hl.exe path is not set.
                if (!File.Exists(Config.Settings.HlExeFullPath))
                {
                    return unknownIcon;
                }

                // e.g. Half-Life\cstrike\cstrike.ico
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.HlExeFullPath) + "\\" + demo.GameFolderName + "\\" + demo.GameFolderName + ".ico");

                if (demo.GameFolderName == "tfc")
                {
                    // Special case: TFC.
                    iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.HlExeFullPath) + "\\TeamFortressClassic.ico");
                }
                else if (demo.GameFolderName == "valve")
                {
                    // Special case: HL.
                    iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.HlExeFullPath) + "\\valve.ico");
                }
            }
            else
            {
                // Check that steam.exe path is set and that the demo has corresponding Steam app information.
                Game game = GameManager.Find(demo);

                if (!File.Exists(Config.Settings.SteamExeFullPath) || game == null)
                {
                    return unknownIcon;
                }

                // Steam\steam\games\x.ico, where x is the game name. e.g. counter-strike.
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.SteamExeFullPath) + "\\steam\\games\\" + game.FolderExtended + ".ico");

                // e.g. counter-strike\cstrike\game.ico
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.SteamExeFullPath) + "\\SteamApps\\" + Config.Settings.SteamAccountFolder + "\\" + game.FolderExtended + "\\" + demo.GameFolderName + "\\game.ico");

                // e.g. counter-strike\cstrike\resource\game.ico.
                iconPaths.Enqueue(System.IO.Path.GetDirectoryName(Config.Settings.SteamExeFullPath) + "\\SteamApps\\" + Config.Settings.SteamAccountFolder + "\\" + game.FolderExtended + "\\" + demo.GameFolderName + "\\resource\\game.ico");
            }

            // Try all the queued paths.
            foreach (String iconFullPath in iconPaths)
            {
                icon = LoadIcon(iconFullPath);

                if (icon != null)
                {
                    return icon;
                }
            }

            return unknownIcon;
        }
Ejemplo n.º 25
0
 public virtual void ConvertEventCallback(Demo demo, HalfLifeDelta delta, UInt32 eventIndex)
 {
 }
Ejemplo n.º 26
0
 public virtual Boolean CanAnalyse(Demo demo)
 {
     return(false);
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Handles demo conversion of the svc_resourcelist message.
 /// </summary>
 /// <returns>False if the resource should be removed from the resource list, otherwise false.</returns>
 public virtual Boolean ConvertResourceListCallback(Demo demo, UInt32 type, UInt32 index, ref String name)
 {
     return true;
 }
Ejemplo n.º 28
0
 public virtual Boolean CanRemoveFadeToBlack(Demo demo)
 {
     return(false);
 }
Ejemplo n.º 29
0
 public virtual Int32 NewRoundEventId(Demo demo)
 {
     return -1;
 }
Ejemplo n.º 30
0
 public virtual Boolean CanRemoveHltvSlowMotion(Demo demo)
 {
     return(false);
 }
Ejemplo n.º 31
0
        private void SetPlayerListGridView(Demo demo)
        {
            GridView gv = new GridView();

            ExtendedGridViewColumn nameColumn = CreateGridViewColumn("Name", "Name");
            nameColumn.IsDefaultSortColumn = true;
            nameColumn.IsLowPriority = true;
            gv.Columns.Add(nameColumn);

            if (demo.Engine != Demo.Engines.Source)
            {
                gv.Columns.Add(CreateGridViewColumn("cl__updaterate", "UpdateRate"));
                gv.Columns.Add(CreateGridViewColumn("rate", "Rate"));
            }

            if (demo.Engine == Demo.Engines.Source || demo.NetworkProtocol >= 48)
            {
                gv.Columns.Add(CreateGridViewColumn("Steam ID", "SteamId"));
            }

            uiPlayersListView.View = gv;
        }