public Fact RemoveMonitor( IMonitor source ) { Ensure.That( source ).Named( "source" ).IsNotNull(); MonitorChangedWeakEventManager.RemoveListener( source, this ); return this; }
public WindowsNativeWindow(string title, int width, int height, int bits, IMonitor monitor) { _title = title; _monitor = monitor; Width = width; Height = height; Bits = bits; }
protected NativeWindowBase(int width, int height, IMonitor monitor) { _monitor = monitor; _implementation = Platform.Factory.CreateWindow(width, height, monitor); _implementation.Resized += OnResize; _implementation.Load += OnLoad; _implementation.Update += OnUpdate; _implementation.Render += OnRender; }
/// <summary> /// Initializes a new instance of the <see cref="MonitorWrapper" /> class. /// </summary> /// <param name="baseMonitor">The monitor to wrap.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="baseMonitor" /> is <see langword="null" />. /// </exception> public MonitorWrapper(IMonitor baseMonitor) { if (baseMonitor == null) { throw new ArgumentNullException("baseMonitor"); } BaseMonitor = baseMonitor; }
public void Remove(IMonitor item) { if (item == null) throw new ArgumentNullException("item should not be null"); if (!mMonitors.Contains(item)) return; item.CheckCompleted -= item_CheckCompleted; item.ExceptionThrown -= item_ExceptionThrown; mMonitors.Remove(item); }
/// <summary> /// Initializes a new instance of the <see cref="MonitorInfo" /> class. /// </summary> /// <param name="monitor">The value for the <see cref="MonitorInfo.Monitor" /> property.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="monitor" /> is <see langword="null" />. /// </exception> public MonitorInfo(IMonitor monitor) { if (monitor == null) { throw new ArgumentNullException("monitor"); } Monitor = monitor; }
public MainPresenter(IMainView view) { this.view = view; view.Presenter = this; monitor = new Monitor(); timer = new Timer(500); timer.Elapsed += (o, args) => Update(); Update(); }
public WebService(IMonitor monitoringBehavior, IProvider providerBehavior) { if (null == monitoringBehavior) { throw new ArgumentNullException(WebService.ArgumentNameMonitoringBehavior); } if (null == providerBehavior) { throw new ArgumentNullException(WebService.ArgumentNameProviderBehavior); } this.monitor = monitoringBehavior; this.provider = providerBehavior; }
public void Add(IMonitor item) { Items.Add(item); }
internal MonsterPatch(IMonitor modMonitor, IModHelper modHelper) : base(modMonitor, modHelper) { }
/// <summary> /// Add a new monitor to the monitor list /// </summary> /// <param name="monitor"></param> public void AddMonitor(IMonitor monitor) { m_monitors.Add(monitor.GetName(), monitor); }
public Service(ISparkSource source, IElasticSink sink, IMonitor monitor) { _source = source; _sink = sink; _monitor = monitor; }
/************************ ** Public methods *************************/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { // SMAPI helpers ModEntry.SHelper = helper; ModEntry.SMonitor = this.Monitor; // Config settings Config = this.Helper.ReadConfig <ModConfig>(); // Internal helpers Commander = new CommandHandler(this); Creator = new CreationHandler(this); SaverLoader = new SaveLoadHandler(this); var loaders = Helper.Content.AssetLoaders; loaders.Add(this); WildHorse.PlayerSpecifiedSpawnMaps = new List <string>(Config.WildHorseSpawnLocations); // Check that Wild Horse spawn maps set in the Config file are all valid foreach (string loc in Config.WildHorseSpawnLocations) { if (!WildHorse.SpawningMaps.Contains(Sanitize(loc))) { SMonitor.Log($"Invalid map \"{loc}\" is listed in Wild Horse spawning locations and will be ignored.\nMaps must all be one of: Forest, BusStop, Mountain, Town, Railroad, or Beach.", LogLevel.Warn); WildHorse.PlayerSpecifiedSpawnMaps.Remove(loc); } } // Event Listeners helper.Events.GameLoop.SaveLoaded += SaveLoadHandler.Setup; helper.Events.GameLoop.SaveLoaded += SaveLoadHandler.LoadData; helper.Events.GameLoop.Saving += SaveLoadHandler.SaveData; helper.Events.GameLoop.Saved += SaveLoadHandler.LoadData; helper.Events.GameLoop.ReturnedToTitle += SaveLoadHandler.StopUpdateChecks; helper.Events.GameLoop.DayStarted += Creator.ProcessNewDay; helper.Events.GameLoop.DayEnding += Creator.ProcessEndDay; // SMAPI Commands helper.ConsoleCommands.Add("list_creatures", $"Lists the creature IDs and skin IDs of the given type.\n(Options: '{string.Join("', '", CommandHandler.CreatureGroups)}', or a specific animal type (such as bluechicken))", Commander.OnCommandReceived); helper.ConsoleCommands.Add("randomize_skin", $"Randomizes the skin for the given group of creatures or the creature with the given ID. Call `randomize_skin <creature group or creature ID>`.\nCallable creature groups: {string.Join(",", CommandHandler.CreatureGroups)}, or an adult creature type\nTo find a creature's ID, call `list_creatures`.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("set_skin", "Sets the skin of the given creature to the given skin ID. Call `set_skin <skin ID> <creature ID>`. To find a creature's ID, call `list_creatures`.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("corral_horses", "Warp all horses to the farm's stable, giving you the honor of being a professional clown car chauffeur.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("horse_whistle", "Summons one of the player's horses to them. Can be called with a horse's ID to call a specific horse. To find a horse's ID, call `list_creatures horse`.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("rename", "Renames the pet or horse of the given ID to the given name. Call `rename <creature ID> \"new name\"`.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("sell", "Used to give away one of your pets or horses. Call `sell <creature ID>`. To find a creature's ID, call `list_creatures`.", Commander.OnCommandReceived); // DEBUG if (Config.DebuggingMode) { helper.ConsoleCommands.Add("debug_asreset", "DEBUG: ** WARNING ** Resets all skins and creature IDs, but ensures that all creatures are properly in the Adopt & Skin system.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("debug_skinmaps", "DEBUG: Prints all info in current skin maps", Commander.OnCommandReceived); helper.ConsoleCommands.Add("debug_idmaps", "DEBUG: Prints AnimalLongToShortIDs", Commander.OnCommandReceived); helper.ConsoleCommands.Add("debug_pets", "DEBUG: Print the information for every Pet instance on the map", Commander.OnCommandReceived); helper.ConsoleCommands.Add("debug_horses", "DEBUG: Print the information for every Horse instance on the map", Commander.OnCommandReceived); helper.ConsoleCommands.Add("debug_find", "DEBUG: Locate the creature with the given ID. Call `debug_find <creature ID>`.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("summon_stray", "DEBUG: Summons a new stray at Marnie's.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("summon_horse", "DEBUG: Summons a wild horse. Somewhere.", Commander.OnCommandReceived); helper.ConsoleCommands.Add("debug_clearunowned", "DEBUG: Removes any wild horses or strays that exist, to clear out glitched extras", Commander.OnCommandReceived); } }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="monitor">Encapsulates monitoring and logging.</param> public ExportCommand(IMonitor monitor) : base(monitor, "export") { }
public AnimalPettingPlan(IMonitor monitor, FarmAnimal animal) { this.monitor = monitor; this.animal = animal; }
public static void LogMessage(IMonitor m, LogLevel level, string message = "No message specified. Bad developer.") { m.Log(message, level); }
public static void LogException(IMonitor m, Exception e) { m.Log($"Exception: {e.Message}.", LogLevel.Error); m.Log($"{e.Data}.", LogLevel.Error); }
/// <summary>Construct an instance.</summary> /// <param name="label">A human-readable name for the mod.</param> /// <param name="modID">The mod's unique ID.</param> /// <param name="minVersion">The minimum version of the mod that's supported.</param> /// <param name="modRegistry">An API for fetching metadata about loaded mods.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> protected BaseIntegration(string label, string modID, string minVersion, IModRegistry modRegistry, IMonitor monitor) { // init Label = label; ModID = modID; ModRegistry = modRegistry; Monitor = monitor; // validate mod var manifest = modRegistry.Get(ModID)?.Manifest; if (manifest == null) { return; } if (manifest.Version.IsOlderThan(minVersion)) { monitor.Log($"Detected {label} {manifest.Version}, but need {minVersion} or later. Disabled integration with this mod.", LogLevel.Warn); return; } IsLoaded = true; }
protected BaseResolver(IMonitor monitor) { this.monitor = monitor; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="monitorForGame">Writes messages to the console and log file on behalf of the game.</param> public ScheduleErrorPatch(IMonitor monitorForGame) { ScheduleErrorPatch.MonitorForGame = monitorForGame; }
void OnMonitorChanged( IMonitor source ) { this.NotifyChanged(); }
/// <summary> /// Provides patches from content packs into mod's content /// </summary> /// <param name="monitor"></param> public ContentPackManager(IMonitor monitor, bool paranoid = false) { this.monitor = monitor; this.paranoid = paranoid; this.packs = new List <ManagedContentPack>(); }
public InstanceController(string name, IMonitor monitor, IVisualiser visualiser) { Name = name; Monitor = monitor; Visualiser = visualiser; }
public IWorkspace GetWorkspaceForMonitor(IMonitor monitor) { return(_workspaces[monitor].FirstOrDefault()); }
/// <summary>Raise a <see cref="EighthUpdateTick"/> event.</summary> /// <param name="monitor">Encapsulates monitoring and logging.</param> internal static void InvokeEighthUpdateTick(IMonitor monitor) { monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.EighthUpdateTick)}", GameEvents.EighthUpdateTick?.GetInvocationList()); }
internal static void Initialize(IMod ModInstance) { Helper = ModInstance.Helper; Monitor = ModInstance.Monitor; sprite = Helper.Content.Load <Texture2D>("assets/Mistbloom.png"); }
//删除监控员 public void Remove(IMonitor monitor) { monitors.Remove(monitor); }
public BaseCommands(ModConfig config, IModHelper helper, IMonitor monitor) { this.Config = config; this.Helper = helper; this.Monitor = monitor; }
public ServicesController(IMonitor databaseMonitor) //todo inject list of monitors (need other container) { if (databaseMonitor == null) throw new ArgumentNullException(nameof(databaseMonitor)); _monitors = new [] { databaseMonitor }; }
public static void Initialize(IMonitor monitor) { Monitor = monitor; }
public TestWindow(IMonitor monitor) : base(800, 600,monitor) { }
public static void Initialize(IMonitor monitor, IModHelper helper, ModConfig config) { Monitor = monitor; Config = config; Helper = helper; }
public void Remove(IMonitor item) { Items.Remove(item); }
public CompanionStateMachine(CompanionManager manager, NPC companion, CompanionMetaData metadata, IContentLoader loader, IReflectionHelper reflection, IMonitor monitor = null) { this.CompanionManager = manager; this.Companion = companion; this.Metadata = metadata; this.ContentLoader = loader; this.Monitor = monitor; this.Bag = new Chest(true); this.Reflection = reflection; this.SpokenDialogues = new HashSet <string>(); }
public void CommonRepopulate(IMonitor common) { PerformanceCounterCategory hddUsageCategories = new PerformanceCounterCategory("LogicalDisk", IpOrHostName); CommonPopulateHddUsage(hddUsageCategories.GetInstanceNames()); ServiceController[] services = ServiceController.GetServices(IpOrHostName); String[] servicesList = new String[services.Length]; Int32 count = 0; foreach (ServiceController sc in services) { servicesList[count++] = sc.DisplayName; } CommonPopulateServiceState(servicesList); PerformanceCounterCategory processStateCategories = new PerformanceCounterCategory("Process", IpOrHostName); CommonPopulateProcessState(processStateCategories.GetInstanceNames()); switch(common.Type) { case FullMonitorType.PerformanceCounter: try { PfcMonitor pfc = (PfcMonitor) common; if (_commonPfcCounter == null) { _commonPfcCounter = new PerformanceCounter { CategoryName = pfc.Category, CounterName = pfc.Counter, InstanceName = pfc.Instance, MachineName = pfc.Server }; } else { _commonPfcCounter.Dispose(); _commonPfcCounter = new PerformanceCounter { CategoryName = pfc.Category, CounterName = pfc.Counter, InstanceName = pfc.Instance, MachineName = pfc.Server }; } switch (pfc.Category) { case "Processor": _commonType = CommonMonitorType.CpuUsage; commonCpuUsageTypeDdl.Text = pfc.Counter; commonCpuCriticalTextBox.Text = pfc.ThresholdPanic; commonCpuWarningTextBox.Text = pfc.ThresholdWarning; commonCpuGroupBox.BackColor = Color.LightGray; commonCpuSelected.Checked = true; break; case "LogicalDisk": _commonType = CommonMonitorType.HddUsage; commonHddDriveLetterDdl.Text = pfc.Instance; commonHddCriticalTextBox.Text = pfc.ThresholdPanic; commonHddWarningTextBox.Text = pfc.ThresholdWarning; commonHddGroupBox.BackColor = Color.LightGray; commonHddSelected.Checked = true; break; case "Process": _commonType = CommonMonitorType.ProcessState; commonProcessStateUsageTypeDdl.Text = pfc.Counter; commonProcessStateProcessDd.Text = pfc.Instance; commonProcessStateCriticalTextBox.Text = pfc.ThresholdPanic; commonProcessStateWarningTextBox.Text = pfc.ThresholdWarning; commonProcessGroupBox.BackColor = Color.LightGray; commonProcessSelected.Checked = true; break; case "Paging File": _commonType = CommonMonitorType.SwapFileUsage; commonSwapFileUsageTypeDdl.Text = pfc.Counter; commonSwapFileCriticalTextBox.Text = pfc.ThresholdPanic; commonSwapFileWarningTextBox.Text = pfc.ThresholdWarning; commonSwapFileGroupBox.BackColor = Color.LightGray; commonSwapFileSelected.Checked = true; break; } } catch(Exception ex) { Logger.Instance.LogException(this.GetType(), ex); } break; case FullMonitorType.Service: ServiceMonitor service = (ServiceMonitor) common; _commonServiceState = new ServiceController(service.Services[0].ServiceName, service.Server); _commonType = CommonMonitorType.ServiceState; commonServiceServicesChoiceDdl.Text = service.Services[0].ServiceName; //NOTE: there is only one service in Common tab commonServiceGroupBox.BackColor = Color.LightGray; commonServiceSelected.Checked = true; break; case FullMonitorType.Wmi: WmiMonitor wmi = (WmiMonitor) common; _commonType = CommonMonitorType.MemoryUsage; //NOTE: % In Use == WmiType.MemoryUsage //NOTE: Available == WmiType.MemoryFree switch(wmi.WmiType) { case WmiType.MemoryFree: commonMemoryUsageTypeDdl.Text = "Available"; break; case WmiType.MemoryUsage: commonMemoryUsageTypeDdl.Text = "% In Use"; break; } commonMemoryWarningTextBox.Text = wmi.ThresholdWarning; commonMemoryCriticalTextBox.Text = wmi.ThresholdPanic; commonMemoryGroupBox.BackColor = Color.LightGray; commonMemorySelected.Checked = true; break; } commonMonitorTestDataUpdateFreqTextBox.Text = common.UpdateFrequency.ToString(); addServerValidIpIpTextBox2.Text = common.Server; addServerValidIpMonitorName2.Text = common.FriendlyName; alreadyPopulated = true; }
/// <summary> /// Initializes a new instance of the <see cref="CachedMonitor" /> class. /// </summary> /// <param name="baseMonitor">The monitor to wrap.</param> /// <param name="sec">The update interval in seconds.</param> /// <param name="timeProvider">The custom time provider to use.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="baseMonitor" /> is <see langword="null" />. /// </exception> public CachedMonitor(IMonitor baseMonitor, double sec, TimeProvider timeProvider = null) : this(baseMonitor: baseMonitor, updateInterval: TimeSpan.FromSeconds(sec), timeProvider: timeProvider) { }
/********* ** Internal methods *********/ /// <summary>Raise an <see cref="InitializeInternal"/> event.</summary> /// <param name="monitor">Encapsulates logging and monitoring.</param> internal static void InvokeInitialize(IMonitor monitor) { monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.InitializeInternal)}", GameEvents.InitializeInternal?.GetInvocationList()); }
/// <summary> /// Removes the listener. /// </summary> /// <param name="source">The source.</param> /// <param name="listener">The listener.</param> public static void RemoveListener( IMonitor source, IWeakEventListener listener ) { MonitorChangedWeakEventManager .GetCurrentManager() .ProtectedRemoveListener( source, listener ); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="monitor">Encapsulates monitoring and logging.</param> /// <param name="contentHelper">The content helper with which to manage loaded assets.</param> public ExportCommand(IMonitor monitor, IGameContentHelper contentHelper) : base(monitor, "export") { this.ContentHelper = contentHelper; }
/// <summary>Raise a <see cref="OneSecondTick"/> event.</summary> /// <param name="monitor">Encapsulates monitoring and logging.</param> internal static void InvokeOneSecondTick(IMonitor monitor) { monitor.SafelyRaisePlainEvent($"{nameof(GameEvents)}.{nameof(GameEvents.OneSecondTick)}", GameEvents.OneSecondTick?.GetInvocationList()); }
/// <summary> /// Initializes a new instance of the <see cref="CachedMonitor" /> class. /// </summary> /// <param name="baseMonitor">The monitor to wrap.</param> /// <param name="updateInterval">The update interval.</param> /// <param name="timeProvider">The custom time provider to use.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="baseMonitor" /> is <see langword="null" />. /// </exception> public CachedMonitor(IMonitor baseMonitor, TimeSpan updateInterval, TimeProvider timeProvider = null) : base(baseMonitor: baseMonitor) { _TIME_PROVIDER = timeProvider ?? GetNow; _UPDATE_INTERVAL = updateInterval; }
/// <summary>Reset the low-level cache used to store expensive query results, so the data is recalculated on demand.</summary> /// <param name="metadata">Provides metadata that's not available from the game data directly.</param> /// <param name="reflectionHelper">Simplifies access to private game code.</param> /// <param name="translations">Provides translations stored in the mod folder.</param> /// <param name="monitor">The monitor with which to log errors.</param> public void ResetCache(Metadata metadata, IReflectionHelper reflectionHelper, ITranslationHelper translations, IMonitor monitor) { this.Objects = new Lazy <ObjectModel[]>(() => this.DataParser.GetObjects(monitor).ToArray()); this.GiftTastes = new Lazy <GiftTasteModel[]>(() => this.DataParser.GetGiftTastes(this.Objects.Value).ToArray()); this.Recipes = new Lazy <RecipeModel[]>(() => this.DataParser.GetRecipes(metadata, reflectionHelper, translations).ToArray()); }
private void PopulateGridViewFromServerInfo(FullMonitorType returnValue, IMonitor monitor, Boolean repopulate) { if (monitor == null) return; Int32 row = 0; if (!repopulate) { if (serverMonitorList.InvokeRequired) { Invoke(new MethodInvoker(() => row = serverMonitorList.Rows.Add())); } else row = serverMonitorList.Rows.Add(); _gridViewIndex = row; } else row = _gridViewIndex; switch (returnValue) { case FullMonitorType.Basic: #region Basic BasicMonitor basicMonitor = (BasicMonitor)monitor; if (serverMonitorList.InvokeRequired) { Invoke(new MethodInvoker(() => { serverMonitorList.Rows[row].Tag = basicMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { basicMonitor.Server, basicMonitor.FriendlyName, "Basic", "OK", "0", basicMonitor.ToString() }); })); } else { serverMonitorList.Rows[row].Tag = basicMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { basicMonitor.Server, basicMonitor.FriendlyName, "Basic", "OK", "0", basicMonitor.ToString() }); } break; #endregion case FullMonitorType.Common: #region Common if (monitor.Type != FullMonitorType.Common) //NOTE: Don't want infinite loop somehow PopulateGridViewFromServerInfo(monitor.Type, monitor, true); else Logger.Instance.Log(this.GetType(), LogType.Info, "Monitor Type was unindentifiable for monitor: " + monitor.ToString()); break; #endregion case FullMonitorType.EventLog: #region Events EventMonitor eventMonitor = (EventMonitor)monitor; if (serverMonitorList.InvokeRequired) { Invoke(new MethodInvoker(() => { serverMonitorList.Rows[row].Tag = eventMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { eventMonitor.Server, eventMonitor.FriendlyName, "Event Log", "OK", "0", eventMonitor.ToString() }); })); } else { serverMonitorList.Rows[row].Tag = eventMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { eventMonitor.Server, eventMonitor.FriendlyName, "Event Log", "OK", "0", eventMonitor.ToString() }); } break; #endregion case FullMonitorType.PerformanceCounter: #region PerfCounters PfcMonitor pfcMonitor = (PfcMonitor)monitor; if (serverMonitorList.InvokeRequired) { Invoke(new MethodInvoker(() => { serverMonitorList.Rows[row].Tag = pfcMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { pfcMonitor.Server, pfcMonitor.FriendlyName, "Performance Counter", "OK", "0", pfcMonitor.ToString() }); })); } else { serverMonitorList.Rows[row].Tag = pfcMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { pfcMonitor.Server, pfcMonitor.FriendlyName, "Performance Counter", "OK", "0", pfcMonitor.ToString() }); } break; #endregion case FullMonitorType.Service: #region Services ServiceMonitor services = (ServiceMonitor)monitor; if (serverMonitorList.InvokeRequired) { Invoke(new MethodInvoker(() => { serverMonitorList.Rows[row].Tag = services.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { services.Server, services.FriendlyName, "Service", "OK", "0", services.ToString() }); })); } else { serverMonitorList.Rows[row].Tag = services.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { services.Server, services.FriendlyName, "Service", "OK", "0", services.ToString() }); } break; #endregion case FullMonitorType.Wmi: #region Wmi WmiMonitor wmiMonitor = (WmiMonitor)monitor; if (serverMonitorList.InvokeRequired) { Invoke(new MethodInvoker(() => { serverMonitorList.Rows[row].Tag = wmiMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { wmiMonitor.Server, wmiMonitor.FriendlyName, "Wmi", "OK", "0", wmiMonitor.ToString() }); })); } else { serverMonitorList.Rows[row].Tag = wmiMonitor.Hash; serverMonitorList.Rows[row].SetValues(new Object[] { wmiMonitor.Server, wmiMonitor.FriendlyName, "Wmi", "OK", "0", wmiMonitor.ToString() }); } break; #endregion case FullMonitorType.None: default: break; } }
public FileProvider( TabularFileAdapterFactory fileAdapterFactory, IMonitor monitor) : this(fileAdapterFactory, monitor, new string[0]) { }
public NetworkTest(INetworkLayer net, IMonitor monitor) { _net = net; _net.GetMtuSize(out _mtu, out _head, out _tail); _monitor = monitor; _statusLock = new object(); _reportInterval = cReportIntervalDefault; }
/********* ** Public methods *********/ /// <summary>Initialise the core asset data.</summary> /// <param name="getNormalisedPath">Normalises an asset key to match the cache key.</param> /// <param name="reflection">Simplifies access to private code.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> public CoreAssetPropagator(Func <string, string> getNormalisedPath, Reflector reflection, IMonitor monitor) { this.GetNormalisedPath = getNormalisedPath; this.Reflection = reflection; this.Monitor = monitor; }
public AddServer(String monitorName, String remoteIpOrHostName, FullMonitorType tab, MonitorBaseType baseTab, IEnumerable<CAlert> defaultAlerts, IMonitor repopulateMonitor) { InitializeComponent(); perfCounterPCTypeDdl.Visible = false; perfCounterCategoryWaitLabel.Visible = true; perfCounterCounterNameDdl.Visible = false; perfCounterCounterNameWaitLabel.Visible = true; perfCounterInstanceNameDdl.Visible = false; perfCounterInstanceNameWaitLabel.Visible = true; foreach (CAlert c in defaultAlerts) { switch (c.Type) { case AlertType.Email: addServerAlertEmailTextBox.Text = c.Info; break; case AlertType.Phone: addServerAlertSmsTextBox.Text = c.Info; break; } } //NOTE:MonitorName should be the hostname if for some reason HostName isn't populated //_hostName = (hostName == "" ? Environment.MachineName : (hostName != "" ? hostName : monitorName)); IpOrHostName = remoteIpOrHostName == "" ? Environment.MachineName : remoteIpOrHostName; FriendlyName = monitorName == "" ? Environment.MachineName + " " + tab : monitorName; switch (repopulateMonitor.Type) { #region cases case FullMonitorType.PerformanceCounter: addServerBaseTabControl.SelectedIndex = (int)baseTab; addServerTabControl.SelectedIndex = (int)tab; if (repopulateMonitor.Common) { CommonRepopulate(repopulateMonitor); ReturnValue = FullMonitorType.Common; } else { ReturnValue = repopulateMonitor.Type; PerfCounterRepopulate((PfcMonitor)repopulateMonitor); } break; case FullMonitorType.Service: addServerBaseTabControl.SelectedIndex = (int)baseTab; addServerTabControl.SelectedIndex = (int)tab; if (repopulateMonitor.Common) { CommonRepopulate(repopulateMonitor); ReturnValue = FullMonitorType.Common; } else { ReturnValue = repopulateMonitor.Type; ServiceRepopulate((ServiceMonitor)repopulateMonitor); } break; case FullMonitorType.EventLog: addServerBaseTabControl.SelectedIndex = (int)baseTab; addServerTabControl.SelectedIndex = (int)tab; if (repopulateMonitor.Common) { CommonRepopulate(repopulateMonitor); ReturnValue = FullMonitorType.Common; } else { ReturnValue = repopulateMonitor.Type; EventRepopulate((EventMonitor) repopulateMonitor); } break; case FullMonitorType.Basic: addServerBaseTabControl.SelectedIndex = (int)baseTab; BasicRepopulate((BasicMonitor)repopulateMonitor); ReturnValue = repopulateMonitor.Type; break; case FullMonitorType.Common: addServerBaseTabControl.SelectedIndex = (int)baseTab; if (repopulateMonitor.Common) { CommonRepopulate(repopulateMonitor); ReturnValue = FullMonitorType.Common; } else ReturnValue = repopulateMonitor.Type; break; case FullMonitorType.Wmi: addServerBaseTabControl.SelectedIndex = (int)baseTab; if (repopulateMonitor.Common) { CommonRepopulate(repopulateMonitor); ReturnValue = FullMonitorType.Common; } else ReturnValue = repopulateMonitor.Type; break; default: case FullMonitorType.None: Logger.Instance.Log(this.GetType(), LogType.Debug, "AddServer: Unable to match Monitor Type"); this.Close(); break; #endregion } }
internal static void Initialize(ModConfig config, IMonitor monitor, IModHelper helper) { Helper = helper; Monitor = monitor; Config = config; }
private ProvisioningAgentMonitor() { this.consoleMonitor = new ConsoleMonitor(); }
public void unregister(IMonitor monitor) { IMonitor removed; monitors.TryRemove(monitor.getConfig(), out removed); }
public INativeWindow CreateWindow(int width, int height, IMonitor monitor) { return new WindowsNativeWindow("testing", width, height, 16, monitor); }
private Commander(NpcAdventureMod npcAdventureMod) { this.npcAdventureMod = npcAdventureMod; this.monitor = npcAdventureMod.Monitor; this.SetupCommands(npcAdventureMod.Helper.ConsoleCommands); }
//添加监控员 public void Add(IMonitor monitor) { monitors.Add(monitor); }
public MonitoringController() { _monitor = new SurgerySearch.Web.Monitoring.Monitor(); }
public MonitoringController(IMonitor monitor) { _monitor = monitor; }
public AchievementEditor(IModHelper helper, IMonitor monitor) { _helper = helper; _monitor = monitor; }