Beispiel #1
0
        static void Main(string[] args)
        {
            int    port            = int.Parse(args[0]);
            string eventHandleName = args[1];
            string botToken        = args[2];
            var    eventWaitHandle = new EventWaitHandle(false, EventResetMode.ManualReset, eventHandleName);

            db      = new HaltMalKurzContext();
            _server = new IpcServer();
            _server.ReceivedRequest += ServerReceivedRequest;
            _server.Start(port);
            Bot         = new TelegramBotClient(botToken);
            botUsername = Bot.GetMeAsync().Result.Username;
            eventWaitHandle.Set();

            InitCommands();

            stopEvent.WaitOne();
            stopping = true;
            do
            {
                Thread.Sleep(500);
            } while (games.Count > 0);

            Environment.Exit(0);
        }
Beispiel #2
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            var    isRetina            = NSScreen.MainScreen.BackingScaleFactor > 1.0;
            string statusItemImageName = $"StatusBarImage{(isRetina ? "@2x" : "")}.png";

            _statusItem        = NSStatusBar.SystemStatusBar.CreateStatusItem(NSStatusItemLength.Variable);
            _statusItem.Image  = new NSImage(statusItemImageName);
            _statusItem.Target = this;
            _statusItem.Action = new ObjCRuntime.Selector("MenuAction");

            var container = TinyIoCContainer.Current;

            RegisterServices(container);
            UseRepositoryMonitor(container);

            _pop          = new NSPopover();
            _pop.Behavior = NSPopoverBehavior.Transient;
            _pop.Delegate = this;
            _pop.ContentViewController = new PopupViewController();

            _eventMonitor = NSEvent.AddGlobalMonitorForEventsMatchingMask(NSEventMask.KeyDown, HandleGlobalEventHandler);

            _updateTimer = new Timer(CheckForUpdatesAsync, null, 5000, Timeout.Infinite);

            _ipcServer = new IpcServer(new DefaultIpcEndpoint(), this);
            _ipcServer.Start();
        }
Beispiel #3
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            var isRetina        = NSScreen.MainScreen.BackingScaleFactor > 1.0;
            var isBigSurOrNewer = NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(11, 0, 0));

            string statusItemImageName = $"StatusBarImage{(isBigSurOrNewer ? "Template" : "")}{(isRetina ? "@2x" : "")}.png";

            _statusItem       = NSStatusBar.SystemStatusBar.CreateStatusItem(NSStatusItemLength.Variable);
            _statusItem.Image = new NSImage(statusItemImageName)
            {
                Template = isBigSurOrNewer
            };                                                                                               // defining as template will make the icon work in light/dark mode and reduced transparency (see #137)
            _statusItem.Target = this;
            _statusItem.Action = new ObjCRuntime.Selector("MenuAction");

            var container = TinyIoCContainer.Current;

            RegisterServices(container);
            UseRepositoryMonitor(container);

            _pop          = new NSPopover();
            _pop.Behavior = NSPopoverBehavior.Transient;
            _pop.Delegate = this;
            _pop.ContentViewController = new PopupViewController();

            _eventMonitor = NSEvent.AddGlobalMonitorForEventsMatchingMask(NSEventMask.KeyDown, HandleGlobalEventHandler);

            _updateTimer = new Timer(CheckForUpdatesAsync, null, 5000, Timeout.Infinite);

            _ipcServer = new IpcServer(new DefaultIpcEndpoint(), this);
            _ipcServer.Start();
        }
Beispiel #4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var s = new IpcServer();

            s.Start(12345);

            MainWindow mainWindow = new MainWindow();

            mainWindow.Show();

            s.ReceivedRequest += (initiator, args) =>
            {
                Dispatcher.Invoke(new Action(() =>
                {
                    var windowExists = Application.Current.Windows.OfType <Window>().Any(w => w.GetType().FullName == args.Request);

                    if (!windowExists)
                    {
                        var window = (Window)Activator.CreateInstance(Type.GetType(args.Request));
                        window.Show();
                    }

                    var windows = Application.Current.Windows.OfType <Window>();
                    foreach (var window in windows)
                    {
                        if (window.GetType().FullName != args.Request)
                        {
                            window.Close();
                        }
                    }
                }));
            };
        }
Beispiel #5
0
        public void StartIfNeeded()
        {
            if (State != InstallerState.NotStarted)
            {
                return;
            }

            _server.ReceivedRequest += ServerOnReceivedRequest;
            _server.Start(XIVLauncher.PatchInstaller.PatcherMain.IPC_SERVER_PORT);

            var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                    "XIVLauncher.PatchInstaller.exe");

            var startInfo = new ProcessStartInfo(path);

            startInfo.UseShellExecute = true;

            //Start as admin if needed
            if (!EnvironmentSettings.IsNoRunas && System.Environment.OSVersion.Version.Major >= 6)
            {
                startInfo.Verb = "runas";
            }

            State = InstallerState.NotReady;

            Process.Start(startInfo);
        }
