/// <summary> /// Create a global instance of this panel /// </summary>> public static OperatingSystem CreateInstance() { if (panelInstance == null) { panelInstance = new OperatingSystem(); OSShortVersion = info.OSShortVersion; OSPlatform = info.OSPlatform; OSFullName = info.OSFullName; OSVersion = info.OSVersion; OSServicePack = info.OSServicePack; OSType = info.OSType; OSCodeName = info.OSCodeName; OSMachineName = info.OSMachineName; OSUserName = info.OSUserName; UserIsAdministrator = info.UserIsAdministrator; OSProductID = info.OSProductID; OSProductKey = info.OSProductKey; OSInstallDate = info.OSInstallDate; FrameworkShortVersion = info.FrameworkShortVersion; FrameworkVersion = info.FrameworkVersion; FrameworkServicePack = info.FrameworkServicePack; } return panelInstance; }
public static void Clone() { var os = new OperatingSystem(PlatformID.Xbox, new Version(1, 2, 3, 4)); var os2 = (OperatingSystem)os.Clone(); Assert.Equal(os.Platform, os2.Platform); Assert.Equal(os.ServicePack, os2.ServicePack); Assert.Equal(os.Version, os2.Version); Assert.Equal(os.VersionString, os2.VersionString); }
public static void SerializeDeserialize() { var os = new OperatingSystem(PlatformID.WinCE, new Version(5, 6, 7, 8)); var os2 = BinaryFormatterHelpers.Clone(os); Assert.Equal(os.Platform, os2.Platform); Assert.Equal(os.ServicePack, os2.ServicePack); Assert.Equal(os.Version, os2.Version); Assert.Equal(os.VersionString, os2.VersionString); }
public static void Ctor(PlatformID id, string versionString) { var os = new OperatingSystem(id, new Version(versionString)); Assert.Equal(id, os.Platform); Assert.Equal(new Version(versionString), os.Version); Assert.Equal(string.Empty, os.ServicePack); Assert.NotEmpty(os.VersionString); Assert.Equal(os.VersionString, os.ToString()); }
public Computer() { OperatingSystem = new OperatingSystem(); Printers = new List<Printer>(); System = new System(); NetworkAdapters = new List<NetworkAdapter>(); Processes = new List<Process>(); Shares = new List<Share>(); LogicalDisks = new List<LogicalDisk>(); Processors = new List<Processor>(); }
static void setUpPlatform() { //Debug.Log ("platform: " + Application.platform); if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.OSXEditor) { currentOS = OperatingSystem.OSX; } else { currentOS = OperatingSystem.Win; } }
/// <summary> /// Retourneert software /// </summary> /// <param name="type">Het soort software</param> /// <param name="version">Versie van software</param> /// <returns></returns> public static ISoftware CreateSoftware(string type, string version) { ISoftware s = null; switch (type) { case "os": s = new OperatingSystem(version); break; case "office": s = new OfficeSuite(version); break; } return s; }
public Reporting() { os = new OperatingSystem(); cpu = new CPU(); gfx = new GFX(); hardDrive = new HardDrive(); programs = new InstalledPrograms(); mb = new Motherboard(); pageFile = new PageFile(); processes = new ProcessList(); memory = new RAM(); services = new ServiceList(); startupItems = new StartupItems(); hd = new HardDrive(); report = ""; }
public static Client CollectClientInformation() { Client client = new Client(); OperatingSystem os = new OperatingSystem(); ClientType cType = new ClientType(); cType.Name = Settings.Default.ClientTypeName; client.Id = GetUniqueMachineId(); client.HeuristicLabVersion = GetHLVersion(); client.Name = GetMachineName(); client.MemorySize = GetPhysicalMemory().GetValueOrDefault(); client.NumberOfCores = GetNumberOfCores(); os.Name = GetOperatingSystem(); client.OperatingSystem = os; client.ProcessorType = GetCpuInfo(); client.ClientType = cType; client.ClientConfiguration = GetClientConfiguration(); client.Timestamp = DateTime.Now; client.PerformanceValue = RunBenchmark(); return client; }
partial void DeleteOperatingSystem(OperatingSystem instance);
partial void InsertOperatingSystem(OperatingSystem instance);
} catch (Exception) { Console.WriteLine("Error reading settings from file: " + settingsFile); throw; } return ServiceManagementHelper.EncodeToBase64String(settings); } internal static string TryGetConfigurationSetting(string configName) { var setting = ConfigurationSettings.AppSettings[configName]; if (setting == null) {
// Wraps calls to acquire the OperatingSystem version private OperatingSystem GetOperatingSystem() { #if CORECLR if (localOs == null) { OSVERSIONINFOEX osviex = new OSVERSIONINFOEX(); osviex.OSVersionInfoSize = Marshal.SizeOf(osviex); if (!GetVersionEx(ref osviex)) { int errorCode = Marshal.GetLastWin32Error(); throw new Win32Exception(errorCode); } Version ver = new Version(osviex.MajorVersion, osviex.MinorVersion, osviex.BuildNumber, (osviex.ServicePackMajor << 16) | osviex.ServicePackMinor); localOs = new OperatingSystem(ver, osviex.CSDVersion); } return localOs; #else return Environment.OSVersion; #endif }
/// <summary> /// Initializes a new instance of the <see cref="OperatingSystemInfo"/> class. /// </summary> public OperatingSystemInfo() { _operatingSystem = System.Environment.OSVersion; }
// Cloneable public object Clone() { OperatingSystem os = new OperatingSystem(); os.majorRevision = this.majorRevision; os.minorRevision = this.minorRevision; os.microRevision = this.microRevision; os.nanoRevision = this.nanoRevision; os.confidence = this.confidence; os.PutPropertiesMap(this.properties); return os; }
/// <summary> /// Create a new OperatingSystem object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="architecture">Initial value of the Architecture property.</param> public static OperatingSystem CreateOperatingSystem(global::System.Int32 id, global::System.String name, global::System.Int32 architecture) { OperatingSystem operatingSystem = new OperatingSystem(); operatingSystem.Id = id; operatingSystem.Name = name; operatingSystem.Architecture = architecture; return operatingSystem; }
/// <summary>Creates a symbolic link using command line tools.</summary> public static bool CreateSymbolicLink(string linkPath, string targetPath, bool isDirectory) { // It's easy to get the parameters backwards. Assert.EndsWith(".link", linkPath); if (linkPath != targetPath) // testing loop { Assert.False(targetPath.EndsWith(".link"), $"{targetPath} should not end with .link"); } #if NETFRAMEWORK bool isWindows = true; #else if (OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsMacCatalyst() || OperatingSystem.IsBrowser()) // OSes that don't support Process.Start() { return(false); } bool isWindows = OperatingSystem.IsWindows(); #endif Process symLinkProcess = new Process(); if (isWindows) { symLinkProcess.StartInfo.FileName = "cmd"; symLinkProcess.StartInfo.Arguments = string.Format("/c mklink{0} \"{1}\" \"{2}\"", isDirectory ? " /D" : "", linkPath, targetPath); } else { symLinkProcess.StartInfo.FileName = "/bin/ln"; symLinkProcess.StartInfo.Arguments = string.Format("-s \"{0}\" \"{1}\"", targetPath, linkPath); } symLinkProcess.StartInfo.UseShellExecute = false; symLinkProcess.StartInfo.RedirectStandardOutput = true; symLinkProcess.Start(); symLinkProcess.WaitForExit(); return(symLinkProcess.ExitCode == 0); }
public string Init(string[] files, string[] usernames) { players.Clear(); Console.WriteLine("r2path = " + r2paths.r2); if (File.Exists(r2paths.r2) || !OperatingSystem.IsWindows()) { string cone = string.Format("-w malloc://{0}", memsize); // inicializamos las 2 instancias de r2, si ya estan inicializadas restauramos el estado inicial nPlayers = files.Count(); int addr = 0; int anotherAddr = 512; string [] arenas = { "", "" }; string[] newsrc = { "", "" }; string[] newrasm2params = { "", "" }; string[] newfile = { "", "" }; string[] newr2params = { "", "" }; r2archs.eArch[] newarch = { r2archs.eArch.unknow, r2archs.eArch.unknow }; Console.WriteLine("==== LOADING WARRIOR ===="); for (int x = 0; x < this.nPlayers; x++) { newfile[x] = files[x]; newarch [x] = r2archs.archfromfileext(newfile[x]); newr2params[x] = r2archs.r2param(newarch[x]); newrasm2params[x] = r2archs.rasm2param(newarch[x]); Console.WriteLine(" rasm params = {0} {1}", newrasm2params[x], newfile[x]); newsrc[x] = RunAndGetOutput(r2paths.rasm2, string.Format("{0} -f {1}", newrasm2params[x], newfile[x])).Replace("\r", "").Replace("\n", ""); Console.WriteLine(" Rasm Output = {0}", newsrc[x]); Console.WriteLine(" Rasm size = {0}", newsrc[x].Length / 2); Console.WriteLine("========================="); if (newsrc[x] == "") { return("Invalid source"); } if (newsrc[x].Length / 2 > 512) { return("Invalid source bot >512 bytes"); } } // calculamos un valor aleatorio para determinar la posicion del primer jugador 0=arriba, 1=abajo Random rnd = new Random(Environment.TickCount & Int32.MaxValue); int pos = rnd.Next(0, 2); Console.WriteLine("Initial position Player 0 {0}={1}", pos, pos == 0 ? "arriba" : "abajo"); for (int x = 0; x < this.nPlayers; x++) { if (this.r2[x] == null) { this.r2[x] = new R2Pipe(cone, r2paths.r2); } // seleccionamos la arch this.r2[x].RunCommand(newr2params[x]); this.r2[x].RunCommand("e scr.color=false"); this.r2[x].RunCommand("e asm.lines=false"); this.r2[x].RunCommand("e asm.flags=false"); this.r2[x].RunCommand("e asm.comments=false"); this.r2[x].RunCommand("e asm.bytes=false"); this.r2[x].RunCommand("e cfg.r2wars=true"); this.r2[x].RunCommand("pd"); // guardamos el estado inicial de esil para esta arch if (initstate[(int)newarch[x]] == "") { this.r2[x].RunCommand("aei"); this.r2[x].RunCommand("aeim"); initstate[(int)newarch[x]] = this.r2[x].RunCommand("aerR").Replace("\r", "").Replace("\n", ";"); } // si ya tenemos estado guardado restauramos los registros else { this.r2[x].RunCommand(initstate[(int)newarch[x]]); this.r2[x].RunCommand("aei"); this.r2[x].RunCommand("aeim"); } // reseteamos la memoria this.r2[x].RunCommand(string.Format("w0 {0} @ 0", memsize)); // calculamos donde poner el codigo en la arena if (pos == 0) { pos = 1; // jugador entre 0 y 512; while (true) { if (newsrc[x].Length == 1024) { anotherAddr = 0; addr = 0; break; } addr = rnd.Next(0, anotherAddr - newsrc[x].Length / 2); if (addr % 4 == 0) { anotherAddr = addr + newsrc[x].Length / 2; break; } } } else { pos = 0; //jugador jugador entre 512 y 1024 while (true) { if (newsrc[x].Length == 1024) { anotherAddr = 512; addr = 512; break; } addr = rnd.Next(anotherAddr, 1024 - newsrc[x].Length / 2); if (addr % 4 == 0) { anotherAddr = addr; break; } } } Console.WriteLine("Player {0} position {1}-{2} ({3})", x, addr, addr + newsrc[x].Length / 2, newsrc[x].Length / 2); // Añadimos el codigo del jugador string cmd = string.Format("wx {0} @ {1}", newsrc[x], addr); this.r2[x].RunCommand(cmd); arenas[x] = cmd; // Configuramos PC cmd = string.Format("aer PC={0}", addr); this.r2[x].RunCommand(cmd); // Configuramos STACK cmd = string.Format("aer SP=SP+{0}", addr); this.r2[x].RunCommand(cmd); // Obtenemos los registros para esta partida/jugador string initRegs = this.r2[x].RunCommand("aerR").Replace("\r", "").Replace("\n", ";"); // Iniciamos el jugador añadiendo sus datos de programa player p = new player(usernames[x], addr, newsrc[x].Length / 2, newsrc[x], initRegs); // lo añadimos a la lista de jugadores players.Add(p); int ciclos = GetPCInstructionCycles(x); players[x].actual.cycles = ciclos; players[x].actual.ins = GetPCInstruction(x); players[x].actual.dasm = GetFullProgram(x); players[x].actual.regs = GetRegs(x); players[x].actual.pc = "0x" + GetPC(x).ToString("X8"); players[x].actual.pcsize = GetPCSize(x); players[x].actual.oldpc = 4096; players[x].actual.oldpcsize = 0; players[x].actual.mem = GetMemAccessRAW(x); // borramos el log p.log.Clear(); this.r2[x].RunCommand("e cmd.esil.todo=f theend=1"); this.r2[x].RunCommand("e cmd.esil.trap=f theend=2"); this.r2[x].RunCommand("e cmd.esil.intr=f theend=3"); this.r2[x].RunCommand("e cmd.esil.ioer=f theend=4"); this.r2[x].RunCommand("f theend=0"); this.r2[x].RunCommand(string.Format("b {0}", memsize)); } Console.WriteLine(""); // sincronizamos las arenas this.r2[1].RunCommand(arenas[0]); this.r2[0].RunCommand(arenas[1]); if (players.Count < 2) { return("You need at least 2 users"); } return("OK"); } return("NOK"); }
public static void setPlatform() { string OSstring = SystemInfo.operatingSystem.ToString(); //Debug.Log(OSstring); if (OSstring.Contains("Windows")) { currentSystem = OperatingSystem.Win; } else if (OSstring.Contains("OS X")) { currentSystem = OperatingSystem.OSX; } // Debug.Log("Hello"); }
private static unsafe void CompletionPortCallback(uint errorCode, uint numBytes, NativeOverlapped *nativeOverlapped) { Debug.Assert(OperatingSystem.IsWindows()); BaseOverlappedAsyncResult asyncResult = (BaseOverlappedAsyncResult)ThreadPoolBoundHandle.GetNativeOverlappedState(nativeOverlapped) !; Debug.Assert(!asyncResult.InternalPeekCompleted, $"asyncResult.IsCompleted: {asyncResult}"); if (NetEventSource.Log.IsEnabled()) { NetEventSource.Info(null, $"errorCode:{errorCode} numBytes:{numBytes} nativeOverlapped:{(IntPtr)nativeOverlapped}"); } // Complete the IO and invoke the user's callback. SocketError socketError = (SocketError)errorCode; if (socketError != SocketError.Success && socketError != SocketError.OperationAborted) { // There are cases where passed errorCode does not reflect the details of the underlined socket error. // "So as of today, the key is the difference between WSAECONNRESET and ConnectionAborted, // .e.g remote party or network causing the connection reset or something on the local host (e.g. closesocket // or receiving data after shutdown (SD_RECV)). With Winsock/TCP stack rewrite in longhorn, there may // be other differences as well." Socket?socket = asyncResult.AsyncObject as Socket; if (socket == null) { socketError = SocketError.NotSocket; } else if (socket.Disposed) { socketError = SocketError.OperationAborted; } else { try { // The async IO completed with a failure. // Here we need to call WSAGetOverlappedResult() just so GetLastSocketError() will return the correct error. SocketFlags ignore; bool success = Interop.Winsock.WSAGetOverlappedResult( socket.SafeHandle, nativeOverlapped, out numBytes, false, out ignore); Debug.Assert(!success, $"Unexpectedly succeeded. errorCode:{errorCode} numBytes:{numBytes}"); if (!success) { socketError = SocketPal.GetLastSocketError(); } } catch (ObjectDisposedException) { // Disposed check above does not always work since this code is subject to race conditions socketError = SocketError.OperationAborted; } } } // Set results and invoke callback asyncResult.CompletionCallback((int)numBytes, socketError); }
private void SetPlatform() { // Extract system RID from dotnet cli List <string> commandArgs = new List <string> { "--info" }; if (_verbose) { Console.WriteLine("Running: {0} {1}", "dotnet", String.Join(" ", commandArgs)); } // Running "dotnet" (the executable, not the .cmd/.sh wrapper script) when the current // directory is within a runtime repo clone does not give us the information we want: // it is missing the "OS Platform" and "RID" lines. So, pick some other directory that // is expected to not be in a repo clone, and run the "dotnet" command from that directory. string commandWorkingDirectory = ""; OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; switch (pid) { case PlatformID.Win32NT: commandWorkingDirectory = Environment.SystemDirectory; break; case PlatformID.Unix: commandWorkingDirectory = "/"; // Use the root directory break; default: break; } ProcessResult result = Utility.ExecuteProcess("dotnet", commandArgs, true, commandWorkingDirectory); if (result.ExitCode != 0) { Console.Error.WriteLine("dotnet --info returned non-zero"); } var lines = result.StdOut.Split(new[] { Environment.NewLine }, StringSplitOptions.None); foreach (var line in lines) { Regex pattern = new Regex(@"OS Platform:([\sA-Za-z0-9\.-]*)$"); Match match = pattern.Match(line); if (match.Success) { if (match.Groups[1].Value.Trim() == "Windows") { _os = "Windows"; } else if (match.Groups[1].Value.Trim() == "Darwin") { _os = "OSX"; } else if (match.Groups[1].Value.Trim() == "Linux") { // Assuming anything other than Windows or OSX is a Linux flavor _os = "Linux"; } else { Console.WriteLine("Unknown operating system. Please specify with --os"); Environment.Exit(-1); } } } }
public void It_builds_a_framework_dependent_RID_specific_runnable_output() { var runtimeIdentifier = RuntimeInformation.RuntimeIdentifier; var testAsset = _testAssetsManager .CopyTestAsset("AppWithLibraryAndRid", "BuildFrameworkDependentRIDSpecific") .WithSource(); if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) { // .NET Core 2.1.0 packages don't support latest versions of OS X, so roll forward to the // latest patch which does testAsset = testAsset.WithProjectChanges(project => { var ns = project.Root.Name.Namespace; var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); propertyGroup.Add(new XElement("TargetLatestRuntimePatch", true)); }); } var restoreCommand = new RestoreCommand(testAsset, "App"); restoreCommand .Execute($"/p:TestRuntimeIdentifier={runtimeIdentifier}") .Should() .Pass(); var buildCommand = new BuildCommand(testAsset, "App"); buildCommand .Execute($"/p:RuntimeIdentifier={runtimeIdentifier}", $"/p:TestRuntimeIdentifier={runtimeIdentifier}", "/p:SelfContained=false") .Should().Pass(); var outputDirectory = buildCommand.GetOutputDirectory(ToolsetInfo.CurrentTargetFramework, runtimeIdentifier: runtimeIdentifier); outputDirectory.Should().NotHaveSubDirectories(); var sqlFile = ""; if (OperatingSystem.IsWindows()) { sqlFile = "sqlite3.dll"; } else if (OperatingSystem.IsLinux()) { sqlFile = "libsqlite3.so"; } else if (OperatingSystem.IsMacOS()) { sqlFile = "libsqlite3.dylib"; } string[] expectedFiles = new[] { $"App{Constants.ExeSuffix}", "App.dll", "App.pdb", "App.deps.json", "App.runtimeconfig.json", "LibraryWithoutRid.dll", "LibraryWithoutRid.pdb", "LibraryWithRid.dll", "LibraryWithRid.pdb", "LibraryWithRids.dll", "LibraryWithRids.pdb", sqlFile }; outputDirectory.Should().OnlyHaveFiles(expectedFiles.Where(x => !String.IsNullOrEmpty(x)).ToList()); new DotnetCommand(Log, Path.Combine(outputDirectory.FullName, "App.dll")) .Execute() .Should().Pass() .And.HaveStdOutContaining($"3.13.0 '{runtimeIdentifier}' 3.13.0 '{runtimeIdentifier}' Hello World"); }
/// <summary> /// Gather details about the environment the application is running in /// <param name="includeEnvVars">Indicate whether to include environment varialbles or not.Default is false</param> /// <returns>Returns an instance of ApplicationEnvironment</returns> /// </summary> public static ApplicationEnvironment GetApplicationEnvironment(bool includeEnvVars = false) { ApplicationEnvironment env = new ApplicationEnvironment(); env.ProcessId = Process.GetCurrentProcess().Id; env.ProcessStartTime = Process.GetCurrentProcess().StartTime; env.Hostname = Dns.GetHostName(); #if DNXCORE50 || DOTNET5_4 // Allow OS detection on .NET Core if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { env.Os = "Linux"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { env.Os = "Windows"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { env.Os = "Mac OSX"; } else { env.Os = "Unknown"; } #else OperatingSystem os = Environment.OSVersion; PlatformID platform = os.Platform; switch (platform) { case PlatformID.Unix: env.Os = "Linux/Unix"; break; case PlatformID.Win32NT: env.Os = "Windows"; break; default: env.Os = "Unknown"; break; } env.OsVersion = Environment.OSVersion.Version.ToString(); #endif // Framework detection #if DNXCORE50 // Use compiler target detection for CoreCLR env.Framework = "CoreCLR"; #else env.Framework = Type.GetType("Mono.Runtime") != null ? "Mono" : ".NET Framework"; #endif if (includeEnvVars) { // Loop over environment variables to escape special characters IDictionary envVars = Environment.GetEnvironmentVariables(); foreach (var envVarKey in envVars.Keys) { string envVarValue = envVars[envVarKey].ToString(); envVarValue = envVarValue.Replace("\\", "\\\\"); envVarValue = envVarValue.Replace('"', '\"'); env.EnvironmentVariables.Add(envVarKey.ToString(), envVarValue); } } // Loop over configuration sources and get their values foreach (var source in AppConfig.Sources.Keys) { env.ApplicationConfiguration.Add(source, AppConfig.GetAllValues(source)); } #if !DNXCORE50 && !DOTNET5_4 env.CommandLine = Environment.CommandLine.Replace("\\", "\\\\"); #endif return(env); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { if (FSOEnvironment.DPIScaleFactor != 1 || FSOEnvironment.SoftwareDepth) { GlobalSettings.Default.GraphicsWidth = GraphicsDevice.Viewport.Width / FSOEnvironment.DPIScaleFactor; GlobalSettings.Default.GraphicsHeight = GraphicsDevice.Viewport.Height / FSOEnvironment.DPIScaleFactor; } OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix); FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice); base.Initialize(); GameFacade.GameThread = Thread.CurrentThread; SceneMgr = new _3DLayer(); SceneMgr.Initialize(GraphicsDevice); uiLayer = new UILayer(this, Font, BigFont); GameFacade.Controller = new GameController(); GameFacade.Screens = uiLayer; GameFacade.Scenes = SceneMgr; GameFacade.GraphicsDevice = GraphicsDevice; GameFacade.GraphicsDeviceManager = Graphics; GameFacade.Cursor = new CursorManager(this.Window); if (!GameFacade.Linux) { GameFacade.Cursor.Init(FSO.Content.Content.Get().GetPath("")); } /** Init any computed values **/ GameFacade.Init(); //init audio now HITVM.Init(); GameFacade.Strings = new ContentStrings(); GameFacade.Controller.StartLoading(); GraphicsDevice.RasterizerState = new RasterizerState() { CullMode = CullMode.None }; try { var audioTest = new SoundEffect(new byte[2], 44100, AudioChannels.Mono); //initialises XAudio. audioTest.CreateInstance().Play(); } catch (Exception e) { e = new Exception(); } this.IsMouseVisible = true; this.IsFixedTimeStep = true; this.Window.AllowUserResizing = true; this.Window.ClientSizeChanged += new EventHandler <EventArgs>(Window_ClientSizeChanged); if (!FSOEnvironment.SoftwareKeyboard) { AddTextInput(); } base.Screen.Layers.Add(SceneMgr); base.Screen.Layers.Add(uiLayer); GameFacade.LastUpdateState = base.Screen.State; //this.Window.Title = "FreeSO"; if (!GlobalSettings.Default.Windowed && !GameFacade.GraphicsDeviceManager.IsFullScreen) { GameFacade.GraphicsDeviceManager.ToggleFullScreen(); } }
// 判断Windows系统是否为旧版本 private static bool IsOldOsVersion() { OperatingSystem os = Environment.OSVersion; return(os.Platform != PlatformID.Win32NT || os.Version.Major < 6); }
public bool InitWithArguments(string[] args) { string baseDir = AppDomain.CurrentDomain.BaseDirectory; Directory.SetCurrentDirectory(baseDir); AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); //AppDomain.CurrentDomain.SetDynamicBase(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/JITCache/")); OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; ILocator gameLocator; bool linux = pid == PlatformID.MacOSX || pid == PlatformID.Unix; if (linux && Directory.Exists("/Users")) { gameLocator = new MacOSLocator(); } else if (linux) { gameLocator = new LinuxLocator(); } else { gameLocator = new WindowsLocator(); } bool useDX = false; #region User resolution parmeters foreach (var arg in args) { if (char.IsDigit(arg[0])) { //attempt parsing resoulution try { var split = arg.Split("x".ToCharArray()); int ScreenWidth = int.Parse(split[0]); int ScreenHeight = int.Parse(split[1]); GlobalSettings.Default.GraphicsWidth = ScreenWidth; GlobalSettings.Default.GraphicsHeight = ScreenHeight; } catch (Exception) { } } else if (arg[0] == '-') { var cmd = arg.Substring(1); if (cmd.StartsWith("lang")) { GlobalSettings.Default.LanguageCode = byte.Parse(cmd.Substring(4)); } else if (cmd.StartsWith("hz")) { GlobalSettings.Default.TargetRefreshRate = int.Parse(cmd.Substring(2)); } else { //normal style param switch (cmd) { case "dx11": case "dx": useDX = true; break; case "gl": case "ogl": useDX = false; break; case "ts1": GlobalSettings.Default.TS1HybridEnable = true; break; case "tso": GlobalSettings.Default.TS1HybridEnable = false; break; case "3d": FSOEnvironment.Enable3D = true; break; case "touch": FSOEnvironment.SoftwareKeyboard = true; break; case "nosound": FSOEnvironment.NoSound = true; break; } } } else { if (arg.Equals("w", StringComparison.InvariantCultureIgnoreCase)) { GlobalSettings.Default.Windowed = true; } else if (arg.Equals("f", StringComparison.InvariantCultureIgnoreCase)) { GlobalSettings.Default.Windowed = false; } } } #endregion UseDX = MonogameLinker.Link(useDX); var path = gameLocator.FindTheSimsOnline(); if (path != null) { //check if this path has tso in it. tuning.dat should be a good indication. if (!File.Exists(Path.Combine(path, "tuning.dat"))) { ShowDialog("The Sims Online appears to be missing. The game expects TSO at directory '" + path + "', but some core files are missing from that folder. If you know you installed TSO into a different directory, please move it into the directory specified."); return(false); } FSOEnvironment.Args = string.Join(" ", args); FSOEnvironment.ContentDir = "Content/"; FSOEnvironment.GFXContentDir = "Content/" + (UseDX ? "DX/" : "OGL/"); FSOEnvironment.Linux = linux; FSOEnvironment.DirectX = UseDX; FSOEnvironment.GameThread = Thread.CurrentThread; if (GlobalSettings.Default.LanguageCode == 0) { GlobalSettings.Default.LanguageCode = 1; } Files.Formats.IFF.Chunks.STR.DefaultLangCode = (Files.Formats.IFF.Chunks.STRLangCode)GlobalSettings.Default.LanguageCode; GlobalSettings.Default.StartupPath = path; GlobalSettings.Default.ClientVersion = GetClientVersion(); return(true); } else { ShowDialog("The Sims Online was not found on your system. FreeSO will not be able to run without access to the original game files."); return(false); } }
/// <summary> /// Deprecated Method for adding a new object to the OperatingSystems EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToOperatingSystems(OperatingSystem operatingSystem) { base.AddObject("OperatingSystems", operatingSystem); }
private void getOS() { OperatingSystem os = Environment.OSVersion; Version vs = os.Version; string osname = ""; if (os.Platform == PlatformID.Win32Windows) { if (vs.Minor == 0) { osname = "95"; } else if (vs.Minor == 10) { if (vs.Revision.ToString() == "2222A") { osname = "98SE"; } else { osname = "98"; } } else if (vs.Minor == 90) { osname = "Me"; } } else if (os.Platform == PlatformID.Win32NT) { if (vs.Major == 3) { osname = "NT 3.51"; } else if (vs.Major == 4) { osname = "NT 4"; } else if (vs.Major == 5) { if (vs.Minor == 0) { osname = "2000"; } else { osname = "XP"; } } else if (vs.Major == 6) { if (vs.Minor == 0) { osname = "Vista"; } else if (vs.Minor == 1) { osname = "7"; } else if (vs.Minor == 2) { osname = "8"; } else { osname = "8.1"; } } else if (vs.Major == 10) { osname = "10"; } } if (osname != "") { osname = "Windows " + osname; if (os.ServicePack != "") { osname += os.ServicePack; } } label1.Text = osname; }
public static bool InitWithArguments(string[] args) { AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve; //Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Console.WriteLine("Loading Content..."); ILocator locator; OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; bool linux = pid == PlatformID.MacOSX || pid == PlatformID.Unix; if (linux) { locator = new LinuxLocator(); } else { locator = new WindowsLocator(); } string path = locator.FindTheSimsOnline(); bool useDX = false; UseDX = MonogameLinker.Link(useDX); if (path != null) { GlobalSettings.Default.Load(); var simspath = locator.FindTheSimsComplete(); FSOEnvironment.SimsCompleteDir = simspath; FSOEnvironment.ContentDir = "Content/"; FSOEnvironment.GFXContentDir = "Content/" + (useDX ? "DX/" : "OGL/"); GlobalSettings.Default.StartupPath = path; GlobalSettings.Default.Save(); } FSO.Content.Content.Init(path, null); Console.WriteLine("Success!"); Console.WriteLine("Starting VM server..."); PacketHandlers.Register((byte)PacketType.VM_PACKET, false, 0, new OnPacketReceive(VMPacket)); StartVM(); Stream inputStream = Console.OpenStandardInput(); while (true) { Inst.SendMessage(Console.ReadLine()); } }
public static List<OperatingSystem> Get_OperatingSystems(ManagementScope scope) { List<OperatingSystem> result = new List<OperatingSystem>(); ObjectQuery wmiquery = new ObjectQuery("SELECT * FROM Win32_OperatingSystem"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, wmiquery); ManagementObjectCollection coll = searcher.Get(); foreach (ManagementObject queryObj in coll) { var os = new OperatingSystem(); if(queryObj["CSDVersion"] != null) os.ServicePack = queryObj["CSDVersion"].ToString().Trim(' '); os.Manufacturer = queryObj["Manufacturer"].ToString().Trim(' '); os.Version = queryObj["Version"].ToString().Trim(' '); os.Architecture = queryObj["OSArchitecture"].ToString().Trim(' '); os.RegisteredUser = queryObj["RegisteredUser"].ToString().Trim(' '); os.Organization = queryObj["Organization"].ToString().Trim(' '); os.CodeSet = queryObj["CodeSet"].ToString().Trim(' '); os.CountryCode = queryObj["CountryCode"].ToString().Trim(' '); os.CurrentTimeZone = queryObj["CurrentTimeZone"].ToString().Trim(' '); os.EncryptionLevel = queryObj["EncryptionLevel"].ToString().Trim(' '); os.ForegroundApplicationBoost = queryObj["ForegroundApplicationBoost"].ToString().Trim(' '); os.InstallDate = ToDateTime(queryObj["InstallDate"].ToString().Trim(' ')).ToString(); os.LastBootupTime = ToDateTime(queryObj["LastBootUpTime"].ToString().Trim(' ')).ToString(); os.LocalDateTime = ToDateTime(queryObj["LocalDateTime"].ToString().Trim(' ')).ToString(); os.Locale = queryObj["Locale"].ToString().Trim(' '); os.OSLanguage = queryObj["OSLanguage"].ToString().Trim(' '); os.OSType = queryObj["OSType"].ToString().Trim(' '); os.ProductType = Convert.ToInt32(queryObj["ProductType"].ToString().Trim(' ')); os.ProductID = queryObj["SerialNumber"].ToString().Trim(' '); os.SystemDrive = queryObj["SystemDrive"].ToString().Trim(' '); os.WindowsDirectory = queryObj["WindowsDirectory"].ToString().Trim(' '); os.SKU = queryObj["OperatingSystemSKU"].ToString().Trim(' '); os.ProductName = queryObj["Caption"].ToString().Trim(' '); string softwareRegLoc = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\"; ManagementClass registry = new ManagementClass(scope, new ManagementPath("StdRegProv"), null); ManagementBaseObject inParams = registry.GetMethodParameters("GetBinaryValue"); inParams["hDefKey"] = 0x80000002;//HKEY_LOCAL_MACHINE inParams["sSubKeyName"] = softwareRegLoc; inParams["sValueName"] = "DigitalProductId"; // Read Registry Value ManagementBaseObject outParams = registry.InvokeMethod("GetBinaryValue", inParams, null); if (outParams.Properties["uValue"].Value != null) os.ProductKey = DecodeProductKey((byte[])outParams.Properties["uValue"].Value); result.Add(os); } return result; }
public override Hashtable GetJsonHashTable() { OperatingSystem GetOsInfo = new OperatingSystem(); Hardware GetHardwareInfo = new Hardware(); var json = base.GetJsonHashTable(); GetOsInfo.GetFrameworkVersion(); GetOsInfo.GetArchicteture(); GetOsInfo.GetLanguage(); GetOsInfo.GetVersion(); GetOsInfo.GetJavaVersion(); GetHardwareInfo.GetProcessorData(); GetHardwareInfo.GetMemoryData(); GetHardwareInfo.GetDiskData(); GetHardwareInfo.GetScreenResolution(); json.Add("aver",Watcher.ApplicationVersion); json.Add("ID", Watcher.UserGUID); json.Add("osv", GetOsInfo.Version); json.Add("ossp", GetOsInfo.ServicePack); json.Add("osar", GetOsInfo.Archicteture); json.Add("osjv", GetOsInfo.JavaVersion); json.Add("osnet", GetOsInfo.FrameworkVersion); json.Add("osnsp", GetOsInfo.FrameworkServicePack); json.Add("oslng", GetOsInfo.Lcid); json.Add("osscn", GetHardwareInfo.ScreenResolution); json.Add("cnm", GetHardwareInfo.ProcessorName); json.Add("cbr", GetHardwareInfo.ProcessorBrand); json.Add("cfr", GetHardwareInfo.ProcessorFrequency); json.Add("ccr", GetHardwareInfo.ProcessorCores); json.Add("car", GetHardwareInfo.ProcessorArchicteture); json.Add("mtt", GetHardwareInfo.MemoryTotal); json.Add("mfr", GetHardwareInfo.MemoryFree); json.Add("dtt", "null"); json.Add("dfr", "null"); return json; }
/// <summary> /// Returns the name of the operating system running on this computer. /// </summary> /// <returns>A string containing the the operating system name.</returns> public static string GetOSNameString() { OperatingSystem osInfo = Environment.OSVersion; string osName = "UNKNOWN"; switch (osInfo.Platform) { case PlatformID.Win32Windows: { switch (OSMinorVersion) { case 0: { osName = "Windows 95"; break; } case 10: { osName = osInfo.Version.Revision.ToString() == "2222A" ? "Windows 98 Second Edition" : "Windows 98"; break; } case 90: { osName = "Windows Me"; break; } } break; } case PlatformID.Win32NT: { switch (OSMajorVersion) { case 3: { osName = "Windows NT 3.51"; break; } case 4: { osName = "Windows NT 4.0"; break; } case 5: { switch (OSMinorVersion) { case 0: osName = "Windows 2000"; break; case 1: osName = "Windows XP"; break; case 2: if (OSProductType == NT_WORKSTATION) { osName = "WindowsXP x64"; } else { osName = GetSystemMetrics(SM_SERVERR2) ? "Windows Server 2003 R2" : "Windows Server 2003"; } break; } break; } case 6: { switch (OSMinorVersion) { case 0: osName = OSProductType == NT_WORKSTATION ? "Windows Vista" : "Windows 2008"; break; case 1: osName = OSProductType == NT_WORKSTATION ? "Windows 7" : "Windows 2008 R2"; break; } break; } } break; } } return(osName); }
public void Install(OperatingSystem operatingSystem) { System = operatingSystem; operatingSystem.Setup(this); }
void setPlatform() { if (Application.platform == RuntimePlatform.WindowsPlayer) { currentOS = OperatingSystem.Win; } else if (Application.platform == RuntimePlatform.OSXPlayer) { currentOS = OperatingSystem.OSX; } }
partial void OnOperatingSystemInstanceChanging(OperatingSystem value);
public static void Main(string[] args) { string path = null; OperatingSystem os = Environment.OSVersion; string platform = os.Platform.ToString(); if (platform.Equals("Unix")) { path = "/Users/johnlundgren"; } else if (platform.Equals("Win32NT")) { path = @"C:\windows"; } else { Console.WriteLine("Not known platform."); return; } //ShowLargeFiles(path); var rep = new Repository(); //List<Employee> developers = rep.RetrieveDevelopers(); //IterateWithIEnumerator(developers.GetEnumerator()); //Employee[] sales = rep.RetrieveSalesPeople(); //IterateWithIEnumerator(sales.GetEnumerator()); //string strDouble = "2.45"; //Console.WriteLine(strDouble.ToDouble()); //foreach(var dev in rep.DevelopersThatStartWithG()) //{ // Console.WriteLine(dev.Name); //} //foreach (var salesPerson in rep.SalesPeopleThatStartWithK()) //{ // Console.WriteLine(salesPerson.Name); //} //foreach (var employee in rep.EmployeesThatStartWithP()) //{ // Console.WriteLine(employee.Name); //} //Console.WriteLine(DelegateDefinitions.AddValues(8, 9)); //Console.WriteLine(DelegateDefinitions.CalculateArea(6)); //DelegateDefinitions.WriteArea(5); //var movies = rep.RetrieveMovies(); //var query = movies.Filter<Movie>(m => m.Year > 2000); //var query = movies.Where<Movie>(m => m.Year > 2000); //foreach (var item in query) //{ // Console.WriteLine(item); //} var values = MyLinq.Random().Where(v => v > 0.5).Take(5); foreach (var value in values) { Console.WriteLine(value); } }
partial void UpdateOperatingSystem(OperatingSystem instance);
public static void GetObjectData_InvalidArgs_Throws() { var os = new OperatingSystem(PlatformID.Win32NT, new Version(10, 0)); Assert.Throws<ArgumentNullException>("info", () => os.GetObjectData(null, new StreamingContext())); }
public Environment() { OSVersion = new OperatingSystem(Env.OSVersion); }
/// <summary> /// Initializes a new instance of the <see cref="OperatingSystemInfo"/> class, using the specified platform identifier value and version object. /// </summary> /// <param name="operatingSystem">A valid instance of <see cref="System.OperatingSystem"/> class. Usually is given by the <value>Env.OSVersion</value> property.</param> public OperatingSystemInfo(OperatingSystem operatingSystem) { _operatingSystem = operatingSystem; }
private OperatingSystem ExtractOperatingSystem(XElement element) { OperatingSystem os = new OperatingSystem(); if (element != null) { os.Name = element.Element("Name").Value; os.SID = element.Element("SID").Value; os.Manufacturer = element.Element("Manufacturer").Value; os.Caption = element.Element("Caption").Value; os.Version = element.Element("Version").Value; os.CSDVersion = element.Element("CSDVersion").Value; os.InstallDate = Utility.ConvertValue<DateTime>(element.Element("InstallDate").Value, Utility.DefaultDate); os.LastBOotUpTime = Utility.ConvertValue<DateTime>(element.Element("LastBootUpTime").Value, Utility.DefaultDate); os.SerialNumber = element.Element("SerialNumber").Value; os.ServicePackMajorVersion = Utility.ConvertValue<Int32>(element.Element("ServicePackMajorVersion").Value, Utility.DefaultInt); os.ProductType = element.Element("ProductType").Value; os.OSProductSuite = element.Element("OSProductSuite").Value; os.OtherTypeDescription = element.Element("OtherTypeDescription").Value; os.Description = element.Element("Description").Value; os.OperatingSystemSKU = element.Element("OperatingSystemSKU").Value; os.OSArchitecture = element.Element("OSArchitecture").Value; os.BuildNumber = Utility.ConvertValue<Int32>(element.Element("BuildNumber").Value, Utility.DefaultInt); os.SystemDrive = element.Element("SystemDrive").Value; os.SystemDirectory = element.Element("SystemDirectory").Value; os.WindowsDirectory = element.Element("WindowsDirectory").Value; os.Organization = element.Element("Organization").Value; os.LocalDateTime = Utility.ConvertValue<DateTime>(element.Element("LocalDateTime").Value, Utility.DefaultDate); os.OSType = element.Element("OSType").Value; os.ActivationStatus = element.Element("ActivationStatus").Value; os.osRecoveryAutoReboot = Utility.ConvertValue<bool>(element.Element("osRecoveryAutoReboot").Value, Utility.DefaultBoolean); os.osRecoveryDebugInfoType = element.Element("osRecoveryDebugInfoType").Value; os.osRecoveryOverwriteExistingDebugFile = Utility.ConvertValue<bool>(element.Element("osRecoveryOverwriteExistingDebugFile").Value, Utility.DefaultBoolean); os.osRecoveryExpandedDebugFilePath = element.Element("osRecoveryExpandedDebugFilePath").Value; os.osRecoveryExpandedMiniDumpDirectory = element.Element("osRecoveryExpandedMiniDumpDirectory").Value; } return os; }
protected override void OnNavigatedTo(NavigationEventArgs e) { this._os = (OperatingSystem)e.Parameter; }
private static int HandleMobileApp(string action, string platform, string category, string testBinaryBase, string reportBase) { //install or uninstall mobile app int exitCode = -100; string outputFile = Path.Combine(reportBase, action, $"{category}_{action}.output.txt"); string errorFile = Path.Combine(reportBase, action, $"{category}_{action}.error.txt"); bool platformValueFlag = true; bool actionValueFlag = true; Directory.CreateDirectory(Path.Combine(reportBase, action)); var outputStream = new FileStream(outputFile, FileMode.Create); var errorStream = new FileStream(errorFile, FileMode.Create); using (var outputWriter = new StreamWriter(outputStream)) using (var errorWriter = new StreamWriter(errorStream)) { //Validate inputs if ((platform != "android") && (platform != "apple")) { outputWriter.WriteLine($"Incorrect value of platform. Provided {platform}. Valid strings are android and apple."); platformValueFlag = false; } if ((action != "install") && (action != "uninstall")) { outputWriter.WriteLine($"Incorrect value of action. Provided {action}. Valid strings are install and uninstall."); actionValueFlag = false; } if (platformValueFlag && actionValueFlag) { int timeout = 240000; // Set timeout to 4 mins, because the installation on Android arm64/32 devices could take up to 10 mins on CI string dotnetCmd_raw = System.Environment.GetEnvironmentVariable("__TestDotNetCmd"); string xharnessCmd_raw = System.Environment.GetEnvironmentVariable("XHARNESS_CLI_PATH"); string dotnetCmd = string.IsNullOrEmpty(dotnetCmd_raw) ? "dotnet" : dotnetCmd_raw; string xharnessCmd = string.IsNullOrEmpty(xharnessCmd_raw) ? "xharness" : $"exec {xharnessCmd_raw}"; string appExtension = platform == "android" ? "apk" : "app"; string cmdStr = $"{dotnetCmd} {xharnessCmd} {platform} {action}"; if (platform == "android") { cmdStr += $" --package-name=net.dot.{category}"; if (action == "install") { cmdStr += $" --app={testBinaryBase}/{category}.{appExtension} --output-directory={reportBase}/{action}"; } } else // platform is apple { cmdStr += $" --output-directory={reportBase}/{action} --target=ios-simulator-64"; //To Do: target should be either emulator or device if (action == "install") { cmdStr += $" --app={testBinaryBase}/{category}.{appExtension}"; } else // action is uninstall { cmdStr += $" --app=net.dot.{category}"; } } using (Process process = new Process()) { if (OperatingSystem.IsWindows()) { process.StartInfo.FileName = "cmd.exe"; } else { process.StartInfo.FileName = "/bin/bash"; } process.StartInfo.Arguments = ConvertCmd2Arg(cmdStr); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; DateTime startTime = DateTime.Now; process.Start(); var cts = new CancellationTokenSource(); Task copyOutput = process.StandardOutput.BaseStream.CopyToAsync(outputStream, 4096, cts.Token); Task copyError = process.StandardError.BaseStream.CopyToAsync(errorStream, 4096, cts.Token); if (process.WaitForExit(timeout)) { // Process completed. exitCode = process.ExitCode; Task.WaitAll(copyOutput, copyError); } else { //Time out. DateTime endTime = DateTime.Now; try { cts.Cancel(); } catch {} outputWriter.WriteLine("\ncmdLine:{0} Timed Out (timeout in milliseconds: {1}, start: {2}, end: {3})", cmdStr, timeout, startTime.ToString(), endTime.ToString()); errorWriter.WriteLine("\ncmdLine:{0} Timed Out (timeout in milliseconds: {1}, start: {2}, end: {3})", cmdStr, timeout, startTime.ToString(), endTime.ToString()); process.Kill(entireProcessTree: true); } } } outputWriter.WriteLine("xharness exitcode is : " + exitCode.ToString()); outputWriter.Flush(); errorWriter.Flush(); } return(exitCode); }
private string GetVersions() { /* * Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1 (6.1.7601.65536) * System Version: Microsoft Windows Server 2008 R2 Standard Edition Service Pack 1 (build 7601), 64-bit * CLR Version 2.0.50727.5448 * Application VHD Director, Version 1.0.0.0 * VHD Director, Version 1.0.0.0 * */ String output = string.Empty; OperatingSystem os = Environment.OSVersion; Version ver = os.Version; data.Add("Operating System", String.Format("OS1: {0} ({1})", os.VersionString, ver.ToString())); data.Add("OS.Name", CSharp411.OSInfo.Name); data.Add("OS.Edition", CSharp411.OSInfo.Edition); data.Add("OS.Service Pack", CSharp411.OSInfo.ServicePack); data.Add("OS.Version", CSharp411.OSInfo.VersionString); data.Add("OS.Bits", CSharp411.OSInfo.Bits.ToString()); // data.Add("OS2", String.Format("OS2: {0}\r\n", SystemVersionInterop.GetText())); output += "--- Operating System ---\r\n"; output += String.Format("Name = {0}\r\n", OSInfo.Name); output += String.Format("Edition = {0}\r\n", OSInfo.Edition); output += String.Format("Service Pack = {0}\r\n", OSInfo.ServicePack); output += String.Format("Version = {0}\r\n", OSInfo.VersionString); output += String.Format("Bits = {0}\r\n\r\n", OSInfo.Bits.ToString()); // output += String.Format("OS2: {0}\r\n", SystemVersionInterop.GetText()); ver = Environment.Version; data.Add("CLR Version", ver.ToString()); data.Add("64-bit OS", Wow.Is64BitOperatingSystem.ToString()); data.Add("64-bit process", Wow.Is64BitProcess.ToString()); output += String.Format("CLR Version: {0}\r\n", ver.ToString()); output += String.Format("64-bit operating system: {0}\r\n", Wow.Is64BitOperatingSystem); output += String.Format("64-bit process: {0}\r\n", Wow.Is64BitProcess); Assembly assem = Assembly.GetEntryAssembly(); AssemblyName assemName = assem.GetName(); ver = assemName.Version; data.Add("Application", assemName.Name); data.Add("Application Version", ver.ToString()); #if DEBUG data.Add("Build", "DEBUG"); #else data.Add("Build", "RELEASE"); #endif output += String.Format("Application: {0}, Version {1}\r\n", assemName.Name, ver.ToString()); // Get the version of a specific assembly. //string filename = @".\StringLibrary.dll"; // assem = Assembly.ReflectionOnlyLoadFrom(filename); //AssemblyName assemName = assem.GetName(); // ver = assemName.Version; //output += String.Format("{0}, Version {1}\r\n", assemName.Name, ver.ToString()); return(output); }
public void AddNewOs(OperatingSystem operatingSystem) { _osList.Add(operatingSystem); }
public static string GetOSInfo() { //Get Operating system information. OperatingSystem os = Environment.OSVersion; //Get version information about the os. Version vs = os.Version; //Variable to hold our return value string operatingSystem = ""; if (os.Platform == PlatformID.Win32Windows) { //This is a pre-NT version of Windows switch (vs.Minor) { case 0: operatingSystem = "95"; break; case 10: if (vs.Revision.ToString() == "2222A") { operatingSystem = "98SE"; } else { operatingSystem = "98"; } break; case 90: operatingSystem = "Me"; break; default: break; } } else if (os.Platform == PlatformID.Win32NT) { switch (vs.Major) { case 3: operatingSystem = "NT 3.51"; break; case 4: operatingSystem = "NT 4.0"; break; case 5: if (vs.Minor == 0) { operatingSystem = "2000"; } else { operatingSystem = "XP"; } break; case 6: if (vs.Minor == 0) { operatingSystem = "Vista"; } else { operatingSystem = "7"; } break; default: break; } } //Make sure we actually got something in our OS check //We don't want to just return " Service Pack 2" or " 32-bit" //That information is useless without the OS version. if (operatingSystem != "") { //Got something. Let's prepend "Windows" and get more info. operatingSystem = "Windows " + operatingSystem; //See if there's a service pack installed. if (os.ServicePack != "") { //Append it to the OS name. i.e. "Windows XP Service Pack 3" operatingSystem += " " + os.ServicePack; } //Append the OS architecture. i.e. "Windows XP Service Pack 3 32-bit" operatingSystem += " " + getOSArchitecture().ToString() + "-bit"; } //Return the information we've gathered. return(operatingSystem); }