本文整理汇总了C#中ProcessPriorityClass类的典型用法代码示例。如果您正苦于以下问题:C# ProcessPriorityClass类的具体用法?C# ProcessPriorityClass怎么用?C# ProcessPriorityClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessPriorityClass类属于命名空间,在下文中一共展示了ProcessPriorityClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CheckForNeedButton
private bool CheckForNeedButton(ProcessPriorityClass priority)
{
if (priority == ProcessPriorityClass.Normal)
{
radioButton1.Checked = true;
return true;
}
else if (priority == ProcessPriorityClass.AboveNormal)
{
radioButton2.Checked = true;
return true;
}
else if (priority == ProcessPriorityClass.BelowNormal)
{
radioButton3.Checked = true;
return true;
}
else if (priority == ProcessPriorityClass.High)
{
radioButton4.Checked = true;
return true;
}
else if (priority == ProcessPriorityClass.Idle)
{
radioButton5.Checked = true;
return true;
}
else if (priority == ProcessPriorityClass.RealTime)
{
radioButton6.Checked = true;
return true;
}
return false;
}
开发者ID:AndreiMisiukevich,项目名称:Task-manager,代码行数:34,代码来源:ChangePriority.cs
示例2: ConsoleProcess
public ConsoleProcess()
{
BufferSizeStdout = 4096;
BufferSizeStderr = 4096;
ModeStderr = CommunicationMode.Line;
ModeStdout = CommunicationMode.Line;
PriorityClass = ProcessPriorityClass.Normal;
}
开发者ID:Xtremrules,项目名称:dot42,代码行数:8,代码来源:ConsoleProcess.cs
示例3: SetPriority
public virtual void SetPriority(int processId, ProcessPriorityClass priority)
{
var process = Process.GetProcessById(processId);
Logger.Info("Updating [{0}] process priority from {1} to {2}",
process.ProcessName,
process.PriorityClass,
priority);
process.PriorityClass = priority;
}
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:11,代码来源:ProcessProvider.cs
示例4: Initialize
public void Initialize()
{
this.CachedProcessPriorityClass = Process.GetCurrentProcess().PriorityClass;
this.CachedThreadPriority = Thread.CurrentThread.Priority;
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
Thread.CurrentThread.Priority = ThreadPriority.Highest;
this.IsCachedStatus = true;
this.Time(1, () => { });
}
开发者ID:nokia6102,项目名称:jasily.cologler,代码行数:12,代码来源:CodeTimer.cs
示例5: ChangePriority
private void ChangePriority(ProcessPriorityClass priority)
{
cbxPriority.SelectedValue = priority;
for (var i = 0; i < tsmiPriority.DropDownItems.Count; i++)
{
var item = (ToolStripMenuItem)tsmiPriority.DropDownItems[i];
item.Checked = (int)item.Tag == (int)priority;
}
processor.Priority = priority;
}
开发者ID:vitalyobukhov,项目名称:Flac2Alac,代码行数:12,代码来源:Progress.cs
示例6: HighPerformance
#pragma warning disable 0618
/// <summary>
/// Initializes a new instance of the <see cref="HighPerformance"/> class.
/// </summary>
internal HighPerformance() {
////if (!WaitForQuietCpu()) {
//// Assert.Inconclusive("Timed out waiting for a quiet CPU in which to perform perf tests.");
////}
this.originalLoggerThreshold = LogManager.GetLoggerRepository().Threshold;
LogManager.GetLoggerRepository().Threshold = LogManager.GetLoggerRepository().LevelMap["OFF"];
this.powerSetting = new PowerManagment.PowerSetting(PowerManagment.PowerProfiles.HighPerformance);
this.originalProcessPriority = Process.GetCurrentProcess().PriorityClass;
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
Thread.CurrentThread.Priority = ThreadPriority.Highest;
SpinCpu();
}
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:17,代码来源:HighPerformance.cs
示例7: ProcessInfo
/// <summary>
/// Initializes a new instance of the <see cref="ProcessInfo"/> class.
/// </summary>
/// <param name="filename">The filename.</param>
/// <param name="arguments">The arguments.</param>
/// <param name="workingDirectory">The working directory.</param>
/// <param name="priority">The priority.</param>
/// <param name="successExitCodes">The success exit codes.</param>
public ProcessInfo(string filename, SecureArguments arguments, string workingDirectory, ProcessPriorityClass priority, int[] successExitCodes)
{
this.arguments = arguments;
this.priority = priority;
startInfo.FileName = filename.StripQuotes();
startInfo.Arguments = arguments == null ? null : arguments.ToString(SecureDataMode.Private);
startInfo.WorkingDirectory = workingDirectory.StripQuotes();
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardInput = false;
this.successExitCodes = successExitCodes ?? new[] { 0 };
}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:22,代码来源:ProcessInfo.cs
示例8: TryExecute_Impersonated
/// <summary>
/// Executes the <paramref name="executable"/> and waits a maximum time of <paramref name="maxWaitMs"/> for completion. If the process doesn't end in
/// this time, it gets aborted. This method tries to impersonate the interactive user and run the process under its identity.
/// </summary>
/// <param name="executable">Program to execute</param>
/// <param name="arguments">Program arguments</param>
/// <param name="priorityClass">Process priority</param>
/// <param name="maxWaitMs">Maximum time to wait for completion</param>
/// <returns><c>true</c> if process was executed and finished correctly</returns>
public static bool TryExecute_Impersonated(string executable, string arguments, ProcessPriorityClass priorityClass = ProcessPriorityClass.Normal, int maxWaitMs = INFINITE)
{
IntPtr userToken;
if (!ImpersonationHelper.GetTokenByProcess(out userToken, true))
return false;
try
{
string unused;
return TryExecute_Impersonated(executable, arguments, userToken, false, out unused, priorityClass, maxWaitMs);
}
finally
{
ImpersonationHelper.SafeCloseHandle(userToken);
}
}
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:24,代码来源:ProcessUtils.cs
示例9: TryExecuteReadString
/// <summary>
/// Executes the <paramref name="executable"/> and waits a maximum time of <paramref name="maxWaitMs"/> for completion and returns the contents of
/// <see cref="Process.StandardOutput"/>. If the process doesn't end in this time, it gets aborted.
/// </summary>
/// <param name="executable">Program to execute</param>
/// <param name="arguments">Program arguments</param>
/// <param name="result">Returns the contents of standard output</param>
/// <param name="priorityClass">Process priority</param>
/// <param name="maxWaitMs">Maximum time to wait for completion</param>
/// <returns></returns>
public static bool TryExecuteReadString(string executable, string arguments, out string result, ProcessPriorityClass priorityClass = ProcessPriorityClass.Normal, int maxWaitMs = 1000)
{
using (System.Diagnostics.Process process = new System.Diagnostics.Process { StartInfo = new ProcessStartInfo(executable, arguments) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true } })
{
process.Start();
process.PriorityClass = priorityClass;
using (process.StandardOutput)
{
result = process.StandardOutput.ReadToEnd();
if (process.WaitForExit(maxWaitMs))
return process.ExitCode == 0;
}
if (!process.HasExited)
process.Kill();
}
return false;
}
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:27,代码来源:ProcessUtils.cs
示例10: ClientConnection
public ClientConnection(string hostName, string ipAddress, int instance, ProcessPriorityClass priority, int bitSize)
{
IsOnline = true;
Jobs = new List<Job>();
PriorityJobs = new List<Job>();
CurrentJob = "";
ActiveHours = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";
Id = (_nextClientId++);
HostName = hostName;
IPAddress = ipAddress;
Instance = instance;
Priority = priority;
BitSize = bitSize;
_lastCall.Reset();
_lastCall.Start();
RestoreSettings();
}
开发者ID:SteveMoody73,项目名称:Amleto,代码行数:18,代码来源:ClientConnection.cs
示例11: Run
public void Run(ProcessEx process, ProcessPriorityClass priority)
{
if (this.Status.InUse)
throw new InvalidOperationException("Current core is running another process");
if (process == null)
throw new ArgumentNullException("Process can not be null");
this.Process = process;
this.Process.ExecutingCore = this;
//bind event
this.Process.Exited += Process_Exited;
this.Process.Start();
this.Process.Status = ProcessExecutionStatus.Running;
this.Process.PriorityClass = priority;
this.Status.InUse = true;
//TODO set affinity
this.Process.ProcessorAffinity = (IntPtr) (int) Math.Pow(2, this.Status.Index);
}
开发者ID:Liano,项目名称:intelife,代码行数:22,代码来源:Core.cs
示例12: RegistSchedule
public void RegistSchedule(string serviceName,ProcessPriorityClass Priority,string FilePath,string args)
{
using (TaskService task= new TaskService())
{
string SchedulerName= "GISHitpanDBManager"+Guid.NewGuid().ToString();
using(TaskDefinition def = task.NewTask())
{
//일반
def.Principal.DisplayName = serviceName;
def.Principal.UserId=string.Format("{0}\\{1}",Environment.UserDomainName,Environment.UserName);
def.Principal.LogonType=TaskLogonType.InteractiveToken;
def.Principal.RunLevel=TaskRunLevel.Highest;
def.Triggers.Add( new LogonTrigger());
//조건
def.Settings.MultipleInstances=TaskInstancesPolicy.IgnoreNew;
def.Settings.DisallowStartIfOnBatteries=false;
def.Settings.StopIfGoingOnBatteries=false;
def.Settings.AllowHardTerminate=false;
def.Settings.StartWhenAvailable=true;
def.Settings.RunOnlyIfNetworkAvailable=false;
def.Settings.IdleSettings.StopOnIdleEnd=false;
def.Settings.IdleSettings.RestartOnIdle=false;
//설정
def.Settings.AllowDemandStart=false;
def.Settings.Enabled=true;
def.Settings.Hidden=false;
def.Settings.RunOnlyIfIdle=false;
def.Settings.ExecutionTimeLimit=TimeSpan.Zero;
def.Settings.Priority = Priority;
//동작
def.Actions.Add(FilePath, args);
//등록
task.RootFolder.RegisterTaskDefinition(SchedulerName,def);
}
}
}
开发者ID:hesed7,项目名称:hitpan,代码行数:37,代码来源:AutoBackupService.cs
示例13: QueueProcess
/// <summary>
/// Queues the process.
/// </summary>
/// <param name="process">The process to enqueue.</param>
/// <param name="prc">process priority.</param>
public void QueueProcess(ProcessEx process, ProcessPriorityClass prc)
{
lock (_queueLock)
{
this._processQueue.Enqueue(new KeyValuePair<ProcessEx, ProcessPriorityClass>(process, prc));
process.Status = ProcessExecutionStatus.Queued;
}
}
开发者ID:Liano,项目名称:intelife,代码行数:13,代码来源:ProcessManager.cs
示例14: ProcessInfo
/// <summary>
/// Initializes a new instance of the <see cref="ProcessInfo" /> class.
/// </summary>
/// <param name="filename">The filename.</param>
/// <param name="arguments">The arguments.</param>
/// <param name="workingDirectory">The working directory.</param>
/// <param name="priority">The priority.</param>
/// <remarks></remarks>
public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority) :
this(filename, arguments, workingDirectory, priority, null){}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:10,代码来源:ProcessInfo.cs
示例15: SetProcessPriority
private void SetProcessPriority(ProcessPriorityClass priority)
{
try
{
using (var phandle = new ProcessHandle(processSelectedPid, ProcessAccess.SetInformation))
phandle.SetPriorityClass(priority);
}
catch (Exception ex)
{
PhUtils.ShowException("Unable to set process priority", ex);
}
}
开发者ID:andyvand,项目名称:ProcessHacker,代码行数:12,代码来源:HackerWindow.cs
示例16: SetPriorityJob
public SetPriorityJob(ProcessPriorityClass priority)
{
_priority = priority;
}
开发者ID:SteveMoody73,项目名称:Amleto,代码行数:4,代码来源:SetPriorityJob.cs
示例17: NewProcessInfo
private ProcessInfo NewProcessInfo(string args, IIntegrationResult result, ProcessPriorityClass priority, int[] successExitCodes)
{
Log.Info(string.Concat("[Git] Calling git ", args));
var processInfo = new ProcessInfo(Executable, args, BaseWorkingDirectory(result), priority,
successExitCodes);
//processInfo.StreamEncoding = Encoding.UTF8;
return processInfo;
}
开发者ID:josemarcenaro,项目名称:CruiseControl.NET,代码行数:8,代码来源:Git.cs
示例18: StartGame
/// <summary>
/// Starts spring game
/// </summary>
/// <param name="client">tasclient to get current battle from</param>
/// <param name="priority">spring process priority</param>
/// <param name="affinity">spring process cpu affinity</param>
/// <param name="scriptOverride">if set, overrides generated script with supplied one</param>
/// <param name="userName">lobby user name - used to submit score</param>
/// <param name="passwordHash">lobby password hash - used to submit score</param>
/// <returns>generates script</returns>
public string StartGame(TasClient client, ProcessPriorityClass? priority, int? affinity, string scriptOverride, bool useSafeMode = false, bool useMultithreaded=false, BattleContext contextOverride = null, Battle battleOverride = null) {
if (!File.Exists(paths.Executable) && !File.Exists(paths.DedicatedServer)) throw new ApplicationException(string.Format("Spring or dedicated server executable not found: {0}, {1}", paths.Executable, paths.DedicatedServer));
this.client = client;
wasKilled = false;
if (!IsRunning) {
gameEndedOk = false;
IsBattleOver = false;
lobbyUserName = client.UserName;
lobbyPassword = client.UserPassword;
battleResult = new BattleResult();
talker = new Talker();
talker.SpringEvent += talker_SpringEvent;
var battle = battleOverride ?? client.MyBattle;
isHosting = client != null && battle != null && battle.Founder.Name == client.MyUser.Name;
if (isHosting) scriptPath = Utils.MakePath(paths.WritableDirectory, "script_" + battle.Founder + ".txt").Replace('\\', '/');
else scriptPath = Utils.MakePath(paths.WritableDirectory, "script.txt").Replace('\\', '/');
statsPlayers.Clear();
statsData.Clear();
StartContext = null;
string script;
if (!string.IsNullOrEmpty(scriptOverride)) {
battleResult.IsMission = true;
isHosting = false;
script = scriptOverride;
}
else {
List<UserBattleStatus> players;
battleGuid = Guid.NewGuid();
var service = GlobalConst.GetSpringieService();
SpringBattleStartSetup startSetup = null;
if (isHosting && GlobalConst.IsZkMod(battle.ModName)) {
try {
StartContext = contextOverride ?? battle.GetContext();
startSetup = service.GetSpringBattleStartSetup(StartContext);
if (startSetup.BalanceTeamsResult != null)
{
StartContext.Players = startSetup.BalanceTeamsResult.Players;
StartContext.Bots = startSetup.BalanceTeamsResult.Bots;
}
connectedPlayers.Clear();
foreach (var p in StartContext.Players)
{
p.IsIngame = true;
}
} catch (Exception ex) {
Trace.TraceError("Error getting start setup: {0}", ex);
}
}
script = battle.GenerateScript(out players, client.MyUser, talker.LoopbackPort, battleGuid.ToString(), startSetup);
battleResult.IsMission = battle.IsMission;
battleResult.IsBots = battle.Bots.Any();
battleResult.Title = battle.Title;
battleResult.Mod = battle.ModName;
battleResult.Map = battle.MapName;
battleResult.EngineVersion = paths.SpringVersion;
talker.SetPlayers(players);
statsPlayers = players.ToDictionary(x => x.Name,
x => new BattlePlayerResult
{
LobbyID = x.LobbyUser.AccountID,
AllyNumber = x.AllyNumber,
CommanderType = null,
// todo commandertype
IsSpectator = x.IsSpectator,
IsVictoryTeam = false,
});
}
if (isHosting) timer.Start();
File.WriteAllText(scriptPath, script);
LogLines = new StringBuilder();
var optirun = Environment.GetEnvironmentVariable("OPTIRUN");
process = new Process();
process.StartInfo.CreateNoWindow = true;
List<string> arg = new List<string>();
if (string.IsNullOrEmpty(optirun))
{
if (UseDedicatedServer)
//.........这里部分代码省略.........
开发者ID:TurBoss,项目名称:Zero-K-Infrastructure,代码行数:101,代码来源:Spring.cs
示例19: TryExecuteReadString_AutoImpersonate
/// <summary>
/// Executes the <paramref name="executable"/> and waits a maximum time of <paramref name="maxWaitMs"/> for completion and returns the contents of
/// <see cref="Process.StandardOutput"/>. If the process doesn't end in this time, it gets aborted.
/// </summary>
/// <param name="executable">Program to execute</param>
/// <param name="arguments">Program arguments</param>
/// <param name="result">Returns the contents of standard output</param>
/// <param name="priorityClass">Process priority</param>
/// <param name="maxWaitMs">Maximum time to wait for completion</param>
/// <returns></returns>
public static bool TryExecuteReadString_AutoImpersonate(string executable, string arguments, out string result, ProcessPriorityClass priorityClass = ProcessPriorityClass.Normal, int maxWaitMs = 1000)
{
return IsImpersonated ?
TryExecuteReadString_Impersonated(executable, arguments, out result, priorityClass, maxWaitMs) :
TryExecuteReadString(executable, arguments, out result, priorityClass, maxWaitMs);
}
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:16,代码来源:ProcessUtils.cs
示例20: TryExecute
/// <summary>
/// Executes the <paramref name="executable"/> and waits a maximum time of <paramref name="maxWaitMs"/> for completion. If the process doesn't end in
/// this time, it gets aborted.
/// </summary>
/// <param name="executable">Program to execute</param>
/// <param name="arguments">Program arguments</param>
/// <param name="priorityClass">Process priority</param>
/// <param name="maxWaitMs">Maximum time to wait for completion</param>
/// <returns><c>true</c> if process was executed and finished correctly</returns>
public static bool TryExecute(string executable, string arguments, ProcessPriorityClass priorityClass = ProcessPriorityClass.Normal, int maxWaitMs = INFINITE)
{
string unused;
return TryExecute(executable, arguments, false, out unused, priorityClass, maxWaitMs);
}
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:14,代码来源:ProcessUtils.cs
注:本文中的ProcessPriorityClass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论