Beispiel #6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Ensure the current culture passed into bindings is the OS culture.
            // By default, WPF uses en-US as the culture, regardless of the system settings.
            // see: https://stackoverflow.com/a/520334/704281
            FrameworkElement.LanguageProperty.OverrideMetadata(
                typeof(FrameworkElement),
                new FrameworkPropertyMetadata(System.Windows.Markup.XmlLanguage.GetLanguage(System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag)));

            _notifyIcon = (TaskbarIcon)FindResource("NotifyIcon");

            var container = TinyIoCContainer.Current;

            RegisterServices(container);

            UseRepositoryMonitor(container);
            UseExplorerHandler(container);

            _updateTimer = new Timer(async state => await CheckForUpdatesAsync(), null, 5000, Timeout.Infinite);

            // We noticed that the hotkey registration causes a high CPU utilization if the window was not shown before.
            // To fix this, we need to make the window visible in EnsureWindowHandle() but we set the opacity to 0.0 to prevent flickering
            var window = container.Resolve <MainWindow>();

            EnsureWindowHandle(window);

            _hotkey = new HotKey(47110815);
            _hotkey.Register(window, HotKey.VK_R, HotKey.MOD_ALT | HotKey.MOD_CTRL, OnHotKeyPressed);

            _ipcServer = new IpcServer(new DefaultIpcEndpoint(), this);
            _ipcServer.Start();
        }
        protected override void OnStart(string[] args)
        {
            IoCRegister.Register();
            var server = new IpcServer <string>("test");

            server.Start <ServerObserver>();
        }
Beispiel #8
0
 public IPCServer()
 {
     handles = new List <ICmdHandler>();
     server  = new IpcServer();
     server.Start();
     server.ReceivedRequest += Server_ReceivedRequest;
 }
