private void setLogPath(string newLogPath) { if (clsGlobal.PerformOnAll) { foreach (string str in clsGlobal.g_objfrmMDIMain.PortManagerHash.Keys) { PortManager manager = (PortManager)clsGlobal.g_objfrmMDIMain.PortManagerHash[str]; if (manager != null) { if (manager.comm != null) { if (manager.comm.Log.IsFileOpen()) { manager.comm.Log.CloseFile(); } manager.comm.Log.filename = newLogPath; } this._Log.RunCallBackFnc(); } } } else { if ((this._comm != null) && (this._Log != null)) { if (this._Log.IsFileOpen()) { this._Log.CloseFile(); } this._Log.filename = newLogPath; } this._Log.RunCallBackFnc(); } clsGlobal.PerformOnAll = false; }
static void Main(string[] args) { try { databaseconfigpath = args[0]; Console.WriteLine("Using databaseconfigfile " + args[0]); } catch (Exception e) { Console.WriteLine("No databaseconfigpath was given. Exiting..." + e.Message); databaseconfigpath = ""; } try { portconfigpath = args[1]; Console.WriteLine("Using portconfigfile " + args[1]); } catch (Exception e) { Console.WriteLine("No portconfigpath was given, using default ports. (exception message: " + e.Message + ")"); portconfigpath = ""; } PortManager.instance(); Thread.Sleep(1000); //Console.WriteLine("here"); DatabaseController dc = DatabaseController.instance(); Thread.Sleep(1000); LoginController lc = LoginController.instance(); Thread.Sleep(100); MatchController mc = MatchController.instance(); Thread.Sleep(100); MiscController miscc = MiscController.instance(); Thread.Sleep(100); Thread login = new Thread(lc.logincontrol); login.Start(); Thread match = new Thread(mc.handleRequests); match.Start(); Thread misc = new Thread(miscc.handleRequests); misc.Start(); //string res = dc.GetAgeAndGender("theVilandry"); //Console.WriteLine(res); //dc.successfulRegister("admin", "admin".GetHashCode().ToString(), 1, 1); }
//发送函数 public byte[] SendDirectCommand(byte[] data, string portName) { byte[] rev = null; try { PortManager.GetInstance().GetPipe(laserPipeName).GetBusProperty().GetProperty("port").value = portName; PortManager.GetInstance().Save(); //不保存打开,当前串口设置失效 PortManager.GetInstance().Reset(); //解决配置中串口不存在时,后前无法open的bug PortManager.GetInstance().GetPipe(laserPipeName).Open(); LogHelper.GetLogger <SerialPortHelper>().Error("Send Data: " + ByteHelper.Byte2ReadalbeXstring(data)); SimpleProtocolData newData = new SimpleProtocolData(data); object recv = PortManager.GetInstance().Send(LARCommandHelper.InsName1, newData); if (recv != null) { rev = ((ByteArrayWrap)recv).GetBytes(); LogHelper.GetLogger <SerialPortHelper>().Error("Reveived Data: " + ByteHelper.Byte2ReadalbeXstring(data)); } } catch (Exception ex) { LogHelper.GetLogger <SerialPortHelper>().Error("error message: " + ex.Message); LogHelper.GetLogger <SerialPortHelper>().Error("error stacktrace: " + ex.StackTrace); } return(rev); }
// Release all Bridge resources. // If 'force' is true, it means the Bridge is shutting down // and even the firewall rules necessary to talk to the Bridge // will be removed. public static void ReleaseAllResources(bool force) { // Cleanly shutdown all AppDomains we own so they have // the chance to release resources they've acquired or installed AppDomainManager.ShutdownAllAppDomains(); // Uninstall any certificates added or used by the Bridge itself CertificateManager.UninstallAllCertificates(force: true); // Force the removal of the SSL cert that may have been added // by another AppDomain or left from a prior run int httpsPort = ConfigController.BridgeConfiguration.BridgeHttpsPort; if (httpsPort != 0) { CertificateManager.UninstallSslPortCertificate(httpsPort); } int wssPort = ConfigController.BridgeConfiguration.BridgeSecureWebSocketPort; if (wssPort != 0) { CertificateManager.UninstallSslPortCertificate(wssPort); } // Finally remove all firewall rules we added for the ports PortManager.RemoveAllBridgeFirewallRules(); // If the Bridge is not being shutdown, open a port in the firewall to // communicate with the Bridge itself. if (!force) { PortManager.OpenPortInFirewall(ConfigController.BridgeConfiguration.BridgePort); } }
protected internal override void CallOn(HacknetPlugin plugin, MemberInfo targettedInfo) { if (targettedInfo.DeclaringType != plugin.GetType()) { throw new InvalidOperationException($"Pathfinder.Meta.Load.PortAttribute is only valid in a class derived from BepInEx.Hacknet.HacknetPlugin"); } object portRecord = null; switch (targettedInfo) { case PropertyInfo propertyInfo: if (propertyInfo.PropertyType != typeof(PortRecord)) { throw new InvalidOperationException($"Property {propertyInfo.Name}'s type does not derive from Pathfinder.Port.PortRecord"); } portRecord = propertyInfo.GetGetMethod()?.Invoke(plugin, null); break; case FieldInfo fieldInfo: if (fieldInfo.FieldType != typeof(PortRecord)) { throw new InvalidOperationException($"Field {fieldInfo.Name}'s type does not derive from Pathfinder.Port.PortRecord"); } portRecord = fieldInfo.GetValue(plugin); break; } if (portRecord == null) { throw new InvalidOperationException($"PortRecord not set to a default value, PortRecord should be set before HacknetPlugin.Load() is called"); } PortManager.RegisterPortInternal((PortRecord)portRecord, targettedInfo.Module.Assembly); }
private void button_Send_Click(object sender, EventArgs e) { if (clsGlobal.PerformOnAll) { foreach (string str in clsGlobal.g_objfrmMDIMain.PortManagerHash.Keys) { PortManager manager = (PortManager)clsGlobal.g_objfrmMDIMain.PortManagerHash[str]; if ((manager != null) && manager.comm.IsSourceDeviceOpen()) { this.SetDGPSSource(); this.SetSBASParameters(); this.SetDGPSControl(); base.Close(); } } clsGlobal.PerformOnAll = false; } else if (this.comm.IsSourceDeviceOpen()) { this.SetDGPSSource(); this.SetSBASParameters(); this.SetDGPSControl(); base.Close(); } base.DialogResult = DialogResult.OK; base.Close(); }
public void handleRequests() { server = new TcpListener(IPAddress.Any, PortManager.instance().Miscport); server.Start(); while (true) { TcpClient client = server.AcceptTcpClient(); try { NetworkStream stream = client.GetStream(); KeyValuePair <bool, string> pair = Utility.ReadFromNetworkStream(stream); if (pair.Key == false) { Console.WriteLine("MiscController: invalid syntax on message, discarding request."); continue; } string command = pair.Value; //string command = Utility.ReadFromNetworkStream(stream); handleCommands(command, stream); client.Close(); } catch (Exception e) { Console.WriteLine("Error in MiscManager, error message: " + e.Message); } } }
void RemoveObstacleWithoutRebuild(Shape shape) { ValidateArg.IsNotNull(shape, "shape"); Obstacle obstacle = ShapeToObstacleMap[shape]; ShapeToObstacleMap.Remove(shape); PortManager.RemoveObstaclePorts(obstacle); }
public string[] GetUserHistoryIDs(string username) { lock (llock) { string[] results = new string[0]; try { client = new TcpClient(PortManager.instance().Host, PortManager.instance().Miscport); } catch (Exception e) { Trace.WriteLine("MiscController error: couldnt connect to server, error message: " + e.Message); EventArgs er = new EventArgs(); OnLostConnection(er); return(new string[0]); } NetworkStream stream = client.GetStream(); byte[] idData = Encoding.Unicode.GetBytes("KNOCKNOCK|" + "LISTLOAD|" + username); try { stream.Write(idData); } catch (Exception e) { Trace.WriteLine("MiscController error: couldnt send username for history, error message: " + e.Message); client.Close(); EventArgs er = new EventArgs(); OnLostConnection(er); return(new string[0]); } try { Thread.Sleep(100); string attemptResult = Utility.ReadFromNetworkStream(stream); if (attemptResult == "!") { return(new string[0]); } results = attemptResult.Split("!"); } catch (Exception e) { Trace.WriteLine("Error in sending history: error message " + e.Message); client.Close(); EventArgs er = new EventArgs(); OnLostConnection(er); return(new string[0]); } return(results); } }
public void Initialize(PortManager portManager, DeckModel deckModel) { this.mPortManager = portManager; this.mDeckModel = deckModel; this.mUIPortMenuButton_Sally.ChangeState(UIPortMenuCenterButton.State.MainMenu); this.mUIPortMenuAnimation.Initialize(null); if (this.mUIPortMenuButton_Current != null) { this.mUIPortMenuButton_Current.GenerateTweenRemoveHover(); this.mUIPortMenuButton_Current.RemoveHover(); this.mUIPortMenuButton_Current = null; } this.mUIPortMenuButtons_MainMenu = this.GeneratePortMenuMain(); this.mUIPortMenuButtons_SubMenu = this.GeneratePortMenuSub(); this.mTexture_Shaft.get_transform().set_localScale(Vector3.get_zero()); UIPortMenuButton[] array = this.mUIPortMenuButtons_SubMenu; for (int i = 0; i < array.Length; i++) { UIPortMenuButton uIPortMenuButton = array[i]; bool selectable = this.IsValidSelectable(this.mPortManager, this.mDeckModel, uIPortMenuButton); Vector3 localPosition = uIPortMenuButton.get_transform().get_localPosition(); uIPortMenuButton.get_transform().set_localPosition(this.mUIPortMenuButton_Sally.get_transform().get_localPosition()); uIPortMenuButton.Initialize(selectable); uIPortMenuButton.get_gameObject().SetActive(false); uIPortMenuButton.alpha = 0f; } UIPortMenuButton[] array2 = this.mUIPortMenuButtons_MainMenu; for (int j = 0; j < array2.Length; j++) { UIPortMenuButton uIPortMenuButton2 = array2[j]; bool selectable2 = this.IsValidSelectable(this.mPortManager, this.mDeckModel, uIPortMenuButton2); Vector3 localPosition2 = uIPortMenuButton2.get_transform().get_localPosition(); uIPortMenuButton2.get_transform().set_localPosition(this.mUIPortMenuButton_Sally.get_transform().get_localPosition()); uIPortMenuButton2.get_transform().set_localScale(Vector3.get_zero()); uIPortMenuButton2.Initialize(selectable2); uIPortMenuButton2.get_gameObject().SetActive(false); uIPortMenuButton2.alpha = 0f; } this.mUIPortMenuAnimation.SetOnFinishedCollectAnimationListener(new Action(this.OnFinishedCollectAnimationListener)); UIPortMenuButton[] array3 = this.mUIPortMenuButtons_MainMenu; for (int k = 0; k < array3.Length; k++) { UIPortMenuButton uIPortMenuButton3 = array3[k]; bool selectable3 = this.IsValidSelectable(this.mPortManager, this.mDeckModel, uIPortMenuButton3); uIPortMenuButton3.Initialize(selectable3); } UIPortMenuButton[] array4 = this.mUIPortMenuButtons_SubMenu; for (int l = 0; l < array4.Length; l++) { UIPortMenuButton uIPortMenuButton4 = array4[l]; bool selectable4 = this.IsValidSelectable(this.mPortManager, this.mDeckModel, uIPortMenuButton4); uIPortMenuButton4.Initialize(selectable4); } this.mStateManager = new UserInterfacePortMenuManager.StateManager <UserInterfacePortMenuManager.State>(UserInterfacePortMenuManager.State.None); this.mStateManager.OnPush = new Action <UserInterfacePortMenuManager.State>(this.OnPushState); this.mStateManager.OnPop = new Action <UserInterfacePortMenuManager.State>(this.OnPopState); this.mStateManager.OnResume = new Action <UserInterfacePortMenuManager.State>(this.OnResumeState); }
public async Task DisconnectDevice() { _connectedPortManager?.Stop(); await Task.Delay(500); //To let things wrap up _receivedDataAction = null; _connectedPortManager?.Dispose(); _connectedPortManager = null; }
public ModelFactory() { Dispatcher.CurrentDispatcher.ShutdownStarted += OnShutdownStarted; var fileOutputManager = new FileOutputManager(SettingsManager); ConsoleManager = new WinConsoleManager(SettingsManager, fileOutputManager); PortManager = new PortManager(SettingsManager, ConsoleManager, _mainThreadRunner, _usbNotification); _pipeManager = new PipeManager(PortManager, SettingsManager, ConsoleManager, _mainThreadRunner); }
private bool IsValidSelectable(PortManager portManager, DeckModel deckModel, UIPortMenuButton portMenuButton) { Generics.Scene scene = portMenuButton.GetScene(); if (scene != Generics.Scene.Marriage) { return(SingletonMonoBehaviour <AppInformation> .Instance.IsValidMoveToScene(portMenuButton.GetScene())); } return(portManager.IsValidMarriage(deckModel.GetFlagShip().MemId)); }
public string GetChatHistoryMessage(string convID) { Trace.WriteLine("her"); lock (llock) { string result = ""; try { client = new TcpClient(PortManager.instance().Host, PortManager.instance().Miscport); Trace.WriteLine("here"); } catch (Exception e) { Trace.WriteLine("MiscController error: couldnt connect to server, error message: " + e.Message); EventArgs er = new EventArgs(); OnLostConnection(er); return(""); } Trace.WriteLine("heree"); NetworkStream stream = client.GetStream(); byte[] idData = Encoding.Unicode.GetBytes("KNOCKNOCK|" + "CONVLOAD|" + convID); try { stream.Write(idData); } catch (Exception e) { Trace.WriteLine("MiscController error: couldnt send convID for history, error message: " + e.Message); client.Close(); EventArgs er = new EventArgs(); OnLostConnection(er); return(""); } Trace.WriteLine("hereee"); try { Thread.Sleep(100); result = Utility.ReadFromNetworkStream(stream); } catch (Exception e) { Trace.WriteLine("Error in sending history: error message " + e.Message); client.Close(); EventArgs er = new EventArgs(); OnLostConnection(er); return(""); } return(result); } }
public static void Main() { //setup dependencies -- no container manager //DebugRoutines debugRoutines = new DebugRoutines(); //debugRoutines.Loop(); IOutputPort bankZeroDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D0, false)); IOutputPort bankOneDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D1, false)); IOutputPort bankTwoDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D2, false)); IOutputPort bankThreeDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D3, false)); IOutputPort bankFourDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D4, false)); IOutputPort bankFiveDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D5, false)); IOutputPort bankSixDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D8, false)); IOutputPort bankSevenDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D9, false)); IOutputPort bankEightDataPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D10, false)); IOutputPort ledPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.ONBOARD_LED, false)); var portLayout = new PortLayout { DataPorts = new[] { bankZeroDataPort, bankOneDataPort, bankTwoDataPort, bankThreeDataPort, bankFourDataPort, bankFiveDataPort, bankSixDataPort, bankSevenDataPort, bankEightDataPort }, ClockPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D6, false)), LatchPort = new OutputPort(new Microsoft.SPOT.Hardware.OutputPort(Pins.GPIO_PIN_D7, false)) }; var logger = new Logger(ledPort); var portManager = new PortManager(portLayout, logger); portManager.setBanks(NUM_BANKS); // DDL, you can move this later var rgbManager = new RgbManager(portManager, NUM_BANKS, NUM_CHANNELS); var complexBehaviorManager = new ComplexBehaviorManager(rgbManager, logger); //begin behavior routines complexBehaviorManager.RunInitalizeSequence(1000, 500); complexBehaviorManager.ChaseFadedLight(0, 10, 100, LedColor.GetBlue); var colors = new LedColor[6]; colors[0] = LedColor.GetRed; colors[1] = LedColor.GetGreen; colors[2] = LedColor.GetBlue; colors[3] = LedColor.GetA; colors[4] = LedColor.GetB; colors[5] = LedColor.GetC; complexBehaviorManager.ParadeForward(1000, 500, colors); portLayout.Dispose(); }
private void deletePortBtn_Click(object sender, EventArgs e) { if (1 != this.portListView.SelectedItems.Count) { return; } PortManager.DeletePrintJackPort(this.portListView.SelectedItems[0].Text); this.ReloadPorts(); }
private static void Main(string[] args) { CommandLineArguments commandLineArgs = new CommandLineArguments(args); string hostFormatString = "http://{0}:{1}"; string owinAddress = String.Format(hostFormatString, commandLineArgs.AllowRemote ? "+" : "localhost", commandLineArgs.Port); string visibleHost = (commandLineArgs.AllowRemote) ? Environment.MachineName : "localhost"; string visibleAddress = String.Format(hostFormatString, visibleHost, commandLineArgs.Port); // Configure the remote addresses the firewall rules will accept. // If remote access is not allowed, specifically disallow remote addresses PortManager.RemoteAddresses = commandLineArgs.AllowRemote ? commandLineArgs.RemoteAddresses : String.Empty; // Initialize the BridgeConfiguration from command line. // The first POST to the ConfigController will supply the rest. ConfigController.BridgeConfiguration.BridgeHost = visibleHost; ConfigController.BridgeConfiguration.BridgePort = commandLineArgs.Port; // Remove any pre-existing firewall rules the Bridge may have added // in past runs. We normally cleanup on exit but could have been // aborted. PortManager.RemoveAllBridgeFirewallRules(); // Open the port used to communicate with the Bridge itself PortManager.OpenPortInFirewall(commandLineArgs.Port); Console.WriteLine("Starting the Bridge at {0}", visibleAddress); OwinSelfhostStartup.Startup(owinAddress); Test(visibleHost, commandLineArgs.Port); while (true) { Console.WriteLine("The Bridge is listening at {0}", visibleAddress); if (commandLineArgs.AllowRemote) { Console.WriteLine("Remote access is allowed from '{0}'", commandLineArgs.RemoteAddresses); } else { Console.WriteLine("Remote access is disabled."); } Console.WriteLine("Current configuration is:{0}{1}", Environment.NewLine, ConfigController.BridgeConfiguration.ToString()); Console.WriteLine("Type \"exit\" to stop the Bridge."); string answer = Console.ReadLine(); if (String.Equals(answer, "exit", StringComparison.OrdinalIgnoreCase)) { break; } } Environment.Exit(0); }
public void Release() { mUIJukeBoxMusicBuyConfirm.Release(); mUIJukeBoxMusicPlayingDialog.Release(); mPanelThis = null; mStateManager = null; mPortManager = null; mUIJukeBoxPlayListParent = null; mUIJukeBoxMusicPlayingDialog = null; mKeyController = null; }
private Uri BuildUri() { var builder = new UriBuilder(); builder.Host = Host; builder.Port = Int32.Parse(Port); PortManager.OpenPortInFirewall(builder.Port); builder.Path = AppDomain.CurrentDomain.FriendlyName + "/" + Address; builder.Scheme = Protocol; return(builder.Uri); }
/// <summary> /// Resolves the router's dependencies /// </summary> /// <param name="processes">The processes</param> public void Resolve(IEnumerable <IProcess> processes) { lock (_lock) { var pm = processes.OfType <PortManager>().FirstOrDefault(); if (pm != null) { _portManager = pm; } } }
private Uri BuildUri(ResourceRequestContext context) { var builder = new UriBuilder(); builder.Host = GetHost(context); builder.Port = GetPort(context); PortManager.OpenPortInFirewall(builder.Port); builder.Path = AppDomain.CurrentDomain.FriendlyName + "/" + Address; builder.Scheme = Protocol; return(builder.Uri); }
public void Initialize(PortManager portManager, DeckModel deckModel) { mPortManager = portManager; mDeckModel = deckModel; mUIPortMenuButton_Sally.ChangeState(UIPortMenuCenterButton.State.MainMenu); mUIPortMenuAnimation.Initialize(null); if (mUIPortMenuButton_Current != null) { mUIPortMenuButton_Current.GenerateTweenRemoveHover(); mUIPortMenuButton_Current.RemoveHover(); mUIPortMenuButton_Current = null; } mUIPortMenuButtons_MainMenu = GeneratePortMenuMain(); mUIPortMenuButtons_SubMenu = GeneratePortMenuSub(); mTexture_Shaft.transform.localScale = Vector3.zero; UIPortMenuButton[] array = mUIPortMenuButtons_SubMenu; foreach (UIPortMenuButton uIPortMenuButton in array) { bool selectable = IsValidSelectable(mPortManager, mDeckModel, uIPortMenuButton); Vector3 localPosition = uIPortMenuButton.transform.localPosition; uIPortMenuButton.transform.localPosition = mUIPortMenuButton_Sally.transform.localPosition; uIPortMenuButton.Initialize(selectable); uIPortMenuButton.gameObject.SetActive(false); uIPortMenuButton.alpha = 0f; } UIPortMenuButton[] array2 = mUIPortMenuButtons_MainMenu; foreach (UIPortMenuButton uIPortMenuButton2 in array2) { bool selectable2 = IsValidSelectable(mPortManager, mDeckModel, uIPortMenuButton2); Vector3 localPosition2 = uIPortMenuButton2.transform.localPosition; uIPortMenuButton2.transform.localPosition = mUIPortMenuButton_Sally.transform.localPosition; uIPortMenuButton2.transform.localScale = Vector3.zero; uIPortMenuButton2.Initialize(selectable2); uIPortMenuButton2.gameObject.SetActive(false); uIPortMenuButton2.alpha = 0f; } mUIPortMenuAnimation.SetOnFinishedCollectAnimationListener(OnFinishedCollectAnimationListener); UIPortMenuButton[] array3 = mUIPortMenuButtons_MainMenu; foreach (UIPortMenuButton uIPortMenuButton3 in array3) { bool selectable3 = IsValidSelectable(mPortManager, mDeckModel, uIPortMenuButton3); uIPortMenuButton3.Initialize(selectable3); } UIPortMenuButton[] array4 = mUIPortMenuButtons_SubMenu; foreach (UIPortMenuButton uIPortMenuButton4 in array4) { bool selectable4 = IsValidSelectable(mPortManager, mDeckModel, uIPortMenuButton4); uIPortMenuButton4.Initialize(selectable4); } mStateManager = new StateManager <State>(State.None); mStateManager.OnPush = OnPushState; mStateManager.OnPop = OnPopState; mStateManager.OnResume = OnResumeState; }
public void PortsAreFree_APortIsLocked_ReturnsFalse() { var mock = new Mock<IPortChecker>(); mock.Setup(x=> x.IsPortOpen(77)).Returns(false); var portManager = new PortManager(mock.Object); Assert.Equal(true, portManager.PortsAreFree(1, 76)); Assert.Equal(true, portManager.PortsAreFree(78, 200)); Assert.Equal(false, portManager.PortsAreFree(1, 200)); }
private void ThreadManaging() { while (true) { ConcurrentDictionary <PrivateChatController, Thread> AliveThreads = new ConcurrentDictionary <PrivateChatController, Thread>(); lock (llock) { foreach (KeyValuePair <PrivateChatController, Thread> t in privatechatsThreads) { //Console.WriteLine("TEMP: TRY TO REMOVE SHIT"); if (t.Key.Ongoing == false) { try { t.Value.Abort(); } catch (Exception e) { Console.WriteLine("MatchController: powerkill on PrivateChatThread on port " + t.Key.Portnum); } finally { Thread.Sleep(10); if (t.Key.Type == CHATTPYE.PRIVATE) { PortManager.instance().ReturnPrivateChatPort(t.Key.Portnum); } else if (t.Key.Type == CHATTPYE.GROUP) { PortManager.instance().ReturnGroupChatPort(t.Key.Portnum); } } } else { AliveThreads.TryAdd(t.Key, t.Value); } } privatechatsThreads = AliveThreads; } if (privatechatsThreads.Count == 0) { Thread.Sleep(20000); } else { Console.WriteLine("MatchController: alive chats: " + privatechatsThreads.Count); Thread.Sleep(10000); } } }
private void btn_Send_Click(object sender, EventArgs e) { string messageName = "Set GPS/DR Navigation Mode"; byte num = 0; if (this.rdBtn_GPSOnly.Checked) { num = 1; } else if (this.rdBtn_DrNavwStoredCal.Checked) { num = 2; } else if (this.rdBtn_DRNavwCurrentCal.Checked) { num = 4; } else if (this.rdBtn_DRNavOnly.Checked) { num = 8; } else { num = 1; } StringBuilder builder = new StringBuilder(); builder.Append(string.Format("172,2,{0},0", num)); string msg = this.comm.m_Protocols.ConvertFieldsToRaw(builder.ToString(), messageName, "SSB"); if (clsGlobal.PerformOnAll) { foreach (string str3 in clsGlobal.g_objfrmMDIMain.PortManagerHash.Keys) { if (!(str3 == clsGlobal.FilePlayBackPortName)) { PortManager manager = (PortManager)clsGlobal.g_objfrmMDIMain.PortManagerHash[str3]; if (manager != null) { manager.comm.WriteData(msg); } } } clsGlobal.PerformOnAll = false; } else { this.comm.WriteData(msg); } base.Close(); }
public MatchMakingServer(MatchMakerSettings settings) { SerializerSingleton.Serializer.AddSerializer <ClientHeartBeatPacket>(new ClientHeartBeatSerializer()); SerializerSingleton.Serializer.AddSerializer <ClientHandshakePacket>(new ClientHandshakeSerializer()); SerializerSingleton.Serializer.AddSerializer <ClientInstanceReadyPacket>(new ClientInstanceReadySerializer()); SerializerSingleton.Serializer.AddSerializer <ServerExitPacket>(new ServerExitSerializer()); Settings = settings; Logger.DefaultLogger(Settings.ToString()); PortManager = new PortManager(Settings); InstanceManager = new GameInstanceManager(Settings); ConnectionManager = new ConnectionManager(Settings); WaitingQueue = new List <WaitingQueueItem>(); RemoveList = new List <WaitingQueueItem>(); }
private List <EngageValidation> EngegeCheck(PortManager portManager, ShipModel shipModel) { List <EngageValidation> list = new List <EngageValidation>(); if (mPortManager.YubiwaNum <= 0) { list.Add(EngageValidation.NoYubiwa); } if (shipModel.IsInRepair()) { list.Add(EngageValidation.InRepair); } return(list); }
public void Initialize(PortManager portManager, int deckId, Camera overlayCamera) { mPortManager = portManager; mOverlayCamera = overlayCamera; mDeckId = deckId; mConfiguredBGM = (BGMFileInfos)mPortManager.UserInfo.GetPortBGMId(deckId); mContext = new Context(); mDefaultVolume = SingletonMonoBehaviour <SoundManager> .Instance.bgmSource.volume; mStateManager = new StateManager <State>(State.NONE); mStateManager.OnPush = OnPushState; mStateManager.OnPop = OnPopState; mStateManager.OnResume = OnResumeState; mUIJukeBoxPlayListParent.Initialize(mPortManager, mPortManager.GetJukeboxList().ToArray(), mOverlayCamera); mUIJukeBoxPlayListParent.StartState(); }
public LocalServers(string jsonFileSettings = "appsettings.json") { if (string.IsNullOrEmpty(nameof(jsonFileSettings))) { throw new ArgumentNullException(nameof(jsonFileSettings)); } JsonFileSettings = jsonFileSettings; ExtraSettings = new Dictionary <string, string>(); Servers = new Dictionary <string, IWebHostBuilder>(); Ports = new List <int>(); PortManager = new PortManager(); }
public bool ForcedReconnect() { try { client = new TcpClient(); client.Connect(PortManager.instance().Host, port); Trace.WriteLine("\n\n" + client.Connected + "\n\n"); } catch (Exception e) { ///to be decided Trace.WriteLine("\n\n" + "Error during reconnect attempt, error msg: " + e.Message + "\n\n"); } return(client.Connected); }
public void MatchControllerTest6_INQUEUE() { MatchController mc = MatchController.instance(); Thread thread = new Thread(mc.handleRequests); thread.Start(); ///A|S|LS string Leftmsg = "KNOCKNOCK|candidate1|1|1|3"; TcpClient Leftclient = new TcpClient("localhost", PortManager.instance().Matchport); NetworkStream leftstream = Leftclient.GetStream(); byte[] leftattempt = Encoding.Unicode.GetBytes(Leftmsg); leftstream.Write(leftattempt); Thread.Sleep(10); string leftres = Utility.ClientReadFromNetworkStream(leftstream); ///note that its the server's read function, which is different and requires the KNOCKNOCK| trailer. Console.WriteLine(leftres + "|"); Assert.AreEqual(leftres, "OK"); string rightmsg = "KNOCKNOCK|candidate1|1|1|2"; TcpClient Righttclient = new TcpClient("localhost", PortManager.instance().Matchport); NetworkStream rightstream = Righttclient.GetStream(); byte[] rightattempt = Encoding.Unicode.GetBytes(rightmsg); rightstream.Write(rightattempt); string rightres = Utility.ClientReadFromNetworkStream(rightstream); Thread.Sleep(10); //Assert.AreEqual(rightres, "OK"); Assert.AreEqual("ER|INQUEUE", rightres); try { mc.Server.Stop(); thread.Abort(); } catch (Exception e) { } }