Esempio n. 1
0
        private void ServerThread(object data)
        {
            var pipeServer = new NamedPipeServerStream("LegendaryClientPipe@191537514598135486vneaoifJidafd", PipeDirection.InOut, NumThreads);

            pipeServer.WaitForConnection();
            Client.SendPIPE = new StreamString(pipeServer);
            Client.SendPIPE.WriteString("Logger started. All errors will be logged from now on");
            var assembly = Assembly.GetExecutingAssembly();
            var fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version  = fvi.FileVersion;

            Client.SendPIPE.WriteString("LegendaryClient Version: " + version);

            Client.SendPIPE.WriteString("AwaitStart");


            var output = new NamedPipeClientStream(".",
                                                   "LegendaryClientPipe@191537514598135486vneaoifJidafdOUTPUT",
                                                   PipeDirection.InOut,
                                                   PipeOptions.None,
                                                   TokenImpersonationLevel.Impersonation);

            output.Connect();
            var ss = new StreamString(output);

            Client.InPIPE = ss;
            Started       = true;
            while (Started)
            {
                var x = ss.ReadString();
                if (x.Contains("SendOVERLAY"))
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input,
                                           new ThreadStart(() =>
                    {
                        var mmm         = x.Split('|');
                        var messageOver = new MessageOverlay {
                            MessageTitle = { Content = mmm[1] }, MessageTextBox = { Text = mmm[2] }
                        };
                        if (!x.ToLower().Contains("fullover"))
                        {
                            Client.OverlayContainer.Content    = messageOver.Content;
                            Client.OverlayContainer.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            Client.FullNotificationOverlayContainer.Content    = messageOver.Content;
                            Client.FullNotificationOverlayContainer.Visibility = Visibility.Visible;
                        }
                        Client.SendPIPE.WriteString("Overlay received!");
                    }));
                }
                else if (x == "Server_STOPPED")
                {
                    Started = false;
                }
            }
        }
        private void ServerThread(object data)
        {
            var pipeServer = new NamedPipeServerStream("LegendaryClientPipe@191537514598135486vneaoifJidafd", PipeDirection.InOut, NumThreads);
            pipeServer.WaitForConnection();
            Client.SendPIPE = new StreamString(pipeServer);
            Client.SendPIPE.WriteString("Logger started. All errors will be logged from now on");
            var assembly = Assembly.GetExecutingAssembly();
            var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version = fvi.FileVersion;
            Client.SendPIPE.WriteString("LegendaryClient Version: " + version);

            Client.SendPIPE.WriteString("AwaitStart");


            var output = new NamedPipeClientStream(".",
                "LegendaryClientPipe@191537514598135486vneaoifJidafdOUTPUT",
                PipeDirection.InOut,
                PipeOptions.None,
                TokenImpersonationLevel.Impersonation);
            output.Connect();
            var ss = new StreamString(output);
            Client.InPIPE = ss;
            Started = true;
            while (Started)
            {
                var x = ss.ReadString();
                if (x.Contains("SendOVERLAY"))
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input,
                        new ThreadStart(() =>
                        {
                            var mmm = x.Split('|');
                            var messageOver = new MessageOverlay {MessageTitle = {Content = mmm[1]}, MessageTextBox = {Text = mmm[2]}};
                            if (!x.ToLower().Contains("fullover"))
                            {
                                Client.OverlayContainer.Content = messageOver.Content;
                                Client.OverlayContainer.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                Client.FullNotificationOverlayContainer.Content = messageOver.Content;
                                Client.FullNotificationOverlayContainer.Visibility = Visibility.Visible;
                            }
                            Client.SendPIPE.WriteString("Overlay received!");
                        }));
                }
                else if (x == "Server_STOPPED")
                {
                    Started = false;
                }
            }
        }
Esempio n. 3
0
        private void ServerThread(object data)
        {
            NamedPipeServerStream pipeServer =
                new NamedPipeServerStream("LegendaryClientPipe@191537514598135486vneaoifjidafd", PipeDirection.InOut, numThreads);
            int threadId = Thread.CurrentThread.ManagedThreadId;

            pipeServer.WaitForConnection();
            try
            {
                Client.SendPIPE = new StreamString(pipeServer);
                Client.SendPIPE.WriteString("Logger started. All errors will be logged from now on");
                Assembly        assembly = Assembly.GetExecutingAssembly();
                FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
                string          version  = fvi.FileVersion;
                Client.SendPIPE.WriteString("LegendaryClient Version: " + version);

                Client.SendPIPE.WriteString("AwaitStart");


                NamedPipeClientStream output = new NamedPipeClientStream(".", "LegendaryClientPipe@191537514598135486vneaoifjidafdOUTPUT", PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.Impersonation);
                output.Connect();
                StreamString ss = new StreamString(output);
                Client.InPIPE = ss;
                started       = true;
                while (started)
                {
                    string x = ss.ReadString();
                    if (x.Contains("SendOVERLAY"))
                    {
                        try
                        {
                            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                            {
                                string[] mmm    = x.Split('|');
                                var messageOver = new MessageOverlay {
                                    MessageTitle = { Content = mmm[1] }, MessageTextBox = { Text = mmm[2] }
                                };
                                if (!x.ToLower().Contains("fullover"))
                                {
                                    Client.OverlayContainer.Content    = messageOver.Content;
                                    Client.OverlayContainer.Visibility = Visibility.Visible;
                                }
                                else
                                {
                                    Client.FullNotificationOverlayContainer.Content    = messageOver.Content;
                                    Client.FullNotificationOverlayContainer.Visibility = Visibility.Visible;
                                }
                                Client.SendPIPE.WriteString("Overlay received!");
                            }));
                        }
                        catch
                        {
                            Client.SendPIPE.WriteString("Unable to show the overlay :(");
                        }
                    }
                    else if (x == "Server_STOPPED")
                    {
                        started = false;
                    }
                }
            }
            catch (IOException e)
            {
                Client.Log(e.Message, "IOException");
                Client.Log(e.StackTrace, "IOException");
                Client.Log(e.Source, "IOException");
            }
        }