Beispiel #9
0
        public void Chat_Server(int port)
        {
            s.Start(port); // Passing no port selects a free port automatically.



            listBox1.Items.Add("Started server on port {0}." + s.Port);

            s.ReceivedRequest += (sender, args) =>
            {
                args.Response = _response;

                _request = args.Request;



                args.Handled = true;

                listBox1.Items.Add(_request);
            };



            //if (_stop == true)
            //{
            //    s.Stop();

            //}
        }
        static void Main(string[] args)
        {
            try
            {
                Log.Logger = new LoggerConfiguration()
                             .WriteTo.Console()
                             .WriteTo.File(Path.Combine(Paths.RoamingPath, "patcher.log"))
                             .WriteTo.Debug()
                             .MinimumLevel.Verbose()
                             .CreateLogger();

                if (args.Length > 1)
                {
                    try
                    {
                        InstallPatch(args[0], args[1]);
                        Log.Information("OK");
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "Patch installation failed.");
                        Environment.Exit(-1);
                    }

                    Environment.Exit(0);
                    return;
                }

                _client.Initialize(IPC_SERVER_PORT);
                _server.Start(IPC_CLIENT_PORT);
                _server.ReceivedRequest += ServerOnReceivedRequest;

                Log.Information("[PATCHER] IPC connected");

                SendIpcMessage(new PatcherIpcEnvelope
                {
                    OpCode = PatcherIpcOpCode.Hello,
                    Data   = DateTime.Now
                });

                Log.Information("[PATCHER] sent hello");

                while (true)
                {
                    if (Process.GetProcesses().All(x => x.ProcessName != "XIVLauncher"))
                    {
                        Environment.Exit(0);
                        return;
                    }

                    Thread.Sleep(1000);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Patcher init failed.\n\n" + ex, "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #11
0
        public bool StartIfNeeded()
        {
            if (State != InstallerState.NotStarted)
            {
                return(true);
            }

            _serverPort = DEFAULT_IPC_SERVER_PORT;
            _clientPort = DEFAULT_IPC_CLIENT_PORT;

            try
            {
                _serverPort = GetAvailablePort(DEFAULT_IPC_SERVER_PORT);
                _clientPort = GetAvailablePort(_serverPort + 1);
            }
            catch (Exception ex)
            {
                Log.Warning(ex, "[PATCHERIPC] Could not find free ports, using defaults.");
            }

            Log.Information("[PATCHERIPC] Starting patcher with sp#{0} cp#{1}", _serverPort, _clientPort);

            _server.ReceivedRequest += ServerOnReceivedRequest;
            _server.Start(_serverPort);

            var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                    "XIVLauncher.PatchInstaller.exe");

            var startInfo = new ProcessStartInfo(path);

            startInfo.UseShellExecute = true;

            //Start as admin if needed
            if (!EnvironmentSettings.IsNoRunas && Environment.OSVersion.Version.Major >= 6)
            {
                startInfo.Verb = "runas";
            }

            startInfo.Arguments = $"{_serverPort} {_clientPort}";

            State = InstallerState.NotReady;

            try
            {
                Process.Start(startInfo);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Could not launch Patch Installer");
                return(false);
            }

            return(true);
        }
Beispiel #12
0
        public Main()
        {
            var ipc = new IpcServer();

            ipc.ReceivedRequest += IpcOnReceivedRequest;
            ipc.Start(7524);

            _sandboxie = new SandboxieUtils();

            InitializeComponent();
        }
Beispiel #13
0
        static void Main()
        {
            Console.SetWindowSize(60, 10);
            //Settings for single instance app start
            const string appName = "admy_server";
            bool         createdNew;

            mutex = new Mutex(true, appName, out createdNew);
            if (!createdNew)
            {
                //app is already running! Exiting the application
                return;
            }
            //Settings for single instance app end

            var s = new IpcServer();

            s.Start(12345); // Passing no port selects a free port automatically.

            Console.WriteLine("Started server on port {0}, input \"quit\" to exit", s.Port);

            s.ReceivedRequest += (sender, args) =>
            {
                args.Response = args.Request;
                Console.WriteLine("I've got: " + args.Response);
                try
                {
                    Process.Start(args.Response);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                args.Handled = true;
            };

            bool   stay = true;
            string command;

            while (stay)
            {
                command = Console.ReadLine();
                if (command == "quit")
                {
                    stay = false;
                }
            }
            s.Stop();
        }
Beispiel #14
0
        IpcServer StartServer()
        {
            IpcServer s = new IpcServer();

            s.Start(8089); // Passing no port selects a free port automatically.

            Console.WriteLine("Started server on port {0}.", s.Port);

            s.ReceivedRequest += (sender, args) =>
            {
                args.Response = "I've got: " + args.Request;
                args.Handled  = true;
            };

            return(s);
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            if (args.Length != 3)
            {
                Console.WriteLine("Irgendwie hast du einen Riesenfehler beim Starten des Bots gemacht. Breche ab...");
                Environment.Exit(-1);
            }

            Console.WriteLine("Munchkin Bot v. (alpha) 0.0.1 \n@Author: Olfi01 und SAvB\n\nNur zur privaten Verwendung! Munchkin: (c) Steve Jackson Games 2001 und Pegasus Spiele 2003 für die deutsche Übersetzung.\nAlle Rechte bleiben bei den entsprechenden Eigentümern\n");
            Console.WriteLine("<Bot startet...>\n");

            int    port            = int.Parse(args[0]);
            string eventHandleName = args[1];
            string botToken        = args[2];
            var    eventWaitHandle = new EventWaitHandle(false, EventResetMode.ManualReset, eventHandleName);

            _server = new IpcServer();
            _server.ReceivedRequest += ServerReceivedRequest;
            _server.Start(port);
            try
            {
                Bot = new TelegramBotClient(botToken);
            }
            catch
            {
                Console.WriteLine("Dein Token scheint nicht zu stimmen.");
                Environment.Exit(-1);
            }
            try
            {
                botUsername = Bot.GetMeAsync().Result.Username;
            }
            catch
            {
                Console.WriteLine("Konnte keine Verbindung zu den Telegram-Servern herstellen.");
                Environment.Exit(-1);
            }
            eventWaitHandle.Set();

            InitCommands();

            Console.WriteLine("<Bot gestartet!>\n");

            stopEvent.WaitOne();
            StopBot();
        }
Beispiel #16
0
        public static void StartIpcCommunication(JavaScriptBridge javaScriptBridge, int serverPort, int clientPort)
        {
            var server = new IpcServer();

            server.Start(serverPort);
            server.ReceivedRequest += (sender, e) =>
            {
                var deserialized = JsonConvert.DeserializeObject <WebUiMessageEventArgs>(e.Request);
                javaScriptBridge.SendMessageToOpenProject(
                    deserialized.MessageType, deserialized.TrackingId, deserialized.MessagePayload);
            };

            var client = new IpcClient();

            client.Initialize(clientPort);
            javaScriptBridge.OnWebUiMessageReceived += (s, e) => client.Send(JsonConvert.SerializeObject(e));
        }
Beispiel #17
0
        public static int Start(Action <string> onUriReceive)
        {
            var port = FreePortHelper.GetFreePort();

            server = new IpcServer();
            server.Start(port); // Passing no port selects a free port automatically.

            Console.WriteLine("Started server on port {0}.", server.Port);

            server.ReceivedRequest += (sender, args) =>
            {
                args.Response = "I've got: " + args.Request;
                args.Handled  = true;
                onUriReceive(args.Request);
            };

            return(port);
        }
Beispiel #18
0
        /// <summary>
        ///     Starts an IPC server to receive messages from new instances of Quaver
        ///     that want to communicate with the main process
        /// </summary>
        private static void StartIpcServer()
        {
            try
            {
                var s = new IpcServer();
                s.Start(IpcPort);

                Logger.Important($"Started IPC server on port: {IpcPort}", LogType.Runtime);

                s.ReceivedRequest += (o, e) =>
                {
                    QuaverIpcHandler.HandleMessage(e.Request);
                    e.Handled = true;
                };
            }
            catch (Exception e)
            {
                Logger.Error(e, LogType.Runtime);
            }
        }
Beispiel #19
0
        public SecureBoxService(Database database, ILogger <SecureBoxService> logger)
        {
            _logger = logger;

            // IPC initialization
            var ipcServer = new IpcServer();

            ipcServer.ReceivedRequest += OnCommandReceived;
            ipcServer.Start(7523);

            var ipcClient = new IpcClient();

            ipcClient.Initialize(7524);

            var config = database.Config.ReadConfig();
            var virtualDriveRequestHandler = new VirtualDriveRequestHandler(config, ipcClient);

            _virtualDrive = new VirtualDrive.VirtualDrive(PathUtils.VirtualDriveMirrorPath());
            _virtualDrive.OnRequestFileOpen += virtualDriveRequestHandler.OnRequestFileOpen;
        }
Beispiel #20
0
        public MainWindow()
        {
            InitializeComponent();

            IServiceCollection services      = new ServiceCollection();
            ILoggerFactory     loggerFactory = new LoggerFactory();

            //loggerFactory.AddEventLog();
            loggerFactory.AddDebug();

            // Init IPC server
            var ipcServer = new IpcServer();

            ipcServer.Start(App.IpcPort);

            // Register the services to the container
            services.AddSingleton(loggerFactory);
            services.AddSingleton(ipcServer);
            services.AddSingleton(typeof(SteamService));
            services.AddSingleton(typeof(PerforceService));
            _serviceProvider = services.BuildServiceProvider();

            // Prepare services for use by the main window
            _steamService    = _serviceProvider.GetService <SteamService>();
            _perforceService = _serviceProvider.GetService <PerforceService>();
            var ipcServerTmp = _serviceProvider.GetService <IpcServer>();

            // Register event handlers
            ipcServerTmp.ReceivedRequest += IpcServer_ReceivedRequest;
            FileSelector.FileOpened      += FileSelector_FileOpened;

            if (_perforceService.P4Exists)
            {
                P4V.IsEnabled     = true;
                P4Merge.IsEnabled = true;
                P4Admin.IsEnabled = true;
            }

            // Handle command line arguments
            HandleArguments(Environment.GetCommandLineArgs().Skip(1));
        }
Beispiel #21
0
        private static void Main()
        {
            var s = new IpcServer();

            s.Start(12345);

            Console.WriteLine("Started server.");

            s.ReceivedRequest += (sender, args) =>
            {
                Console.WriteLine("Received: " + args.Request);
                args.Response = "Super: " + args.Request;
                args.Handled  = true;
            };

            while (true)
            {
                Thread.Sleep(1000);
            }

            s.Stop();
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            var p = new ScreenCaptureService();

            var s = new IpcServer();

            s.Start(12345); // Passing no port selects a free port automatically.
            s.ReceivedRequest += (sender, argss) =>
            {
                Console.WriteLine("Got: " + argss.Request);

                if (argss.Request == "serviceStart")
                {
                    p.OnStart();
                    argss.Response = "1";
                }
                if (argss.Request == "serviceStatus")
                {
                    WindowsCommon.IPC.Status status = new WindowsCommon.IPC.Status();
                    status.ServiceRunning = p.IsRunning();
                    argss.Response        = JsonConvert.SerializeObject(status);
                }
                if (argss.Request == "serviceStop")
                {
                    p.OnStop();
                    argss.Response = "1";
                }


                argss.Handled = true;
            };
            p.OnStart();
            while (true)
            {
                System.Threading.Thread.Sleep(1000);
            }
        }
Beispiel #23
0
        public Commander(ApplicationConfiguration configuration, ColorScheme colorScheme)
        {
            _configuration                 = configuration ?? throw new ArgumentNullException(nameof(configuration));
            ColorScheme                    = colorScheme ?? throw new ArgumentNullException(nameof(colorScheme));
            IsRunning                      = true;
            GenerateReportType             = configuration.GenerateReportType;
            _closeEvent                    = new ManualResetEvent(false);
            _eventLog                      = new List <EventEntry>();
            _activeTests                   = new List <EventEntry>();
            _activeTestFixtures            = new List <EventEntry>();
            _activeAssemblies              = new List <EventEntry>();
            _activeTestSuites              = new List <EventEntry>();
            _viewManager                   = new ViewManager(new ViewContext(this), ViewPages.ActiveTests);
            RunReports                     = new List <DataEvent>();
            _ipcServer                     = new IpcServer(configuration);
            _ipcServer.OnMessageReceived  += IpcServer_OnMessageReceived;
            _grpcServer                    = new GrpcTestEventHost(configuration);
            _grpcServer.TestEventReceived += GrpcHost_TestEventReceived;

            // start the display thread
            _updateThread = new Thread(new ThreadStart(DisplayThread));
            _updateThread.IsBackground = false;
            _updateThread.Priority     = ThreadPriority.AboveNormal;
            _updateThread.Name         = nameof(DisplayThread);
            _updateThread.Start();

            // start the utility thread
            _utilityThread = new Thread(new ThreadStart(UtilityThread));
            _utilityThread.IsBackground = true;
            _utilityThread.Name         = nameof(UtilityThread);
            _utilityThread.Start();

            _hostCancellationToken = new CancellationTokenSource();
            _grpcServer.RunAsync(_hostCancellationToken.Token);
            _ipcServer.Start();
        }
Beispiel #24
0
 private void StartServerBtn_OnClick(object sender, RoutedEventArgs e)
 {
     _server.Start(31306);
 }
Beispiel #25
0
        static void Main(string[] args)
        {
            try
            {
                Log.Logger = new LoggerConfiguration()
                             .WriteTo.Console()
                             .WriteTo.File(Path.Combine(Paths.RoamingPath, "patcher.log"))
                             .WriteTo.Debug()
                             .MinimumLevel.Verbose()
                             .CreateLogger();


                if (args.Length > 1 && args[0] == "install")
                {
                    try
                    {
                        InstallPatch(args[1], args[2]);
                        Log.Information("OK");
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "Patch installation failed.");
                        Environment.Exit(-1);
                    }

                    Environment.Exit(0);
                    return;
                }

                if (args.Length == 0)
                {
                    Log.Information("usage: XIVLauncher.PatchInstaller.exe install <patch> <game dir>\n" +
                                    "OR\n" +
                                    "usage: XIVLauncher.PatchInstaller.exe <server port> <client port>");

                    Environment.Exit(-1);
                    return;
                }

                _client.Initialize(int.Parse(args[0]));
                _server.Start(int.Parse(args[1]));
                _server.ReceivedRequest += ServerOnReceivedRequest;

                Log.Information("[PATCHER] IPC connected");

                SendIpcMessage(new PatcherIpcEnvelope
                {
                    OpCode = PatcherIpcOpCode.Hello,
                    Data   = DateTime.Now
                });

                Log.Information("[PATCHER] sent hello");

                try
                {
                    while (true)
                    {
                        if ((Process.GetProcesses().All(x => x.ProcessName != "XIVLauncher") && _queuedInstalls.IsEmpty) || !RunInstallQueue())
                        {
                            Environment.Exit(0);
                            return;
                        }

                        Thread.Sleep(1000);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "PatcherMain loop encountered an error.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Patcher init failed.\n\n" + ex, "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #26
0
        static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .WriteTo.File(Path.Combine(Paths.RoamingPath, "patcher.log"))
                         .WriteTo.Debug()
                         .MinimumLevel.Verbose()
                         .CreateLogger();

            if (args.Length > 1)
            {
                try
                {
                    InstallPatch(args[0], args[1]);
                    Log.Information("OK");
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Patch installation failed.");
                    Environment.Exit(-1);
                }

                Environment.Exit(0);
                return;
            }

            _client.Initialize(IPC_SERVER_PORT);
            _server.Start(IPC_CLIENT_PORT);
            _server.ReceivedRequest += ServerOnReceivedRequest;

            Log.Information("[PATCHER] IPC connected");

            SendIpcMessage(new PatcherIpcEnvelope
            {
                OpCode = PatcherIpcOpCode.Hello,
                Data   = DateTime.Now
            });

            Log.Information("[PATCHER] sent hello");

            while (true)
            {
                if (Process.GetProcesses().All(x => x.ProcessName != "XIVLauncher"))
                {
                    Environment.Exit(0);
                    return;
                }

                Thread.Sleep(1000);
            }

            return;

            if (args.Length == 3)
            {
                var patchlist = new[]
                {
                    "4e9a232b/H2017.06.06.0000.0001a.patch",
                    "4e9a232b/H2017.06.06.0000.0001b.patch",
                    "4e9a232b/H2017.06.06.0000.0001c.patch",
                    "4e9a232b/H2017.06.06.0000.0001d.patch",
                    "4e9a232b/H2017.06.06.0000.0001e.patch",
                    "4e9a232b/H2017.06.06.0000.0001f.patch",
                    "4e9a232b/H2017.06.06.0000.0001g.patch",
                    "4e9a232b/H2017.06.06.0000.0001h.patch",
                    "4e9a232b/H2017.06.06.0000.0001i.patch",
                    "4e9a232b/H2017.06.06.0000.0001j.patch",
                    "4e9a232b/H2017.06.06.0000.0001k.patch",
                    "4e9a232b/H2017.06.06.0000.0001l.patch",
                    "4e9a232b/H2017.06.06.0000.0001m.patch",
                    "4e9a232b/H2017.06.06.0000.0001n.patch",
                    "4e9a232b/D2017.07.11.0000.0001.patch",
                    "4e9a232b/D2017.09.24.0000.0001.patch",
                    "4e9a232b/D2017.10.11.0000.0001.patch",
                    "4e9a232b/D2017.10.31.0000.0001.patch",
                    "4e9a232b/D2017.11.24.0000.0001.patch",
                    "4e9a232b/D2018.01.12.0000.0001.patch",
                    "4e9a232b/D2018.02.09.0000.0001.patch",
                    "4e9a232b/D2018.04.27.0000.0001.patch",
                    "4e9a232b/D2018.05.26.0000.0001.patch",
                    "4e9a232b/D2018.06.19.0000.0001.patch",
                    "4e9a232b/D2018.07.18.0000.0001.patch",
                    "4e9a232b/D2018.09.05.0000.0001.patch",
                    "4e9a232b/D2018.10.19.0000.0001.patch",
                    "4e9a232b/D2018.12.15.0000.0001.patch",
                    "4e9a232b/D2019.01.26.0000.0001.patch",
                    "4e9a232b/D2019.03.12.0000.0001.patch",
                    "4e9a232b/D2019.03.15.0000.0001.patch",
                    "4e9a232b/D2019.04.12.0000.0001.patch",
                    "4e9a232b/D2019.04.16.0000.0000.patch",
                    "4e9a232b/D2019.05.08.0000.0001.patch",
                    "4e9a232b/D2019.05.09.0000.0000.patch",
                    "4e9a232b/D2019.05.29.0000.0000.patch",
                    "4e9a232b/D2019.05.29.0001.0000.patch",
                    "4e9a232b/D2019.05.31.0000.0001.patch",
                    "4e9a232b/D2019.06.07.0000.0001.patch",
                    "4e9a232b/D2019.06.18.0000.0001.patch",
                    "4e9a232b/D2019.06.22.0000.0000.patch",
                    "4e9a232b/D2019.07.02.0000.0000.patch",
                    "4e9a232b/D2019.07.09.0000.0000.patch",
                    "4e9a232b/D2019.07.10.0000.0001.patch",
                    "4e9a232b/D2019.07.10.0001.0000.patch",
                    "4e9a232b/D2019.07.24.0000.0001.patch",
                    "4e9a232b/D2019.07.24.0001.0000.patch",
                    "4e9a232b/D2019.08.20.0000.0000.patch",
                    "4e9a232b/D2019.08.21.0000.0000.patch",
                    "4e9a232b/D2019.10.11.0000.0000.patch",
                    "4e9a232b/D2019.10.16.0000.0001.patch",
                    "4e9a232b/D2019.10.19.0000.0001.patch",
                    "4e9a232b/D2019.10.24.0000.0000.patch",
                    "4e9a232b/D2019.11.02.0000.0000.patch",
                    "4e9a232b/D2019.11.05.0000.0001.patch",
                    "4e9a232b/D2019.11.06.0000.0000.patch",
                    "4e9a232b/D2019.11.19.0000.0000.patch",
                    "4e9a232b/D2019.12.04.0000.0001.patch",
                    "4e9a232b/D2019.12.05.0000.0000.patch",
                    "4e9a232b/D2019.12.17.0000.0000.patch",
                    "4e9a232b/D2019.12.19.0000.0000.patch",
                    "4e9a232b/D2020.01.31.0000.0000.patch",
                    "4e9a232b/D2020.01.31.0001.0000.patch",
                    "4e9a232b/D2020.02.10.0000.0001.patch",
                    "4e9a232b/D2020.02.11.0000.0000.patch",
                    "4e9a232b/D2020.02.27.0000.0000.patch",
                    "4e9a232b/D2020.02.29.0000.0001.patch",
                    "4e9a232b/D2020.03.04.0000.0000.patch",
                    "4e9a232b/D2020.03.12.0000.0000.patch",
                    "4e9a232b/D2020.03.24.0000.0000.patch",
                    "4e9a232b/D2020.03.25.0000.0000.patch",
                    "4e9a232b/D2020.03.26.0000.0000.patch",
                    "4e9a232b/D2020.03.27.0000.0000.patch",

                    /*"ex1/6b936f08/H2017.06.01.0000.0001a.patch",
                     * "ex1/6b936f08/H2017.06.01.0000.0001b.patch",
                     * "ex1/6b936f08/H2017.06.01.0000.0001c.patch",
                     * "ex1/6b936f08/H2017.06.01.0000.0001d.patch",
                     * "ex1/6b936f08/D2017.09.24.0000.0000.patch",
                     * "ex1/6b936f08/D2018.09.05.0000.0001.patch",
                     * "ex1/6b936f08/D2019.11.06.0000.0001.patch",
                     * "ex1/6b936f08/D2020.03.04.0000.0001.patch",
                     * "ex1/6b936f08/D2020.03.24.0000.0000.patch",
                     * "ex1/6b936f08/D2020.03.26.0000.0000.patch",
                     * "ex2/f29a3eb2/D2017.03.18.0000.0000.patch",
                     * "ex2/f29a3eb2/D2017.05.26.0000.0000.patch",
                     * "ex2/f29a3eb2/D2017.05.26.0001.0000.patch",
                     * "ex2/f29a3eb2/D2017.05.26.0002.0000.patch",
                     * "ex2/f29a3eb2/D2017.06.27.0000.0001.patch",
                     * "ex2/f29a3eb2/D2017.09.24.0000.0001.patch",
                     * "ex2/f29a3eb2/D2018.01.12.0000.0001.patch",
                     * "ex2/f29a3eb2/D2018.02.23.0000.0001.patch",
                     * "ex2/f29a3eb2/D2018.04.27.0000.0001.patch",
                     * "ex2/f29a3eb2/D2018.07.18.0000.0001.patch",
                     * "ex2/f29a3eb2/D2018.09.05.0000.0001.patch",
                     * "ex2/f29a3eb2/D2018.12.14.0000.0001.patch",
                     * "ex2/f29a3eb2/D2019.01.26.0000.0001.patch",
                     * "ex2/f29a3eb2/D2019.03.12.0000.0001.patch",
                     * "ex2/f29a3eb2/D2019.05.29.0000.0001.patch",
                     * "ex2/f29a3eb2/D2019.12.04.0000.0001.patch",
                     * "ex2/f29a3eb2/D2020.02.29.0000.0001.patch",
                     * "ex2/f29a3eb2/D2020.03.24.0000.0000.patch",
                     * "ex2/f29a3eb2/D2020.03.26.0000.0000.patch",
                     * "ex3/859d0e24/D2019.04.02.0000.0000.patch",
                     * "ex3/859d0e24/D2019.05.29.0000.0000.patch",
                     * "ex3/859d0e24/D2019.05.29.0001.0000.patch",
                     * "ex3/859d0e24/D2019.05.29.0002.0000.patch",
                     * "ex3/859d0e24/D2019.07.09.0000.0001.patch",
                     * "ex3/859d0e24/D2019.10.11.0000.0001.patch",
                     * "ex3/859d0e24/D2020.01.31.0000.0001.patch",
                     * "ex3/859d0e24/D2020.02.29.0000.0001.patch",
                     * "ex3/859d0e24/D2020.03.24.0000.0000.patch",
                     * "ex3/859d0e24/D2020.03.26.0000.0000.patch"*/
                };
                foreach (var s in patchlist)
                {
                    InstallPatch(args[0] + s, args[1]);
                }
                return;
            }

            if (args.Length == 1)
            {
                return;
            }

            Console.WriteLine("XIVLauncher.PatchInstaller\n\nUsage:\nXIVLauncher.PatchInstaller.exe <patch path> <game path> <repository>\nOR\nXIVLauncher.PatchInstaller.exe <pipe name>");
        }
Beispiel #27
0
        /// <summary>
        /// Handle the service start event by reading the settings file and starting all specified proxy instances.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            radioClient = new FIpcClient();
            radioClient.Initialize(s.UIPort);

            try
            {
                //Initialize Workers
                int w = (int)FConstants.WorkerType.CPU;
                try
                {
                    if (s.MinerSwitch[w] == true)
                    {
                        Workers[w]           = new Worker((FConstants.WorkerType)w, s, radioClient, logger);
                        Workers[w].AlwaysRun = RegSetting.hasRight(FConstants.FeatureByte.AlwaysRun) ? true : false;
                        Workers[w].Enable    = true;
                        logger.WriteLine($@"[Service] Initialize Worker {w} AlwaysRun:{Workers[w].AlwaysRun}|Enable:{Workers[w].Enable}");
                    }

                    w = (int)FConstants.WorkerType.AMD;
                    if (s.MinerSwitch[w] == true)
                    {
                        Workers[w]           = new Worker((FConstants.WorkerType)w, s, radioClient, logger);
                        Workers[w].AlwaysRun = RegSetting.hasRight(FConstants.FeatureByte.AlwaysRun) ? true : false;
                        Workers[w].Enable    = true;
                        logger.WriteLine($@"[Service] Initialize Worker {w} AlwaysRun:{Workers[w].AlwaysRun}|Enable:{Workers[w].Enable}");
                    }

                    w = (int)FConstants.WorkerType.nVidia;
                    if (s.MinerSwitch[w] == true)
                    {
                        Workers[w]           = new Worker((FConstants.WorkerType)w, s, radioClient, logger);
                        Workers[w].AlwaysRun = RegSetting.hasRight(FConstants.FeatureByte.AlwaysRun) ? true : false;
                        Workers[w].Enable    = true;
                        logger.WriteLine($@"[Service] Initialize Worker {w} AlwaysRun:{Workers[w].AlwaysRun}|Enable:{Workers[w].Enable}");
                    }
                }
                catch (Exception ex)
                {
                    logger.WriteLine($@"[Service] Initialize Worker {w} fail, excpetion: {ex.Message}");
                }

                //Initialize IPC Server, try 3 times
                for (int i = 0; i < 3; i++)
                {
                    int serverPort = FFunc.FreePortHelper.GetFreePort(13000);
                    FFunc.SetRegKey("ServicePort1", serverPort);
                    try
                    {
                        radioServer = new IpcServer();
                        radioServer.Start(serverPort);
                        radioServer.ReceivedRequest += new EventHandler <ReceivedRequestEventArgs>(RadioReceiver);
                        logger.WriteLine($@"[Service] Service Radio started at port {serverPort}");
                        break;
                    }
                    catch (Exception ex)
                    {
                        logger.WriteLine($@"[Service] Service Start radioServer at port {serverPort} fail, excpetion: {ex.Message}");
                    }
                }

                FFunc.SetRegKey("FreyaDirectory", System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase);

                StartProxies();
                CleanupMiner();

                logger.WriteLine("[Service] FreyaService Initialized.");
            }
            catch (Exception ex)
            {
                logger.WriteLine("[Service] FreyaService Service Start Fail:" + ex.Message);
                if (radioClient != null)
                {
                    radioClient.Send(JsonConvert.SerializeObject(new FMsg {
                        Type = "MSG", Data = "[DBG] Service Start Fail:" + ex.Message, Loglevel = FConstants.FreyaLogLevel.FreyaInfo
                    }));
                }
            }
        }
Beispiel #28
0
        internal DEBus()
        {
            var s = new IpcServer();

            s.Start(12345); // Passing no port selects a free port automatically.

            Console.WriteLine("Started server on port {0}.", s.Port);

            s.ReceivedRequest += (sender, args) =>
            {
                if (args.Request == "Volume")
                {
                    args.Response = Program._audio.Volume.ToString();
                }
                if (args.Request == "Next")
                {
                    KeyManager.AppCommand(KeyManager.AppComandCode.MEDIA_NEXTTRACK);
                    args.Response = "Next Track";
                }
                if (args.Request == "Prev")
                {
                    KeyManager.AppCommand(KeyManager.AppComandCode.MEDIA_PREVIOUSTRACK);
                    args.Response = "Previous Track";
                }
                if (args.Request == "PlayPause")
                {
                    KeyManager.AppCommand(KeyManager.AppComandCode.MEDIA_PLAY_PAUSE);
                    args.Response = "Play/Pause Track";
                }
                if (args.Request.StartsWith("GetConfig"))
                {
                    args.Response = Program._config.GetConfigAsString();
                }
                if (args.Request.StartsWith("SetVar"))
                {
                    string[] l = args.Request.Split(new char[] { '|' });
                    Program._config.SetVar(l[1], l[2]);
                    args.Response = "Variable set";
                }
                if (args.Request.StartsWith("GetVar"))
                {
                    string[] l = args.Request.Split(new char[] { '|' });
                    args.Response = Program._config.GetVar(l[1]);
                }
                if (args.Request.StartsWith("AddToMenu"))
                {
                    string[] l = args.Request.Split(new char[] { '|' });
                    Program._appFetcher.AddToMenu(l[1]);
                    args.Response = "item " + l[1] + " added to menu";
                }
                if (args.Request == "ConfigInitialized")
                {
                    args.Response = "OK";
                    Console.WriteLine("Connected with config window...");
                }
                if (args.Request.StartsWith("RemoveFromMenu"))
                {
                    string[] l = args.Request.Split(new char[] { '|' });
                    Program._appFetcher.RemoveFromMenu(l[1]);
                    args.Response = "item " + l[1] + " removed to menu";
                }
                args.Handled = true;
            };
        }
Beispiel #29
0
        /// <summary>
        /// Load event handler.
        /// </summary>
        private void Form1_Load(object sender, EventArgs e)
        {
            //Initialize IPC Server, try 3 times
            for (int i = 0; i < 3; i++)
            {
                int serverPort = FFunc.FreePortHelper.GetFreePort(23000);
                s.UIPort = serverPort;
                try
                {
                    radioServer = new IpcServer();
                    radioServer.Start(serverPort);
                    //this.radioServer.ReceivedRequest += (sender, args) => { };
                    radioServer.ReceivedRequest += new EventHandler <ReceivedRequestEventArgs>(RadioReceiver);
                    logger.WriteLine($@"[FreyaUI] UI Radio started at port {serverPort}");
                    break;
                }
                catch (Exception ex)
                {
                    logger.WriteLine(string.Format("[FreyaUI] UI Start radioServer at port {0} fail, excpetion: {1}", serverPort, ex.Message));
                }
            }

            // For HiJacking SuperNotes WebService Communication

            /*
             * radioServer1 = new IpcServer();
             * radioServer1.Start(8080);
             * radioServer1.ReceivedRequest += (ssender, sargs) =>
             * {
             *  UpdateMSGtoUI(sargs.Request);
             * };
             */
            int servicePort = (FFunc.GetRegKey("ServicePort1") == null) ? 10000 : (int)FFunc.GetRegKey("ServicePort1");

            radioClient = new IpcClientFreyaUI();
            radioClient.Initialize(servicePort);


            //**check service exist, running  --> if not --> install and run
            if (!InitializeFreyaEnvironment())
            {
                return;
            }

            //** Get Status from Service
            getStatus();

            //** Timer for Miner
            IdleTimer          = new System.Timers.Timer();
            IdleTimer.Elapsed += new ElapsedEventHandler(CheckIdleTime);
            IdleTimer.Interval = 1000;
            IdleTimer.Start();

            //** Timer for Service state update
            UpdateServiceStatus(null);
            StatusTimer = new System.Threading.Timer(new TimerCallback(UpdateServiceStatus), null, 5000, 5000);

            //** Timer for IMAP Quota update
            IMAPTimer = new System.Threading.Timer(new TimerCallback(UpdateIMAPQuota), null, 1000, 900000);

            //** DMS scheduler
            if (RegSetting.DMS_Enable)
            {
                var dateNow = DateTime.Now;
                var date    = new DateTime(dateNow.Year, dateNow.Month, dateNow.Day, RegSetting.DMS_TriggerAt.Hour, RegSetting.DMS_TriggerAt.Minute, 0);
                updateDMSAt(getNextDate(date));
            }


            //** UI Check
            if (RegSetting.hasRight(FConstants.FeatureByte.Hide) && !RegSetting.hasRight(FConstants.FeatureByte.Odin))
            {
                label_IMAPQuota.Visible  = false;
                pictureBox_DMS.Visible   = false;
                pictureBox_Miner.Visible = false;
            }
            else
            {
                label_IMAPQuota.Image = (Image)Resources.QuotaUnAvailable;
                toolTip.SetToolTip(label_IMAPQuota, "Freya is trying to get MailBox quota...");

                if (!IconLock_DMS)
                {
                    pictureBox_DMS.Image = RegSetting.DMS_Enable ? (Image)Resources.dms_enable : (Image)Resources.dms_disable;
                    toolTip.SetToolTip(pictureBox_DMS, RegSetting.DMS_Enable ? "Auto DMS is enable, Freya will fill out DMS daily for you." : "Auto DMS disabled.");
                }
            }
            label1.Text = "";
            label2.Text = "";
            label3.Text = "";
            label4.Text = "";
            alwaysActiveToolStripMenuItem.Checked = RegSetting.hasRight(FConstants.FeatureByte.AlwaysRun) ? true : false;
            enableToolStripMenuItem.Enabled       = s.MinerEnable ? false : true;
            disableToolStripMenuItem.Enabled      = s.MinerEnable ? true : false;


            //** Get arguments, restore windows state
            string[] args = Environment.GetCommandLineArgs();

            if (args.Length == 2) //第一個是.exe路徑
            {
                if (args[1].Equals("minimized"))
                {
                    this.WindowState         = FormWindowState.Minimized;
                    this.ShowInTaskbar       = false;
                    this.notifyIcon1.Visible = true;
                    startMinimized           = true;
                }

                //this.Location
                //this.Size
            }
        }