static SystemInfo[] getSortedSystemInfos(SystemInfo[] systemInfos, SortMethod sortMethod) { if (sortMethod == SortMethod.Name) { return systemInfos .OrderBy(systemInfo => systemInfo.systemName) .ToArray(); } if (sortMethod == SortMethod.NameDescending) { return systemInfos .OrderByDescending(systemInfo => systemInfo.systemName) .ToArray(); } if (sortMethod == SortMethod.ExecutionTime) { return systemInfos .OrderBy(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); } if (sortMethod == SortMethod.ExecutionTimeDescending) { return systemInfos .OrderByDescending(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); } return systemInfos; }
private void CheckLogin() { string userName = Request.Params["UserName"]; string userPass = Public.FilterSql(Request.Params["password"]); Hashtable ht = new Hashtable(); ht.Add("UserName", userName); ht.Add("UserPass", Encrypt.Md5(userPass)); HD.Model.Admin model = HD.Model.Admin.Instance.GetModelById(ht); if (!string.IsNullOrEmpty(model.Id.ToString())) { SystemInfo info = new SystemInfo(); info.LoginID = model.Id.ToString(); info.LoginName = model.UserName; //创建登录状态 CookieHelper.WriteCookie(UIConfig.CookieName, info, UIConfig.Expires); Response.Redirect("home.aspx"); } else { MessageBox.ShowMessage("登录帐号或者密码不正确", "login.aspx"); } }
public static Platform GetOperationSystemPlatform() { var sysInfo = new SystemInfo(); // WinXP and older - use GetNativeSystemInfo if (Environment.OSVersion.Version.Major > 5 || (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1)) { GetNativeSystemInfo(ref sysInfo); } // else use GetSystemInfo else { GetSystemInfo(ref sysInfo); } switch (sysInfo.wProcessorArchitecture) { case ProcessorArchitectureIa64: case ProcessorArchitectureAmd64: return Platform.X64; case ProcessorArchitectureIntel: return Platform.X86; default: return Platform.Unknown; } }
void drawSystemInfos(SystemInfo[] systemInfos, bool isChildSysem) { var orderedSystemInfos = systemInfos .OrderByDescending(systemInfo => systemInfo.averageExecutionDuration) .ToArray(); foreach (var systemInfo in orderedSystemInfos) { EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(isChildSysem); systemInfo.isActive = EditorGUILayout.Toggle(systemInfo.isActive, GUILayout.Width(20)); EditorGUI.EndDisabledGroup(); var reactiveSystem = systemInfo.system as ReactiveSystem; if (reactiveSystem != null) { if (systemInfo.isActive) { reactiveSystem.Activate(); } else { reactiveSystem.Deactivate(); } } var avg = string.Format("Ø {0:0.000}", systemInfo.averageExecutionDuration).PadRight(9); var min = string.Format("min {0:0.000}", systemInfo.minExecutionDuration).PadRight(11); var max = string.Format("max {0:0.000}", systemInfo.maxExecutionDuration); EditorGUILayout.LabelField(systemInfo.systemName, avg + "\t" + min + "\t" + max); EditorGUILayout.EndHorizontal(); var debugSystem = systemInfo.system as DebugSystems; if (debugSystem != null) { var indent = EditorGUI.indentLevel; EditorGUI.indentLevel += 1; drawSystemInfos(debugSystem.systemInfos, true); EditorGUI.indentLevel = indent; } } }
//public string Caption { get; set; } //public string deviceID { get; set; } //public string caption { get; set; } //public string serialNumber { get; set; } //public string bankLabel { get; set; } //public string formFactor { get; set; } //public string memoryType { get; set; } //public string capacity { get; set; } //public string speed { get; set; } public void SendDevices() { SystemInfo systemInfo = new SystemInfo(); //List<Param> hdd = systemInfo.GetHDDInfo(); //List<Param> net = systemInfo.GetNetworkInfo(true); //List<Route> staticRoutes = systemInfo.GetStaticRoutes(); //List<Param> network = systemInfo.GetRAMInfo(); JSONObject = new StringBuilder(); JSONObject.Clear(); JSONObject.AppendLine("{ "); List<Param> cpu = systemInfo.GetCPUInfo(); List<Param> os = systemInfo.GetOperatingSystem(); AddToJSON(cpu, "CPU"); AddToJSON(os, "OS"); List<Param> AdvancedData = new List<Param>(); AdvancedData.Add(new Param("UnicalID", ProgramState.UnicalID)); AdvancedData.Add(new Param("PCID", ProgramState.PCID)); AddToJSON(AdvancedData, string.Empty); StringBuilder newJSONObject = JSONObject.Remove(JSONObject.Length - 3, 1); newJSONObject.AppendLine(" }"); string data = JSONObject.ToString(); SendToWeb(data, URLDevices); }
public static void getInfo(out SystemInfo sysInfos) { int width = 0, height = 0; CKLBLuaEnv_cmdSystemInfo(ref width, ref height); sysInfos.width = width; sysInfos.height = height; }
public void Add(SystemInfo systemInfo) { lock (KnownSystems) { if (!KnownSystems.Contains(systemInfo.MachineName)) { KnownSystems.Add(systemInfo.MachineName); } } }
public SystemInfo CreateSystemInfo(SystemInformation systemInformation) { SystemInfo systemInfo = new SystemInfo(); systemInfo.Architecture = systemInformation.Architecture; systemInfo.SystemName = systemInformation.SystemName; systemInfo.SystemVersion = systemInformation.SystemVersion; systemInfo.PrimaryHostName = systemInformation.PrimaryHostName; this.SetNetworkInfo(systemInfo, systemInformation); return systemInfo; }
private void InitializeFormSize() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); byte countHDD = systemInfo.GetHDDCount(); for (int i = 0; i < countHDD; i++) { this.Size = new Size(this.Size.Width, this.Size.Height + heightHDDLabelValue); } }
private void SetNetworkInfo(SystemInfo systemInfo, SystemInformation systemInformation) { foreach (NetworkInterface network in systemInformation.Interfaces) { NetworkInfo networkInfo = new NetworkInfo(); networkInfo.MacAddress = network.MacAddress; networkInfo.Name = network.Name; networkInfo.IpAddress = network.IpAddress; systemInfo.NetworkInterfaces.Add(networkInfo); } }
static GUIStyle getSystemStyle(SystemInfo systemInfo) { var style = new GUIStyle(GUI.skin.label); var color = systemInfo.isReactiveSystems ? Color.white : style.normal.textColor; style.normal.textColor = color; return style; }
public void PickUpCard(CardInfo card, SystemInfo system) { if (!state.IsAllowed("pickup card")) { return; } state.AddAction("pickup card"); card.state = CardInfo.State.Placed; card.tile = system.tile; system.cards.Add(card); }
private void FillBusyRAM() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о занятости ОЗУ // и помещаем ее в переменную busyRAM string busyRAM = systemInfo.GetBusyRAM(); label4.Text = busyRAM; }
private void FillCPUTemperature() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о темературе CPU // и помещаем ее в переменную CPUTemperature string CPUTemperature = systemInfo.GetCPUTemperature(); label2.Text = CPUTemperature; }
public Information() { this.timer = new Timer(1000); this.timer.Interval = 1000; this.timer.Enabled = false; this.timer.Elapsed+=new ElapsedEventHandler(this.TimerEvent); this.views = new Dictionary<IPushData, List<ViewType>>(); this.performanceCounters = new Dictionary<string,PerformanceCounterData>(); this.systemInfo = new SystemInfo(); this.GetSystemInfo(); }
private void FillBusyCPU() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о занятости CPU // и помещаем ее в переменную CPUTemperature string busyCPU = systemInfo.GetBusyCPU(); label2.Text = busyCPU; }
public SystemInfo GetFullSystemInfo() { var systemInfo = new SystemInfo { AppStartInfo = GetAppStartInfo(), User = GetUserInfo(), Software = GetSoftwareInfo(), Network = GetNetworkInfo(), Hardware = GetHardwareInfo() }; return systemInfo; }
// // GET: /Home/ public ActionResult Index() { SystemInfo systemInfo = new SystemInfo(); string cpuNO = "当前CPU核心数:" + systemInfo.ProcessorCount.ToString() + "个"; ViewBag.cpuNO = cpuNO; string cpuUser = "******" + systemInfo.CpuLoad.ToString("0.0") + "%"; ViewBag.cpuUser = cpuUser; var memoryFree = systemInfo.MemoryAvailable / systemInfo.PhysicalMemory * 100; string mem = "可用内存使用率:" + memoryFree.ToString("0.000") + "%"; ViewBag.mem = mem; return View(); }
public string[] Data() { SystemInfo systemInfo = new SystemInfo(); string[] cpuStrings = new string[3]; string cpuNO = "当前CPU核心数:" + systemInfo.ProcessorCount.ToString() + "个"; cpuStrings[0] = systemInfo.ProcessorCount.ToString(); string cpuUser = "******" + systemInfo.CpuLoad.ToString("0.0") + "%"; cpuStrings[1] = systemInfo.CpuLoad.ToString("0.0"); var memoryFree = systemInfo.MemoryAvailable / systemInfo.PhysicalMemory * 100; string mem = "可用内存使用率:" + memoryFree.ToString("0.000") + "%"; cpuStrings[2] = memoryFree.ToString("0.000"); return cpuStrings; }
private void FillDataGridView1() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о сетевых интерфейсах // и помещаем ее в переменную networkInfo List<Param> networkInfo = systemInfo.GetNetworkInfo(checkBox1.Checked); // добавялем каждый элемент в dataGridView1 foreach (Param row in networkInfo) { AddElementToDataGridView1(row); } }
private void FillDataGridView() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о установленных программах // и помещаем ее в переменную ApplicationsInfo List<string> ApplicationsInfo = systemInfo.GetApplicationsInfo(); // добавялем каждый элемент в dataGridView foreach (string row in ApplicationsInfo) { AddElementToDataGridView(row); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SystemInfo sysInfo = new SystemInfo(); StringBuilder strSysInfoSB = new StringBuilder(); strSysInfoSB.Append("<Table style=\"Width:100%\" cellspacing=\"1\">"); strSysInfoSB.Append(HandleListToString(sysInfo.initSysInfoData())); strSysInfoSB.Append(HandleListToString(sysInfo.initRegKeyData())); strSysInfoSB.Append(HandleListToString(sysInfo.initAPIData())); strSysInfoSB.Append(HandleListToString(sysInfo.initEnvData())); strSysInfoSB.Append("</Table>"); divSysInfo.InnerHtml = strSysInfoSB.ToString(); } }
private void FillDataGridView() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию об ОС // и помещаем ее в переменную OSInfo List<Param> OSInfo = systemInfo.GetOperatingSystem(); // добавялем каждый элемент в dataGridView foreach (Param row in OSInfo) { AddElementToDataGridView(row); } }
private void FillDataGridView() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о процессоре // и помещаем ее в переменную processorInfo List<Param> processorInfo = systemInfo.GetCPUInfo(); // добавялем каждый элемент в dataGridView foreach (Param row in processorInfo) { AddElementToDataGridView(row); } }
public void PlaceSelected(SystemInfo system) { if (!state.IsAllowed("place selected")) { return; } state.AddAction("place selected"); CardInfo card = CardInfo.GetByInstanceID(state.GetValue<int>("selected card")); state.RemoveValue("selected card"); card.state = CardInfo.State.Placed; card.tile = system.tile; system.cards.Add(card); }
private void FillBusyHDDs() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о локальных дисках // и помещаем ее в переменную hddInfo List<HDDParam> hddInfo = systemInfo.GetBusyHDDs(); // добавялем каждый элемент в dataGridView foreach (HDDParam row in hddInfo) { AddElementToDataGridView(row); } }
static void Main(string[] args) { //获取当前进程对象 Process cur = Process.GetCurrentProcess(); PerformanceCounter curpcp = new PerformanceCounter("Process", "Working Set - Private", cur.ProcessName); PerformanceCounter curpc = new PerformanceCounter("Process", "Working Set", cur.ProcessName); PerformanceCounter curtime = new PerformanceCounter("Process", "% Processor Time", cur.ProcessName); //上次记录CPU的时间 TimeSpan prevCpuTime = TimeSpan.Zero; //Sleep的时间间隔 int interval = 1000; PerformanceCounter totalcpu = new PerformanceCounter("Processor", "% Processor Time", "_Total"); SystemInfo sys = new SystemInfo(); //const int KB_DIV = 1024; const int MB_DIV = 1024 * 1024; const int GB_DIV = 1024 * 1024 * 1024; while (true) { //第一种方法计算CPU使用率 //当前时间 TimeSpan curCpuTime = cur.TotalProcessorTime; //计算 double value = (curCpuTime - prevCpuTime).TotalMilliseconds / interval / Environment.ProcessorCount * 100; prevCpuTime = curCpuTime; Console.WriteLine(); Console.WriteLine("{0}:{1} {2:N}KB CPU使用率:{3}", cur.ProcessName, "工作集(进程类)", cur.WorkingSet64 / 1024, value);//这个工作集只是在一开始初始化,后期不变 Console.WriteLine("{0}:{1} {2:N}KB CPU使用率:{3}", cur.ProcessName, "工作集 ", curpc.NextValue() / 1024, value);//这个工作集是动态更新的 //第二种计算CPU使用率的方法 Console.WriteLine("{0}:{1} {2:N}KB CPU使用率:{3}%", cur.ProcessName, "私有工作集 ", curpcp.NextValue() / 1024, curtime.NextValue() / Environment.ProcessorCount); //Thread.Sleep(interval); //第一种方法获取系统CPU使用情况 Console.WriteLine("\r系统CPU使用率:{0}%", totalcpu.NextValue()); //Thread.Sleep(interval); //第二章方法获取系统CPU和内存使用情况 Console.WriteLine("\r系统CPU使用率:{0}%,系统内存使用大小:{1}MB({2}GB)", sys.CpuLoad, (sys.PhysicalMemory - sys.MemoryAvailable) / MB_DIV, (sys.PhysicalMemory - sys.MemoryAvailable) / (double)GB_DIV); Thread.Sleep(interval); } //Console.ReadLine(); }
/// <summary> /// Gets the current processor architecture. /// </summary> private static string GetPlatform() { var sysInfo = new SystemInfo(); GetNativeSystemInfo(ref sysInfo); switch (sysInfo.ProcessorArchitecture) { case 0: return "x86"; case 6: return "IA64"; case 9: return "x64"; default: return string.Empty; } }
private void FillHDDsTemperature() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // получаем массив температур HDDs List<byte> HDDsTemperature = systemInfo.GetHDDsTemperature(); label4.Text = HDDsTemperature[0].ToString() + " °C"; if(HDDsTemperature.Count > 1) { for (int i = 1; i < HDDsTemperature.Count; i++) { AddHDDTemperatureLabel(i + 1, HDDsTemperature[i]); } } }
private void FillDataGridView2() { //получаем объект типа SystemInfo SystemInfo systemInfo = new SystemInfo(); // вызываем метод объекта systemInfo, который // собирает инфрормацию о индексах сетевых интерфейсах // и помещаем ее в переменную interfacesIndexs List<Route> interfacesIndexs = systemInfo.GetStaticRoutes(); // добавялем каждый элемент в dataGridView2 foreach (Route route in interfacesIndexs) { AddElementToDataGridView2(route.Destination, route.Mask, route.Gateway, route.Interface, route.Metric); } }
/// <summary> /// Convert a path into a fully qualified path. /// </summary> /// <param name="path">The path to convert.</param> /// <returns>The fully qualified path.</returns> /// <remarks> /// <para> /// Converts the path specified to a fully /// qualified path. If the path is relative it is /// taken as relative from the application base /// directory. /// </para> /// </remarks> protected static string ConvertToFullPath(string path) { return(SystemInfo.ConvertToFullPath(path)); }
public void EqualsIgnoringCase_SameStringsSameCase_true() { Assert.True(SystemInfo.EqualsIgnoringCase("foo", "foo")); }
public static extern void GetSystemInfo(out SystemInfo input);
void Start() { // Disable if Image Effects is not supported if (!SystemInfo.supportsImageEffects) { Debug.LogWarning("HighlightingSystem : Image effects is not supported on this platform! Disabling."); this.enabled = false; return; } // Disable if Render Textures is not supported /* * if (!SystemInfo.supportsRenderTextures) * { * Debug.LogWarning("HighlightingSystem : RenderTextures is not supported on this platform! Disabling."); * this.enabled = false; * return; * } */ // Disable if required Render Texture Format is not supported if (!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB32)) { Debug.LogWarning("HighlightingSystem : RenderTextureFormat.ARGB32 is not supported on this platform! Disabling."); this.enabled = false; return; } // Disable if HighlightingStencilOpaque shader is not supported if (!Shader.Find("Hidden/Highlighted/StencilOpaque").isSupported) { Debug.LogWarning("HighlightingSystem : HighlightingStencilOpaque shader is not supported on this platform! Disabling."); this.enabled = false; return; } // Disable if HighlightingStencilTransparent shader is not supported if (!Shader.Find("Hidden/Highlighted/StencilTransparent").isSupported) { Debug.LogWarning("HighlightingSystem : HighlightingStencilTransparent shader is not supported on this platform! Disabling."); this.enabled = false; return; } // Disable if HighlightingStencilOpaqueZ shader is not supported if (!Shader.Find("Hidden/Highlighted/StencilOpaqueZ").isSupported) { Debug.LogWarning("HighlightingSystem : HighlightingStencilOpaqueZ shader is not supported on this platform! Disabling."); this.enabled = false; return; } // Disable if HighlightingStencilTransparentZ shader is not supported if (!Shader.Find("Hidden/Highlighted/StencilTransparentZ").isSupported) { Debug.LogWarning("HighlightingSystem : HighlightingStencilTransparentZ shader is not supported on this platform! Disabling."); this.enabled = false; return; } // Disable if HighlightingBlur shader is not supported if (!blurShader.isSupported) { Debug.LogWarning("HighlightingSystem : HighlightingBlur shader is not supported on this platform! Disabling."); this.enabled = false; return; } // Disable if HighlightingComposite shader is not supported if (!compShader.isSupported) { Debug.LogWarning("HighlightingSystem : HighlightingComposite shader is not supported on this platform! Disabling."); this.enabled = false; return; } // Set the initial intensity in blur shader blurMaterial.SetFloat("_Intensity", _blurIntensity); }
public Task SendRestartRequiredNotification(SystemInfo info, CancellationToken cancellationToken) { return(Task.FromResult(true)); }
public override void Render(PostProcessRenderContext context) { var cmd = context.command; if (m_ResetHistory) { cmd.BlitFullscreenTriangle(context.source, context.destination); m_ResetHistory = false; return; } const float kMaxBlurRadius = 5f; var vectorRTFormat = RenderTextureFormat.RGHalf; var packedRTFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB2101010) ? RenderTextureFormat.ARGB2101010 : RenderTextureFormat.ARGB32; var sheet = context.propertySheets.Get(context.resources.shaders.motionBlur); cmd.BeginSample("MotionBlur"); // Calculate the maximum blur radius in pixels. int maxBlurPixels = (int)(kMaxBlurRadius * context.height / 100); // Calculate the TileMax size. // It should be a multiple of 8 and larger than maxBlur. int tileSize = ((maxBlurPixels - 1) / 8 + 1) * 8; // Pass 1 - Velocity/depth packing var velocityScale = settings.shutterAngle / 360f; sheet.properties.SetFloat(ShaderIDs.VelocityScale, velocityScale); sheet.properties.SetFloat(ShaderIDs.MaxBlurRadius, maxBlurPixels); sheet.properties.SetFloat(ShaderIDs.RcpMaxBlurRadius, 1f / maxBlurPixels); int vbuffer = ShaderIDs.VelocityTex; cmd.GetTemporaryRT(vbuffer, context.width, context.height, 0, FilterMode.Point, packedRTFormat, RenderTextureReadWrite.Linear); cmd.BlitFullscreenTriangle(BuiltinRenderTextureType.None, vbuffer, sheet, (int)Pass.VelocitySetup); // Pass 2 - First TileMax filter (1/2 downsize) int tile2 = ShaderIDs.Tile2RT; cmd.GetTemporaryRT(tile2, context.width / 2, context.height / 2, 0, FilterMode.Point, vectorRTFormat, RenderTextureReadWrite.Linear); cmd.BlitFullscreenTriangle(vbuffer, tile2, sheet, (int)Pass.TileMax1); // Pass 3 - Second TileMax filter (1/2 downsize) int tile4 = ShaderIDs.Tile4RT; cmd.GetTemporaryRT(tile4, context.width / 4, context.height / 4, 0, FilterMode.Point, vectorRTFormat, RenderTextureReadWrite.Linear); cmd.BlitFullscreenTriangle(tile2, tile4, sheet, (int)Pass.TileMax2); cmd.ReleaseTemporaryRT(tile2); // Pass 4 - Third TileMax filter (1/2 downsize) int tile8 = ShaderIDs.Tile8RT; cmd.GetTemporaryRT(tile8, context.width / 8, context.height / 8, 0, FilterMode.Point, vectorRTFormat, RenderTextureReadWrite.Linear); cmd.BlitFullscreenTriangle(tile4, tile8, sheet, (int)Pass.TileMax2); cmd.ReleaseTemporaryRT(tile4); // Pass 5 - Fourth TileMax filter (reduce to tileSize) var tileMaxOffs = Vector2.one * (tileSize / 8f - 1f) * -0.5f; sheet.properties.SetVector(ShaderIDs.TileMaxOffs, tileMaxOffs); sheet.properties.SetFloat(ShaderIDs.TileMaxLoop, (int)(tileSize / 8f)); int tile = ShaderIDs.TileVRT; cmd.GetTemporaryRT(tile, context.width / tileSize, context.height / tileSize, 0, FilterMode.Point, vectorRTFormat, RenderTextureReadWrite.Linear); cmd.BlitFullscreenTriangle(tile8, tile, sheet, (int)Pass.TileMaxV); cmd.ReleaseTemporaryRT(tile8); // Pass 6 - NeighborMax filter int neighborMax = ShaderIDs.NeighborMaxTex; int neighborMaxWidth = context.width / tileSize; int neighborMaxHeight = context.height / tileSize; cmd.GetTemporaryRT(neighborMax, neighborMaxWidth, neighborMaxHeight, 0, FilterMode.Point, vectorRTFormat, RenderTextureReadWrite.Linear); cmd.BlitFullscreenTriangle(tile, neighborMax, sheet, (int)Pass.NeighborMax); cmd.ReleaseTemporaryRT(tile); // Pass 7 - Reconstruction pass sheet.properties.SetFloat(ShaderIDs.LoopCount, Mathf.Clamp(settings.sampleCount / 2, 1, 64)); cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, (int)Pass.Reconstruction); cmd.ReleaseTemporaryRT(vbuffer); cmd.ReleaseTemporaryRT(neighborMax); cmd.EndSample("MotionBlur"); }
private FileConnection(SystemInfo info, Socket socket, HostInputStream @in, HostOutputStream @out, int ccsid, int datastreamLevel, int maxDataBlockSize, string user, string jobName) : base(info, user, jobName, socket, @in, @out) { ccsid_ = ccsid; datastreamLevel_ = datastreamLevel; maxDataBlockSize_ = maxDataBlockSize; }
/// <summary> /// Hook the shutdown event /// </summary> /// <remarks> /// <para> /// On the full .NET runtime, the static constructor hooks up the /// <c>AppDomain.ProcessExit</c> and <c>AppDomain.DomainUnload</c>> events. /// These are used to shutdown the log4net system as the application exits. /// </para> /// </remarks> static LoggerManager() { try { // Register the AppDomain events, note we have to do this with a // method call rather than directly here because the AppDomain // makes a LinkDemand which throws the exception during the JIT phase. RegisterAppDomainEvents(); } catch (System.Security.SecurityException) { LogLog.Debug(declaringType, "Security Exception (ControlAppDomain LinkDemand) while trying " + "to register Shutdown handler with the AppDomain. LoggerManager.Shutdown() " + "will not be called automatically when the AppDomain exits. It must be called " + "programmatically."); } // Dump out our assembly version into the log if debug is enabled LogLog.Debug(declaringType, GetVersionInfo()); // Set the default repository selector #if NETCF || UNITY_WEBPLAYER s_repositorySelector = new CompactRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); #else // Look for the RepositorySelector type specified in the AppSettings 'log4net.RepositorySelector' string appRepositorySelectorTypeName = SystemInfo.GetAppSetting("log4net.RepositorySelector"); if (appRepositorySelectorTypeName != null && appRepositorySelectorTypeName.Length > 0) { // Resolve the config string into a Type Type appRepositorySelectorType = null; try { appRepositorySelectorType = SystemInfo.GetTypeFromString(appRepositorySelectorTypeName, false, true); } catch (Exception ex) { LogLog.Error(declaringType, "Exception while resolving RepositorySelector Type [" + appRepositorySelectorTypeName + "]", ex); } if (appRepositorySelectorType != null) { // Create an instance of the RepositorySelectorType object appRepositorySelectorObj = null; try { appRepositorySelectorObj = Activator.CreateInstance(appRepositorySelectorType); } catch (Exception ex) { LogLog.Error(declaringType, "Exception while creating RepositorySelector [" + appRepositorySelectorType.FullName + "]", ex); } if (appRepositorySelectorObj != null && appRepositorySelectorObj is IRepositorySelector) { s_repositorySelector = (IRepositorySelector)appRepositorySelectorObj; } else { LogLog.Error(declaringType, "RepositorySelector Type [" + appRepositorySelectorType.FullName + "] is not an IRepositorySelector"); } } } // Create the DefaultRepositorySelector if not configured above if (s_repositorySelector == null) { s_repositorySelector = new DefaultRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy)); } #endif }
private unsafe void OnRenderImage(RenderTexture source, RenderTexture destination) { if (!this.CheckResources()) { Graphics.Blit(source, destination); } else { if (this.filterType == MotionBlurFilter.CameraMotion) { this.StartFrame(); } RenderTextureFormat format = !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.RGHalf; RenderTexture texture = RenderTexture.GetTemporary(divRoundUp(source.width, this.velocityDownsample), divRoundUp(source.height, this.velocityDownsample), 0, format); int width = 1; int height = 1; this.maxVelocity = Mathf.Max(2f, this.maxVelocity); float maxVelocity = this.maxVelocity; bool flag = (this.filterType == MotionBlurFilter.ReconstructionDX11) && (this.dx11MotionBlurMaterial == null); if ((this.filterType != MotionBlurFilter.Reconstruction) && (!flag && (this.filterType != MotionBlurFilter.ReconstructionDisc))) { width = divRoundUp(texture.width, (int)this.maxVelocity); height = divRoundUp(texture.height, (int)this.maxVelocity); maxVelocity = texture.width / width; } else { this.maxVelocity = Mathf.Min(this.maxVelocity, MAX_RADIUS); width = divRoundUp(texture.width, (int)this.maxVelocity); height = divRoundUp(texture.height, (int)this.maxVelocity); maxVelocity = texture.width / width; } RenderTexture texture2 = RenderTexture.GetTemporary(width, height, 0, format); RenderTexture texture3 = RenderTexture.GetTemporary(width, height, 0, format); texture.filterMode = FilterMode.Point; texture2.filterMode = FilterMode.Point; texture3.filterMode = FilterMode.Point; if (this.noiseTexture) { this.noiseTexture.filterMode = FilterMode.Point; } source.wrapMode = TextureWrapMode.Clamp; texture.wrapMode = TextureWrapMode.Clamp; texture3.wrapMode = TextureWrapMode.Clamp; texture2.wrapMode = TextureWrapMode.Clamp; this.CalculateViewProjection(); if (base.gameObject.activeInHierarchy && !this.wasActive) { this.Remember(); } this.wasActive = base.gameObject.activeInHierarchy; Matrix4x4 matrixx = Matrix4x4.Inverse(this.currentViewProjMat); this.motionBlurMaterial.SetMatrix("_InvViewProj", matrixx); this.motionBlurMaterial.SetMatrix("_PrevViewProj", this.prevViewProjMat); this.motionBlurMaterial.SetMatrix("_ToPrevViewProjCombined", this.prevViewProjMat * matrixx); this.motionBlurMaterial.SetFloat("_MaxVelocity", maxVelocity); this.motionBlurMaterial.SetFloat("_MaxRadiusOrKInPaper", maxVelocity); this.motionBlurMaterial.SetFloat("_MinVelocity", this.minVelocity); this.motionBlurMaterial.SetFloat("_VelocityScale", this.velocityScale); this.motionBlurMaterial.SetFloat("_Jitter", this.jitter); this.motionBlurMaterial.SetTexture("_NoiseTex", this.noiseTexture); this.motionBlurMaterial.SetTexture("_VelTex", texture); this.motionBlurMaterial.SetTexture("_NeighbourMaxTex", texture3); this.motionBlurMaterial.SetTexture("_TileTexDebug", texture2); if (this.preview) { Matrix4x4 worldToCameraMatrix = this._camera.worldToCameraMatrix; Matrix4x4 identity = Matrix4x4.identity; identity.SetTRS(this.previewScale * 0.3333f, Quaternion.identity, Vector3.one); Matrix4x4 gPUProjectionMatrix = GL.GetGPUProjectionMatrix(this._camera.projectionMatrix, true); this.prevViewProjMat = (gPUProjectionMatrix * identity) * worldToCameraMatrix; this.motionBlurMaterial.SetMatrix("_PrevViewProj", this.prevViewProjMat); this.motionBlurMaterial.SetMatrix("_ToPrevViewProjCombined", this.prevViewProjMat * matrixx); } if (this.filterType != MotionBlurFilter.CameraMotion) { Graphics.Blit(source, texture, this.motionBlurMaterial, 0); Camera tmpCam = null; if (this.excludeLayers.value != 0) { tmpCam = this.GetTmpCam(); } if (tmpCam && ((this.excludeLayers.value != 0) && (this.replacementClear && this.replacementClear.isSupported))) { tmpCam.targetTexture = texture; tmpCam.cullingMask = (int)this.excludeLayers; tmpCam.RenderWithShader(this.replacementClear, string.Empty); } } else { Vector4 zero = Vector4.zero; float num4 = Vector3.Dot(base.transform.up, Vector3.up); Vector3 rhs = this.prevFramePos - base.transform.position; float magnitude = rhs.magnitude; float num6 = 1f; num6 = (Vector3.Angle(base.transform.up, this.prevFrameUp) / this._camera.fieldOfView) * (source.width * 0.75f); zero.x = this.rotationScale * num6; num6 = (Vector3.Angle(base.transform.forward, this.prevFrameForward) / this._camera.fieldOfView) * (source.width * 0.75f); zero.y = (this.rotationScale * num4) * num6; num6 = (Vector3.Angle(base.transform.forward, this.prevFrameForward) / this._camera.fieldOfView) * (source.width * 0.75f); zero.z = (this.rotationScale * (1f - num4)) * num6; if ((magnitude > Mathf.Epsilon) && (this.movementScale > Mathf.Epsilon)) { zero.w = (this.movementScale * Vector3.Dot(base.transform.forward, rhs)) * (source.width * 0.5f); Vector4 *vectorPtr1 = &zero; vectorPtr1->x += (this.movementScale * Vector3.Dot(base.transform.up, rhs)) * (source.width * 0.5f); Vector4 *vectorPtr2 = &zero; vectorPtr2->y += (this.movementScale * Vector3.Dot(base.transform.right, rhs)) * (source.width * 0.5f); } if (this.preview) { this.motionBlurMaterial.SetVector("_BlurDirectionPacked", (new Vector4(this.previewScale.y, this.previewScale.x, 0f, this.previewScale.z) * 0.5f) * this._camera.fieldOfView); } else { this.motionBlurMaterial.SetVector("_BlurDirectionPacked", zero); } } if (!this.preview && (Time.frameCount != this.prevFrameCount)) { this.prevFrameCount = Time.frameCount; this.Remember(); } source.filterMode = FilterMode.Bilinear; if (this.showVelocity) { this.motionBlurMaterial.SetFloat("_DisplayVelocityScale", this.showVelocityScale); Graphics.Blit(texture, destination, this.motionBlurMaterial, 1); } else if ((this.filterType == MotionBlurFilter.ReconstructionDX11) && !flag) { this.dx11MotionBlurMaterial.SetFloat("_MinVelocity", this.minVelocity); this.dx11MotionBlurMaterial.SetFloat("_VelocityScale", this.velocityScale); this.dx11MotionBlurMaterial.SetFloat("_Jitter", this.jitter); this.dx11MotionBlurMaterial.SetTexture("_NoiseTex", this.noiseTexture); this.dx11MotionBlurMaterial.SetTexture("_VelTex", texture); this.dx11MotionBlurMaterial.SetTexture("_NeighbourMaxTex", texture3); this.dx11MotionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance)); this.dx11MotionBlurMaterial.SetFloat("_MaxRadiusOrKInPaper", maxVelocity); Graphics.Blit(texture, texture2, this.dx11MotionBlurMaterial, 0); Graphics.Blit(texture2, texture3, this.dx11MotionBlurMaterial, 1); Graphics.Blit(source, destination, this.dx11MotionBlurMaterial, 2); } else if ((this.filterType == MotionBlurFilter.Reconstruction) || flag) { this.motionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance)); Graphics.Blit(texture, texture2, this.motionBlurMaterial, 2); Graphics.Blit(texture2, texture3, this.motionBlurMaterial, 3); Graphics.Blit(source, destination, this.motionBlurMaterial, 4); } else if (this.filterType == MotionBlurFilter.CameraMotion) { Graphics.Blit(source, destination, this.motionBlurMaterial, 6); } else if (this.filterType != MotionBlurFilter.ReconstructionDisc) { Graphics.Blit(source, destination, this.motionBlurMaterial, 5); } else { this.motionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance)); Graphics.Blit(texture, texture2, this.motionBlurMaterial, 2); Graphics.Blit(texture2, texture3, this.motionBlurMaterial, 3); Graphics.Blit(source, destination, this.motionBlurMaterial, 7); } RenderTexture.ReleaseTemporary(texture); RenderTexture.ReleaseTemporary(texture2); RenderTexture.ReleaseTemporary(texture3); } }
/// <summary> /// 定时器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer_Elapsed(object sender, ElapsedEventArgs e) { try { this.Dispatcher.BeginInvoke(new Action(() => { count++; tbTime.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); tbCpu.Text = string.Format("CPU: {0:f}%", SystemInfo.GetCpuLoad.ToString("0.00")); if (count > 10) { count = 0; } if (count == 1) { SetDriveInfo(AppConfigInfos.AppStateInfos.MemoryPath); pbMemory.Value = SystemInfo.PhysicalMemory - SystemInfo.MemoryAvailable; tbp.Text = string.Format("{0}/{1}", SystemInfo.GetMemoryUnit((long)pbMemory.Value), SystemInfo.GetMemoryUnit(SystemInfo.PhysicalMemory)); } })); } catch (Exception ex) { SystemInfo.StartProcess("cmd.exe", "lodctr /r"); LogHelper.Instance.WirteErrorMsg(ex.Message); } }
/// <summary> /// 设置剩余内存 /// </summary> /// <param name="path"></param> private void SetDriveInfo(string path) { if (string.IsNullOrEmpty(path)) { return; } path = path.Replace("/", "\\"); DriveInfo[] allDirves = DriveInfo.GetDrives(); //检索计算机上的所有逻辑驱动器名称 foreach (DriveInfo item in allDirves) { //Fixed 硬盘 if (item.IsReady && path.StartsWith(item.Name)) { //单位B long totalSize = item.TotalSize; /// (1024 * 1024 * 1024); long useSize = totalSize - item.TotalFreeSpace; // -(item.TotalFreeSpace / (1024 * 1024 * 1024)); pbMemorySize.Maximum = totalSize; pbMemorySize.Value = useSize; tbMemorySize.Text = string.Format("{0}/{1}", SystemInfo.GetMemoryUnit(useSize), SystemInfo.GetMemoryUnit(totalSize)); } } }
public void EqualsIgnoringCase_DifferentStrings_false() { Assert.False(SystemInfo.EqualsIgnoringCase("foo", "foobar")); }
protected static extern void GetSystemInfo(out SystemInfo Info);
public static SystemInfo CreateSystem(string systemId, ushort vehicleId, bool isOnline, PisVersion version, PisBaseline baseline) { SystemInfo createdSystem = new SystemInfo(systemId, DefaultMissionName, vehicleId, DefaultStatus, isOnline, DefaultCommunicationLink, EmptyServiceList, baseline, version, DefaultMission, baseline.CurrentValidOut == Boolean.TrueString || baseline.FutureValidOut == Boolean.TrueString || baseline.ArchivedValidOut == Boolean.TrueString); return(createdSystem); }
public override void OnInspectorGUI() { serObj.Update(); waterBase = (WaterBase)serObj.targetObject; oceanBase = ((WaterBase)serObj.targetObject).gameObject; if (!oceanBase) { return; } GUILayout.Label("This script helps adjusting water material properties", EditorStyles.miniBoldLabel); EditorGUILayout.PropertyField(sharedMaterial, new GUIContent("Material")); oceanMaterial = (Material)sharedMaterial.objectReferenceValue; if (!oceanMaterial) { sharedMaterial.objectReferenceValue = (Object)WaterEditorUtility.LocateValidWaterMaterial(oceanBase.transform); serObj.ApplyModifiedProperties(); oceanMaterial = (Material)sharedMaterial.objectReferenceValue; if (!oceanMaterial) { return; } } EditorGUILayout.Separator(); GUILayout.Label("Overall Quality", EditorStyles.boldLabel); EditorGUILayout.PropertyField(waterQuality, new GUIContent("Quality")); EditorGUILayout.PropertyField(edgeBlend, new GUIContent("Edge blend?")); if (waterQuality.intValue > (int)WaterQuality.Low) { EditorGUILayout.HelpBox("Water features not supported", MessageType.Warning); } if (edgeBlend.boolValue && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth)) { EditorGUILayout.HelpBox("Edge blend not supported", MessageType.Warning); } EditorGUILayout.Separator(); bool hasShore = oceanMaterial.HasProperty("_ShoreTex"); GUILayout.Label("Main Colors", EditorStyles.boldLabel); GUILayout.Label("Alpha values define blending with realtime textures", EditorStyles.miniBoldLabel); WaterEditorUtility.SetMaterialColor("_BaseColor", EditorGUILayout.ColorField("Refraction", WaterEditorUtility.GetMaterialColor("_BaseColor", oceanMaterial)), oceanMaterial); WaterEditorUtility.SetMaterialColor("_ReflectionColor", EditorGUILayout.ColorField("Reflection", WaterEditorUtility.GetMaterialColor("_ReflectionColor", oceanMaterial)), oceanMaterial); EditorGUILayout.Separator(); GUILayout.Label("Main Textures", EditorStyles.boldLabel); GUILayout.Label("Used for small waves (bumps), foam and white caps", EditorStyles.miniBoldLabel); WaterEditorUtility.SetMaterialTexture("_BumpMap", (Texture)EditorGUILayout.ObjectField("Normals", WaterEditorUtility.GetMaterialTexture("_BumpMap", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial); if (hasShore) { WaterEditorUtility.SetMaterialTexture("_ShoreTex", (Texture)EditorGUILayout.ObjectField("Shore & Foam", WaterEditorUtility.GetMaterialTexture("_ShoreTex", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial); } Vector4 animationTiling; Vector4 animationDirection; Vector2 firstTiling; Vector2 secondTiling; Vector2 firstDirection; Vector2 secondDirection; animationTiling = WaterEditorUtility.GetMaterialVector("_BumpTiling", oceanMaterial); animationDirection = WaterEditorUtility.GetMaterialVector("_BumpDirection", oceanMaterial); firstTiling = new Vector2(animationTiling.x * 100.0F, animationTiling.y * 100.0F); secondTiling = new Vector2(animationTiling.z * 100.0F, animationTiling.w * 100.0F); firstTiling = EditorGUILayout.Vector2Field("Tiling 1", firstTiling); secondTiling = EditorGUILayout.Vector2Field("Tiling 2", secondTiling); //firstTiling.x = EditorGUILayout.FloatField("1st Tiling U", firstTiling.x); //firstTiling.y = EditorGUILayout.FloatField("1st Tiling V", firstTiling.y); //secondTiling.x = EditorGUILayout.FloatField("2nd Tiling U", secondTiling.x); //secondTiling.y = EditorGUILayout.FloatField("2nd Tiling V", secondTiling.y); firstDirection = new Vector2(animationDirection.x, animationDirection.y); secondDirection = new Vector2(animationDirection.z, animationDirection.w); //firstDirection.x = EditorGUILayout.FloatField("1st Animation U", firstDirection.x); //firstDirection.y = EditorGUILayout.FloatField("1st Animation V", firstDirection.y); //secondDirection.x = EditorGUILayout.FloatField("2nd Animation U", secondDirection.x); //secondDirection.y = EditorGUILayout.FloatField("2nd Animation V", secondDirection.y); firstDirection = EditorGUILayout.Vector2Field("Direction 1", firstDirection); secondDirection = EditorGUILayout.Vector2Field("Direction 2", secondDirection); animationTiling = new Vector4(firstTiling.x / 100.0F, firstTiling.y / 100.0F, secondTiling.x / 100.0F, secondTiling.y / 100.0F); animationDirection = new Vector4(firstDirection.x, firstDirection.y, secondDirection.x, secondDirection.y); WaterEditorUtility.SetMaterialVector("_BumpTiling", animationTiling, oceanMaterial); WaterEditorUtility.SetMaterialVector("_BumpDirection", animationDirection, oceanMaterial); Vector4 displacementParameter = WaterEditorUtility.GetMaterialVector("_DistortParams", oceanMaterial); Vector4 fade = WaterEditorUtility.GetMaterialVector("_InvFadeParemeter", oceanMaterial); EditorGUILayout.Separator(); GUILayout.Label("Normals", EditorStyles.boldLabel); GUILayout.Label("Displacement for fresnel, specular and reflection/refraction", EditorStyles.miniBoldLabel); float gerstnerNormalIntensity = WaterEditorUtility.GetMaterialFloat("_GerstnerIntensity", oceanMaterial); gerstnerNormalIntensity = EditorGUILayout.Slider("Per Vertex", gerstnerNormalIntensity, -2.5F, 2.5F); WaterEditorUtility.SetMaterialFloat("_GerstnerIntensity", gerstnerNormalIntensity, oceanMaterial); displacementParameter.x = EditorGUILayout.Slider("Per Pixel", displacementParameter.x, -4.0F, 4.0F); displacementParameter.y = EditorGUILayout.Slider("Distortion", displacementParameter.y, -0.5F, 0.5F); // fade.z = EditorGUILayout.Slider("Distance fade", fade.z, 0.0f, 0.5f); EditorGUILayout.Separator(); GUILayout.Label("Fresnel", EditorStyles.boldLabel); GUILayout.Label("Defines reflection to refraction relation", EditorStyles.miniBoldLabel); if (!oceanMaterial.HasProperty("_Fresnel")) { if (oceanMaterial.HasProperty("_FresnelScale")) { float fresnelScale = EditorGUILayout.Slider("Intensity", WaterEditorUtility.GetMaterialFloat("_FresnelScale", oceanMaterial), 0.1F, 4.0F); WaterEditorUtility.SetMaterialFloat("_FresnelScale", fresnelScale, oceanMaterial); } displacementParameter.z = EditorGUILayout.Slider("Power", displacementParameter.z, 0.1F, 10.0F); displacementParameter.w = EditorGUILayout.Slider("Bias", displacementParameter.w, -3.0F, 3.0F); } else { Texture fresnelTex = (Texture)EditorGUILayout.ObjectField( "Ramp", (Texture)WaterEditorUtility.GetMaterialTexture("_Fresnel", oceanMaterial), typeof(Texture), false); WaterEditorUtility.SetMaterialTexture("_Fresnel", fresnelTex, oceanMaterial); } EditorGUILayout.Separator(); WaterEditorUtility.SetMaterialVector("_DistortParams", displacementParameter, oceanMaterial); if (edgeBlend.boolValue) { GUILayout.Label("Fading", EditorStyles.boldLabel); fade.x = EditorGUILayout.Slider("Edge fade", fade.x, 0.001f, 3.0f); if (hasShore) { fade.y = EditorGUILayout.Slider("Shore fade", fade.y, 0.001f, 3.0f); } fade.w = EditorGUILayout.Slider("Extinction fade", fade.w, 0.0f, 2.5f); WaterEditorUtility.SetMaterialVector("_InvFadeParemeter", fade, oceanMaterial); } EditorGUILayout.Separator(); if (oceanMaterial.HasProperty("_Foam")) { GUILayout.Label("Foam", EditorStyles.boldLabel); Vector4 foam = WaterEditorUtility.GetMaterialVector("_Foam", oceanMaterial); foam.x = EditorGUILayout.Slider("Intensity", foam.x, 0.0F, 1.0F); foam.y = EditorGUILayout.Slider("Cutoff", foam.y, 0.0F, 1.0F); WaterEditorUtility.SetMaterialVector("_Foam", foam, oceanMaterial); } serObj.ApplyModifiedProperties(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static FileConnection getConnection(SystemInfo info, String user, String password) throws IOException public static FileConnection getConnection(SystemInfo info, string user, string password) { return(getConnection(false, info, user, password)); }
public void EqualsIgnoringCase_BothNull_true() { Assert.True(SystemInfo.EqualsIgnoringCase(null, null)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static FileConnection getConnection(final boolean isSSL, SystemInfo info, String user, String password) throws IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: public static FileConnection getConnection(bool isSSL, SystemInfo info, string user, string password) { return(getConnection(isSSL, info, user, password, isSSL ? DEFAULT_SSL_FILE_SERVER_PORT : DEFAULT_FILE_SERVER_PORT)); }
// Use this for processing the image texture void OnRenderImage(RenderTexture source, RenderTexture destination) { // High Quality if (setting == Setting.High) { material.SetFloat("Threshold", threshold); RenderTextureFormat format; if (GetComponent <Camera>().hdr) { if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf)) { format = RenderTextureFormat.ARGBHalf; } else { format = RenderTextureFormat.DefaultHDR; } } else { format = RenderTextureFormat.Default; } RenderTexture smallerTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture smallerTex8 = RenderTexture.GetTemporary(source.width / 8, source.height / 8, 0, format); RenderTexture smallerTex16 = RenderTexture.GetTemporary(source.width / 16, source.height / 16, 0, format); RenderTexture HBlurredTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture HVBlurredTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture HBlurredTex8 = RenderTexture.GetTemporary(source.width / 8, source.height / 8, 0, format); RenderTexture HVBlurredTex8 = RenderTexture.GetTemporary(source.width / 8, source.height / 8, 0, format); RenderTexture HBlurredTex16 = RenderTexture.GetTemporary(source.width / 16, source.height / 16, 0, format); RenderTexture HVBlurredTex16 = RenderTexture.GetTemporary(source.width / 16, source.height / 16, 0, format); // For the 1/4th Texture // Render the bright pass texture Graphics.Blit(source, smallerTex4, material, 0); // Blur the bright pass texture // Horizontal Blur Pass Graphics.Blit(smallerTex4, HBlurredTex4, material, 1); // Vertical Blur Pass Graphics.Blit(HBlurredTex4, HVBlurredTex4, material, 2); // For the 1/8th Texture // Render the bright pass texture Graphics.Blit(source, smallerTex8, material, 0); // Blur the bright pass texture // Horizontal Blur Pass Graphics.Blit(smallerTex8, HBlurredTex8, material, 1); // Vertical Blur Pass Graphics.Blit(HBlurredTex8, HVBlurredTex8, material, 2); // For the 1/16th Texture // Render the bright pass texture Graphics.Blit(source, smallerTex16, material, 0); // Blur the bright pass texture // Horizontal Blur Pass Graphics.Blit(smallerTex4, HBlurredTex16, material, 1); // Vertical Blur Pass Graphics.Blit(HBlurredTex4, HVBlurredTex16, material, 2); // Blend the original and blurred textures material.SetTexture("BlurredTexture4", HVBlurredTex4); material.SetTexture("BlurredTexture8", HVBlurredTex8); material.SetTexture("BlurredTexture16", HVBlurredTex16); Graphics.Blit(source, destination, material, 3); // High Quality Blend Pass RenderTexture.ReleaseTemporary(smallerTex4); RenderTexture.ReleaseTemporary(smallerTex8); RenderTexture.ReleaseTemporary(smallerTex16); RenderTexture.ReleaseTemporary(HBlurredTex4); RenderTexture.ReleaseTemporary(HBlurredTex8); RenderTexture.ReleaseTemporary(HBlurredTex16); RenderTexture.ReleaseTemporary(HVBlurredTex4); RenderTexture.ReleaseTemporary(HVBlurredTex8); RenderTexture.ReleaseTemporary(HVBlurredTex16); } // Medium Quality else if (setting == Setting.Medium) { material.SetFloat("Threshold", threshold); RenderTextureFormat format; if (GetComponent <Camera>().hdr) { if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf)) { format = RenderTextureFormat.ARGBHalf; } else { format = RenderTextureFormat.DefaultHDR; } } else { format = RenderTextureFormat.Default; } RenderTexture smallerTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture smallerTex8 = RenderTexture.GetTemporary(source.width / 8, source.height / 8, 0, format); RenderTexture HBlurredTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture HVBlurredTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture HBlurredTex8 = RenderTexture.GetTemporary(source.width / 8, source.height / 8, 0, format); RenderTexture HVBlurredTex8 = RenderTexture.GetTemporary(source.width / 8, source.height / 8, 0, format); // For the 1/4th Texture // Render the bright pass texture Graphics.Blit(source, smallerTex4, material, 0); // Blur the bright pass texture // Horizontal Blur Pass Graphics.Blit(smallerTex4, HBlurredTex4, material, 1); // Vertical Blur Pass Graphics.Blit(HBlurredTex4, HVBlurredTex4, material, 2); // For the 1/8th Texture // Render the bright pass texture Graphics.Blit(source, smallerTex8, material, 0); // Blur the bright pass texture // Horizontal Blur Pass Graphics.Blit(smallerTex8, HBlurredTex8, material, 1); // Vertical Blur Pass Graphics.Blit(HBlurredTex8, HVBlurredTex8, material, 2); // Blend the original and blurred textures material.SetTexture("BlurredTexture4", HVBlurredTex4); material.SetTexture("BlurredTexture8", HVBlurredTex8); Graphics.Blit(source, destination, material, 4); // Medium Quality Blend Pass RenderTexture.ReleaseTemporary(smallerTex4); RenderTexture.ReleaseTemporary(smallerTex8); RenderTexture.ReleaseTemporary(HBlurredTex4); RenderTexture.ReleaseTemporary(HBlurredTex8); RenderTexture.ReleaseTemporary(HVBlurredTex4); RenderTexture.ReleaseTemporary(HVBlurredTex8); } // Low Quality else { material.SetFloat("Threshold", threshold); RenderTextureFormat format; if (GetComponent <Camera>().hdr) { if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf)) { format = RenderTextureFormat.ARGBHalf; } else { format = RenderTextureFormat.DefaultHDR; } } else { format = RenderTextureFormat.Default; } RenderTexture smallerTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture HBlurredTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); RenderTexture HVBlurredTex4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, format); // For the 1/4th Texture // Render the bright pass texture Graphics.Blit(source, smallerTex4, material, 0); // Blur the bright pass texture // Horizontal Blur Pass Graphics.Blit(smallerTex4, HBlurredTex4, material, 1); // Vertical Blur Pass Graphics.Blit(HBlurredTex4, HVBlurredTex4, material, 2); // Blend the original and blurred textures material.SetTexture("BlurredTexture4", HVBlurredTex4); Graphics.Blit(source, destination, material, 5); // Low Quality Blend Pass RenderTexture.ReleaseTemporary(smallerTex4); RenderTexture.ReleaseTemporary(HBlurredTex4); RenderTexture.ReleaseTemporary(HVBlurredTex4); } }
public void EqualsIgnoringCase_LeftNull_false() { Assert.False(SystemInfo.EqualsIgnoringCase(null, "foo")); }
/// <summary> /// Отображает окно сообщения с указанным текстом и типом сообщения /// </summary> /// <param name="Text"></param> /// <param name="Type"></param> /// <param name="Time"></param> public static void Show(String Text, Font Font, MessageType Type, Int32 Time) { // Форма сообщения Form Message = new Form() { Opacity = 0, BackColor = Color.FromArgb(17, 17, 17), Size = new Size(320, 100), StartPosition = FormStartPosition.Manual, DesktopLocation = new Point( Convert.ToInt32(SystemInfo.Screen().Width), 10), FormBorderStyle = FormBorderStyle.None, ControlBox = false, ShowInTaskbar = false, TopMost = true }; // Отрисовка левой боковой границы PictureBox Line = new PictureBox() { Parent = Message, Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom, Location = new Point(0, 0), Size = new Size(2, 100), BackColor = (Type == MessageType.Information ? Drawing.MetroColors.Blue : (Type == MessageType.Error ? Color.Red : Color.Yellow)) }; Bitmap Close = new Bitmap(8, 8); using (Graphics G = Graphics.FromImage(Close)) { G.DrawLine(new Pen(Color.Silver, 1), new Point(0, 0), new Point(Close.Width - 1, Close.Height - 1)); G.DrawLine(new Pen(Color.Silver, 1), new Point(Close.Width - 1, 0), new Point(0, Close.Height - 1)); } //// Кнопка закрытия сообщения //PictureBox Exit = new PictureBox() //{ // Parent = Message, // BackColor = Color.Transparent, // Size = new Size(Close.Width, Close.Height), // Location = new Point(Message.Width - 6 - Close.Width, 6), // SizeMode = PictureBoxSizeMode.StretchImage, // Image = Close //}; //Exit.MouseClick += (object O, MouseEventArgs E) => { Message.Dispose(); MessageCount--; }; // Заголовок сообщения Label mCaption = new Label() { Parent = Message, AutoSize = true, Location = new Point(7, 4), ForeColor = (Type == MessageType.Information ? Drawing.MetroColors.Blue : (Type == MessageType.Error ? Color.Red : Color.Yellow)), Font = new Font(Font.FontFamily, 11, FontStyle.Bold, GraphicsUnit.Point), Text = (Type == MessageType.Information ? "Информация" : (Type == MessageType.Error ? "Ошибка" : "Внимание")) }; // Текст сообщения Label mData = new Label() { Parent = Message, Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom, Size = new Size(310, 70), Location = new Point(8, 25), ForeColor = Color.White, Font = new Font(Font.FontFamily, 8, FontStyle.Regular), Text = Text }; MessageCount++; Opening(Message, 10, Time); }
private void Start() { if (GameData.Instance.testServer || GameData.IsHeadlessServer) { Debug.Log("Turn off lightsystem as this is a server"); enabled = false; } #if UNITY_EDITOR if (!Application.isPlaying) { Shader.SetGlobalTexture("_ObstacleTex", Texture2D.whiteTexture); return; } #endif if (LightCamera == null) { Debug.LogError("Lighting Camera in LightingSystem is null. Please, select Lighting Camera camera for lighting to work."); enabled = false; return; } if (LightOverlayMaterial == null) { Debug.LogError("LightOverlayMaterial in LightingSystem is null. Please, select LightOverlayMaterial camera for lighting to work."); enabled = false; return; } if (AffectOnlyThisCamera && _camera.targetTexture != null) { Debug.LogError("\"Affect Only This Camera\" will not work if camera.targetTexture is set."); AffectOnlyThisCamera = false; } _camera = GetComponent <Camera>(); if (EnableNormalMapping && !_camera.orthographic) { Debug.LogError("Normal mapping is not supported with perspective camera."); EnableNormalMapping = false; } // if both FlareLayer component and AffectOnlyThisCamera setting is enabled // Unity will print an error "Flare renderer to update not found" FlareLayer flare = GetComponent <FlareLayer>(); if (flare != null && flare.enabled) { Debug.Log("Disabling FlareLayer since AffectOnlyThisCamera setting is checked."); flare.enabled = false; } if (!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf)) { HDR = false; } _texFormat = HDR ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB32; float lightPixelsPerUnityMeter = LightPixelsPerUnityMeter; _halfTexelOffest = SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9"); InitTK2D(); if (_camera.orthographic) { float rawCamHeight = (_camera.orthographicSize + LightCameraSizeAdd) * 2f; float rawCamWidth = (_camera.orthographicSize * _camera.aspect + LightCameraSizeAdd) * 2f; _extendedLightTextureSize = new Point2(Mathf.RoundToInt(rawCamWidth * lightPixelsPerUnityMeter), Mathf.RoundToInt(rawCamHeight * lightPixelsPerUnityMeter)); float rawSmallCamHeight = _camera.orthographicSize * 2f * lightPixelsPerUnityMeter; _smallLightTextureSize = new Point2(Mathf.RoundToInt(rawSmallCamHeight * _camera.aspect), Mathf.RoundToInt(rawSmallCamHeight)); } else { { float lightCamHalfFov = (_camera.fieldOfView + LightCameraFovAdd) * Mathf.Deg2Rad / 2f; float lightCamSize = Mathf.Tan(lightCamHalfFov) * LightObstaclesDistance * 2; //var gameCamHalfFov = _camera.fieldOfView*Mathf.Deg2Rad/2f; int texHeight = Mathf.RoundToInt(lightCamSize / LightPixelSize); float texWidth = texHeight * _camera.aspect; _extendedLightTextureSize = Point2.Round(new Vector2(texWidth, texHeight)); } { float lightCamHalfFov = _camera.fieldOfView * Mathf.Deg2Rad / 2f; float lightCamSize = Mathf.Tan(lightCamHalfFov) * LightObstaclesDistance * 2; //LightCamera.orthographicSize = lightCamSize/2f; float gameCamHalfFov = _camera.fieldOfView * Mathf.Deg2Rad / 2f; float gameCamSize = Mathf.Tan(gameCamHalfFov) * LightObstaclesDistance * 2; _camera.orthographicSize = gameCamSize / 2f; int texHeight = Mathf.RoundToInt(lightCamSize / LightPixelSize); float texWidth = texHeight * _camera.aspect; _smallLightTextureSize = Point2.Round(new Vector2(texWidth, texHeight)); } } if (_extendedLightTextureSize.x % 2 != 0) { _extendedLightTextureSize.x++; } if (_extendedLightTextureSize.y % 2 != 0) { _extendedLightTextureSize.y++; } if (_extendedLightTextureSize.x > 1024 || _extendedLightTextureSize.y > 1024 || _smallLightTextureSize.x > 1024 || _smallLightTextureSize.y > 1024) { Debug.LogError("LightPixelSize is too small. That might have a performance impact."); return; } if (_extendedLightTextureSize.x < 4 || _extendedLightTextureSize.y < 4 || _smallLightTextureSize.x < 4 || _smallLightTextureSize.y < 4) { Debug.LogError("LightPixelSize is too big. Lighting may not work correctly."); return; } _screenBlitTempTex = new RenderTexture(_camera.pixelWidth, _camera.pixelHeight, 0, _texFormat); _screenBlitTempTex.filterMode = FilterMode.Point; LightCamera.orthographic = _camera.orthographic; if (EnableNormalMapping) { _lightSourcesTexture = new RenderTexture(_camera.pixelWidth, _camera.pixelHeight, 0, _texFormat); _lightSourcesTexture.filterMode = FilterMode.Point; } else { _lightSourcesTexture = new RenderTexture(_smallLightTextureSize.x, _smallLightTextureSize.y, 0, _texFormat); _lightSourcesTexture.filterMode = LightTexturesFilterMode; } _obstaclesTexture = new RenderTexture(_extendedLightTextureSize.x, _extendedLightTextureSize.y, 0, _texFormat); _ambientTexture = new RenderTexture(_extendedLightTextureSize.x, _extendedLightTextureSize.y, 0, _texFormat); _ambientTexture.filterMode = LightTexturesFilterMode; Point2 upsampledObstacleSize = _extendedLightTextureSize * (LightObstaclesAntialiasing ? 2 : 1); _obstaclesUpsampledTexture = new RenderTexture(upsampledObstacleSize.x, upsampledObstacleSize.y, 0, _texFormat); if (AffectOnlyThisCamera) { _renderTargetTexture = new RenderTexture(_camera.pixelWidth, _camera.pixelHeight, -2, RenderTextureFormat.ARGB32); _renderTargetTexture.filterMode = FilterMode.Point; _camera.targetTexture = _renderTargetTexture; _camera.clearFlags = CameraClearFlags.SolidColor; _camera.backgroundColor = Color.clear; } _alphaBlendedMaterial = new Material(Shader.Find("Light2D/Internal/Alpha Blended")); if (XZPlane) { Shader.EnableKeyword("LIGHT2D_XZ_PLANE"); } else { Shader.DisableKeyword("LIGHT2D_XZ_PLANE"); } _obstaclesPostProcessor = new ObstacleCameraPostPorcessor(); LoopAmbientLight(100); }
private static void Opening(Form Form, Int32 Duration, Int32 TimeWait) { Int32 _messageCount = MessageCount; Form.Show(); Animation.Move(Form, new Point(Convert.ToInt32(SystemInfo.Screen().Width) - 330, 10), TransitionType.EaseInOutQuad, 15); Timer Location = new Timer() { Interval = 1 }; Location.Tick += delegate(Object sender, EventArgs e) { if (_messageCount < MessageCount) { _messageCount = MessageCount; Animation.Move(Form, new Point(Convert.ToInt32(SystemInfo.Screen().Width) - 330, Form.Location.Y + 110), TransitionType.EaseInOutQuad, 15); } }; Timer Hide = new Timer() { Interval = Duration }; Hide.Tick += delegate(Object sender, EventArgs e) { Form.Opacity -= Form.Opacity > 0 ? 0.1 : 0; if (Form.Opacity < 0.1) { Hide.Stop(); Form.Dispose(); MessageCount--; } //Animation.Animation.Move(Form, new Point(Information.Screen("Width"), Form.Location.Y), TransitionType.EaseInOutQuad, 15); //if (Form.Location.X == Information.Screen("Width")) //{ // Hide.Stop(); // Form.Dispose(); // MessageCount--; //} }; Timer Wait = new Timer() { Interval = TimeWait }; Wait.Tick += delegate(Object sender, EventArgs e) { Wait.Stop(); Hide.Start(); }; Timer Show = new Timer() { Interval = Duration }; Show.Tick += delegate(Object sender, EventArgs e) { Form.Opacity += Form.Opacity < 0.8 ? 0.1 : 0; if (Form.Opacity > 0.7) { Show.Stop(); Wait.Start(); } }; Location.Start(); Show.Start(); }
private void SetMemoryInfo(SystemInfo sysInfo) { //var memoryGB = Math.Round((((double)Convert.ToDouble(sysInfo.MemoryInBytes) / 1024) / 1024), 2).ToString("N"); lblRam.Text = String.Format("{0} bytes ({1} GB)", sysInfo.MemoryInBytes, sysInfo.MemoryInGB); }
// Check if the platform has the capability of compression. static bool CheckSupportCompression() { return (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.R8) && SystemInfo.supportedRenderTargetCount > 1); }
public void EqualsIgnoringCase_RightNull_false() { Assert.False(SystemInfo.EqualsIgnoringCase("foo", null)); }
private void BuildSpawners() { //Remove all previous spawners _spawners.ForEach(Destroy); _spawners.Clear(); _textureHolder = new List <Texture2D>(); foreach (var trajectory in TrajectoriesManager.Instance.GetInjectionGridTrajectories(CancellationToken.None).Result) { var particlesSpawner = Instantiate(ParticlesSpawner, trajectory.StartPoint, Quaternion.identity, transform); var visualEffect = particlesSpawner.GetComponent <VisualEffect>(); /** RGBA32 method * Uniquement 256 valeurs par axe => Pas assez précis * var colors = trajectory.Points.Select(p => new Color32(PositionToColor(p.x), PositionToColor(p.y), PositionToColor(p.z), byte.MaxValue)).ToArray(); * * var texture = new Texture2D(colors.Length, 1, TextureFormat.RGBA32, false); * texture.SetPixels32(colors); */ /** RGBAHalf Method - GetRawTextureData * Ne fonctionne pas bien (position incohérentes) * var texture = new Texture2D(trajectory.Points.Length, 1, TextureFormat.RGBAHalf, false); * var textureData = texture.GetRawTextureData<UInt16>(); * * for (int i = 0; i < trajectory.Points.Length; i++) { * var p = trajectory.Points[i]; * textureData[i * 4] = PositionToUInt16(p.x); * textureData[i * 4 + 1] = PositionToUInt16(p.y); * textureData[i * 4 + 2] = PositionToUInt16(p.z); * textureData[i * 4 + 3] = UInt16.MaxValue; * } */ /** RGBAHalf Method - GetRawTextureData * Ne fonctionne pas bien du tout * 15360 correspond au blanc (donc max) quand on regarde en reverse engineering * * var texture = new Texture2D(trajectory.Points.Length, 1, TextureFormat.RGBAHalf, false); * var textureData = texture.GetRawTextureData<UInt16>(); * * for (int i = 0; i < trajectory.Points.Length; i++) { * var p = trajectory.Points[i]; * textureData[i * 4] = PositionToColor16(p.x); * textureData[i * 4 + 1] = PositionToColor16(p.y); * textureData[i * 4 + 2] = PositionToColor16(p.z); * textureData[i * 4 + 3] = Convert.ToUInt16(15360); * }*/ /** RGBAHalf Method - SetPixels * SetPixels : This function works only on RGBA32, ARGB32, RGB24 and Alpha8 texture formats * It's not meant to be used with RGBAHalf but it actually works * * var texture = new Texture2D(trajectory.Points.Length, 1, TextureFormat.RGBAHalf, false); * texture.SetPixels(trajectory.Points.Select(p => new Color(PositionToColor(p.x), PositionToColor(p.y), PositionToColor(p.z), 1f)).ToArray()); */ /** reverse engineering * texture.SetPixel(0, 0, Color.black); * texture.SetPixel(1, 0, Color.white); * * texture.Apply(); * * var textureData = texture.GetRawTextureData(); * var textureData2 = texture.GetRawTextureData<UInt16>(); * var textureData3 = texture.GetRawTextureData<Int16>(); */ /** RGBAFloat Method * More precise and way more easier to handle (because float exist in C# whereas float16 doesn't) */ var texture = new Texture2D(trajectory.Points.Length, 1, TextureFormat.RGBAFloat, false); var textureData = texture.GetRawTextureData <Vector4>(); //We can directly use Vector4 because is 4 float, that matches RGBA channels for (var i = 0; i < textureData.Length; i++) { textureData[i] = trajectory.Points[i]; //Implicite Vector3 to Vector4 conversion, as we don't use alpha chanel } texture.Apply(); //Apply value to VFX visualEffect.SetUInt("TrajectoryLength", Convert.ToUInt32(trajectory.Points.Length)); visualEffect.SetTexture("Trajectory", texture); //Hold value to lists _spawners.Add(particlesSpawner); _textureHolder.Add(texture); //We need to keep a ref to the texture because SetTexture only make a binding. } Debug.Log($"{TextureFormat.RGBAHalf} is supported = {SystemInfo.SupportsTextureFormat(TextureFormat.RGBAHalf)}"); }
public static extern void GetSystemInfo(out SystemInfo Info);
public void EqualsIgnoringCase_SameStringsDifferentCase_true() { Assert.True(SystemInfo.EqualsIgnoringCase("foo", "FOO")); }
private static string ToOperatingSystemString(SystemInfo systemInfo) { return(!String.IsNullOrWhiteSpace(systemInfo.OperatingSystemArchitecture) ? String.Format(CultureInfo.InvariantCulture, "{0} {1}", systemInfo.OperatingSystem, systemInfo.OperatingSystemArchitecture) : systemInfo.OperatingSystem); }