// ADDS ITEMS TO REPORT
        private void AddReportItem(string ARIName, string ARIType, string ARIValue)
        {
            // int readingwidth = 26;

            // REV 10-27-2017 Exclude Data & Level entries missing values
            // Further work required regarding additional data from OHMonitor
            // Don't remove incomplete Memory Entries since these are updated automatically in Form2.cs

            if ((ARIType == "Data" && ARIValue == "" && !ARIName.Contains("Memory")) || (ARIType == "Level" && ARIValue == ""))
            {
                return;
            }

            // END REV

            OHMitem ARItem = new OHMitem();

            ARItem.name    = ARIName;
            ARItem.type    = ARIType + ": ";
            ARItem.reading = ARIValue;
            if (ARIType == "GpuAti")
            {
                ARItem.type = "Graphics Card";
            }

            if (ARIType == "Temperature")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    // 01-26-2017 ARItem.reading = ((((9.0 / 5.0) * temp) + 32).ToString("000.0") + " F");
                    //ARItem.reading = ((((9.0 / 5.0) * temp) + 32).ToString("F1") + " F");
                    ARItem.reading = temp.ToString("F1") + " C";
                }
                catch
                {
                    return;
                }
            }
            if (ARIType == "Clock")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    if (temp < 1000)
                    {
                        ARItem.reading = (temp.ToString("F1") + " MHZ");
                    }
                    else
                    {
                        temp           = temp / 1000;
                        ARItem.reading = (temp.ToString("F1") + " GHZ");
                    }
                }
                catch
                {
                    return;
                }
            }
            if (ARIType == "Control" || ARIType == "Load")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (temp.ToString("F1") + " %"); // REV 10-30-2017 F0->F1
                }
                catch
                {
                    return;
                }
            }
            if (ARIType == "Voltage")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (temp.ToString("F1") + " V");
                }
                catch
                {
                    return;
                }
            }
            // 07-28-2016 Added This item
            if (ARIType == "Fan")
            {
                try
                {
                    double rpm = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (rpm.ToString("F0") + " RPM");
                }
                catch
                {
                    return;
                }
            }
            // 01-27-2016 Added Item
            if (ARIType == "Power")
            {
                try
                {
                    double watts = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (watts.ToString("F1") + " W");
                }
                catch
                {
                    return;
                }
            }



            ReportItems.Add(ARItem);
        }
Пример #2
0
        // ADDS ITEMS TO REPORT
        private void AddReportItem(string ARIName, string ARIType, string ARIValue)
        {
            if ((ARIType == "Data" && ARIValue == "" && !ARIName.Contains("Memory")) || (ARIType == "Level" && ARIValue == ""))
            {
                return;
            }

            // END REV

            OHMitem ARItem = new OHMitem();

            ARItem.name    = ARIName;
            ARItem.type    = ARIType;
            ARItem.reading = ARIValue;
            if (ARIType == "GpuAti")
            {
                ARItem.type = "Graphics Card";
            }

            if (ARIType == "Temperature")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    // 01-26-2017 ARItem.reading = ((((9.0 / 5.0) * temp) + 32).ToString("000.0") + " F");

                    if (celsius)
                    {
                        ARItem.reading = temp.ToString() + " C";
                    }
                    else
                    {
                        ARItem.reading = ((((9.0 / 5.0) * temp) + 32).ToString("F1") + " F");
                    }
                }
                catch
                {
                    return;
                }
            }
            if (ARIType == "Clock")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    if (temp < 1000)
                    {
                        ARItem.reading = (temp.ToString("F1") + " MHZ");
                    }
                    else
                    {
                        temp           = temp / 1000;
                        ARItem.reading = (temp.ToString("F1") + " GHZ");
                    }
                }
                catch
                {
                    return;
                }
            }
            if (ARIType == "Control" || ARIType == "Load")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (temp.ToString("F1") + " %"); // REV 10-30-2017 F0->F1
                }
                catch
                {
                    return;
                }
            }
            if (ARIType == "Voltage")
            {
                try
                {
                    double temp = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (temp.ToString("F1") + " V");
                }
                catch
                {
                    return;
                }
            }
            // 07-28-2016 Added This item
            if (ARIType == "Fan")
            {
                try
                {
                    double rpm = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (rpm.ToString("F0") + " RPM");
                }
                catch
                {
                    return;
                }
            }
            // 01-27-2016 Added Item
            if (ARIType == "Power")
            {
                try
                {
                    double watts = Convert.ToDouble(ARIValue);
                    ARItem.name    = ARIName;
                    ARItem.reading = (watts.ToString("F1") + " W");
                }
                catch
                {
                    return;
                }
            }


            if (ARItem.name == "")
            {
                ARItem.name = "N/A";
            }

            if (ARItem.type == "")
            {
                ARItem.type = "N/A";
            }

            if (ARItem.reading == "")
            {
                ARItem.reading = "N/A";
                ARItem.name    = "$" + ARItem.name;
            }


            // This text is added only once to the file.
            if (!File.Exists(path))
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(path))
                {
                    sw.WriteLine(ARItem.name);
                    sw.WriteLine(ARItem.type);
                    sw.WriteLine(ARItem.reading);
                }
            }
            else
            {
                using (StreamWriter sw = File.AppendText(path))
                {
                    sw.WriteLine(ARItem.name);
                    sw.WriteLine(ARItem.type);
                    sw.WriteLine(ARItem.reading);
                }
            }
        }