private void LogicInit() { if (wtch == null) { wtch = new WMIProcessWatcher(TeraProcessName); } else { wtch.RemoveWatchCreateProcessEvent(); } if (((!string.IsNullOrWhiteSpace(ShinraMeterConfiguration.ShinraPath)) && (ShinraMeterConfiguration.ShinraMeterRunWithTera)) || ((!string.IsNullOrWhiteSpace(TccConfiguration.TccPath)) && (TccConfiguration.TccRunWithTera))) { CleanUpTaskSheduler(); AddWorksIntoTaskSheduler(); try { wtch.AddWatchCreateProcessEvent(processesStartBody); } catch (Exception ex) { log.Error(ex, "LogicInit -> AddWatchCreateProcessEvent"); } } else { CleanUpTaskSheduler(); } }
public void Dispose() { wtch.Dispose(); wtch = null; }