Example #1
0
        private void GetData(object source = null, ElapsedEventArgs args = null)
        {
            //Console.WriteLine("tick");
            //GetDataExecute();
            ProcessMod[] processes = ProcessMod.GetProcesses();

            OnResult?.Invoke(this, processes.ToList());
        }
Example #2
0
        /// <summary>The load method called to initialize this GUI</summary>
        /// <param name="sender">unused</param>
        /// <param name="e">unused</param>
        private void UnitViewerGUI_Load(object sender, EventArgs e)
        {
            SetDoubleBuffered(treeViewUnits);
            SetDoubleBuffered(treeViewDeaths);
            treePlayers      = new TreeNode[12];
            treeSelPlayers   = new TreeNode[8];
            treeDeaths       = new TreeNode[228];
            treePlayerDeaths = new TreeNode[228][];
            treeAllUnits     = treeViewUnits.Nodes.Add("AllUnits", "All Units");
            TreeNode treeByPlayers = treeViewUnits.Nodes.Add("TreeByPlayers", "Players' Units");

            for (uint i = 0; i < 12; i++)
            {
                string playerKey  = string.Format("Player{0}", i + 1);
                string playerText = string.Format("Player {0}", i + 1);
                treePlayers[i] = treeByPlayers.Nodes.Add(playerKey, playerText);
            }
            treePlayer13to256 = treeByPlayers.Nodes.Add("Player13-256", "Player 13-256");
            TreeNode treeBySelections = treeViewUnits.Nodes.Add("TreeByPlayerSel", "Selections");

            for (uint i = 0; i < 8; i++)
            {
                string playerKey  = string.Format("selPlayer{0}", i + 1);
                string playerText = string.Format("Player {0}", i + 1);
                treeSelPlayers[i] = treeBySelections.Nodes.Add(playerKey, playerText);
            }
            String[] unitNames = UnitNames.get();
            for (uint unitId = 0; unitId < 228; unitId++)
            {
                string unitKey = string.Format("unit{0}", unitId);
                treeDeaths[unitId]       = treeViewDeaths.Nodes.Add(unitKey, string.Format("[{0}] {1}", unitId.ToString("000"), unitNames[unitId]));
                treePlayerDeaths[unitId] = new TreeNode[12];
                for (uint playerId = 0; playerId < 12; playerId++)
                {
                    string playerDeathsKey  = string.Format("player{0}", playerId + 1);
                    string playerDeathsText = string.Format("Player {0}:     {1}", (playerId + 1).ToString("00"), 0.ToString());
                    treePlayerDeaths[unitId][playerId] = treeDeaths[unitId].Nodes.Add(playerDeathsKey, playerDeathsText);
                }
            }

            p       = new ProcessMod();
            updater = new Updater(this);
            updater.StartTimedUpdates(1000);
            unitViews   = new SortedDictionary <ushort, UnitView>();
            customViews = new SortedDictionary <UInt32, UnitView>();
            usedIndices = new List <ushort>();
            RefreshWindow();
        }
Example #3
0
 public static void MemoryUsageFormatter(TreeViewColumn column, CellRenderer cell, ITreeModel model, TreeIter iter)
 {
     try
     {
         string data       = model.GetValue(iter, 2).ToString();
         double dataDouble = Convert.ToDouble(data, CultureInfo.InvariantCulture);
         if (data != "")
         {
             ((CellRendererText)cell).Text = ProcessMod.FormatMemSize(dataDouble);
         }
     }
     catch (Exception e)
     {
         if (e is NullReferenceException || e is FormatException)
         {
             ((CellRendererText)cell).Text = "";
         }
     }
 }
Example #4
0
 public static void TotalCpuTimeFormatter(TreeViewColumn column, CellRenderer cell, ITreeModel model, TreeIter iter)
 {
     try
     {
         string data     = model.GetValue(iter, 6).ToString();
         long   dataLong = Convert.ToInt64(data, CultureInfo.InvariantCulture);
         if (data != "")
         {
             ((CellRendererText)cell).Text = ProcessMod.FormatTimeMs(dataLong);
         }
     }
     catch (Exception e)
     {
         if (e is NullReferenceException || e is FormatException)
         {
             ((CellRendererText)cell).Text = "";
         }
     }
 }
Example #5
0
        public static void CpuUsageFormatter(TreeViewColumn column, CellRenderer cell, ITreeModel model, TreeIter iter)
        {
            string data = "";

            try
            {
                data = model.GetValue(iter, 7).ToString();
                double dataDouble = Convert.ToDouble(data, CultureInfo.InvariantCulture);
                if (data != "")
                {
                    ((CellRendererText)cell).Text = ProcessMod.FormatCpuUsage(dataDouble);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"{e.Message} : {data}");
                if (e is NullReferenceException || e is FormatException)
                {
                    ((CellRendererText)cell).Text = "";
                }
            }
        }
Example #6
0
        private void GetDataExecute()
        {
            ProcessMod[] processes = ProcessMod.GetProcesses();

            OnResult?.Invoke(this, processes.ToList());
        }