Ejemplo n.º 1
0
        private static void Test1()
        {
            foreach (var item in Enum.GetValues(typeof(TypeCode)))
            {
                var t = (item + "").GetTypeEx();
                Console.WriteLine("{0}\t{1}\t{2}", item, t, t?.IsPrimitive);
            }

            "你好".SpeakAsync();

            XTrace.WriteLine("FullPath:{0}", ".".GetFullPath());
            XTrace.WriteLine("BasePath:{0}", ".".GetBasePath());
            XTrace.WriteLine("TempPath:{0}", Path.GetTempPath());

            var mi = MachineInfo.Current ?? MachineInfo.RegisterAsync().Result;

            foreach (var pi in mi.GetType().GetProperties())
            {
                XTrace.WriteLine("{0}:\t{1}", pi.Name, mi.GetValue(pi));
            }

            Console.WriteLine();

#if __CORE__
            foreach (var pi in typeof(RuntimeInformation).GetProperties())
            {
                XTrace.WriteLine("{0}:\t{1}", pi.Name, pi.GetValue(null));
            }
#endif

            //Console.WriteLine();

            //foreach (var pi in typeof(Environment).GetProperties())
            //{
            //    XTrace.WriteLine("{0}:\t{1}", pi.Name, pi.GetValue(null));
            //}

            mi = MachineInfo.Current;
            for (var i = 0; i < 100; i++)
            {
                XTrace.WriteLine("CPU={0:p2} Temp={1} Memory={2:n0} Disk={3}", mi.CpuRate, mi.Temperature, mi.AvailableMemory.ToGMK(), MachineInfo.GetFreeSpace().ToGMK());
                Thread.Sleep(1000);
                mi.Refresh();
            }

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private static void Test1()
        {
            var b = (Byte)0x0F;

            XTrace.WriteLine("{0} {0:X} {0:X2}", b);
            // 15 F 0F

            //var keys = ECDsaHelper.GenerateKey();
            //XTrace.WriteLine("prvKey:{0}", keys[0]);
            //XTrace.WriteLine("pubKey:{0}", keys[1]);

            //"你好".SpeakAsync();

            XTrace.WriteLine("FullPath:{0}", ".".GetFullPath());
            XTrace.WriteLine("BasePath:{0}", ".".GetBasePath());
            XTrace.WriteLine("TempPath:{0}", Path.GetTempPath());

            var mi = MachineInfo.Current ?? MachineInfo.RegisterAsync().Result;

            foreach (var pi in mi.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                XTrace.WriteLine("{0}:\t{1}", pi.Name, mi.GetValue(pi));
            }

            Console.WriteLine();

#if __CORE__
            foreach (var pi in typeof(RuntimeInformation).GetProperties())
            {
                XTrace.WriteLine("{0}:\t{1}", pi.Name, pi.GetValue(null));
            }
#endif

            //Console.WriteLine();

            //foreach (var pi in typeof(Environment).GetProperties())
            //{
            //    XTrace.WriteLine("{0}:\t{1}", pi.Name, pi.GetValue(null));
            //}

            mi = MachineInfo.Current;
            for (var i = 0; i < 100; i++)
            {
                XTrace.WriteLine("CPU={0:p2} Temp={1} Memory={2:n0} Disk={3}", mi.CpuRate, mi.Temperature, mi.AvailableMemory.ToGMK(), MachineInfo.GetFreeSpace().ToGMK());
                Thread.Sleep(1000);
                mi.Refresh();
            }

            Console.ReadKey();
        }