bool Push( string packageFilePath, NugetSourceConfiguration config) { var logger = new ProcessLogger(_output.Standard, _output.Error); _output.Accent1.WriteLine("Pushing {0}", packageFilePath); _output.Standard.WriteLine(); if (_proj.NuGet.Push( packageFilePath, logger, config == null ? null : config.Source, config == null ? null : config.ApiKey)) { _output.Standard.WriteLine(); _output.Accent1.WriteLine("Successfully pushed {0}", packageFilePath); return(true); } else { _output.Standard.WriteLine(); _output.Error.WriteLine("An error occured while pushing {0}", packageFilePath); return(false); } }
public TaskMapper() { _cloudStorage = new DropboxFacade(); _logger = new ProcessLogger(_cloudStorage); _rtm = new RTMFacade(); }
private void InitialSystemInfo() { #region 初始化配置 ProcessLogger = log4net.LogManager.GetLogger("ProcessLogger"); ExceptionLogger = log4net.LogManager.GetLogger("SystemExceptionLogger"); ProcessLogger.Fatal("System Start " + DateTime.Now.ToString()); #endregion }
public void StartReporterThread() { var settings = new Settings(new SettingsReader("ActivityLogger.ini")); ActivityReport = new ActivityReport(); _activityLogger = ActivityLogger.Instance(ActivityReport, settings); var mouseClickLogger = MouseClickLogger.Instance(); var mouseClickReporter = MouseClickReporter.Instance(_activityLogger); mouseClickReporter.Subscribe(mouseClickLogger); var keyLogger = KeyLogger.Instance(); var keyReporter = KeyReporter.Instance(_activityLogger); keyReporter.Subscribe(keyLogger); Task.Factory.StartNew(() => { var activityReporter = new ActivityReporter(_activityReceiver); activityReporter.Subscribe(_activityLogger); var mouseLogger = new MouseLogger(); var mouseReporter = new MouseReporter(_activityLogger); mouseReporter.Subscribe(mouseLogger); var processLogger = new ProcessLogger(); var processReporter = new ProcessReporter(_activityLogger); processReporter.Subscribe(processLogger); var timeLogger = new TimeLogger(); var timeReporter = new TimeReporter(_activityLogger); timeReporter.Subscribe(timeLogger); var activityTypeLogger = new ActivityTypeLogger(settings); var activityTypeReporter = new ActivityTypeReporter(_activityLogger); activityTypeReporter.Subscribe(activityTypeLogger); while (true) { Thread.Sleep(1000); // KeyLogger & MouseClickLogger will log when keystrokes/clicks are // recorded, so no need to tell it to log here. mouseLogger.Log(); processLogger.Log(); timeLogger.Log(); activityTypeLogger.DetermineActivityType( processReporter.ProcessReport, mouseReporter.MouseReport, MouseClickReporter.Instance().MouseClickReport, KeyReporter.Instance().KeyReport); activityTypeLogger.Log(); _activityLogger.Log(); } }); }
public void Disable(UnityModManager.ModEntry modEntry, bool unpatch = false) { _logger = modEntry.Logger; using (ProcessLogger process = new ProcessLogger(_logger)) { process.Log("Disabling."); Enabled = false; // use try-catch to prevent the progression being disrupt by exceptions if (_eventHandlers != null) { process.Log("Raising events: OnDisable()"); for (int i = _eventHandlers.Count - 1; i >= 0; i--) { try { _eventHandlers[i].HandleModDisable(); } catch (Exception e) { Error(e); } } _eventHandlers = null; } if (unpatch) { HarmonyInstance harmonyInstance = HarmonyInstance.Create(modEntry.Info.Id); foreach (MethodBase method in harmonyInstance.GetPatchedMethods().ToList()) { Patches patchInfo = harmonyInstance.GetPatchInfo(method); IEnumerable <Patch> patches = patchInfo.Transpilers.Concat(patchInfo.Postfixes).Concat(patchInfo.Prefixes) .Where(patch => patch.owner == modEntry.Info.Id); if (patches.Any()) { process.Log($"Unpatching: {patches.First().patch.DeclaringType.DeclaringType?.Name}.{method.DeclaringType.Name}.{method.Name}"); foreach (Patch patch in patches) { try { harmonyInstance.Unpatch(method, patch.patch); } catch (Exception e) { Error(e); } } } } Patched = false; } modEntry.OnSaveGUI -= HandleSaveGUI; Core = null; Settings = null; Version = null; _logger = null; process.Log("Disabled."); } }
private void inputdatacaipiao(object sender, DoWorkEventArgs e) { ALLResult = new List <clsDatabaseinfo>(); //导入程序集 DateTime oldDate = DateTime.Now; Result = new List <clsDatabaseinfo>(); clsAllnew BusinessHelp = new clsAllnew(); ProcessLogger.Fatal("1005--input kiajiang data" + DateTime.Now.ToString()); Result = BusinessHelp.InputclaimReport(ref this.bgWorker, MCpath); ALLResult = BusinessHelp.Result; ProcessLogger.Fatal("1006-- Input finish" + DateTime.Now.ToString()); DateTime FinishTime = DateTime.Now; // TimeSpan s = DateTime.Now - oldDate; string timei = s.Minutes.ToString() + ":" + s.Seconds.ToString(); string Showtime = clsShowMessage.MSG_029 + timei.ToString(); bgWorker.ReportProgress(clsConstant.Thread_Progress_OK, clsShowMessage.MSG_009 + "\r\n" + Showtime); }
public void Enable(UnityModManager.ModEntry modEntry, Assembly assembly) { _logger = modEntry.Logger; if (Enabled) { Debug("Already enabled."); return; } using (ProcessLogger process = new ProcessLogger(_logger)) { try { process.Log("Enabling."); process.Log("Loading settings."); modEntry.OnSaveGUI += HandleSaveGUI; Version = modEntry.Version; Settings = UnityModManager.ModSettings.Load <TSettings>(modEntry); Core = new TCore(); Type[] types = assembly.GetTypes(); if (!Patched) { HarmonyInstance harmonyInstance = HarmonyInstance.Create(modEntry.Info.Id); foreach (Type type in types) { List <HarmonyMethod> harmonyMethods = type.GetHarmonyMethods(); if (harmonyMethods != null && harmonyMethods.Count() > 0) { process.Log($"Patching: {type.DeclaringType?.Name}.{type.Name}"); HarmonyMethod attributes = HarmonyMethod.Merge(harmonyMethods); PatchProcessor patchProcessor = new PatchProcessor(harmonyInstance, type, attributes); patchProcessor.Patch(); } } Patched = true; } Enabled = true; process.Log("Registering events."); _eventHandlers = types.Where(type => type != typeof(TCore) && !type.IsInterface && !type.IsAbstract && typeof(IModEventHandler).IsAssignableFrom(type)) .Select(type => Activator.CreateInstance(type, true) as IModEventHandler).ToList(); if (Core is IModEventHandler core) { _eventHandlers.Add(core); } _eventHandlers.Sort((x, y) => x.Priority - y.Priority); process.Log("Raising events: OnEnable()"); for (int i = 0; i < _eventHandlers.Count; i++) { _eventHandlers[i].HandleModEnable(); } } catch (Exception e) { Error(e); Disable(modEntry, true); throw; } process.Log("Enabled."); } }
public void Enable(UnityModManager.ModEntry modEntry, Assembly assembly) { _logger = modEntry.Logger; if (Enabled) { Debug("Already enabled."); return; } using (ProcessLogger process = new ProcessLogger(_logger)) { try { process.Log("Enabling."); var dict = Harmony.VersionInfo(out var myVersion); process.Log($"Harmony version: {myVersion}"); foreach (var entry in dict) { process.Log($"Mod {entry.Key} loaded with Harmony version {entry.Value}"); } process.Log("Loading settings."); modEntry.OnSaveGUI += HandleSaveGUI; Version = modEntry.Version; Settings = UnityModManager.ModSettings.Load <TSettings>(modEntry); Core = new TCore(); Type[] types = assembly.GetTypes(); if (!Patched) { Harmony harmonyInstance = new Harmony(modEntry.Info.Id); foreach (Type type in types) { List <HarmonyMethod> harmonyMethods = HarmonyMethodExtensions.GetFromType(type); if (harmonyMethods != null && harmonyMethods.Count() > 0) { process.Log($"Patching: {type.FullName}"); try { PatchClassProcessor patchProcessor = harmonyInstance.CreateClassProcessor(type); patchProcessor.Patch(); } catch (Exception e) { Error(e); } } } Patched = true; } Enabled = true; process.Log("Registering events."); _eventHandlers = types.Where(type => type != typeof(TCore) && !type.IsInterface && !type.IsAbstract && typeof(IModEventHandler).IsAssignableFrom(type)) .Select(type => Activator.CreateInstance(type, true) as IModEventHandler).ToList(); if (Core is IModEventHandler core) { _eventHandlers.Add(core); } _eventHandlers.Sort((x, y) => x.Priority - y.Priority); process.Log("Raising events: OnEnable()"); for (int i = 0; i < _eventHandlers.Count; i++) { _eventHandlers[i].HandleModEnable(); } } catch (Exception e) { Error(e); Disable(modEntry, true); throw; } process.Log("Enabled."); } }