Exemple #1
0
        public Form1()
        {
            Int64   phav        = PerformanceInfo.GetPhysicalAvailableMemoryInMiB();
            Int64   tot         = PerformanceInfo.GetTotalMemoryInMiB();
            decimal percentFree = ((decimal)phav / (decimal)tot) * 100;

            InitializeComponent();
            percentToolStripMenuItem.Text = percentFree.ToString() + " gb";
            cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
            ramCounter = new PerformanceCounter("Memory", "Available MBytes");
            try
            {
                DriveInfo[]   myDrives = DriveInfo.GetDrives();
                StringBuilder sb       = new StringBuilder();
                foreach (DriveInfo drive in myDrives)
                {
                    sb.AppendLine("Drive:" + drive.Name);
                    sb.AppendLine("Drive Type:" + drive.DriveType);

                    if (drive.IsReady == true)
                    {
                        sb.AppendLine("Vol Label:" + drive.VolumeLabel);
                        sb.AppendLine("File System: " + drive.DriveFormat);
                    }
                }
                richTextBox1.Text = (sb.ToString());
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!IsMemoryByte)
     {
         Int64   phav            = PerformanceInfo.GetPhysicalAvailableMemoryInMiB();
         Int64   tot             = PerformanceInfo.GetTotalMemoryInMiB();
         decimal percentFree     = ((decimal)phav / (decimal)tot) * 100;
         decimal percentOccupied = 100 - percentFree;
         textBox3.Text = ("Available Physical Memory (MiB) " + phav.ToString());
         textBox4.Text = ("Total Memory (MiB) " + tot.ToString());
         textBox1.Text = ("Free (%) " + percentFree.ToString());
         textBox2.Text = ("Occupied (%) " + percentOccupied.ToString());
     }
     else
     {
         Int64   phav            = PerformanceInfo.GetPhysicalAvailableMemoryInMiB();
         Int64   tot             = PerformanceInfo.GetTotalMemoryInMiB();
         decimal percentFree     = ((decimal)phav / (decimal)tot) * 100;
         decimal percentOccupied = 100 - percentFree;
         textBox3.Text = ("Available Physical Memory (MiB) " + Convert.ToByte(phav));
         textBox4.Text = ("Total Memory (MiB) " + Convert.ToByte(tot));
         textBox1.Text = ("Free (%) " + Convert.ToByte(percentFree));
         textBox2.Text = ("Occupied (%) " + Convert.ToByte(percentOccupied));
     }
 }
Exemple #3
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            Int64   phav            = PerformanceInfo.GetPhysicalAvailableMemoryInMiB();
            Int64   tot             = PerformanceInfo.GetTotalMemoryInMiB();
            decimal percentFree     = ((decimal)phav / (decimal)tot) * 100;
            decimal percentOccupied = 100 - percentFree;

            textBox3.Text = ("Available Physical Memory (MiB) " + phav.ToString());
            textBox4.Text = ("Total Memory (MiB) " + tot.ToString());
            textBox1.Text = ("Free (%) " + percentFree.ToString());
            textBox2.Text = ("Occupied (%) " + percentOccupied.ToString());
            FlushMemory();
            percentToolStripMenuItem.Text = percentFree.ToString() + " gb";
        }
Exemple #4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            textBox12.Text = GetPathFromIsolatedStoragePath();
            textBox6.Text  = getCurrentCpuUsage();
            textBox7.Text  = getAvailableRAM();
            string OPSystemVersion = Environment.OSVersion.ToString();

            textBox8.Text = OPSystemVersion;
            Int64   phav            = PerformanceInfo.GetPhysicalAvailableMemoryInMiB();
            Int64   tot             = PerformanceInfo.GetTotalMemoryInMiB();
            decimal percentFree     = ((decimal)phav / (decimal)tot) * 100;
            decimal percentOccupied = 100 - percentFree;

            textBox3.Text = ("Available Physical Memory (MiB) " + phav.ToString());
            textBox4.Text = ("Total Memory (MiB) " + tot.ToString());
            textBox1.Text = ("Free (%) " + percentFree.ToString());
            textBox2.Text = ("Occupied (%) " + percentOccupied.ToString());
            FlushMemory();
            percentToolStripMenuItem.Text = percentFree.ToString() + " gb";
            long workingSet = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;

            textBox11.Text = workingSet.ToString();
            DriveInfo[]   myDrives = DriveInfo.GetDrives();
            StringBuilder sb       = new StringBuilder();

            foreach (DriveInfo drive in myDrives)
            {
                sb.AppendLine("Drive:" + drive.Name);
                sb.AppendLine("Drive Type:" + drive.DriveType);

                if (drive.IsReady == true)
                {
                    sb.AppendLine("Vol Label:" + drive.VolumeLabel);
                    sb.AppendLine("File System: " + drive.DriveFormat);
                }
            }
            richTextBox1.Text = (sb.ToString());
            // assemblyToolStripMenuItem1.Text = IsolatedStorageFile.GetEnumerator(IsolatedStorageScope.Assembly).ToString();
        }