public FerryAvailabilityService(Ports ports, Ferries ferries, TimeTables timeTables, PortManager portManager) { _ports = ports; _ferries = ferries; _timeTables = timeTables; _portManager = portManager; }
/// <summary> /// Resets computer /// </summary> public void Reset() { CPU.Reset(); Video.Reset(); Ports.Reset(); // reset cards for (int i = 0; i < TVComputerConstants.ExpansionCardCount; i++) { if (Cards[i] != null) { Cards[i].Reset(); } } // reset cartridge Cartridge?.Reset(); }
public async Task OldDicomClientSend_StorePart10File_ShouldSucceed() { var port = Ports.GetNext(); using var server = DicomServerFactory.Create <CStoreScp>(port); server.Logger = _logger.IncludePrefix("CStoreScp"); var file = DicomFile.Open(TestData.Resolve("CT-MONO2-16-ankle")); var client = DicomClientFactory.Create("127.0.0.1", port, false, "SCU", "SCP"); client.Logger = _logger.IncludePrefix("DicomClient"); await client.AddRequestAsync(new DicomCStoreRequest(file)); var exception = await Record.ExceptionAsync(() => client.SendAsync()); Assert.Null(exception); }
/// <summary> /// 实例化接收串口,注册接收事件 /// </summary> /// <param name="portName">串口名</param> /// <param name="baudRate">串口波特率</param> /// <param name="receivedDataAction">当串口接收到数据时bool 为True,object为byte[],当返回错误信息时,bool为false,object为string</param> /// <param name="receivedMessageData">当内容被识别为报文时,进行此方法</param> public Receiver(string portName, int baudRate, Action <bool, bool, object> receivedDataAction, Action <object> receivedMessageData) { Ports.InitialEnt(portName, baudRate, (isConnected, status, data) => { if (isConnected && status) { receivedDataAction(true, true, (byte[])data);//接收实际数据回传 Spliter.Split((byte[])data, StaticMessageTypeInRuntime.LegalMessageType.MessageTypesDictionaryWithHead, (msgData) => { receivedMessageData((MessageData)msgData);//接收数据中识别报文回传 }); } else { receivedDataAction(isConnected, status, (string)data);//返回状态信息 } }); }
public IActionResult RunSuite(string catName, string suiteName, string frame) { if (_runFlags.IsContinuousIntegration && frame != null) { WorkerFrameStateHelper.NotifySuiteStarted(_env, frame, catName + "/" + suiteName); } var model = new RunSuiteViewModel { Title = suiteName, ScriptVirtualPath = UIModelHelper.GetSuiteVirtualPath(catName, suiteName), StyleCompilerTestServerUrl = "http://" + Request.Host.Host + ":" + Ports.Get("style-compiler") + "/test-server" }; AssignBaseRunProps(model); return(View(model)); }
public bool SelectRFOutputPort(Ports input, out string error) { error = ""; try { checkBusyState(mbSession, "*ESR?"); checkBusyState(mbSession, "*OPC?"); string cmd = string.Format(":FEED:RF:PORT:OUTPut {0}\n", input); mbSession.Write(cmd); Thread.Sleep(100); return(true); } catch (Exception ex) { error = ex.ToString(); return(false); } }
public async Task DicomClientShallNotCloseConnectionTooEarly_CEchoSerialAsync(int expected) { var port = Ports.GetNext(); using (var server = DicomServer.Create <DicomCEchoProvider>(port)) { while (!server.IsListening) { await Task.Delay(50); } var actual = 0; var client = new DicomClient(); for (var i = 0; i < expected; i++) { client.AddRequest( new DicomCEchoRequest { OnResponseReceived = (req, res) => { output.WriteLine("Response #{0} / expected #{1}", actual, req.UserState); Interlocked.Increment(ref actual); output.WriteLine(" #{0} / expected #{1}", actual - 1, req.UserState); }, UserState = i } ); output.WriteLine("Sending #{0}", i); await client.SendAsync("127.0.0.1", port, false, "SCU", "ANY-SCP", 600 * 1000); output.WriteLine("Sent (or timed out) #{0}", i); if (i != actual - 1) { output.WriteLine(" waiting #{0}", i); await Task.Delay((int)TimeSpan.FromSeconds(1).TotalMilliseconds); output.WriteLine(" waited #{0}", i); } } Assert.Equal(expected, actual); } }
public MainWindowViewModelDummy() { Values.Add(new ValueData() { Name = "TestName", Value = 3.14f }); Values.Add(new ValueData() { Name = "TestName2", Value = 92 }); Logs = "lorem ipsum sit doloren\nconnection established\nok"; Ports.Add("COM1"); Ports.Add("COM2"); Ports.Add("COM3"); SelectedPort = "COM3"; }
private void HandleReceivedData(string message, IPAddress sender) //inspect received data and take action { string[] variables = message.Split(' '); if (variables[0] == "Playerlist") { if (playerlists.Count == 0) { playerlists.Add(new PlayerList()); Ports.Add(int.Parse(variables[1])); inactivitytimer.Add(0); playerlists[0].Store(message); } else { int count = 0; bool newplayerlist = true; foreach (PlayerList playerlist in playerlists) { if (playerlist.IsHost(sender)) { newplayerlist = false; inactivitytimer[count] = 0; playerlist.Store(message); break; } count++; } if (newplayerlist) //ip was not yet in the list { playerlists.Add(new PlayerList()); Ports.Add(int.Parse(variables[1])); inactivitytimer.Add(0); playerlists[playerlists.Count - 1].Store(message); GameEnvironment.GameStateManager.GetGameState("hostSelectionState"); } } } else if (variables[0] == "Closed:") { string[] parts = variables[1].Split(':'); ListsRemoveAt(IPAddress.Parse(parts[0])); } }
public new void Start() { Ports.Add(_options.Host, _options.Port, ServerCredentials.Insecure); _healthService.SetStatus("", HealthCheckResponse.Types.ServingStatus.Serving); foreach (IMethodContext context in _methodRegistry.RegisteredMethods) { foreach (var(methodName, definition) in context.GetDefinitions()) { Services.Add(definition.Intercept(_globalInterceptor)); _logger.LogDebug("Method {grpc-diag-method} registered.", methodName); _healthService.SetStatus(context.GetServiceName(), HealthCheckResponse.Types.ServingStatus.Serving); } } Services.Add(GrpcHealth.BindService(_healthService)); base.Start(); }
public void RemoveCard(int in_slot_index) { if (Cards[in_slot_index] != null) { // remove io callbacks ushort port_address = GetCardIOAddress(in_slot_index); for (int port_count = 0; port_count < ExpansionCardPortRange; port_count++) { Ports.RemovePortReader(port_address, Cards[in_slot_index].CardPortRead); Ports.RemovePortWriter(port_address, Cards[in_slot_index].CardPortWrite); port_address++; } } // remove card Cards[in_slot_index] = null; }
internal MoveHub(IConnection connection, Ports thirdMotor, Ports distanceColorSensor) { _connection = connection; _thirdMotorPort = thirdMotor; _distanceColorSensorPort = distanceColorSensor; CreateParts(thirdMotor, distanceColorSensor); LED = _led; MotorA = _motorA; MotorB = _motorB; MotorAB = _motorAB; Motor3 = _motor3; TiltSensor = _tiltSensor; DistanceColorSensor = _distanceColorSensor; Button = _button; LoggerHelper.Instance.Debug("MotorHub constructor called"); }
public async Task SendingFindRequestToServerThatNeverRespondsShouldTimeout() { var port = Ports.GetNext(); using (CreateServer <NeverRespondingDicomServer>(port)) { var client = CreateClient(port); client.ServiceOptions.RequestTimeout = TimeSpan.FromSeconds(2); var request = new DicomCFindRequest(DicomQueryRetrieveLevel.Patient) { Dataset = new DicomDataset { { DicomTag.PatientID, "PAT123" } }, OnResponseReceived = (req, res) => throw new Exception("Did not expect a response"), }; DicomRequest.OnTimeoutEventArgs eventArgsFromRequestTimeout = null; request.OnTimeout += (sender, args) => eventArgsFromRequestTimeout = args; RequestTimedOutEventArgs eventArgsFromDicomClientRequestTimedOut = null; client.RequestTimedOut += (sender, args) => eventArgsFromDicomClientRequestTimedOut = args; await client.AddRequestAsync(request).ConfigureAwait(false); var sendTask = client.SendAsync(); var sendTimeoutCancellationTokenSource = new CancellationTokenSource(); var sendTimeout = Task.Delay(TimeSpan.FromSeconds(10), sendTimeoutCancellationTokenSource.Token); var winner = await Task.WhenAny(sendTask, sendTimeout).ConfigureAwait(false); sendTimeoutCancellationTokenSource.Cancel(); sendTimeoutCancellationTokenSource.Dispose(); Assert.Equal(winner, sendTask); Assert.NotNull(eventArgsFromRequestTimeout); Assert.NotNull(eventArgsFromDicomClientRequestTimedOut); Assert.Equal(request, eventArgsFromDicomClientRequestTimedOut.Request); Assert.Equal(client.ServiceOptions.RequestTimeout, eventArgsFromDicomClientRequestTimedOut.Timeout); } }
public void OldDicomClientSend_StorePart10File_ShouldSucceed() { var port = Ports.GetNext(); using (var server = DicomServer.Create <CStoreScp>(port)) { server.Logger = _logger.IncludePrefix("CStoreScp"); var file = DicomFile.Open(@".\Test Data\CT-MONO2-16-ankle"); var client = new DicomClient { Logger = _logger.IncludePrefix("DicomClient") }; client.AddRequest(new DicomCStoreRequest(file)); var exception = Record.Exception(() => client.Send("127.0.0.1", port, false, "SCU", "SCP")); Assert.Null(exception); } }
/// <summary> /// 添加流量 /// </summary> /// <param name="currentFlowCount">当前瞬时流量</param> /// <param name="port"></param> /// <returns></returns> public bool AddFlow(long currentFlowCount, int port, bool isUpload) { if (Ports != null && Ports.Count > 0) { ProcessPort _pp = Ports.FirstOrDefault(x => x.Port == port); if (_pp != null) { if (isUpload) { UpLoad += currentFlowCount; } else { DownLoad += currentFlowCount; } return(true); } } return(false); }
public MTADeployModel(V1Deployment v1Deployment) { DeployName = v1Deployment.Metadata.Name; DeployNamespace = v1Deployment.Metadata.NamespaceProperty; Replicas = (int)(v1Deployment.Spec.Replicas); Annotations = (Dictionary <string, string>)(v1Deployment.Metadata.Annotations); Labels = (Dictionary <string, string>)(v1Deployment.Metadata.Labels); Image = v1Deployment.Spec.Template.Spec.Containers[0].Image; ImagePullPolicy = v1Deployment.Spec.Template.Spec.Containers[0].ImagePullPolicy; var container = v1Deployment.Spec.Template.Spec.Containers[0]; ContainerName = container.Name; foreach (var containerPort in container.Ports) { Ports.Add(containerPort.ContainerPort); } }
public void FakeServer_ExpectGetReturnsString_ResponseMatchesExpectation() { const string expectedResult = "Some String Data"; var port = Ports.GetFreeTcpPort(); var baseAddress = "http://localhost:" + port; const string url = "/some-url"; using (var fakeServer = new FakeServer(port)) { fakeServer.Expect.Get(url).Returns(expectedResult); fakeServer.Start(); var result = new WebClient().DownloadString(new Uri(baseAddress + url)); result.Should().Be(expectedResult); } }
public void DicomClientSend_TooManyPresentationContexts_YieldsInformativeException() { var port = Ports.GetNext(); using (DicomServer.Create <DicomCEchoProvider>(port)) { var client = new DicomClient(); // this just illustrates the issue of too many presentation contexts, not real world application. var pcs = DicomPresentationContext.GetScpRolePresentationContextsFromStorageUids( DicomStorageCategory.None, DicomTransferSyntax.ImplicitVRLittleEndian); client.AdditionalPresentationContexts.AddRange(pcs); var exception = Record.Exception(() => client.Send("localhost", port, false, "SCU", "SCP")); Assert.IsType <DicomNetworkException>(exception); } }
public void Initialize() { _dataManager = new DataManager(_settingsManager, ConsoleManager, this, _mainThreadRunner); foreach (var portName in _settingsManager.AppSettings.PortsSettingsMap.Keys) { CreatePortInfo(portName, false); } var selectedPortName = _settingsManager.AppSettings.SelectedPort; if (!string.IsNullOrWhiteSpace(selectedPortName)) { SelectedPort = Ports.SingleOrDefault(p => p.Name == selectedPortName) ?? CreatePortInfo(selectedPortName, false); } _usbNotification.DeviceChanged += OnUsbDevicesChanged; _settingsManager.PropertyChanged += OnSettingsManagerChanged; UpdatePorts(); }
public Cable(Ports from, Ports to) { this.start = from; start.connection = this; this.end = to; end.connection = this; thisLine = LineRendererContainer.AddComponent <LineRenderer>(); thisLine.material = new Material(Shader.Find("Sprites/Default")); thisLine.enabled = true; thisLine.positionCount = 2; thisLine.SetPosition(0, start.thisPos.position); thisLine.SetPosition(1, end.thisPos.position); thisLine.SetWidth(0.2f, 0.2f); thisLine.startColor = Color.red; thisLine.endColor = Color.red; LineRendererContainer.transform.SetParent(GameObject.Find("LineCollector").transform, true); }
public override ExpressionSyntax AccessSyntax(CSPort sourcePort) { if (!sourcePort.HasProperty(GET)) { return(null); } var val1Port = Ports.FirstOrDefault(x => x.HasProperty(VALUE_1)) as CSPort; var val2Port = Ports.FirstOrDefault(x => x.HasProperty(VALUE_2)) as CSPort; var pAccess1 = val1Port.GetFirstConnectedPortMemberAccessExpressionSyntax(); var pAccess2 = val2Port.GetFirstConnectedPortMemberAccessExpressionSyntax(); if (pAccess1 == null || pAccess2 == null) { return(null); } return(SyntaxFactory.AssignmentExpression(SyntaxKind.CoalesceAssignmentExpression, val1Port.GetFirstConnectedPortMemberAccessExpressionSyntax(), val2Port.GetFirstConnectedPortMemberAccessExpressionSyntax())); }
public async Task SendingLargeFileUsingVeryShortResponseTimeoutShouldSucceed() { var port = Ports.GetNext(); using (CreateServer <InMemoryDicomCStoreProvider>(port)) { var client = CreateClient(port); client.Options.RequestTimeout = TimeSpan.FromSeconds(2); client.Options.MaxPDULength = 16 * 1024; // 16 KB TimeSpan streamWriteTimeout = TimeSpan.FromMilliseconds(10); client.NetworkManager = new ConfigurableNetworkManager(() => Thread.Sleep(streamWriteTimeout)); DicomResponse response = null; // Size = 5 192 KB, one PDU = 16 KB, so this will result in 325 PDUs // If stream timeout = 50ms, then total time to send will be 3s 250ms var request = new DicomCStoreRequest(@"./Test Data/10200904.dcm") { OnResponseReceived = (req, res) => response = res, }; await client.AddRequestAsync(request).ConfigureAwait(false); var sendTask = client.SendAsync(); var sendTimeoutCancellationTokenSource = new CancellationTokenSource(); var sendTimeout = Task.Delay(TimeSpan.FromSeconds(10), sendTimeoutCancellationTokenSource.Token); var winner = await Task.WhenAny(sendTask, sendTimeout).ConfigureAwait(false); sendTimeoutCancellationTokenSource.Cancel(); sendTimeoutCancellationTokenSource.Dispose(); Assert.Equal(winner, sendTask); Assert.NotNull(response); Assert.Equal(DicomStatus.Success, response.Status); } }
public IEnumerable <BaseNode> GetConnections(string portName) { if (!Ports.TryGetValue(portName, out var port)) { yield break; } if (port.direction == BasePort.Direction.Input) { foreach (var connection in port.Connections) { yield return(connection.FromNode); } } else { foreach (var connection in port.Connections) { yield return(connection.ToNode); } } }
public IPort MakeContract(ITariff tariff, int id) { var item = Ports.Find(x => x.Id == id); if (item == null) { AddPort(); Abonents.Contracts.Add(new Contract(Ports.Last().Id, tariff)); Ports.Last().ChangeStatusOfContract(); Ports.Last().EndingCall += Abonents.FindContract(Ports.Last().Id).HandleCostOfCall; Ports.Last().GettingHistory += Abonents.HandleGetHistoryEvent; Ports.Last().GettingHistory += HandleGetHistoryEvent; Ports.Last().ChangingTariff += Abonents.FindContract(Ports.Last().Id).HandleChangeTariffEvent; return(Ports.Last()); } else { IPort fail = new Port(-1, ""); return(fail); } }
public void Update(GameTime gameTime) { time += (float)gameTime.ElapsedGameTime.TotalSeconds; if (time >= 1) { for (int i = 0; i < playerlists.Count; i++) { inactivitytimer[i]++; } for (int i = 0; i < playerlists.Count; i++) { if (inactivitytimer[i] >= 5) //remove button if inactive { playerlists.RemoveAt(i); Ports.RemoveAt(i); inactivitytimer.RemoveAt(i); } } time = 0; } }
public async Task DicomClientSend_StorePart10File_ShouldSucceed() { var port = Ports.GetNext(); using (var server = DicomServer.Create <CStoreScp>(port)) { server.Logger = _logger.IncludePrefix("CStoreScp"); var file = DicomFile.Open(@".\Test Data\CT-MONO2-16-ankle"); var client = new Dicom.Network.Client.DicomClient("127.0.0.1", port, false, "SCU", "SCP") { Logger = _logger.IncludePrefix("DicomClient") }; await client.AddRequestAsync(new DicomCStoreRequest(file)).ConfigureAwait(false); var exception = await Record.ExceptionAsync(async() => await client.SendAsync()); Assert.Null(exception); } }
void GetBombValues() { List <string> PortList = BombInfo.QueryWidgets(KMBombInfo.QUERYKEY_GET_PORTS, null); foreach (string Portals in PortList) { Ports i = JsonConvert.DeserializeObject <Ports>(Portals); TotalPorts += i.PresentPorts.Length; } Serial SerialNumber = JsonConvert.DeserializeObject <Serial>(BombInfo.QueryWidgets(KMBombInfo.QUERYKEY_GET_SERIAL_NUMBER, null)[0]); LastDigitSerial = SerialNumber.serial[5] - '0'; SerialNum = SerialNumber.serial.ToLower(); List <string> BatteryList = BombInfo.QueryWidgets(KMBombInfo.QUERYKEY_GET_BATTERIES, null); BatteryHolders = BatteryList.Count; foreach (string Batteries in BatteryList) { Battery i = JsonConvert.DeserializeObject <Battery>(Batteries); TotalBatteries += i.numbatteries; } List <string> IndicatorList = BombInfo.QueryWidgets(KMBombInfo.QUERYKEY_GET_INDICATOR, null); TotalIndicators = IndicatorList.Count; foreach (string Indicators in IndicatorList) { Indicator i = JsonConvert.DeserializeObject <Indicator>(Indicators); if (i.on == "True" && i.label == "BOB") { HasBOB = true; } } }
public NodeReflectionData(Type type, NodeAttribute nodeAttr) { Type = type; Name = nodeAttr.Name ?? ObjectNames.NicifyVariableName(type.Name); Path = nodeAttr.Path?.Split('/'); Help = nodeAttr.Help; Deletable = nodeAttr.Deletable; Moveable = nodeAttr.Moveable; EditorType = NodeReflection.GetNodeEditorType(type); contextMethods = new Dictionary <ContextMenu, MethodInfo>(); var attrs = type.GetCustomAttributes(true); foreach (var attr in attrs) { if (attr is TagsAttribute tagAttr) { // Load any tags associated with the node Tags.AddRange(tagAttr.Tags); } else if (attr is OutputAttribute output) { // Load any Outputs defined at the class level Ports.Add(new PortReflectionData() { Name = output.Name, Type = output.Type, Direction = PortDirection.Output, Capacity = output.Multiple ? PortCapacity.Multiple : PortCapacity.Single, HasControlElement = false }); } } // Load additional data from class fields AddFieldsFromClass(type); SetScriptNodeType(); SetScriptNodeViewType(); LoadContextMethods(); }
public async Task SendingFindRequestToServerThatSendsPendingResponsesWithinTimeoutShouldNotTimeout() { var port = Ports.GetNext(); using (CreateServer <FastPendingResponsesDicomServer>(port)) { var client = CreateClient(port); client.ServiceOptions.RequestTimeout = TimeSpan.FromSeconds(2); DicomCFindResponse lastResponse = null; var request = new DicomCFindRequest(DicomQueryRetrieveLevel.Patient) { Dataset = new DicomDataset { { DicomTag.PatientID, "PAT123" } }, OnResponseReceived = (req, res) => lastResponse = res }; DicomRequest.OnTimeoutEventArgs onTimeoutEventArgs = null; request.OnTimeout += (sender, args) => onTimeoutEventArgs = args; await client.AddRequestAsync(request).ConfigureAwait(false); var sendTask = client.SendAsync(); var sendTimeoutCancellationTokenSource = new CancellationTokenSource(); var sendTimeout = Task.Delay(TimeSpan.FromSeconds(10), sendTimeoutCancellationTokenSource.Token); var winner = await Task.WhenAny(sendTask, sendTimeout).ConfigureAwait(false); sendTimeoutCancellationTokenSource.Cancel(); sendTimeoutCancellationTokenSource.Dispose(); Assert.Equal(winner, sendTask); Assert.NotNull(lastResponse); Assert.Equal(lastResponse.Status, DicomStatus.Success); Assert.Null(onTimeoutEventArgs); } }
private void OnOkCommand() { var portsToEnable = new List <FirewallPort>(); var portsToDisable = new List <FirewallPort>(); foreach (var entry in Ports.Where(x => x.Changed)) { var firewallPort = new FirewallPort(entry.PortInfo.GetTag(_instance), entry.PortInfo.Port); if (entry.IsEnabled) { portsToEnable.Add(firewallPort); } else { portsToDisable.Add(firewallPort); } } Result = new PortChanges(portsToEnable: portsToEnable, portsToDisable: portsToDisable); _owner.Close(); }
public async Task SendingLargeFileUsingVeryShortResponseTimeoutShouldSucceed() { var port = Ports.GetNext(); using (CreateServer <InMemoryDicomCStoreProvider>(port)) { var streamWriteTimeout = TimeSpan.FromMilliseconds(10); var clientFactory = CreateClientFactory(new ConfigurableNetworkManager(() => Thread.Sleep(streamWriteTimeout))); var client = clientFactory.Create("127.0.0.1", port, false, "SCU", "ANY-SCP"); client.Logger = _logger.IncludePrefix(typeof(DicomClient).Name).WithMinimumLevel(LogLevel.Debug); client.ServiceOptions.RequestTimeout = TimeSpan.FromSeconds(2); client.ServiceOptions.MaxPDULength = 16 * 1024; // 16 KB DicomResponse response = null; // Size = 5 192 KB, one PDU = 16 KB, so this will result in 325 PDUs // If stream timeout = 50ms, then total time to send will be 3s 250ms var request = new DicomCStoreRequest(TestData.Resolve("10200904.dcm")) { OnResponseReceived = (req, res) => response = res, }; await client.AddRequestAsync(request).ConfigureAwait(false); var sendTask = client.SendAsync(); var sendTimeoutCancellationTokenSource = new CancellationTokenSource(); var sendTimeout = Task.Delay(TimeSpan.FromSeconds(10), sendTimeoutCancellationTokenSource.Token); var winner = await Task.WhenAny(sendTask, sendTimeout).ConfigureAwait(false); sendTimeoutCancellationTokenSource.Cancel(); sendTimeoutCancellationTokenSource.Dispose(); Assert.Equal(winner, sendTask); Assert.NotNull(response); Assert.Equal(DicomStatus.Success, response.Status); } }
public IEnumerable<AvailableCrossing> GetAvailableCrossings(TimeSpan time, int fromPort, int toPort) { var ports = new Ports().All(); var timetables = _timeTables.All(); var allEntries = timetables.SelectMany(x => x.Entries).OrderBy(x => x.Time).ToList(); foreach (var timetable in allEntries) { var origin = ports.Single(x => x.Id == timetable.OriginId); var destination = ports.Single(x => x.Id == timetable.DestinationId); var ferry = _ferryService.NextFerryAvailableFrom(timetable.OriginId, timetable.Time); if (toPort == destination.Id && fromPort == origin.Id) { if (timetable.Time >= time) { var bookings = _bookings.All().Where(x => x.JourneyId == timetable.Id); var seatsLeft = ferry.Passengers - bookings.Sum(x => x.Passengers); if (seatsLeft > 0) { yield return new AvailableCrossing { Arrive = timetable.Time.Add(timetable.JourneyTime), FerryName = ferry.Name, SeatsLeft = ferry.Passengers - bookings.Sum(x => x.Passengers), SetOff = timetable.Time, OriginPort = origin.Name, DestinationPort = destination.Name, JourneyId = timetable.Id }; } } } } }
public PortManager(Ports ports, Ferries ferries) { _ports = ports; _ferries = ferries; }
/// <summary> /// Initializes a new SMTP over SSL server on the specified standard port number /// </summary> /// <param name="portNumber">The port number.</param> /// <param name="sslCertificate">The SSL certificate.</param> public DefaultServer(Ports port) : this(new DefaultServerBehaviour((int)port)) { }
public rpcd(Ports portNumber, Progs prog) { this.prog = (uint)prog; conn = new UdpClient(new IPEndPoint(IPAddress.Any, (int)portNumber)); }
/// <summary> /// Check if the parity is supported. /// </summary> /// <param name="parity">The parity the user wants to set.</param> /// <returns><b>true</b> if the parity is indicated as supported.</returns> public bool IsValidParity(Ports.Parity parity) { switch (parity) { case Parity.None: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.PARITY_NONE]; case Parity.Odd: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.PARITY_ODD]; case Parity.Even: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.PARITY_EVEN]; case Parity.Mark: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.PARITY_MARK]; case Parity.Space: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.PARITY_SPACE]; default: return false; } }
private void SendWarning(Ports.Sensors.ISensor sensor) { //TODO: figure something out here. }
public PCAN(Ports device, long baudrate) { iface = device; Bitrate = baudrate; PCANBasic.Initialize((byte)iface, baud); rx = new Thread(_read); rx.IsBackground = true; rx.Start(); }
public IntPtr CreateFile(String fileName, Ports.FileAccess desiredAccess, Ports.FileShareModes shareMode, IntPtr securityAttributes, Ports.FileCreationDisposition creationDisposition, Ports.FileAttribute flagsAndAttributes, IntPtr templateFile) { stream = new FileStream(@"C:\Documents and Settings\David Júlio\My Documents\Isel\Pic\test.txt", System.IO.FileMode.Open); return stream.Handle; }
public Boolean PurgeComm(IntPtr file, Ports.Purge purge) { return true; }
/// <summary> /// Async callback for webclients get file operation /// ,gets called if the file was retrieved successfully /// </summary> /// <param name="sender">event sending webclient instance</param> /// <param name="e">event arguments of the download operation</param> private void DownloadFileCallback(object sender, DownloadDataCompletedEventArgs e) { try { if (e.Cancelled) return; if (e.Result.Length <= 0) return; string page_string = ""; page_string = System.Text.Encoding.Default.GetString(e.Result); //Console.WriteLine("port page: " + page_string); int start = page_string.IndexOf("<strong class=\""); if (start != -1) { string temp = page_string.Substring(start + "<strong class=\"".Length); int end = temp.IndexOf("\""); if (end != -1) { string tcp = temp.Substring(0, end); if (tcp == "green small") OpenPorts = Ports.Tcp; else OpenPorts = Ports.None; start = temp.IndexOf("<strong class=\""); if (start != -1) { string temp2 = temp.Substring(start + "<strong class=\"".Length); end = temp2.IndexOf("\""); if (end != -1) { string udp = temp2.Substring(0, end); if (udp == "green small" && OpenPorts == Ports.None) OpenPorts = Ports.Udp; if (udp == "green small" && OpenPorts == Ports.Tcp) OpenPorts = Ports.UdpAndTcp; busy = false; if (Completed != null) Completed(this); } } } } } catch (Exception out_ex) { Console.WriteLine("Exception during download of port page: " + out_ex.Message); error_code = Connection.ErrorCodes.Exception; if (UnableToFetch != null) UnableToFetch(this); } }
/// <summary> /// Initializes a new SMTP over SSL server on the specified standard port number /// </summary> /// <param name="port">The standard port (or auto) to use.</param> public DefaultServer(bool allowRemoteConnection, Ports port) : this(new DefaultServerBehaviour(allowRemoteConnection, (int)port)) { }
void OilPressureSensor_BelowMinimumPressure(object sender, Ports.Sensors.PressureEventArgs e) { }
void OilPressureSensor_MinimumPressureReached(object sender, Ports.Sensors.PressureEventArgs e) { }
void OilTempSensor_ReachedOperatingTemp(object sender, Ports.Sensors.TemperatureEventArgs e) { }
public IntPtr CreateFile( String fileName, Ports.FileAccess desiredAccess, Ports.FileShareModes shareMode, IntPtr securityAttributes, Ports.FileCreationDisposition creationDisposition, Ports.FileAttribute flagsAndAttributes, IntPtr templateFile) { IntPtr handle = UnsafeNativeMethods.CreateFile( fileName, desiredAccess, shareMode, securityAttributes, creationDisposition, flagsAndAttributes, templateFile); if (handle == IntPtr.Zero || handle == new IntPtr(-1)) { throw new IOException(StringResources.Manager.GetString("InvalidPort")); } return handle; }
/// <summary> /// Constructor. Create a stream that connects to the specified port with standard parameters. /// </summary> /// <remarks> /// The stream doesn't impose any arbitrary limits on setting the baud rate. It is passed /// directly to the driver and it is up to the driver to determine if the baud rate is /// settable or not. Normally, a driver will attempt to set a baud rate that is within 5% /// of the requested baud rate (but not guaranteed). /// <para>Not all combinations are supported. The driver will interpret the data and indicate /// if configuration is possible or not.</para> /// </remarks> /// <param name="port">The name of the COM port, such as "COM1" or "COM33".</param> /// <param name="baud">The baud rate that is passed to the underlying driver.</param> /// <param name="data">The number of data bits. This is checked that the driver /// supports the data bits provided. The special type 16X is not supported.</param> /// <param name="parity">The parity for the data stream.</param> /// <param name="stopbits">Number of stop bits.</param> public SerialPortStream(string port, int baud, int data, Ports.Parity parity, StopBits stopbits) : this(port) { BaudRate = baud; DataBits = data; Parity = parity; StopBits = stopbits; }
public ChannelServerConfiguration SetPorts(Ports ports) { Ports = ports; return this; }
public ChannelServerConfiguration SetPortsForwarding(Ports portsForwarding) { PortsForwarding = portsForwarding; return this; }
/// <summary> /// Check if the number of stop bits is settable. /// </summary> /// <param name="stopbits">The number of stop bits the user wants to set.</param> /// <returns><b>true</b> if the number of stop bits is indicated as supported.</returns> public bool IsValidStopBits(Ports.StopBits stopbits) { switch (stopbits) { case StopBits.One: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.STOPBITS_10]; case StopBits.One5: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.STOPBITS_15]; case StopBits.Two: return m_CommProp.dwSettableDataStopParity[(int)NativeMethods.SettableStopParity.STOPBITS_20]; default: return false; } }
void OilTempSensor_OverTemp(object sender, Ports.Sensors.TemperatureEventArgs e) { }
private static void WireUp() { var timeTables = new TimeTables(); var ferries = new Ferries(); var bookings = new Bookings(); _ports = new Ports(); _ferryService = new FerryAvailabilityService(_ports, ferries, timeTables, new PortManager(_ports, ferries)); _bookingService = new JourneyBookingService(timeTables, bookings, _ferryService); _timeTableService = new TimeTableService(timeTables, bookings, _ferryService); }