Example #1
0
        static private RICustomData _GetProcessInformation(RICustomData cData, Process process)
        {
            RICustomDataCategory cat = cData.AddCategory("Process Information");

            cat.AddRow("Process Id", process.Id.ToString());
            cat.AddRow("Process Name", process.ProcessName);
            cat.AddRow("Image", process.MainModule.FileName);
            cat.AddRow("Machine Name", process.MachineName == "." ? Environment.MachineName : process.MachineName);
            cat.AddRow("Main Window Handle", process.MainWindowHandle != null ? process.MainWindowHandle.ToString() : null);
            cat.AddRow("Main Window Title", process.MainWindowTitle);
            cat.AddRow("Handle", process.Handle != null ? process.Handle.ToString() : null);
            cat.AddRow("Open Handles", process.HandleCount.ToString());
            cat.AddRow("Number of Modules", process.Modules.Count.ToString());

            cat = cData.AddCategory("Priority Information");
            cat.AddRow("Base Priority", process.BasePriority.ToString());
            cat.AddRow("Priority", process.PriorityClass.ToString());
            cat.AddRow("Priority Boost", process.PriorityBoostEnabled.ToString());

            cat = cData.AddCategory("Memory Information");
            cat.AddRow("Non-Paged System Memory", string.Format("{0} KB", (process.NonpagedSystemMemorySize64 / 1024).ToString("N0")));
            cat.AddRow("Paged System Memory", string.Format("{0} KB", (process.PagedSystemMemorySize64 / 1024).ToString("N0")));
            cat.AddRow("Paged Memory", string.Format("{0} KB", (process.PagedMemorySize64 / 1024).ToString("N0")));
            cat.AddRow("Peak Paged Memory", string.Format("{0} KB", (process.PeakPagedMemorySize64 / 1024).ToString("N0")));
            cat.AddRow("Peak Virtual Memory", string.Format("{0} KB", (process.PeakVirtualMemorySize64 / 1024).ToString("N0")));
            cat.AddRow("Private Memory", string.Format("{0} KB", (process.PrivateMemorySize64 / 1024).ToString("N0")));

            return(cData);
        }
Example #2
0
        static private void AppendCustomDataChild(StringBuilder sb, RICustomData cData, List <RICustomDataElement> children, Int32 indent)
        {
            foreach (RICustomDataElement ce in children)
            {
                if (ce.CustomDataType == RICustomDataElementType.Category)
                {
                    String catFmt = String.Format("{{0,{0}}}{{1}}{{2}}", indent);

                    RICustomDataCategory cat = (RICustomDataCategory)ce;
                    sb.AppendFormat(catFmt, " ", String.Format("[{0}]", cat.Caption), Environment.NewLine);

                    AppendCustomDataChild(sb, cData, cat.Children, indent + 3);
                }
                else // must be Row
                {
                    String sIndentFmt = String.Format("{{0,{0}}}{{1}}", indent);

                    RICustomDataRow row = (RICustomDataRow)ce;
                    Int32           maxFieldsAllowed = row.Fields.Count < cData.Columns.Length ? row.Fields.Count : cData.Columns.Length;
                    String          separator        = cData.IsPropertyGrid ? " " : " | ";

                    for (Int32 i = 0; i < maxFieldsAllowed; i++)
                    {
                        if (i > 0)
                        {
                            sb.AppendFormat("{0}{1}", separator, row.Fields[i]);
                        }
                        else
                        {
                            sb.AppendFormat(sIndentFmt, " ", row.Fields[i]);
                            if (cData.IsPropertyGrid)
                            {
                                sb.Append(":");
                            }
                        }
                    }

                    sb.AppendFormat(Environment.NewLine);
                }
            }
        }
Example #3
0
        //---------------------------------------------------------------------
        static RICustomData GetCustomData1()
        {
            Random rnd = new Random((Int32)DateTime.Now.Ticks);

            List <RICustomDataColumn> columns = new List <RICustomDataColumn>();

            columns.Add(new RICustomDataColumn("Column1"));
            columns.Add(new RICustomDataColumn("Column2"));
            columns.Add(new RICustomDataColumn("Column3"));
            columns.Add(new RICustomDataColumn("Column4"));

            RICustomData cData = new RICustomData("My Custom Data", columns, true, false);

            cData.AddRow("Ross", "Test");

            RICustomDataCategory cat = cData.AddCategory("Category1");

            for (Int32 i = 0; i < 3; i++)
            {
                const String crap = "a";
                cat.AddRow(String.Format("field1{0}{1}", i, crap), String.Format("field2{0}{1}", i, crap), String.Format("field3{0}", i));
            }

            cat = cat.AddCategory("Category2");
            RICustomDataCategory cat2 = cat;

            for (Int32 i = 0; i < 3; i++)
            {
                const String crap = "b";
                cat.AddRow(String.Format("field1{0}{1}", i, crap), String.Format("field2{0}", i), String.Format("field3{0}", i), String.Format("field4{0}", i));
            }

            cat = cat.AddCategory("Category3");
            RICustomDataCategory cat3 = cat.AddCategory("Category3b");

            cat3.AddRow("Ross", "Test");

            for (Int32 i = 0; i < 3; i++)
            {
                const String crap = "c";
                cat.AddRow(String.Format("field1{0}{1}", i, crap), String.Format("field2{0}", i), String.Format("field3{0}", i), String.Format("field4{0}", i));
            }

            for (Int32 i = 0; i < 3; i++)
            {
                const String crap = "bx";
                cat2.AddRow(String.Format("field1{0}{1}", i, crap), String.Format("field2{0}", i), String.Format("field3{0}{1}", i, crap));
            }

            cat = cData.AddCategory("Category1a");
            for (Int32 i = 0; i < 3; i++)
            {
                const String crap = "a1";
                cat.AddRow(String.Format("field1{0}{1}", i, crap), String.Format("field2{0}{1}", i, crap), String.Format("field3{0}", i));
            }

            for (Int32 i = 0; i < 3; i++)
            {
                const String crap = "d";
                cData.AddRow(String.Format("field1{0}{1}", i, crap), String.Format("field2{0}", i), String.Format("field3{0}{1}", i, crap));
            }

            return(cData);
        }