public static QuickLook Parse([NotNull] XmlNode informationPackageMap, [NotNull] XmlNode metadataSection, [NotNull] XmlNode dataObjectSection, [NotNull] XmlNamespaceManager manager, [NotNull] DirectoryInfo baseDirectory) { var quickLook = new QuickLook(); var quickLookNode = informationPackageMap .SelectSingleNodeThrowIfNull("xfdu:contentUnit/xfdu:contentUnit[@repID='s1Level1QuickLookSchema']", manager); var quickLookObjectNode = dataObjectSection .SelectedDataObjectById(quickLookNode.SelectSingleNode("dataObjectPointer").GetAttributeValue("dataObjectID")); quickLook.File = quickLookObjectNode.GetFileInfoFromDataObject(baseDirectory); quickLook.Checksum = quickLookObjectNode.GetChecksumFromDataObject(); quickLook.Documentation = DocumentationParser.ParseQuickLookDocumentation(metadataSection, manager, baseDirectory); return(quickLook); }
private void UpdateValues() { Stopwatch sw = new Stopwatch(); /*if (TrayClicked == true) * { * * * }*/ while (true) { sw.Start(); Cpu cpu = null; Memory ram = null; Network[] net = null; All all = null; FileSystem filesystem = null; QuickLook quicklook = null; Core core = null; try { all = server.PerformQueryHack <All>("all"); //(All)server.PerformQuery<All>(); cpu = all.Cpu; //(Cpu)server.PerformQuery<Cpu>(); ram = (Memory)server.PerformQuery <Memory>(); net = all.Network.ToArray(); //(Network[])server.PerformQuery<Network>(); var fs = server.PerformQueryHack <List <FileSystem> >("fs"); filesystem = fs[0]; //quicklook = all.QuickLook; quicklook = server.PerformQueryHack <QuickLook>("quicklook");// (Glances.Plugins.QuickLook)server.PerformQuery<Glances.Plugins.QuickLook>(); //core = all.Core; //(Core)server.PerformQueryHack<Core>("Core"); core = server.PerformQueryHack <Core>("core"); } catch (Exception ex) { all = new All() { System = new Glances.Plugins.System(), Ip = new Ip() }; cpu = new Cpu(); ram = new Memory(); net = new Network[] { new Network() { InterfaceName = NetInt } }; quicklook = new QuickLook(); core = new Core(); filesystem = new FileSystem() { Size = 0, Used = 0 }; } // this.Invoke((MethodInvoker)delegate //Only on Windows Forms try { { //CPU menuCpu.Text = string.Format("Cpu {0}%", Math.Round((double)cpu.Total, 2)); menuQuickLookCpuName.Text = string.Format("CPU Model : {0}", quicklook.CpuName);// all.QuickLook.CpuName; menuCorePhysical.Text = string.Format("Cores : {0}", core.Physical); menuCoreLogical.Text = string.Format("Threads : {0}", core.Logical); menuQuickLookCpuHz.Text = string.Format("Max Clock : {0}", GetUnitHz(quicklook.CpuHz /*all.QuickLook.CpuHz*/)); menuQuickLookCpuHzCurrent.Text = string.Format("Current Clock : {0}", GetUnitHz(quicklook.CpuHzCurrent /*all.QuickLook.CpuHzCurrent*/)); menuMemLoad.Text = string.Format("MemUsage {0} ({1}%)", GetUnitSize(ram.Total - ram.Free), Math.Round((double)ram.Percent, 2)); var netLo = net.First(x => x.InterfaceName == NetInt); menuNetUp.Text = string.Format("NetUp ˄{0}", GetUnitSize(netLo.Tx)); menuNetDown.Text = string.Format("NetDown ˅{0}", GetUnitSize(netLo.Rx)); menuIpAdress.Text = "IpAddress " + all.Ip.PublicAddress; menuUpTime.Text = "UpTime " + all.Uptime; menuFileSystem.Text = string.Format("FreeSpace: {0}", GetUnitSize(filesystem.Size - filesystem.Used), Math.Round((float)filesystem.Percent, 2)); //menuSystem menuSystem.Text = "System"; menuSystemOsName.Text = "OS : " + all.System.OsName; menuSystemOsVersion.Text = "Kernel : " + all.System.OsVersion; menuSystemLinuxDistro.Text = "Distro : " + all.System.LinuxDistro; menuSystemHostname.Text = "Hostname : " + all.System.Hostname; menuSystemPlatform.Text = "Platform : " + all.System.Platform; menuSystemHumanReadableName.Text = "HRN : " + all.System.HumanReadableName; }//); sw.Stop(); if (sw.ElapsedMilliseconds < 1000) { Thread.Sleep(1000 - (int)sw.ElapsedMilliseconds); } sw.Reset(); } catch (Exception ex) { MessageBox.Show(string.Format("EXCEPTION: {0} {1}\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace)); Debug.WriteLine(string.Format("EXCEPTION: {0} {1}\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace)); } } }