public void asdasd() { var result = System.Diagnostics.Process.GetProcesses().Where(i => i.MainWindowTitle.Length > 0).ToList(); foreach (var item in result) { if (ConfigurationViewModel.process != null) { foreach (var item1 in ConfigurationViewModel.process) { if (item1 == item.MainWindowTitle) { item.Kill(); } } } ProcessEntity entity = new ProcessEntity() { Datetime = item.StartTime, Id = item.Id, Title = item.MainWindowTitle, Name = item.ProcessName }; ProcessList.Add(entity); } Task task = Task.Run(() => LogFile()); }
public void UpdateList() { Process[] newSession = Process.GetProcesses(); foreach (Process process in newSession) { int i = ProcessExists(process.Id); if (i != -1) { ProcessList[i].Update(); } else { ProcessList.Add(new SingleProcess(process, AbleToAccess(process))); } } //int length = ProcessList.Count; //for (int i = 0; i < length; i++) //{ // if (ProcessList[i].Updated) ProcessList[i].Updated = false; // else // { // ProcessList.RemoveAt(i); // --i; --length; // } //} ProcessList.RemoveAll(i => i.Updated == false); ProcessList.ForEach(i => i.Updated = false); }
public void CreateProcess(string processName, List <SyntaxNode> program, Priority priority = Priority.Normal) { CheckChannel(); var findInProcess = ProcessList.Find(t => t.Name == processName); var findInSuspend = SuspendedList.Find(t => t.Name == processName); if (findInProcess == null && findInSuspend == null) { var process = new Process() { Name = processName, Program = program, Priority = priority, State = State.Created, CpuState = new CpuState(1048576), CreateTime = Time }; ProcessList.Add(process); SortList(); AllocateMemory(process.Name); OnProcessCreate(process); } else { throw new ProcessConflictException() { Name = processName }; } }
/// <summary> /// Set the queue as a List type instead of BlockingCollection /// </summary> /// <returns>Context</returns> public QueueManager UseListQueue() { if (_queueType == "List") { return(this); } bool running = Status == QueueStatus.Running; Stop(); var queue = new ProcessList(); foreach (var process in _queue.ProcessBlockingCollection) { queue.Add(process); } _queueType = "List"; _queue = new BaseProcessQueue(_queueType); foreach (var process in queue) { _queue.Add(process); } Console.WriteLine("Queue Changed to list"); if (running) { Start(); } return(this); }
internal ProcessDataStorage() { _processList = new List <SingleProcess>(); foreach (Process process in Process.GetProcesses()) { ProcessList.Add(new SingleProcess(process, AbleToAccess(process))); } }
/// <summary> /// Setups the Poller with initial folders to start with. /// </summary> internal void CreateTasks() { int i = 0; if (!useLocation) { this.IgnoreSubDirectories = false; //Console.WriteLine("Number of rules: {0}", Rules.Length); foreach (Rule r in Rules) { //TODO: Work on exclusion list. TaskItemList list = r["HASHFIRST"]; //Console.WriteLine("RuleName={0}; RuleValues:{1}", r.Name, r.wildcards.Value); foreach (TaskItem taskitem in list) { if (taskitem != null) { Events.Add(new ManualResetEvent(false)); Task task = new Task(taskitem, wildcards, Hasher.MaxPerFolder, Events[i]); task.MaxDepth = taskitem.MaxDepth; //Console.WriteLine("MaxDepth = {0}", task.MaxDepth); Poll.Add(task); i++; } } pollTimer.BeginTimer(); } } else { foreach (string s in this.locations) { if (s.Trim().CompareTo("") != 0) { Events.Add(new ManualResetEvent(false)); Poll.Add(new Task(new TaskItem(s), wildcards, Hasher.MaxPerFolder, Events[i])); i++; } } } }
/// <summary> /// Encapsulate a single process into PCB (Process Control Block) /// </summary> /// <param name="process">The process</param> /// <returns>The encapsulated PCB</returns> public PCB AddAndEncapsulateProcess(Process process) { EventLogger.AddEvent("New process: " + process.ToString()); PCB pcb = new PCB(counter++, process); ProcessList.Add(pcb); //Add process to the scheduling algorithm too selectedAlgorithm.AddNewProcess(pcb); return(pcb); }
void ProfileSwitch(object sender) { string newProfile = sender.ToString(); SaveSettings(false); var newGameData = Settings.data.Games[newProfile]; if (newGameData.Name != gameData.Name) { if (string.IsNullOrWhiteSpace(newGameData.Path)) { var dialog = new VistaFolderBrowserDialog { Description = $"Select userdata folder for {newGameData.Name}", UseDescriptionForTitle = true }; if (dialog.ShowDialog(this) == true) { newGameData.Path = dialog.SelectedPath; } } if (!string.IsNullOrWhiteSpace(newGameData.Path)) // check if paths in category exist here { TabScene.StopThread(); TabChara1.StopThread(); TabChara2.StopThread(); TabOutfit1.StopThread(); TabOutfit2.StopThread(); Settings.data.LastProfile = newProfile; SaveSettings(false); gameData = newGameData; ProcessList.Clear(); gameData.SceneList.ForEach((y) => ProcessList.Add(y.Name)); var scene = gameData.SceneList[gameData.SavedScene]; currentTarget = scene.Name; WindowTitle.Value = $"{defaultTitle} - {gameData.Name} - {currentTarget}"; PartialReplaceEnabled.Value = scene.PartialReplaceEnabled; SpecialLoadEnabled.Value = scene.SpecialLoadEnabled; TabScene.SetGame(gameData, gameData.Category.Scene); TabChara1.SetGame(gameData, gameData.Category.Chara1); TabChara2.SetGame(gameData, gameData.Category.Chara2); TabOutfit1.SetGame(gameData, gameData.Category.Outfit1); TabOutfit2.SetGame(gameData, gameData.Category.Outfit2); ImageMultiplier.Value = SelectedTab.ImageMultiplier; SavedTab.Value = gameData.Tab != -1 ? gameData.Tab : 0; } } }
//---------------------------------------------------------------------- void RefreshProcListByCom(string com) { byte[] data = null; switch (com) { case "Connect": data = Encoding.Default.GetBytes("Connect:"); break; case "Kill": data = Encoding.Default.GetBytes($"Kill:{ProcIndex.Id}"); break; case "Run": data = Encoding.Default.GetBytes($"Run:{RunTask}"); break; case "Refresh": data = Encoding.Default.GetBytes("Refresh:"); break; } socket.Send(data); var answer = new byte[8192]; var length = socket.Receive(answer); if (length != 0) { var mStream = new MemoryStream(); var binFormatter = new BinaryFormatter(); mStream.Write(answer, 0, length); mStream.Position = 0; var tempCol = binFormatter.Deserialize(mStream) as List <ProcItem>; Dispatcher.Invoke(() => { ProcessList.Clear(); foreach (var item in tempCol) { var proc = new ProcItem(); proc.Id = item.Id; proc.Name = item.Name; ProcessList.Add(proc); } }); } }
/// <summary> /// Create an empty Process structure. It will not registered or started. /// </summary> public static Process CreateEmptyProcess(ProcessCreateOptions options) { var proc = new Process(); proc.ProcessID = Interlocked.Increment(ref NextCreateProcessID); lock (ProcessList) ProcessList.Add(proc); proc.User = options.User; proc.PageTable = PageTable.KernelTable; proc.Service = new ProcessService(proc); return(proc); }
public Task <RunnableProcess> RunProcessAsync(ProcessConfiguration configuration) { var process = new RunnableProcess(configuration); process.CreateProcess(); ProcessList.Add(process); var task = new Task <RunnableProcess>(() => RunProcess(process)); task.Start(); return(task); }
public void UpdateList(Proc NewProcess) { Proc OldProcess = ProcessList.FirstOrDefault(name => name.Name == NewProcess.Name); // Retoune le processus dans la liste. if (OldProcess != null) { int index = processList.IndexOf(OldProcess); ProcessList[index].Cpu = NewProcess.Cpu; ProcessList[index].Ram = NewProcess.Ram; return; } ProcessList.Add(NewProcess); //Si le processus n'est pas dans la liste, on l'ajoute. }
public void GetMyPreFileList(GetPreListCallBackEventHandler callBackGetPreListResult, uint startIndex, string [] tags, uint days = 0, uint count = 9, EWorkshopEnumerationType orderBy = EWorkshopEnumerationType.k_EWorkshopEnumerationTypeRankedByVote, string searchText = "") { if (searchText.CompareTo("") == 0) { SteamGetMyPreListProcess item = new SteamGetMyPreListProcess(callBackGetPreListResult, startIndex, tags, count); ProcessList.Add(item); } else { SteamSearchMyProcess item = new SteamSearchMyProcess(callBackGetPreListResult, startIndex, tags, count, searchText); ProcessList.Add(item); } }
/* * * This version of the function is used if we are reading in a file. * in the index 0 is the ID of the process if needed (p1, p2, p3, etc) * and in the index 1 is the memory in kb. * this can obviously be changed * - Chris A * * */ void GetProcesses() { string[] file = File.readAllLines(); foreach (String line in file) { string[] l = line.Split('\t'); if (l[0] == "Id") continue; Process obj = new Process(); obj.ID = Convert.ToInt32(l[0]); obj.MemoryInKB = Convert.ToInt32(l[1]); ProcessList.Add(obj); } }
public void StartOne() { if (Jobs.Count == 0) { return; } Job job = Jobs.First(); //Interlocked.Increment(ref runningJobs); //RaisePropertyChanged("RunningJobs"); Jobs.Remove(job); job.Execute(); ProcessList.Add(job.Process); // job.Process.Exited += OnJobFinished; }
/// <summary> /// Queues the text for writing to the <see cref="LogFile"/>. /// </summary> /// <param name="text">The text to be written to the <see cref="LogFile"/>.</param> public void Write(string text) { // Yield to the "file full operation" to complete, if in progress. m_operationWaitHandle.WaitOne(); if (IsOpen) { // Queue the text for writing to the log file. m_logEntryQueue.Add(text); } else { throw new InvalidOperationException(string.Format("{0} \"{1}\" is not open", this.GetType().Name, m_fileName)); } }
void BindingProcess() { try { var dispatcher = App.Current.Dispatcher; ProcessLogProxy.MessageAction = ((x) => { dispatcher.Invoke(() => { ProcessList.Add(x); }); }); ProcessLogProxy.SuccessMessage = ((x) => { dispatcher.Invoke(() => { ProcessList.Add(new ProcessMsg(x, "Green")); }); }); ProcessLogProxy.Error = ( (x) => { dispatcher.Invoke(() => { ProcessList.Add(new ProcessMsg(x, "Red")); }); }); ProcessLogProxy.Normal = ( x => { dispatcher.Invoke(() => { ProcessList.Add(new ProcessMsg(x, "Blue")); }); }); } catch (Exception e) { string msg = e.ToString(); // to do nothing } }
public void ResumeProcess(string processName) { var find = SuspendedList.Find(t => t.Name == processName); if (find != null) { SuspendedList.Remove(find); find.State = State.Ready; ProcessList.Add(find); OnProcessStateChange(find, State.Suspended); } else { throw new ProcessNotExistException() { Name = processName }; } }
public void AddEvents(IEnumerable <AbstractEvent> abstactEvents) { var newEvents = new List <AbstractEvent>(); foreach (var abstactEvent in abstactEvents) { switch (abstactEvent) { case LogEvent evt: { if (evt.ProcessInvocationUID != null && !ProcessList.ContainsKey(evt.ProcessInvocationUID.Value)) { continue; } } break; case IoCommandStartEvent evt: { if (!ProcessList.ContainsKey(evt.ProcessInvocationUid)) { continue; } } break; case ProcessInvocationStartEvent evt: { if (!ProcessList.ContainsKey(evt.InvocationUID)) { TrackedProcessInvocation invoker = null; if (evt.CallerInvocationUID != null && !ProcessList.TryGetValue(evt.CallerInvocationUID.Value, out invoker)) { continue; } var process = new TrackedProcessInvocation(evt.InvocationUID, evt.InstanceUID, evt.InvocationCounter, invoker, evt.Type, evt.Kind, evt.Name, evt.Topic); ProcessList.Add(process.InvocationUid, process); OnProcessInvoked?.Invoke(this, process); } } break; case ProcessInvocationEndEvent evt: { if (!ProcessList.TryGetValue(evt.InvocationUID, out var process)) { continue; } process.ElapsedMillisecondsAfterFinished = TimeSpan.FromMilliseconds(evt.ElapsedMilliseconds); if (evt.NetTimeMilliseconds != null) { process.NetTimeAfterFinished = TimeSpan.FromMilliseconds(evt.NetTimeMilliseconds.Value); } } break; case RowCreatedEvent evt: { if (!ProcessList.TryGetValue(evt.ProcessInvocationUid, out var process)) { continue; } process.CreateRow(); } break; case RowOwnerChangedEvent evt: { if (!ProcessList.TryGetValue(evt.PreviousProcessInvocationUid, out var previousProcess)) { continue; } TrackedProcessInvocation newProcess = null; if (evt.NewProcessInvocationUid != null && !ProcessList.TryGetValue(evt.NewProcessInvocationUid.Value, out newProcess)) { continue; } if (newProcess != null) { previousProcess.PassedRow(evt.RowUid); newProcess.InputRow(evt.RowUid, previousProcess); } else { previousProcess.DropRow(evt.RowUid); } } break; case RowValueChangedEvent evt: continue; case SinkStartedEvent evt: { var sink = new TrackedSink(evt.UID, evt.Location, evt.Path); SinkList.Add(evt.UID, sink); OnSinkStarted?.Invoke(this, sink); } break; case WriteToSinkEvent evt: { if (!ProcessList.TryGetValue(evt.ProcessInvocationUID, out var process)) { continue; } if (!SinkList.TryGetValue(evt.SinkUID, out var sink)) { continue; } process.WriteRowToSink(evt.RowUid); OnWriteToSink?.Invoke(this, sink, process, evt.RowUid, evt.Values); sink.RowCount++; } break; } newEvents.Add(abstactEvent); } if (newEvents.Count == 0) { return; } OnEventsAdded?.Invoke(this, newEvents); }
public override void Initialize() { //将处理器集合中添加此处理器 ProcessList.Add(new ChangeBuildColor_Blue()); }
public override void Initialize() { //将处理器集合中添加此处理器 ProcessList.Add(new RoleColor_Green()); }
public void Vote(VoteResultEventHandler callBackVoteResult, PublishedFileId_t publishID, bool bFor) { SteamVoteProcess item = new SteamVoteProcess(callBackVoteResult, publishID, bFor); ProcessList.Add(item); }
public void AddProcess(SystemProcess process) { ProcessList.Add(process); }
public void DeleteFile(DeleteFileResultEventHandler callBackDeleteFileResult, string fileName, PublishedFileId_t publishID) { SteamDeleteProcess item = new SteamDeleteProcess(callBackDeleteFileResult, fileName, publishID); ProcessList.Add(item); }
public void AddProcess <T>(T process) where T : Process { ProcessList.Add(process); }
public void RefreshVoteDetail(SteamVoteDetailEventHandler callBackRefreshVoteDetail, PublishedFileId_t publishID) { SteamRefreshVoteDetailProcess item = new SteamRefreshVoteDetailProcess(callBackRefreshVoteDetail, publishID); ProcessList.Add(item); }
public void RandomGetIsosFromWorkShop(GetRandomIsoListCallBackEventHandler callback, int amount, int dungeonId, string tag) { SteamRandomGetIsoProcess item = new SteamRandomGetIsoProcess(callback, amount, dungeonId, tag); ProcessList.Add(item); }
public void AddProcess(ProcessViewModel process) { ProcessList.Add(process); }
void Window_Loaded(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Settings.data.LastProfile)) { gameData = Settings.data.Games[Settings.data.LastProfile]; } if (gameData == null) { var list = new SelectList("Choose a profile", Settings.data.Games.Keys); list.Top = Top + (Height / 2) - (list.Height / 2); list.Left = Left + (Width / 2) - (list.Width / 2); if (list.ShowDialog() == true) { gameData = Settings.data.Games[list.Selected]; Settings.data.LastProfile = list.Selected; } } if (gameData != null) { if (string.IsNullOrWhiteSpace(gameData.Path)) { var dialog = new VistaFolderBrowserDialog { Description = $"Select userdata folder for {gameData.Name}", UseDescriptionForTitle = true }; if (dialog.ShowDialog(this) == true) { gameData.Path = dialog.SelectedPath; } } if (!string.IsNullOrWhiteSpace(gameData.Path)) // check if paths in category exist here { RPCServer.Start(serverName, serverPort); RPCClient_UI.Start(serverName, serverPort); gameData.SceneList.ForEach((x) => ProcessList.Add(x.Name)); var scene = gameData.SceneList[gameData.SavedScene]; currentTarget = scene.Name; WindowTitle.Value = $"{defaultTitle} - {gameData.Name} - {currentTarget}"; PartialReplaceEnabled.Value = scene.PartialReplaceEnabled; SpecialLoadEnabled.Value = scene.SpecialLoadEnabled; TabScene.SetGame(gameData, gameData.Category.Scene); TabChara1.SetGame(gameData, gameData.Category.Chara1); TabChara2.SetGame(gameData, gameData.Category.Chara2); TabOutfit1.SetGame(gameData, gameData.Category.Outfit1); TabOutfit2.SetGame(gameData, gameData.Category.Outfit2); ImageMultiplier.Value = SelectedTab.ImageMultiplier; SavedTab.Value = gameData.Tab != -1 ? gameData.Tab : 0; Closing += Window_Closing; return; } } Close(); }
public void ProcessAdd(Process p) { ProcessList.Add(p.ProcessName, p); }