public QuickProcess(ProcessTypes processType, int processId) { QuickProcessViewModel.Errors = 0; InitializeComponent(); Messenger.Default.Send <int>(processId); Messenger.Default.Send <ProcessTypes>(processType); Messenger.Reset(); }
public bool AddLog(HostingLogInfo hostingLogDto, int memberProductId, ProcessTypes processTypes) { var req = new ReqAddLog() { HostingLogDto = hostingLogDto, MemberProductId = memberProductId, ProcessType = processTypes }; return(this.Call <bool, ReqAddLog>(req, "AddLog")); }
private void ExecuteEdit(object parameter) { int index = ProcessTypes.IndexOf(parameter as ProcessType); if (index > -1 && index < ProcessTypes.Count) { ProcessType = new ProcessType(); ProcessType = ProcessTypes[index]; } }
public void LoadTaxonomyDatabase() { XmlDocument db = new XmlDocument(); db.Load(@"c:\temp\MetrologyNET_Taxonomy_v2.xml"); //the path should be updated in the final version ////////////////////////////// XmlNodeList ptNodesList = db.GetElementsByTagName("mtc:ProcessType"); foreach (XmlNode xmlNode in ptNodesList) { ProcessType tempPt = new ProcessType(); // Model object to be filled by XML node String tempName = xmlNode.Attributes["name"].Value; //Console.WriteLine(tempName); if (tempName.StartsWith("Source")) // taxonomy contains: <mtc:ProcessType name="D0AD73A4-E43E-4B9A-9C41-9A54281C18BC">, change or delete it { tempPt.Action = "Source"; tempPt.Taxonomy = tempName.Substring(7); } else if (tempName.StartsWith("Measure")) { tempPt.Action = "Measure"; tempPt.Taxonomy = tempName.Substring(8); } XmlNodeList childNodeList = xmlNode.ChildNodes; foreach (XmlNode childNode in childNodeList) { if (childNode.Name.Equals("mtc:Parameter")) { bool isOptional = false; XmlAttributeCollection attributes = childNode.Attributes; foreach (XmlAttribute xmlAttribute in attributes) { if (xmlAttribute.Name.Equals("optional") && xmlAttribute.Value.Equals("true")) // if there exist an optional attribute and its value is true... { isOptional = true; } } if (isOptional == true) // optional parameter { tempPt.OptionalParameters.Add(new MeasurementParameter(childNode.Attributes["name"].Value)); } else if (isOptional == false) { tempPt.RequiredParameters.Add(new MeasurementParameter(childNode.Attributes["name"].Value)); } } } ProcessTypes.Add(tempPt); } }
public void Add(string processName, string process, int processNum, int portNum) { if (!ProcessTypes.ContainsKey(processName)) { ProcessTypes.Add(processName, new ProcessType(processName, processNum, portNum)); } else { ProcessTypes[processName].Add(processNum, portNum); } }
private void Execute(object parameter) { int index = ProcessTypes.IndexOf(parameter as ProcessType); if (index > -1 && index < ProcessTypes.Count) { FAMA.AP.DataLayer.DbProcessType au = new FAMA.AP.DataLayer.DbProcessType(); au.DeleteData(ProcessTypes[index]); ProcessTypes.RemoveAt(index); } }
public void Initialize(T path, ProcessTypes<T>.IProcessQueue paths, Func<CopyProgressResult> getCopyProgressResultFunc, CopyProgressRoutine3 copyProgressRoutine) { if (IsDisposed) throw GetExceptionForDispose(false); _copyProgressRoutine = (in long totalFileSize, in long bytesTransferred) => { if (paths.TotalSize.ValueInBytes.IsNaN || path.Size.Value.ValueInBytes.IsNaN) _copyProgressRoutine = (in long _totalFileSize, in long _bytesTransferred) => getCopyProgressResultFunc();
internal WardenProcess(string name, int id, string path, ProcessState state, string arguments, ProcessTypes uwp) { Name = name; Id = id; Path = path; State = state; Arguments = arguments; Type = uwp; Children = new ObservableCollection <WardenProcess>(); var epochTicks = new DateTime(1970, 1, 1).Ticks; var unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond); TimeStamp = unixTime; }
internal WardenProcess(string name, int id, string path, ProcessState state, List <string> arguments, ProcessTypes type, List <ProcessFilter> filters) { Filters = filters; Name = name; Id = id; Path = path; State = state; Arguments = arguments; Type = type; Children = new ObservableCollection <WardenProcess>(); var epochTicks = new DateTime(1970, 1, 1).Ticks; var unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond); TimeStamp = unixTime; if (Options.ReadFileHeaders && File.Exists(Path)) { Headers = new PeHeaderReader(Path); } }
public void FilterProcess() { int count = 0; foreach (Process proc in Processes) { count = Countries.Where(w => w.IsSelected).Count(w => w.Name == proc.Country.Name); if (count == 0) { proc.IsSelected = false; continue; } count = Products.Where(w => w.IsSelected).Count(w => w.Name == proc.Product.Name); if (count == 0) { proc.IsSelected = false; continue; } count = RAMs.Where(w => w.IsSelected).Count(w => w.Name == proc.RAM.Name); if (count == 0) { proc.IsSelected = false; continue; } count = RAEs.Where(w => w.IsSelected).Count(w => w.Name == proc.RAE.Name); if (count == 0) { proc.IsSelected = false; continue; } count = ProcessTypes.Where(w => w.IsSelected).Count(w => w.Name == proc.ProcessType.Name); if (count == 0) { proc.IsSelected = false; continue; } proc.IsSelected = true; } }
public static bool HasPermission(int moduleId, ProcessTypes process) { if (moduleId <= 0) return false; var moduleInRolesViewModel = GetAllowedModulesInRolesByUser(); if (moduleInRolesViewModel == null) return false; return moduleInRolesViewModel.Where(p => p.ModuleId == moduleId && p.ProcessType == process).FirstOrDefault() != null; }
public static bool HasPermission(string moduleName, ProcessTypes process) { if (string.IsNullOrEmpty(moduleName)) return false; int moduleId = GetModuleIdByName(moduleName); if (moduleId == 0) return false; return HasPermission(moduleId, process); }
public void UpdateProcessRecord(CloudItem item, ProcessTypes type, int progress) { ProcessRecord processRecord = null; lock (this) { if (map.ContainsKey(item)) { processRecord = map[item]; } else { processRecord = new ProcessRecord(); processRecord.Item = item; processRecord.Name = item.Name; processRecord.Path = item.FullDirectory(); processRecords.Add(processRecord); map[processRecord.Item] = processRecord; } processRecord.Type = type; processRecord.Progress = progress; } }
public static void ProcessFile(FileInfo fileInfo, string password, ProcessTypes processType, bool destructOriginalFile, bool isAlone) { var substitutionByteList = GetSubstitutionByteList(password); completionPercentage = 0; try { using (var readStream = new FileStream(fileInfo.FullName, FileMode.Open)) { var newFileName = processType == ProcessTypes.encrypt ? fileInfo.FullName + ".crypted" : fileInfo.FullName.Substring(0, fileInfo.FullName.LastIndexOf('.')); using (var writeStream = new FileStream(newFileName, FileMode.CreateNew)) { var cpt = 0; var buffer = new byte[1]; while (readStream.Read(buffer, 0, 1) > 0) { byte[] dataToWrite = new byte[1]; if (processType == ProcessTypes.encrypt) { var index = defaultByteList.IndexOf(buffer[0]); dataToWrite[0] = substitutionByteList[index]; } else { var index = substitutionByteList.IndexOf(buffer[0]); dataToWrite[0] = defaultByteList[index]; } writeStream.Write(dataToWrite, 0, 1); if (isAlone) { DisplayCompletionMeter(cpt, (int)readStream.Length - 1); cpt++; } } } } } catch (IOException) { ConsoleManager.WriteLine(fileInfo.Name + " : IO error... unlucky", ConsoleManager.Colors.Error); return; } catch (Exception) { ConsoleManager.WriteLine(fileInfo.Name + " : Something went wrong... unlucky", ConsoleManager.Colors.Error); return; } if (destructOriginalFile) { File.Delete(fileInfo.FullName); } if (!isAlone) { processedFiles += 1; Console.WriteLine("- {0} / {1} - {2}", processedFiles, totalFiles, fileInfo.Name); } }
protected override bool Convert(ProcessTypes <IProcessErrorItem> .IProcessQueue value, object parameter, CultureInfo culture) => value?.HasItems == true;
/// <summary> /// Starts a Warden process using the applications full path. /// This method can handle both Win32 applications and UWP. /// </summary> /// <param name="path">The full path of the executable or UWP family package name</param> /// <param name="arguments">>Any additional arguments.</param> /// <param name="type">The type of application you wish to launch.</param> /// <returns></returns> public static async Task <WardenProcess> Start(string path, string arguments, ProcessTypes type) { if (!Initialized) { throw new WardenManageException(Resources.Exception_Not_Initialized); } WardenProcess process; switch (type) { case ProcessTypes.Uwp: process = await new UwpLauncher().Launch(path, arguments); break; case ProcessTypes.Win32: process = await new Win32Launcher().Launch(path, arguments); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, Resources.Exception_Invalid_Process_Type); } if (process == null) { return(null); } var key = Guid.NewGuid(); ManagedProcesses[key] = process; return(ManagedProcesses[key]); }