private void ChangeMode(MonitorMode setMode) { this.displayMode = setMode; this.titleText = this.monitorModeList[(int)setMode].title; this.displayText = string.Empty; this.counterSuffixText = this.monitorModeList[(int)setMode].suffix; }
private void ChangeMode() { this.displayMode++; if (this.displayMode >= (MonitorMode)this.monitorModeList.Length) { this.displayMode = MonitorMode.USE_MEMORY_PERCENT; } this.ChangeMode(this.displayMode); }
private static ApplicationMonitorMode Create(MonitorMode mode, string title, string suffix) { return(new ApplicationMonitorMode { mode = mode, title = title, suffix = suffix }); }
/// <summary> /// Open the device. To start capturing call the 'StartCapture' function /// </summary> /// <param name="mode"> /// A <see cref="DeviceMode"/> /// </param> /// <param name="read_timeout"> /// A <see cref="System.Int32"/> /// </param> /// <param name="monitor_mode"> /// A <see cref="MonitorMode"/> /// </param> /// <param name="kernel_buffer_size"> /// A <see cref="System.UInt32"/> /// </param> public override void Open(DeviceMode mode, int read_timeout, MonitorMode monitor_mode, uint kernel_buffer_size) { if (!Opened) { StringBuilder errbuf = new StringBuilder(Pcap.PCAP_ERRBUF_SIZE); //will hold errors // set the StopCaptureTimeout value to twice the read timeout to ensure that // we wait long enough before considering the capture thread to be stuck when stopping // a background capture via StopCapture() // // NOTE: Doesn't affect Mono if unix poll is available, doesn't affect Linux because // Linux devices have no timeout, they always block. Only affects Windows devices. StopCaptureTimeout = new TimeSpan(0, 0, 0, 0, read_timeout * 2); PcapHandle = LibPcapSafeNativeMethods.pcap_create( Name, // name of the device errbuf); // error buffer if (PcapHandle == IntPtr.Zero) { string err = "Unable to open the adapter (" + Name + "). " + errbuf.ToString(); throw new PcapException(err); } LibPcapSafeNativeMethods.pcap_set_snaplen(PcapHandle, Pcap.MAX_PACKET_SIZE); if (monitor_mode == MonitorMode.Active) { try { LibPcapSafeNativeMethods.pcap_set_rfmon(PcapHandle, (int)monitor_mode); } catch (System.EntryPointNotFoundException) { throw new PcapException("This implementation of libpcap does not support monitor mode."); } } LibPcapSafeNativeMethods.pcap_set_promisc(PcapHandle, (int)mode); LibPcapSafeNativeMethods.pcap_set_timeout(PcapHandle, read_timeout); if (kernel_buffer_size != 0) { KernelBufferSize = kernel_buffer_size; } var activationResult = LibPcapSafeNativeMethods.pcap_activate(PcapHandle); if (activationResult < 0) { string err = "Unable to activate the adapter (" + Name + "). Return code: " + activationResult.ToString(); throw new PcapException(err); } Active = true; } }
public PerformanceMonitorBeeper(PerformanceMonitor pm, MonitorMode monitorMode, MeasureMode measureMode, int cpuThreshold, int memoryThreshold) { _pm = pm; _cpuThreshold = cpuThreshold; _memoryThreshold = memoryThreshold; _timer = new Timer(1000) {AutoReset = false}; _timer.Elapsed += (sender, eventArgs) => OnTimer(); InitializeMonitorStrategy(monitorMode, measureMode); }
public GameContextConfig(MonitorMode pResolution, int iDepth = 24, int iStencil = 8, bool bSamples = true, NativContextConfigTyp pGraphicType = NativContextConfigTyp.Best, VSyncMode pVsync = VSyncMode.Adaptive) { m_iDepth = iDepth; m_iStencil = iStencil; m_pResolution = new GameResolution(pResolution); m_pVSync = pVsync; m_pConfigTyp = pGraphicType; m_pConfigInt = 0; m_bSamples = bSamples; }
private void InitializeMonitorStrategy(MonitorMode monitorMode, MeasureMode measureMode) { if (monitorMode == MonitorMode.Instant) { _monitorStrategy = Program.Container.Resolve<InstantMonitorStrategy>(new TypedParameter(typeof(MeasureMode), measureMode)); } else { _monitorStrategy = Program.Container.Resolve<SustainedMonitorStrategy>(new TypedParameter(typeof(MeasureMode), measureMode)); } Console.WriteLine("Set monitor mode to: {0}", monitorMode.Humanize()); Console.WriteLine("Set measure mode to: {0}", measureMode.Humanize()); }
public void SetMode(MonitorMode newMode) { if (newMode != mode) { switch (newMode) { case MonitorMode.Status: break; case MonitorMode.Error: break; case MonitorMode.Hired: break; } statusObject.SetActive(newMode == MonitorMode.Status); ErrorObject.SetActive(newMode == MonitorMode.Error); HiredObject.SetActive(newMode == MonitorMode.Hired); mode = newMode; } }
public override void SetBasicPropertyValues() { //PBXDevice的Key值由CTIType,DeviceType,MonitorMode和DeviceName共同决定 string strKey = string.Format("{0}-{1}-{2}-{3}", CTIType, DeviceType, MonitorMode, DeviceName); base.SetBasicPropertyValues(); ResourceProperty propertyValue; for (int i = 0; i < ListProperties.Count; i++) { propertyValue = ListProperties[i]; switch (propertyValue.PropertyID) { case S1110Consts.PROPERTYID_XMLKEY: propertyValue.Value = strKey; break; case PRO_CTITYPE: propertyValue.Value = CTIType.ToString(); break; case PRO_DEVICETYPE: propertyValue.Value = DeviceType.ToString(); break; case PRO_MONITORMODE: propertyValue.Value = MonitorMode.ToString(); break; case PRO_DEVICENAME: propertyValue.Value = DeviceName; break; } } }
public GameResolution(MonitorMode pMonitorMode) { m_pMonitorMode = pMonitorMode; }
static void ChangeMonitorState(MonitorMode mode) { SendMessage(-1, WM_SYSCOMMAND, SC_MONITORPOWER, (int)mode); }
public void Open(DeviceMode mode, int read_timeout, MonitorMode monitor_mode, uint kernel_buffer_size) { Open(mode, read_timeout, kernel_buffer_size); }
/// <summary> /// Open the device. To start capturing call the 'StartCapture' function /// </summary> /// <param name="mode"> /// A <see cref="DeviceMode"/> /// </param> /// <param name="read_timeout"> /// A <see cref="System.Int32"/> /// </param> /// <param name="monitor_mode"> /// A <see cref="MonitorMode"/> /// </param> public override void Open(DeviceMode mode, int read_timeout, MonitorMode monitor_mode) { Open(mode, read_timeout, monitor_mode, 0); }
/// <summary> /// Open the device. To start capturing call the 'StartCapture' function /// </summary> /// <param name="mode"> /// A <see cref="DeviceMode"/> /// </param> /// <param name="read_timeout"> /// A <see cref="System.Int32"/> /// </param> /// <param name="monitor_mode"> /// A <see cref="MonitorMode"/> /// </param> /// <param name="kernel_buffer_size"> /// A <see cref="System.UInt32"/> /// </param> public virtual void Open(DeviceMode mode, int read_timeout, MonitorMode monitor_mode, uint kernel_buffer_size) { throw new NotImplementedException(); }
public override void GetBasicPropertyValues() { base.GetBasicPropertyValues(); ResourceProperty propertyValue; int intValue; for (int i = 0; i < ListProperties.Count; i++) { propertyValue = ListProperties[i]; switch (propertyValue.PropertyID) { case PRO_CTITYPE: if (int.TryParse(propertyValue.Value, out intValue)) { CTIType = intValue; StrCTIType = CTIType.ToString(); if (ListAllBasicInfos != null) { var info = ListAllBasicInfos.FirstOrDefault( b => b.InfoID == S1110Consts.SOURCEID_CTITYPE && b.Value == CTIType.ToString()); if (info != null) { StrCTIType = CurrentApp.GetLanguageInfo( string.Format("BID{0}{1}", S1110Consts.SOURCEID_CTITYPE, info.SortID.ToString("000")), info.Icon); } } } break; case PRO_DEVICETYPE: if (int.TryParse(propertyValue.Value, out intValue)) { DeviceType = intValue; StrDeviceType = DeviceType.ToString(); if (ListAllBasicInfos != null) { var info = ListAllBasicInfos.FirstOrDefault( b => b.InfoID == S1110Consts.SOURCEID_PBX_DEVICETYPE && b.Value == DeviceType.ToString()); if (info != null) { StrDeviceType = CurrentApp.GetLanguageInfo( string.Format("BID{0}{1}", S1110Consts.SOURCEID_PBX_DEVICETYPE, info.SortID.ToString("000")), info.Icon); } } } break; case PRO_MONITORMODE: if (int.TryParse(propertyValue.Value, out intValue)) { MonitorMode = intValue; StrMonitorMode = MonitorMode.ToString(); if (ListAllBasicInfos != null) { var info = ListAllBasicInfos.FirstOrDefault( b => b.InfoID == S1110Consts.SOURCEID_PBX_MONITORMODE && b.Value == MonitorMode.ToString()); if (info != null) { StrMonitorMode = CurrentApp.GetLanguageInfo( string.Format("BID{0}{1}", S1110Consts.SOURCEID_PBX_MONITORMODE, info.SortID.ToString("000")), info.Icon); } } } break; case PRO_DEVICENAME: DeviceName = propertyValue.Value; break; } } GetNameAndDescription(); }
/// <summary> /// Open the device. To start capturing call the 'StartCapture' function /// </summary> /// <param name="mode"> /// A <see cref="DeviceMode"/> /// </param> /// <param name="read_timeout"> /// A <see cref="System.Int32"/> /// </param> public override void Open(DeviceMode mode, int read_timeout) { const MonitorMode monitorMode = MonitorMode.Inactive; this.Open(mode, read_timeout, monitorMode); }
public FormDisplay() { devices = new DisplayDevices(); monitorMode = new MonitorMode(); InitializeComponent(); }
/// <summary> /// Open the device. To start capturing call the 'StartCapture' function /// </summary> /// <param name="mode"> /// A <see cref="DeviceMode"/> /// </param> /// <param name="read_timeout"> /// A <see cref="System.Int32"/> /// </param> /// <param name="kernel_buffer_size"> /// A <see cref="System.UInt32"/> /// </param> public override void Open(DeviceMode mode, int read_timeout, uint kernel_buffer_size) { const MonitorMode monitorMode = MonitorMode.Inactive; this.Open(mode, read_timeout, monitorMode, kernel_buffer_size); }
public static void ChangeMonitorState(MonitorMode mode) { //Thread.Sleep(200); PostMessage(-1, 274, 61808, (int)mode); }
public void Open(DeviceMode mode, int read_timeout, MonitorMode monitor_mode) { Open(mode, read_timeout); }
/// <summary> /// Open the device. To start capturing call the 'StartCapture' function /// </summary> /// <param name="mode"> /// A <see cref="DeviceMode"/> /// </param> /// <param name="read_timeout"> /// A <see cref="int"/> /// </param> /// <param name="monitor_mode"> /// A <see cref="MonitorMode"/> /// </param> /// <param name="kernel_buffer_size"> /// A <see cref="uint"/> /// </param> public override void Open(DeviceMode mode, int read_timeout, MonitorMode monitor_mode, uint kernel_buffer_size) { if (!Opened) { StringBuilder errbuf = new StringBuilder(Pcap.PCAP_ERRBUF_SIZE); //will hold errors // set the StopCaptureTimeout value to twice the read timeout to ensure that // we wait long enough before considering the capture thread to be stuck when stopping // a background capture via StopCapture() // // NOTE: Doesn't affect Mono if unix poll is available, doesn't affect Linux because // Linux devices have no timeout, they always block. Only affects Windows devices. StopCaptureTimeout = new TimeSpan(0, 0, 0, 0, read_timeout * 2); if (Interface.Credentials == null) { PcapHandle = LibPcapSafeNativeMethods.pcap_create( Name, // name of the device errbuf); // error buffer } else { // We got authentication, so this is an rpcap device var auth = RemoteAuthentication.CreateAuth(Name, Interface.Credentials); PcapHandle = LibPcapSafeNativeMethods.pcap_open (Name, // name of the device Pcap.MAX_PACKET_SIZE, // portion of the packet to capture. // MAX_PACKET_SIZE (65536) grants that the whole packet will be captured on all the MACs. (short)0, // No flags here (short)read_timeout, // read timeout ref auth, // authentication errbuf); // error buffer } if (PcapHandle == IntPtr.Zero) { string err = "Unable to open the adapter (" + Name + "). " + errbuf.ToString(); throw new PcapException(err); } LibPcapSafeNativeMethods.pcap_set_snaplen(PcapHandle, Pcap.MAX_PACKET_SIZE); if (monitor_mode == MonitorMode.Active) { try { LibPcapSafeNativeMethods.pcap_set_rfmon(PcapHandle, (int)monitor_mode); } catch (EntryPointNotFoundException) { throw new PcapException("This implementation of libpcap does not support monitor mode."); } } LibPcapSafeNativeMethods.pcap_set_promisc(PcapHandle, (int)mode); LibPcapSafeNativeMethods.pcap_set_timeout(PcapHandle, read_timeout); if (kernel_buffer_size != 0) { KernelBufferSize = kernel_buffer_size; } var activationResult = LibPcapSafeNativeMethods.pcap_activate(PcapHandle); if (activationResult < 0) { string err = "Unable to activate the adapter (" + Name + "). Return code: " + activationResult.ToString(); throw new PcapException(err); } Active = true; // retrieve the file descriptor of the adapter for use with poll() if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { FileDescriptor = LibPcapSafeNativeMethods.pcap_get_selectable_fd(PcapHandle); } } }