⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 老外的一个开源项目
💻 CS
字号:
// Copyright (c) David Vescovi.  All rights reserved.
// Part of Project DrumStix
// Windows Embedded Developers Interest Group (WE-DIG) community project.
// http://www.we-dig.org

using System;
using System.Reflection;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Gumstix;
using Gumstix.Utilities;
using OpenNETCF;

namespace BSP_info
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            char[] delimiterChars = { '=', ',' };
            string outputString;
            string[] words;
            const int versionIndex = 2;
            Int32 BSPVersionMajor = 0;
            Int32 BSPVersionMinor = 0;
            object registryValue;

            InitializeComponent();
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, this.Text);
            lblMachine.Text = Environment2.MachineName;
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblMachineT.Text, lblMachine.Text));
            lblOS.Text = Environment.OSVersion.Version.ToString();
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblOST.Text, lblOS.Text));
            lblProcessor.Text = OpenNETCF.WindowsCE.DeviceManagement.SystemInformation.ProcessorType.ToString();
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblProcessorT.Text, lblProcessor.Text));
            switch (IO.Frequency.runSpeed)
            {
                case IO.Frequency.RunSpeed.SP100MHZ:
                    lblSpeed.Text = "100Mhz";
                    break;
                case IO.Frequency.RunSpeed.SP200MHZ:
                    lblSpeed.Text = "200Mhz";
                    break;
                case IO.Frequency.RunSpeed.SP300MHZ:
                    lblSpeed.Text = "300Mhz";
                    break;
                case IO.Frequency.RunSpeed.SP400MHZ:
                    lblSpeed.Text = "400Mhz";
                    break;
            }
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblSpeedT.Text, lblSpeed.Text));
            lblBootLoaderVersion.Text = IO.Bootloader.Version;
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblBootLoaderVersionT.Text, lblBootLoaderVersion.Text));
            lblHardwareConfiguration.Text = "0x" + Convert.ToString(IO.Bootloader.HardwareConfiguration, 16);
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblHardwareConfigurationT.Text, lblHardwareConfiguration.Text));
            lblCF.Text = Environment.Version.ToString();
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblCFT.Text, lblCF.Text));
            lblOEM.Text = OpenNETCF.WindowsCE.DeviceManagement.OemInfo.ToString();
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblOEMT.Text, lblOEM.Text));
            lblBSP.Text = (String)Registry.GetValue((IntPtr)Registry.HKey.LOCAL_MACHINE, "\\IDENT", "BSPName"); ;
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblBSPT.Text, lblBSP.Text));
            registryValue = Registry.GetValue((IntPtr)Registry.HKey.LOCAL_MACHINE, "\\IDENT", "BSPVersionMajor");
            if (registryValue != null)
            {
                BSPVersionMajor = (Int32)registryValue;
            }
            registryValue = Registry.GetValue((IntPtr)Registry.HKey.LOCAL_MACHINE, "\\IDENT", "BSPVersionMinor");
            if (registryValue != null)
            {
                BSPVersionMinor = (Int32)registryValue;
            }
            lblBSPVer.Text = BSPVersionMajor.ToString() + "." + BSPVersionMinor.ToString();
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblBSPVerT.Text, lblBSPVer.Text));
            outputString = Assembly.Load("GumstixManagedAPI").FullName;
            words = outputString.Split(delimiterChars);
            lblManagedAPI.Text = words[versionIndex];
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblManagedAPIT.Text, lblManagedAPI.Text));
            lblSDF.Text = Environment2.SdfVersion.ToString();
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblSDFT.Text, lblSDF.Text));
            lblOSDesign.Text = (String)Registry.GetValue((IntPtr)Registry.HKey.LOCAL_MACHINE, "\\IDENT", "OSDesignName"); ;
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblOSDesignT.Text, lblOSDesign.Text));
            registryValue = Registry.GetValue((IntPtr)Registry.HKey.LOCAL_MACHINE, "\\IDENT", "OSDesignVersion"); ;
            if (registryValue != null)
                lblOSDesignVer.Text = Convert.ToString((Int32)registryValue);
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblOSDesignVerT.Text, lblOSDesignVer.Text));
            lblOSBuilt.Text = (String)Registry.GetValue((IntPtr)Registry.HKey.LOCAL_MACHINE, "\\IDENT", "OSBuildDateTime"); ;
            OpenNETCF.Diagnostics.ReleaseMessage.WriteLine(true, String.Format("{0} {1}", lblOSBuiltT.Text, lblOSBuilt.Text));
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -