public Probe(int posX, int posY, ProbeType p, Rectangle rect) { int x = posX / 50; int y = posY / 50; int key = SystemGrid.GridSize * y + x; _key = key; ptype = p; if (!SystemGrid.MainGrid.ContainsKey(key) && p == ProbeType.voltage) { throw new Exception("Probe can only be added on wires and terminals"); } else if (!SystemGrid.ComponentGrid.ContainsKey(key) && p == ProbeType.current) { throw new Exception("Probe can only be added on components"); } _rect = rect; _Label = new TextBlock(); _Label.Text = p.ToString(); _Label.FontWeight = FontWeights.Bold; _Label.Background = ptype == ProbeType.current? Brushes.CadetBlue : Brushes.DeepPink; _Label.SnapsToDevicePixels = true; VisualGrid.CurrentCanvas.Children.Add(_Label); Canvas.SetLeft(_Label, posX + 35); Canvas.SetTop(_Label, posY - 87); SystemGrid.probeList.Add(this); }
public static async Task <Status> CreateProbe(this IComputeApiClient client, string networkId, string name, ProbeType type, int port, int probeIntervalSeconds, int errorCountBeforeServerFail, int successCountBeforeServerEnable, int failedProbeIntervalSeconds, int maxReplyWaitSeconds, int statusCodeLowerBound, int statusCodeUpperBound, ProbeRequestMethod requestMethod, string requestUrl, string matchContent) { return (await client.NetworkingLegacy.NetworkVip.CreateProbe( networkId, name, type, port, probeIntervalSeconds, errorCountBeforeServerFail, successCountBeforeServerEnable, failedProbeIntervalSeconds, maxReplyWaitSeconds, statusCodeLowerBound, statusCodeUpperBound, requestMethod, requestUrl, matchContent)); }
/// <summary> /// Capture requirements related to Probe structure /// </summary> /// <param name="probe">Probe structure</param> private void CaptureProbeRequirements(ProbeType probe) { // Since the message parsed by stack layer properly, capture the requirement directly. Site.CaptureRequirement( 24, "[In Probe] The Discovery Protocol uses a WSD Probe with the <Types> and <Scopes> elements in the WSD message."); // Since the message parsed by stack layer properly, capture the requirement directly. Site.CaptureRequirement( 25, @"[The schema definition of Probe is:] <wsd:Probe> <wsd:Types> PeerDist:PeerDistData </wsd:Types> <wsd:Scopes MatchBy=""http://schemas.xmlsoap.org/ws/2005/04/discovery/strcmp0""> 0200000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000 </wsd:Scopes> </wsd:Probe>"); // Since the probe message is received succesfully, the reuqirement can be captured directly Site.CaptureRequirement( 175, @"Probe message MUST be sent using the following assignments: • DISCOVERY_PORT: port 3702 [IANA] • IPv4 multicast address: 239.255.255.250 • IPv6 multicast address: FF02::C (link-local scope)"); this.CaptureClientRoleScopesElementRequirements(probe.Scopes); }
public Probe(ProbeType probeType, MeasurementUnit measurementUnit) { Units = measurementUnit; this.Type = probeType; SetupProbe(); }
public Probe(string displayName, string configName, ProbeType type) { DisplayName = displayName; ConfigName = configName; Type = type; CheckBox = null; }
public Probe(string displayName, string configName, ProbeType type) { DisplayName = displayName; ConfigName = configName; Type = type; CheckBox = null; }
public ILicenseFilter ToILicenseFilter(ProbeType Transducer) { var basef = (LicenseFilterBase)this; var Lfilter = new LicenseFilter(basef); Lfilter.TransducerType = Transducer; return(Lfilter); }
public Queue <ProbeInfo> GetProbesQueue(ProbeType type, int nPort, int nCount) { int nTimes = 0; Queue <ProbeInfo> que = new Queue <ProbeInfo>(); Dictionary <int, List <ProbeInfo> > probesDic = this._ProbesDictionary; List <ProbeInfo> allProbes = this._AllProbes; if (probesDic.ContainsKey(nPort)) { foreach (var p in probesDic[nPort]) { if (type == ProbeType.Tcp && !p.IsTcp) { continue; } if (type == ProbeType.Udp && p.IsTcp) { continue; } que.Enqueue(p); if (nCount <= 0) { continue; } if (++nTimes >= nCount) { return(que); } } } if (nCount <= 0) { return(que); } //while (nTimes < nCount) { foreach (var p in allProbes) { if (p.Ports.Contains(nPort)) { continue; } if (type == ProbeType.Tcp && !p.IsTcp) { continue; } if (type == ProbeType.Udp && p.IsTcp) { continue; } que.Enqueue(p); if (++nTimes >= nCount) { break; } } //} return(que); }
public ProbeTest(ProbeType probeType) { RunOnce(); RunConfigurator.RunPath = "resources/probeRun.QA.xml"; _probeType = probeType; _instance = ConfigurationManager.AppSettings.Get(INSTANCE_CONFIG_KEY); InitialStoring(_probeType); CleanUp(); }
public static void LoadProbeType(ListControl lb, String selectedText = "") { var probeTypes = ProbeType.FindAll(); if (probeTypes != null) { DataBindListControl(lb, probeTypes, "ProbeTypeName", "ProbeTypeId", selectedText); } }
/// <summary> /// The create probe. /// </summary> /// <param name="networkId"> /// The network id. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="type"> /// The type. /// </param> /// <param name="port"> /// The port. /// </param> /// <param name="probeIntervalSeconds"> /// The probe interval seconds. /// </param> /// <param name="errorCountBeforeServerFail"> /// The error count before server fail. /// </param> /// <param name="successCountBeforeServerEnable"> /// The success count before server enable. /// </param> /// <param name="failedProbeIntervalSeconds"> /// The failed probe interval seconds. /// </param> /// <param name="maxReplyWaitSeconds"> /// The max reply wait seconds. /// </param> /// <param name="statusCodeLowerBound"> /// The status code lower bound. /// </param> /// <param name="statusCodeUpperBound"> /// The status code upper bound. /// </param> /// <param name="requestMethod"> /// The request method. /// </param> /// <param name="requestUrl"> /// The request url. /// </param> /// <param name="matchContent"> /// The match content. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task <Status> CreateProbe(string networkId, string name, ProbeType type, int port, int probeIntervalSeconds, int errorCountBeforeServerFail, int successCountBeforeServerEnable, int failedProbeIntervalSeconds, int maxReplyWaitSeconds, int statusCodeLowerBound, int statusCodeUpperBound, ProbeRequestMethod requestMethod, string requestUrl, string matchContent) { var probe = new NewProbe { name = name, type = type, probeIntervalSeconds = probeIntervalSeconds.ToString(CultureInfo.InvariantCulture), errorCountBeforeServerFail = errorCountBeforeServerFail.ToString(CultureInfo.InvariantCulture), successCountBeforeServerEnable = successCountBeforeServerEnable.ToString(CultureInfo.InvariantCulture), failedProbeIntervalSeconds = failedProbeIntervalSeconds.ToString(CultureInfo.InvariantCulture), maxReplyWaitSeconds = maxReplyWaitSeconds.ToString(CultureInfo.InvariantCulture), }; if (type.Equals(ProbeType.HTTP) || type.Equals(ProbeType.HTTPS)) { probe.statusCodeRange = new[] { new ProbeStatusCodeRange { lowerBound = statusCodeLowerBound, upperBound = statusCodeUpperBound } }; probe.requestMethod = requestMethod; probe.requestUrl = requestUrl; probe.matchContent = matchContent; } if (!port.Equals(0)) { probe.port = port.ToString(CultureInfo.InvariantCulture); } Status status = await this._apiClient.PostAsync <NewProbe, Status>( ApiUris.CreateOrGetVipProbes(this._apiClient.OrganizationId, networkId), probe); return(status); }
public static ProbeRef CreateProbe(ProbeType inProbeType) { IL.DeclareLocals(false); Guard.NotNull(CreateProbePtr); ProbeRef result; IL.Push(inProbeType); IL.Push(CreateProbePtr); IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(ProbeRef), typeof(ProbeType))); IL.Pop(out result); return(result); }
/// <summary> /// Receive probe message. /// </summary> /// <param name="sender">The sender.</param> /// <param name="message">The probe message.</param> private void Server_ReceiveProbeMessage(IPEndPoint sender, SoapEnvelope message) { WsdHeader header = (WsdHeader)message.Header; ProbeType probe = ((ProbeOp)message.Body).Probe; if (!this.isReceived && (!this.returned.Contains(header.MessageID.Value))) { this.isReceived = true; ProbeMsg probeMsg = new ProbeMsg(header.MessageID.Value, probe.Types, probe.Scopes.Text[0]); this.ReceiveProbeMessage(sender, probeMsg); } }
public String getPresetFile(Int32 ProbeId, ProbeType transducerType, List <ProbeTransducers> ProbeTransducers) { var type = ProbeTransducers.Single(x => x.ProbeId == ProbeId && x.TransducerType == transducerType).TransducerPosition; if (type == TransducerPosition.Frontal) { return(this.PresetFileNameFrontal); } else { return(this.PresetFileNameLateral); } }
/// <summary> /// 委托事件 /// </summary> /// <param name="sender"></param> /// <summary> /// 加载探头类型信息 /// </summary> private void loadProbeTypeInfo() { var probeTypes = ProbeType.FindAll(); if (probeTypes.Length > 0) { _lstProbeStyle.DataSource = probeTypes; _lstProbeStyle.DisplayMember = "ProbeTypeName"; _lstProbeStyle.ValueMember = "ProbeTypeId"; _lstProbeStyle.SelectedIndex = -1; } }
private void InitialStoring(ProbeType probeType) { //using (var probesDB = new ProbesDb()) //{ // var probe = new Probe // { // Completed = null, // ProbeType = probeType, // Instance = _instance.ToLower() // }; // probesDB.Probes.Add(probe); // probesDB.SaveChanges(); // _id = probe.ProbeId; //} }
/// <summary> /// receive message handler /// </summary> /// <param name="sender">The sender</param> /// <param name="message">The soap envelope message</param> private void Server_ReceiveProbeMessage(IPEndPoint sender, SoapEnvelope message) { WsdHeader header = (WsdHeader)message.Header; ProbeType probe = ((ProbeOp)message.Body).Probe; if (this.receive && (!this.returned.Contains(header.MessageID.Value))) { this.CaptureHeaderRequirements(header); this.CaptureProbeRequirements(probe); PccrdBothRoleCaptureCode.CaptureCommonRequirements(Site); PccrdBothRoleCaptureCode.CaptureTypesElementRequirements(probe.Types, Site); PccrdBothRoleCaptureCode.CaptureScopesElementRequirements(probe.Scopes, Site); ProbeMsg probeMsg = new ProbeMsg(header.MessageID.Value, probe.Types, probe.Scopes.Text[0]); this.ReceiveProbeMessage(sender, probeMsg); } }
static void Main(string[] args) { ProbeType probe = new ProbeType(); probe.Types = "dn:VideoTransmitter"; probe.Scopes = new ScopesType(); probe.Scopes.MatchBy = "trololo"; XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces(); namespaces.Add("dn", "http://www.onvif.org/ver10/network/wsdl"); DiscoveryHeaderBuilder header = new DiscoveryHeaderBuilder(); byte[] soap = SoapBuilder.BuildMessage(probe, Encoding.UTF8, header, namespaces); ICollection <XmlElement> headers; ProbeType parsed = SoapBuilder.ParseMessage <ProbeType>(soap, GetSchemas(), out headers); }
private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; // 创建探头管理实体 Probe.ProbeName = cmbProbeName.Text.Trim(); Probe.ProbeType = ProbeType.Find(cboProbeType.SelectedValue); if (rbtnYes.Checked) { // 是否自动位移 Probe.IsMove = 1; // 距迎头距离 double dFarFromFrontal; double.TryParse(txtM.Text.Trim(), out dFarFromFrontal); Probe.FarFromFrontal = dFarFromFrontal; } else { // 是否自动位移 Probe.IsMove = 0; } // 巷道编号 Probe.Tunnel = selectTunnelSimple1.SelectedTunnel; // 探头描述 Probe.ProbeDescription = txtProbeDescription.Text.Trim(); Probe.Save(); var msg = new UpdateWarningDataMsg(Probe.Tunnel.WorkingFace.WorkingFaceId, Probe.Tunnel.TunnelId, Probe.TableName, OPERATION_TYPE.UPDATE, DateTime.Now); SocketUtil.SendMsg2Server(msg); }
public async Task <Probe> PerformProbeAsync( ProbeType probeType, string uriTemplate, DateTime checkedDateTimeUtc) { _currentProbe = new Probe { ServerId = _server.Id, CheckedDateTimeUtc = checkedDateTimeUtc, Type = probeType }; if (_lastProbeDateTimeUtc == checkedDateTimeUtc && probeType == ProbeType.IsSslCertificateValid) { _currentProbe.Result = _sslPolicyErrors == SslPolicyErrors.None ? ProbeResult.Success : ProbeResult.Failure; return(_currentProbe); } try { HttpResponseMessage response = await _httpClient.GetAsync($"https://{_server.Host}/{uriTemplate}"); _lastProbeDateTimeUtc = checkedDateTimeUtc; Console.WriteLine(response); _currentProbe.Result = probeType == ProbeType.IsSslCertificateValid ? _sslPolicyErrors == SslPolicyErrors.None ? ProbeResult.Success : ProbeResult.Failure : response.StatusCode == HttpStatusCode.OK ? ProbeResult.Success : ProbeResult.Failure; } catch (Exception ex) when(ex is HttpRequestException || ex is OperationCanceledException) { Console.WriteLine(ex); _currentProbe.Result = ProbeResult.Failure; } return(_currentProbe); }
private void sbtnUpdateProbe_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; //ofd.ShowDialog(); if (ofd.ShowDialog() != DialogResult.OK) { return; } var aa = ofd.FileName; var strs = File.ReadAllLines(aa, Encoding.GetEncoding("GB2312")); for (var i = 1; i < strs.Length; i++) { var line = strs[i].Split(','); var probeId = line[1].Substring(3); var probe = Probe.TryFind(probeId); ProbeType probeType; if (line[3].Contains("CH4") || line[3].Contains("甲烷")) { probeType = ProbeType.FindProbeTypeByProbeTypeName("甲烷"); } else if (line[3].Contains("风速")) { probeType = ProbeType.FindProbeTypeByProbeTypeName("风速"); } else { probeType = ProbeType.FindProbeTypeByProbeTypeName("其他"); } Regex reg = new Regex(@"\(.*?\)"); Match m = reg.Match(line[2]); string probeName = ""; if (m.Value.Contains("T")) { probeName = m.Value.Trim('(', ')'); } if (probe == null) { probe = new Probe { ProbeMeasureType = Convert.ToInt16(line[0]), ProbeId = line[1].Substring(3), ProbeDescription = line[2], ProbeTypeDisplayName = line[3], ProbeUseType = line[5], Unit = line[6], ProbeType = probeType, ProbeName = probeName }; } else { probe.ProbeMeasureType = Convert.ToInt16(line[0]); probe.ProbeTypeDisplayName = line[3]; probe.ProbeUseType = line[5]; probe.Unit = line[6]; probe.ProbeType = probeType; probe.ProbeName = probeName; if (probe.ProbeDescription != line[2]) { probe.ProbeDescription = line[2]; probe.Tunnel = null; } } probe.Save(); } RefreshData(); }
public virtual string Execute(ProbeType probe, string language, params string[] arg) { return(Execute(probe.ToString(), language, arg)); }
public Queue <ProbeInfo> GetProbesQueue(ProbeType type, int nPort) { return(this.GetProbesQueue(type, nPort, 0)); }
/// <summary> /// Create a probe on the network VIP /// </summary> /// <param name="client"> /// The <see cref="IComputeApiClient"/> object. /// </param> /// <param name="networkId"> /// The network id /// </param> /// <param name="name"> /// The real server name /// </param> /// <param name="type"> /// </param> /// <param name="port"> /// </param> /// <param name="probeIntervalSeconds"> /// </param> /// <param name="errorCountBeforeServerFail"> /// </param> /// <param name="successCountBeforeServerEnable"> /// </param> /// <param name="failedProbeIntervalSeconds"> /// </param> /// <param name="maxReplyWaitSeconds"> /// </param> /// <param name="statusCodeLowerBound"> /// </param> /// <param name="statusCodeUpperBound"> /// </param> /// <param name="requestMethod"> /// </param> /// <param name="requestUrl"> /// </param> /// <param name="matchContent"> /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public static async Task<Status> CreateProbe(this IComputeApiClient client, string networkId, string name, ProbeType type, int port, int probeIntervalSeconds, int errorCountBeforeServerFail, int successCountBeforeServerEnable, int failedProbeIntervalSeconds, int maxReplyWaitSeconds, int statusCodeLowerBound, int statusCodeUpperBound, ProbeRequestMethod requestMethod, string requestUrl, string matchContent) { var probe = new NewProbe { name = name, type = type, probeIntervalSeconds = probeIntervalSeconds.ToString(CultureInfo.InvariantCulture), errorCountBeforeServerFail = errorCountBeforeServerFail.ToString(CultureInfo.InvariantCulture), successCountBeforeServerEnable = successCountBeforeServerEnable.ToString(CultureInfo.InvariantCulture), failedProbeIntervalSeconds = failedProbeIntervalSeconds.ToString(CultureInfo.InvariantCulture), maxReplyWaitSeconds = maxReplyWaitSeconds.ToString(CultureInfo.InvariantCulture), }; if (type.Equals(ProbeType.HTTP) || type.Equals(ProbeType.HTTPS)) { probe.statusCodeRange = new[] { new ProbeStatusCodeRange {lowerBound = statusCodeLowerBound, upperBound = statusCodeUpperBound} }; probe.requestMethod = requestMethod; probe.requestUrl = requestUrl; probe.matchContent = matchContent; } if (!port.Equals(0)) probe.port = port.ToString(CultureInfo.InvariantCulture); Status status = await client.WebApi.ApiPostAsync<NewProbe, Status>( ApiUris.CreateOrGetVipProbes(client.Account.OrganizationId, networkId), probe); return status; }
public MatchResult MatchData(byte[] byBuffer, int nLen, int nPort, ProbeType type, ProbeInfo probeInfo) { StringBuilder sb_m = new StringBuilder(); StringBuilder sb_r = new StringBuilder(); string strMatch = string.Empty; string strResult = string.Empty; for (int i = 0; i < nLen; i++) { sb_m.Append((char)byBuffer[i]); sb_r.Append(ProbeConfiger.ByteToChar(byBuffer[i])); } strMatch = sb_m.ToString(); strResult = sb_r.ToString(); var probesDic = this._ProbesDictionary; if (probeInfo != null) { foreach (var r in probeInfo.RegexList) { if (r.Regex.IsMatch(strMatch)) { return(new MatchResult(r.Name, strResult, r.RegLine)); } } } HashSet <ProbeInfo> hs = new HashSet <ProbeInfo>(); hs.Add(probeInfo); if (probesDic.ContainsKey(nPort)) { foreach (var p in probesDic[nPort]) { if (!p.IsTcp) { continue; } if (type == ProbeType.Tcp && !p.IsTcp) { continue; } if (type == ProbeType.Udp && p.IsTcp) { continue; } if (hs.Contains(p)) { continue; } foreach (var r in p.RegexList) { if (r.Regex.IsMatch(strMatch)) { return(new MatchResult(r.Name, strResult, r.RegLine)); } } hs.Add(p); } } var allProbes = this._AllProbes; foreach (var p in allProbes) { if (type == ProbeType.Tcp && !p.IsTcp) { continue; } if (type == ProbeType.Udp && p.IsTcp) { continue; } if (hs.Contains(p)) { continue; } foreach (var r in p.RegexList) { if (r.Regex.IsMatch(strMatch)) { return(new MatchResult(r.Name, strResult, r.RegLine)); } } } return(new MatchResult(null, strResult, 0)); }
/// <summary> /// Initializes a new instance of the <see cref="ProbeOp"/> class /// </summary> /// <param name="probe">the probe message</param> public ProbeOp(ProbeType probe) { this.probe = probe; }
static extern nint XPLMCreateProbe(ProbeType probeType);
public Probe(ProbeType probeType = ProbeType.XplmProbeY) { _ref = SceneryAPI.CreateProbe(probeType); }
public Probe(ProbeType probeType) {
public MatchResult MatchData(byte[] byBuffer, int nLen, int nPort, ProbeType type) { return(this.MatchData(byBuffer, nLen, nPort, type, null)); }
/// <summary> /// Initializes a new instance of the <see cref="ProbeOp"/> class /// </summary> /// <param name="probe">the probe message</param> public ProbeOp(ProbeType probe) { this.probe = probe; }
public static async Task<Status> CreateProbe(this IComputeApiClient client, string networkId, string name, ProbeType type, int port, int probeIntervalSeconds, int errorCountBeforeServerFail, int successCountBeforeServerEnable, int failedProbeIntervalSeconds, int maxReplyWaitSeconds, int statusCodeLowerBound, int statusCodeUpperBound, ProbeRequestMethod requestMethod, string requestUrl, string matchContent) { return await client.NetworkingLegacy.NetworkVip.CreateProbe( networkId, name, type, port, probeIntervalSeconds, errorCountBeforeServerFail, successCountBeforeServerEnable, failedProbeIntervalSeconds, maxReplyWaitSeconds, statusCodeLowerBound, statusCodeUpperBound, requestMethod, requestUrl, matchContent); }