private void Send() { lock (SendCmdList) { if (SendCmdList.Count > 0 && IsSendOK) { try { IsSendOK = false; NetworkStream stream = LocalClient.GetStream(); Byte[] dcB = System.Text.Encoding.ASCII.GetBytes(SendCmdList.First() + "\r"); stream.Write(dcB, 0, dcB.Length); Console.WriteLine("Send:" + SendCmdList.First()); SendCmdList.RemoveAt(0); } catch { Console.WriteLine("Send Fail:" + SendCmdList.First()); } } } }
public PeerWorker(WorkerConfig workerConfig, Logger logger, LocalClient localClient, CoreDaemon coreDaemon) : base("PeerWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime, logger) { this.logger = logger; this.localClient = localClient; this.coreDaemon = coreDaemon; }
private void Receive() { NetworkStream stream = LocalClient.GetStream(); while (stream.DataAvailable) { Byte[] sRes = new Byte[200]; if (stream.Read(sRes, 0, 199) > 0) { string[] ReceiveStrings = System.Text.Encoding.ASCII.GetString(sRes).Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (string receiveString in ReceiveStrings) { string receiveValue = receiveString.Trim(new char[] { '\r', '\n', '\0' }); if (!String.IsNullOrWhiteSpace(receiveValue)) { Console.WriteLine(receiveValue); if (receiveValue == "OK" || receiveValue == "ERROR") { IsSendOK = true; Thread.Sleep(100); // "OK"のあとすぐに送信すると受け付けてくれないため100ms待つ } else { OnRecive(receiveValue); } } } } } }
private async Task ReceiveHubMessagesAsync() { using (Message receivedMessage = await DeviceClient.ReceiveAsync(TimeSpan.FromSeconds(30)).ConfigureAwait(false)) { if (receivedMessage == null) { Console.WriteLine("\t{0}> Timed out", DateTime.Now.ToLocalTime()); return; } var message = new MqttApplicationMessageBuilder() .WithPayload(receivedMessage.GetBytes()); string payload = Encoding.ASCII.GetString(receivedMessage.GetBytes()); Console.WriteLine("\t{0}> Received message: {1}", DateTime.Now.ToLocalTime(), payload); if (receivedMessage.Properties.ContainsKey("topic")) { message.WithTopic(receivedMessage.Properties["topic"]); } var keyExclude = new string[] { "topic", "clientId" }; foreach (var prop in receivedMessage.Properties.Where(k => !keyExclude.Contains(k.Key))) { message.WithUserProperty(prop.Key, prop.Value); } await LocalClient.PublishAsync(message.Build(), CancellationToken.None); await DeviceClient.CompleteAsync(receivedMessage).ConfigureAwait(false); } }
public MainWindowViewModel(IKernel kernel, WalletMonitor walletMonitor = null) { this.dispatcher = Dispatcher.CurrentDispatcher; this.kernel = kernel; this.blockchainDaemon = kernel.Get <CoreDaemon>(); this.localClient = kernel.Get <LocalClient>(); this.blockCache = kernel.Get <BlockCache>(); this.startTime = DateTime.UtcNow; this.runningTimeTimer = new DispatcherTimer(); runningTimeTimer.Tick += (sender, e) => { var runningTime = (DateTime.UtcNow - this.startTime); this.RunningTime = "{0:#,#00}:{1:mm':'ss}".Format2(Math.Floor(runningTime.TotalHours), runningTime); }; runningTimeTimer.Interval = TimeSpan.FromMilliseconds(100); runningTimeTimer.Start(); this.ratesTimer = new DispatcherTimer(); ratesTimer.Tick += (sender, e) => { this.BlockRate = this.blockchainDaemon.GetBlockRate(TimeSpan.FromSeconds(1)); this.TransactionRate = this.blockchainDaemon.GetTxRate(TimeSpan.FromSeconds(1)); this.InputRate = this.blockchainDaemon.GetInputRate(TimeSpan.FromSeconds(1)); this.BlockDownloadRate = this.localClient.GetBlockDownloadRate(TimeSpan.FromSeconds(1)); this.DuplicateBlockDownloadRate = this.localClient.GetDuplicateBlockDownloadRate(TimeSpan.FromSeconds(1)); }; ratesTimer.Interval = TimeSpan.FromSeconds(1); ratesTimer.Start(); this.viewChain = this.blockchainDaemon.CurrentChain; this.WinningBlockchainHeight = this.blockchainDaemon.TargetBlockHeight; this.CurrentBlockchainHeight = this.blockchainDaemon.CurrentChain.Height; this.DownloadedBlockCount = this.blockCache.Count; this.blockCache.OnAddition += (blockHash, block) => DownloadedBlockCount = this.blockCache.Count; this.blockCache.OnRemoved += (blockHash) => DownloadedBlockCount = this.blockCache.Count; this.blockchainDaemon.OnTargetBlockChanged += (sender, block) => WinningBlockchainHeight = this.blockchainDaemon.TargetBlockHeight; this.blockchainDaemon.OnChainStateChanged += (sender, chainState) => CurrentBlockchainHeight = this.blockchainDaemon.CurrentChain.Height; if (walletMonitor != null) { this.walletMonitor = walletMonitor; this.WalletEntries = new ObservableCollection <WalletEntry>(); this.walletMonitor.OnEntryAdded += HandleOnWalletEntryAdded; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); ClientRepository repository = ServiceProvider.Clients; MainViewModel viewModel = new MainViewModel(new MainViewModelService(repository), repository); foreach (RemoteClient remote in repository.EnumerateRemote()) { viewModel.RemoteClients.Add(new ClientViewModel() { Key = remote.Key, Name = remote.Name, Url = remote.Url }); } LocalClient local = repository.FindLocal(); if (local != null) { viewModel.LocalClient = new ClientViewModel() { Key = local.Key, Name = "Local", Url = local.Url }; } DataContext = viewModel; }
/// <summary> /// 创建redis对象 /// </summary> /// <returns></returns> public CacheClient CreateInstance() { CacheClient client = null;//获取Redis操作接口 if (IsTrue) { switch (IsCacheName) { case CacheEnum.RedisCache: client = new RedisCacheClient((DBEnum)RedisDB); break; case CacheEnum.MemCache: client = new MemCacheClient(); break; case CacheEnum.LocalCache: client = new LocalClient(); break; } } else { cacheLog.Info(IsCacheName.ToString() + "缓存未启用"); } return(client); }
public async Task MapsToCommand() { //Arrange var cfg = Config.Reset(); cfg.UseInMemoryFileSystem(); var settings = Config.Current.GetSettings <EngineSettings>(); var storageProvider = cfg.GetStorageProvider(); var builder = new EngineBuilder(); var engine = builder.Build <ITestModel>().Result; var client = new LocalClient <ITestModel>(engine); var proxy = client.GetDispatchProxy(); //Act proxy.SetCustomer(new Customer()); //release the lock on the journal await engine.DisposeAsync(); var journalEntry = storageProvider.CreateJournalReader().GetRecords().FirstOrDefault(); // If MapTo is correct, a SetCustomerCommand will be written to the journal // if not, then a ProxyCommand will be written Assert.NotNull(journalEntry); Assert.IsInstanceOf <SetCustomerCommand>(journalEntry.Command); }
internal PeerWorker(WorkerConfig workerConfig, LocalClient localClient, CoreDaemon coreDaemon, HeadersRequestWorker headersRequestWorker) : base("PeerWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime) { this.localClient = localClient; this.coreDaemon = coreDaemon; this.headersRequestWorker = headersRequestWorker; }
private static void Publish(string channel, string message) { using (var client = new LocalClient()) { client.PublishMessage(channel, message); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { Exit(); } if (InputManager.InputManager.KeyJustPressed(Keys.Escape)) { LocalClient.Disconnect(); } // TODO: Add your update logic here InputManager.InputManager.Update(Keyboard.GetState(), Mouse.GetState(), IsActive); TimeManager.Update(gameTime); BackgroundWall.Update(); if (Program.Hosting) { Server.Update(); } LocalClient.Update(); PlatformWorld.Update(); base.Update(gameTime); }
private void DoListen() { try { _listener.Start(); do { TcpClient tcpClient = _listener.AcceptTcpClient(); LocalClient localClient = new LocalClient(tcpClient); localClient.OnReceiveObject += ReceiveObject; localClient.Start(); }while (true); } catch (Exception) { }//try }
protected override void OnConnected() { NetworkStream peerStream = LocalClient.GetStream(); TaskCancellation = new CancellationTokenSource(); var t = Task.Factory.StartNew(() => { while (true) { if (TaskCancellation.IsCancellationRequested) { TaskCancellation.Token.ThrowIfCancellationRequested(); } Receive(); Send(); Thread.Sleep(1); } }, TaskCancellation.Token); ServiceLevelConnectionInitialization(); }
public ListenWorker(Logger logger, LocalClient localClient, PeerWorker peerWorker) : base("ListenWorker", initialNotify: true, minIdleTime: TimeSpan.Zero, maxIdleTime: TimeSpan.Zero, logger: logger) { this.logger = logger; this.localClient = localClient; this.peerWorker = peerWorker; }
public ConnectionGUI(InputField inputField, Button connectionButton, LocalClient client, EventBus events) { _inputField = inputField; _connectionButton = connectionButton; _client = client; _events = events; }
public BlockRequestWorker(WorkerConfig workerConfig, Logger logger, LocalClient localClient, CoreDaemon coreDaemon) : base("BlockRequestWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime, logger) { this.logger = logger; this.localClient = localClient; this.coreDaemon = coreDaemon; this.coreStorage = coreDaemon.CoreStorage; this.allBlockRequests = new ConcurrentDictionary <UInt256, BlockRequest>(); this.blockRequestsByPeer = new ConcurrentDictionary <Peer, ConcurrentDictionary <UInt256, DateTime> >(); this.missedBlockRequests = new ConcurrentDictionary <UInt256, BlockRequest>(); this.localClient.OnBlock += HandleBlock; this.coreDaemon.OnChainStateChanged += HandleChainStateChanged; this.coreDaemon.OnTargetChainChanged += HandleTargetChainChanged; this.coreStorage.BlockTxesMissed += HandleBlockTxesMissed; this.coreDaemon.BlockMissed += HandleBlockMissed; this.blockRequestDurationMeasure = new DurationMeasure(sampleCutoff: TimeSpan.FromMinutes(5)); this.blockDownloadRateMeasure = new RateMeasure(); this.duplicateBlockDownloadCountMeasure = new CountMeasure(TimeSpan.FromSeconds(30)); this.targetChainQueue = new List <ChainedHeader>(); this.targetChainQueueIndex = 0; this.targetChainLookAhead = 1; this.flushWorker = new WorkerMethod("BlockRequestWorker.FlushWorker", FlushWorkerMethod, initialNotify: true, minIdleTime: TimeSpan.Zero, maxIdleTime: TimeSpan.MaxValue, logger: this.logger); this.flushQueue = new ConcurrentQueue <FlushBlock>(); this.flushBlocks = new ConcurrentSet <UInt256>(); this.diagnosticWorker = new WorkerMethod("BlockRequestWorker.DiagnosticWorker", DiagnosticWorkerMethod, initialNotify: true, minIdleTime: TimeSpan.FromSeconds(10), maxIdleTime: TimeSpan.FromSeconds(10), logger: this.logger); }
public BlockRequestWorker(Logger logger, WorkerConfig workerConfig, LocalClient localClient, CoreDaemon blockchainDaemon, ChainedHeaderCache chainedHeaderCache, BlockCache blockCache) : base("BlockRequestWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime, logger) { this.logger = logger; this.localClient = localClient; this.blockchainDaemon = blockchainDaemon; this.chainedHeaderCache = chainedHeaderCache; this.blockCache = blockCache; this.allBlockRequests = new ConcurrentDictionary <UInt256, DateTime>(); this.blockRequestsByPeer = new ConcurrentDictionary <IPEndPoint, ConcurrentDictionary <UInt256, DateTime> >(); this.missingBlockQueue = new SortedList <int, ChainedHeader>(); this.localClient.OnBlock += HandleBlock; this.blockchainDaemon.OnChainStateChanged += HandleChainStateChanged; this.blockchainDaemon.OnTargetChainChanged += HandleTargetChainChanged; this.blockCache.OnMissing += HandleBlockMissing; this.blockRequestDurationMeasure = new DurationMeasure(sampleCutoff: TimeSpan.FromMinutes(5)); this.blockDownloadRateMeasure = new RateMeasure(); this.duplicateBlockDownloadRateMeasure = new RateMeasure(); this.targetChainLookAhead = 1; this.criticalTargetChainLookAhead = 1; this.flushWorker = new WorkerMethod("BlockRequestWorker.FlushWorker", FlushWorkerMethod, initialNotify: true, minIdleTime: TimeSpan.Zero, maxIdleTime: TimeSpan.MaxValue, logger: this.logger); this.flushQueue = new ConcurrentQueue <Tuple <RemoteNode, Block> >(); }
private static void RunGame() { if (!Hosting) { InputManager.Initialize(); Chat.Initialize(); LocalClient.Initialize(Ip, Port); Console.Clear(); while (true) { Update(); Draw(); } } else { // Start a server and maintain it. Listener.Initialize(); Server.Initialize(); Console.Clear(); Console.WriteLine("Started server.\n"); while (true) { Server.Update(); } } }
public static void AutoPairDevices() { // get a list of all paired devices var paired = LocalClient.DiscoverDevices(255, false, true, false, false); // check every discovered device if it is already paired foreach (var device in DeviceList) { var isPaired = paired.Any(t => device.Equals(t)); // if the device is not paired, try to pair it if (!isPaired) { // loop through common PIN numbers to see if they pair foreach (var devicePin in CommonDevicePins) { isPaired = BluetoothSecurity.PairRequest(device.DeviceAddress, devicePin); if (isPaired) { break; } } } } }
private void SessionConnect() { if (session == null) { session = new ObexClientSession(LocalClient.GetStream(), UInt16.MaxValue); } session.Connect(new byte[] { 0x79, 0x61, 0x35, 0xf0, 0xf0, 0xc5, 0x11, 0xd8, 0x09, 0x66, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 }); }
public void SetUp() { _settings = new MemstateSettings(); _settings.WithInmemoryStorage(); _client = new LocalClient <UsersModel>(() => new UsersModel(), _settings); }
public static void UpdateClient() { if (LocalClient != null) { LocalClient.Close(); LocalClient = new BluetoothClient(LocalEndpoint); } }
// Use this for initialization void Start() { m_localClient = GetComponent <LocalClient>(); navAgent = GetComponent <NavMeshAgent>(); PlayerControls = new PlayerControls(); PlayerControls.SetupControls(); }
public void Setup() { MemstateSettings config = new MemstateSettings(); config.FileSystem = new InMemoryFileSystem(); IKeyValueStore<int> model = new KeyValueStore<int>(); var engine = new EngineBuilder(config).Build(model); var client = new LocalClient<IKeyValueStore<int>>(engine); _keyValueStore = client.GetDispatchProxy(); }
static Native() { var path = LrpLibrary.Path; var client = new LocalClient(path, LocalCpp.Signature.Value, Mode.InProcess); LocalCpp.Library proxy = new LocalCpp.Library(client); proxy.SetDotNetDllPath(typeof(Native).Assembly.Location); Native.Client = client; }
public void Start() { _client = new LocalClient(); _client.OnConnected += Connected; _client.Start(); }
public ProxyOverloadingTests() { var settings = new MemstateSettings().WithInmemoryStorage(); var storageProvider = settings.CreateStorageProvider(); var engine = new EngineBuilder(settings, storageProvider).Build <ModelWithOverloads>(); var client = new LocalClient <ModelWithOverloads>(engine); _db = client.GetDispatchProxy(); }
private static void Subscribe(Action<string, string> action, params string[] channels) { using (var client = new LocalClient()) using (var sub = client.CreateSubscription()) { sub.OnMessage = action; sub.SubscribeToChannels(channels); } }
private static void AssignWork(Work work, Guid workerId) { var workAssignment = new WorkAssignment { Work = work, WorkerId = workerId, AssignedAt = DateTime.Now }; AssignedWork.TryAdd(work.MessageId, workAssignment); using (var client = new LocalClient()) { client.PublishMessage(workerId.ToString(), work.ToString()); } }
public async Task DisconnectAsync(CancellationToken cancellationToken) { var cancelToken = cancellationToken != null ? cancellationToken : CancellationToken.None; var disconnectOptions = new MqttClientDisconnectOptions { ReasonString = "Bridge disconnect" }; await LocalClient.DisconnectAsync(disconnectOptions, cancelToken); await DeviceClient.CloseAsync(cancelToken); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); ClientRepository repository = new ClientRepository(); LocalClient client = repository.FindLocal(); IsNewRecord = client == null; DataContext = new LocalClientEditViewModel(client); }
public async Task SetUp() { var cfg = Config.Reset(); cfg.FileSystem = new InMemoryFileSystem(); _settings = cfg.GetSettings <EngineSettings>(); var engine = await Engine.Start <UsersModel>(); _client = new LocalClient <UsersModel>(engine); }
public KeyValueStoreProxyTests() { MemstateSettings config = new MemstateSettings(); config.StorageProvider = typeof(InMemoryStorageProvider).FullName; IKeyValueStore <int> model = new KeyValueStore <int>(); var engine = new EngineBuilder(config).Build(model); var client = new LocalClient <IKeyValueStore <int> >(engine); _keyValueStore = client.GetDispatchProxy(); }
public void CheckForClientDoubleConnection() { using (var server = StartLocalServer(40100)) using (var client = new LocalClient()) { Assert.AreEqual(0, server.ConnectedClientsCount); ConnectClientToServerAndCheckState(client, server); Assert.AreEqual(1, server.ConnectedClientsCount); ConnectClientToServerAndCheckState(client, server); Assert.AreEqual(1, server.ConnectedClientsCount); } }
public void ConnectWithTwoClientsToServer() { using (var server = StartLocalServer(40200)) using (var client1 = new LocalClient()) using (var client2 = new LocalClient()) { Assert.AreEqual(0, server.ConnectedClientsCount); ConnectClientToServerAndCheckState(client1, server); Assert.AreEqual(1, server.ConnectedClientsCount); ConnectClientToServerAndCheckState(client2, server); Assert.AreEqual(2, server.ConnectedClientsCount); } }
public HeadersRequestWorker(WorkerConfig workerConfig, LocalClient localClient, CoreDaemon coreDaemon) : base("HeadersRequestWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime) { this.localClient = localClient; this.coreDaemon = coreDaemon; this.coreStorage = coreDaemon.CoreStorage; this.headersRequestsByPeer = new ConcurrentDictionary<Peer, DateTimeOffset>(); this.localClient.OnBlockHeaders += HandleBlockHeaders; this.coreDaemon.OnTargetChainChanged += HandleTargetChainChanged; this.flushWorker = new WorkerMethod("HeadersRequestWorker.FlushWorker", FlushWorkerMethod, initialNotify: true, minIdleTime: TimeSpan.Zero, maxIdleTime: TimeSpan.MaxValue); this.flushQueue = new ConcurrentQueue<FlushHeaders>(); }
public void ConnectAndDisconnectWithClientAtServer() { using (var server = StartLocalServer()) using (var client = new LocalClient()) { Assert.AreEqual(0, server.ConnectedClientsCount); ConnectClientToServerAndCheckState(client, server); Assert.AreEqual(1, server.ConnectedClientsCount); client.Disconnect(); Assert.IsFalse(client.IsConnected); Assert.AreEqual(0, server.ConnectedClientsCount); } }
static void Main(string[] args) { Func<string> prompt = () => { Console.Write("Enter your message: "); return Console.ReadLine(); }; string message; while (!string.IsNullOrEmpty(message = prompt())) { using (var client = new LocalClient()) { var work = new Work { MessageId = Guid.NewGuid(), Message = message }; client.PublishMessage(Channels.Distribution, work.ToString()); } } }
public static void Main(string[] args) { //TODO //MainnetRules.BypassValidation = true; //MainnetRules.BypassExecuteScript = true; ScriptEngine.BypassVerifySignature = true; using (var storageContext = new MemoryStorageContext()) using (var cacheContext = new CacheContext(storageContext)) { var rules = new Testnet2Rules(cacheContext); using (var blockchainDaemon = new BlockchainDaemon(rules, cacheContext)) using (var knownAddressStorage = new MemoryStorage<NetworkAddressKey, NetworkAddressWithTime>(storageContext)) using (var localClient = new LocalClient(LocalClientType.ComparisonToolTestNet, blockchainDaemon, knownAddressStorage)) { // start the blockchain daemon blockchainDaemon.Start(); // start p2p client localClient.Start(); var projectFolder = Environment.CurrentDirectory; while (projectFolder.Contains(@"\bin")) projectFolder = Path.GetDirectoryName(projectFolder); File.Delete(Path.Combine(projectFolder, "Bitcoinj-comparison.log")); var javaProcessStartInfo = new ProcessStartInfo { FileName = @"C:\Program Files\Java\jdk1.7.0_25\bin\java.exe", WorkingDirectory = projectFolder, Arguments = @"-Djava.util.logging.config.file={0}\bitcoinj.log.properties -jar {0}\bitcoinj.jar".Format2(projectFolder), UseShellExecute = false }; var javaProcess = Process.Start(javaProcessStartInfo); javaProcess.WaitForExit((int)TimeSpan.FromMinutes(5).TotalMilliseconds); Console.ReadLine(); } } }
/// <summary> /// /// </summary> void Start() { var localPlayer = GameObject.FindGameObjectWithTag("LocalPlayer"); m_localClient = localPlayer.GetComponent<LocalClient>(); m_localAnimationController = localPlayer.GetComponent<Player.PlayerAnimationController>(); foreach (var emote in Enum.GetValues(typeof(Player.PlayerEmote)).Cast<Player.PlayerEmote>()) { m_customEmotes["/" + emote.ToString().ToLower()] = emote; } }
public override void ModUnload() { mFloodServ = null; }
public override void ModUnload() { mNickServ = null; }
static LocalClient CreateLocalClient(string signature, string name) { var path = Path.Combine(ManagedLibrary.Path, name); path += ManagedLibrary.Platform; path += ".dll"; var result = new LocalClient(path, signature, Mode.InProcess); return result; }
// heitetään factoryltä tulevat clientit basemapperille public TrafficLocationMapper(WebClient webClient, LocalClient localClient, SessionClient sessionClient) : base(webClient, localClient, sessionClient) { }
public void sendHelp(string Service, LocalClient ServiceClient, Client Source, string[] Params) { if (Params == null) { ServiceCommandResponse tResponse; tResponse = HelpResponses[Service].Commands["help"]; foreach (string tString in tResponse.Value) { ServiceClient.Send_Notice(Source.nick, tString); } } else { //bool tSent = false; //ServiceCommandResponse tResponse; BlackLight.Services.Modules.Help.Lists.CommandList tList = HelpResponses[Service].Commands; for (int tInt = 0; tInt <= Params.GetUpperBound(0); tInt++) { if (tList.Contains(Params[tInt])) { if (tInt == Params.GetUpperBound(0)) { foreach (string tString in tList[Params[tInt]].Value) { ServiceClient.Send_Notice(Source.nick, tString); } break; } else { tList = tList[Params[tInt]].Commands; } } else { string tString = ""; foreach (string tVal in Params) { tString += " " + tVal; } ServiceClient.Send_Notice(Source.nick, "No help available for" + tString); break; } } } }
public Contacts(ContactItemButtonClickDelegate buttonHandler, ContactsDataUpdateDelegate updateHandler) { InitializeComponent(); this.m_clientButtonHandler = buttonHandler; this.m_localClientContact = new LocalClient(); this.m_localClientContact.onDataUpdate += updateHandler; this.m_localClientContact.onDataUpdate += OnDataUpdate; this.Opacity = 0; this.MouseDown += (object s, MouseButtonEventArgs e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; this.IsVisibleChanged += (object s, DependencyPropertyChangedEventArgs e) => { if (!(bool)e.NewValue) { Debug.Warn("Hiding window, cause IsVisible changed."); base.Hide(); } }; }
// heitetään factoryltä tulevat clientit basemapperille public ReasonCodeMapper(WebClient webClient, LocalClient localClient, SessionClient sessionClient) : base(webClient, localClient, sessionClient) { }
public void sendError(string Service, LocalClient ServiceClient, Client Source, string message, string command) { if (message != null&& message.Length > 0) { if (HelpResponses[Service].Errors.Contains(message)) { foreach (string tString in HelpResponses[Service].Errors[message]) { ServiceClient.Send_Notice(Source.nick, tString); } string tError = HelpResponses[Service].Errors["error"][0]; ServiceClient.Send_Notice(Source.nick, string.Format(tError, ServiceClient.nick, command)); } else { ServiceClient.Send_Notice(Source.nick, "Information missing for: " + message); } Console.WriteLine("o no"); } }
public NickServService(LocalClient tMyClient, ServicesCore tMyCore, DataBase tNickDB, ModuleList Modules) { this.MyClient = tMyClient; this.MyCore = tMyCore; this.NickDB = tNickDB; this.Modules = Modules; Help = ((Help.Help) this.Modules["Help"]); }
public ULocalConnectionToClient(LocalClient localClient) { this.address = "localClient"; this.m_LocalClient = localClient; }
// heitetään factoryltä tulevat clientit basemapperille public TrainTypeMapper(WebClient webClient, LocalClient localClient, SessionClient sessionClient) : base(webClient, localClient, sessionClient) { }
/// ----------------------------------------------------------------------------- /// <summary> /// Sends the command to create a new client on the network /// </summary> /// <param name="Client">The instance of the client to be created</param> /// <remarks> /// </remarks> /// <history> /// [Caleb] 6/18/2005 Created /// </history> /// ----------------------------------------------------------------------------- public void Send_Connect(LocalClient Client) { try { Dictionary<string, string> reps = new Dictionary<string, string>(); reps.Add("nickname", Client.nick); reps.Add("hops", "1"); reps.Add("time", "!" + MyCore.Base64.IntToB64(Client.time).Trim()); reps.Add("username", Client.username.Trim()); reps.Add("host", Client.host); reps.Add("servername", MyCore.MyName); reps.Add("modes", Client.modes); reps.Add("realname", Client.realname); MyCore.SendData(MyIRCd.SendCommands["CONNECTSEND"].buildCommand(MyCore.MyName, reps)); //MyCore.SendData(string.Format(MyIRCd.SendCommands["CONNECTSEND"].ToString(), Client.Nick, "1", "!" + MyCore.Base64.IntToB64(Client.Time), Client.Username, Client.Host, MyCore.MyName, Client.Modes, Client.Realname)); } catch (Exception ex) { MyCore.SendLogMessage("Commands", "Send_Nick", BlackLight.Services.Error.Errors.ERROR, "Problem", "", ex.Message, ex.StackTrace); } }
// heitetään factoryltä tulevat clientit basemapperille public AssemblyMapper(WebClient webClient, LocalClient localClient, SessionClient sessionClient) : base(webClient, localClient, sessionClient) { }
private void ConnectClientToServerAndCheckState(LocalClient client, LocalServer server) { client.Connect(server.Address); Assert.IsTrue(client.IsConnected); }
public override bool ModLoad() { DataDriver = MyBase.DataDriver; //Load the DB into memory try { if (DataDriver.DBExists("floodserv.db")) { FloodDB = DataDriver.LoadDB("floodserv.db"); if (FloodDB == null) { throw (new Exception("NickServ: Unknown DB Load Error")); // return false; } } else { MakeDB(); } BlackLight.Services.Timers.Timer FSSaveTimer; FSSaveTimer = new BlackLight.Services.Timers.Timer(new TimeSpan(0), new TimeSpan(0, 5, 0), - 1, new Timers.TimedCallBack(TimerSaveDB)); MyBase.timerController.addTimer(FSSaveTimer); MyBase.Core.events.OnFinishedNetBurst += new BlackLight.Services.Core.ServicesCore.ServicesEvents.OnFinishedNetBurstEventHandler(this.OnConnect); } catch (Exception ex) { MyBase.Core.SendLogMessage("FloodServ", "ModLoad", BlackLight.Services.Error.Errors.ERROR, "Exception", "", ex.Message, ex.StackTrace); //show("FloodServ Error " + ex.Message + " " + ex.StackTrace); return false; } mFloodServ = new LocalClient("FloodServ",new MessageCallBack(FloodServCallBack) ,MyBase.Core); ModuleList tModules = new ModuleList(); tModules.Add(MyBase.ModuleManage.Modules["Help"]); MyService = new FloodServService(mFloodServ, MyBase.Core, FloodDB, tModules); mFloodServ.host = "services.com"; mFloodServ.modes = "S"; mFloodServ.realname = "FloodServ"; mFloodServ.time = BlackLight.Services.Converters.Time.GetTS(DateTime.Now); mFloodServ.username = "******"; MyBase.Core.events.onClientConnect += new BlackLight.Services.Core.ServicesCore.ServicesEvents.onClientConnectEventHandler(MyService.OnClientConnect); mFloodServ.Cmds.Add("HELP", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSHelp)); mFloodServ.Cmds.Add("NPWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNPWatch)); mFloodServ.Cmds.Add("NSWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNSWatch)); mFloodServ.Cmds.Add("REGWATCH", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSRegWatch)); mFloodServ.Cmds.Add("NPSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNPScan)); mFloodServ.Cmds.Add("NSSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSNSScan)); mFloodServ.Cmds.Add("REGSCAN", new BlackLight.Services.Nodes.CommandCallBack( MyService.FSRegScan)); MyBase.Core.LocalClients.AddClient(mFloodServ); return true; }
public override bool ModLoad() { DataDriver = MyBase.DataDriver; //Load the DB into memory try { if (DataDriver.DBExists("nickserv.db")) { NickDB = DataDriver.LoadDB("nickserv.db"); if (NickDB == null) { throw (new Exception("NickServ: Unknown DB Load Error")); // return false; } } else { MakeDB(); } BlackLight.Services.Timers.Timer NSSaveTimer; NSSaveTimer = new BlackLight.Services.Timers.Timer(new TimeSpan(0), new TimeSpan(0, 5, 0), - 1, new Timers.TimedCallBack( TimerSaveDB)); MyBase.timerController.addTimer(NSSaveTimer); MyBase.Core.events.OnFinishedNetBurst += new BlackLight.Services.Core.ServicesCore.ServicesEvents.OnFinishedNetBurstEventHandler(this.OnConnect); } catch (Exception ex) { MyBase.Core.SendLogMessage("Nick", "ModLoad", BlackLight.Services.Error.Errors.ERROR, "Exception", "", ex.Message, ex.StackTrace); //show("NickServ Error " + ex.Message + " " + ex.StackTrace); return false; } mNickServ = new LocalClient("NickServ", new MessageCallBack(NickServCallBack), MyBase.Core); ModuleList tModules = new ModuleList(); tModules.Add(MyBase.ModuleManage.Modules["Help"]); MyService = new NickServService(mNickServ, MyBase.Core, NickDB, tModules); mNickServ.host = "services.com"; mNickServ.modes = "S"; mNickServ.realname = "NickyServ"; mNickServ.time = BlackLight.Services.Converters.Time.GetTS(DateTime.Now); mNickServ.username = "******"; // Client mNickServ.Cmds.Add("REGISTER", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSRegister)); // Client mNickServ.Cmds.Add("IDENTIFY", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSIdentify)); // Client mNickServ.Cmds.Add("GROUP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGroup)); // Client mNickServ.Cmds.Add("GLIST", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGList)); // Client/Oper mNickServ.Cmds.Add("DROP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSDrop)); // Client mNickServ.Cmds.Add("GHOST", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSGhost)); mNickServ.Cmds.Add("HELP", new BlackLight.Services.Nodes.CommandCallBack( MyService.NSHelp)); // Client/Open - (oper gets more) // bNickServ.Cmds.Add("INFO", AddressOf MyService.NullFunction) // Client // bNickServ.Cmds.Add("LOGOUT", AddressOf MyService.NullFunction) // Client // bNickServ.Cmds.Add("RECOVER", AddressOf MyService.NullFunction) // Client // bNickServ.Cmds.Add("RELEASE", AddressOf MyService.NullFunction) // Client // bNickServ.Cmds.Add("AJOIN", AddressOf MyService.NullFunction) // Client / Oper // bNickServ.Cmds.Add("ACCESS", AddressOf MyService.NullFunction) // Client / Oper // bNickServ.Cmds.Add("ALIST", AddressOf MyService.NullFunction) // Client // bNickServ.Cmds.Add("STATUS", AddressOf MyService.NullFunction) // Client/Oper // bNickServ.Cmds.Add("SET", AddressOf MyService.NullFunction) // Oper // bNickServ.Cmds.Add("FIND", AddressOf MyService.NullFunction) // Oper // bNickServ.Cmds.Add("FORBID", AddressOf MyService.NullFunction) // Oper // bNickServ.Cmds.Add("UNFORBID", AddressOf MyService.NullFunction) // Oper // bNickServ.Cmds.Add("SUSPEND", AddressOf MyService.NullFunction) // Oper // bNickServ.Cmds.Add("UNSUSPEND", AddressOf MyService.NullFunction) // Oper - de oper/dc // bNickServ.Cmds.Add("NOOP", AddressOf MyService.NullFunction) // Oper //bNickServ.Cmds.Add("UNIDENTIFY", AddressOf MyService.NullFunction) MyBase.Core.LocalClients.AddClient(mNickServ); return true; }
public ListenWorker(LocalClient localClient, PeerWorker peerWorker) : base("ListenWorker", initialNotify: true, minIdleTime: TimeSpan.Zero, maxIdleTime: TimeSpan.Zero) { this.localClient = localClient; this.peerWorker = peerWorker; }
public FloodServService(LocalClient tMyClient, ServicesCore tMyCore, DataBase tFloodDB, ModuleList Modules) { this.MyClient = tMyClient; this.MyCore = tMyCore; this.FloodDB = tFloodDB; this.Modules = Modules; Help = ((Help.Help) this.Modules["Help"]); m_NPWatches = new ArrayList(); m_NSWatches = new ArrayList(); m_RegWatches = new ArrayList(); m_Recent = new ServiceList(); updateWatchList(0); updateWatchList(1); updateWatchList(2); }
public void sendResponse(string Service, LocalClient ServiceClient, Client Source, string message, params string[] Params) { if (message != null&& message.Length > 0) { if (HelpResponses[Service].Errors.Contains(message)) { foreach (string tString in HelpResponses[Service].Errors[message]) { ServiceClient.Send_Notice(Source.nick, string.Format(tString, Params)); } } else { ServiceClient.Send_Notice(Source.nick, "Information missing for: " + message); } } }