Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            GeneratorProjectInfo generatorProjectInfo = CommandLineManager.Parse(args);
            CmdShell             shell = new CmdShell();

            shell.Run(generatorProjectInfo);
        }
Ejemplo n.º 2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Parse the command line arguments and store them in the current configuration
            CommandLineManager.Parse();

            // If we have restart our application... wait until it has finished
            if (CommandLineManager.Current.RestartPid != 0)
            {
                Process[] processList = Process.GetProcesses();

                Process process = processList.FirstOrDefault(x => x.Id == CommandLineManager.Current.RestartPid);

                if (process != null)
                {
                    process.WaitForExit();
                }
            }

            // Detect the current configuration
            ConfigurationManager.Detect();

            // Get assembly informations
            AssemblyManager.Load();

            // Load application settings (profiles/sessions/clients are loaded when needed)
            SettingsManager.Load();

            // Load localization (requires settings to be loaded first)
            LocalizationManager.Load();

            if (CommandLineManager.Current.Help)
            {
                StartupUri = new Uri("/Views/Help/HelpCommandLineWindow.xaml", UriKind.Relative);
                return;
            }

            // Create mutex
            _mutex = new Mutex(true, "{" + Guid + "}");
            bool mutexIsAcquired = _mutex.WaitOne(TimeSpan.Zero, true);

            // Release mutex
            if (mutexIsAcquired)
            {
                _mutex.ReleaseMutex();
            }

            if (SettingsManager.Current.Window_MultipleInstances || mutexIsAcquired)
            {
                StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
            }
            else
            {
                // Bring the already running application into the foreground
                SingleInstanceHelper.PostMessage((IntPtr)SingleInstanceHelper.HWND_BROADCAST, SingleInstanceHelper.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);

                _singleInstanceClose = true;
                Shutdown();
            }
        }
Ejemplo n.º 3
0
        public void Titling()
        {
            bool titleOp   = false;
            bool lExecuted = false;
            var  clm       = new CommandLineManager();

            clm.ReportTitle(cml => titleOp = true)
            .AddOptionRequiresData("LD", "List out the operation.", (clmanager) => lExecuted = true)
            .Execute();

            Assert.IsTrue(titleOp);
            Assert.IsFalse(lExecuted);

            // Reset for alternate test.
            titleOp = false;
            clm.Parse(new[] { "-LD", "Data" })
            .Execute();

            Assert.IsFalse(titleOp);
            Assert.IsTrue(lExecuted);
        }
Ejemplo n.º 4
0
        static async Task Main(string[] args)
        {
            ShowWelcome();
            CommandLineManager.Parse(args);

            // await new BigBlueButtonFacade(
            //         new FileDownloader(),
            //         new VideoService(),
            //         new PresentationService(new VideoService()))
            //     .SetUrl(
            //         "https://bbb16.pau.edu.tr/playback/presentation/2.0/playback.html?meetingId=12c8395af12fab1af1d10342665ffd9329c241d4-1602053283330")
            //     .EnableMultiThread()
            //     .SetDriverType(WebDriverType.Chrome)
            //     .EnableDownloadWebcamVideo()
            //     .EnableDownloadDeskshareVideo()
            //     .EnableDownloadPresentation()
            //     .SetOutputFileName("BigBlueButtonVideo_1")
            //     .SetOutputDirectory("/Users/berkay.yalcin/Desktop/deneme")
            //     .SetTimeoutSeconds(60)
            //     .StartAsync();
        }
Ejemplo n.º 5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Parse the command line arguments and store them in the current configuration
            CommandLineManager.Parse();

            // If we have restart our application... wait until it has finished
            if (CommandLineManager.Current.RestartPid != 0)
            {
                var processList = Process.GetProcesses();

                var process = processList.FirstOrDefault(x => x.Id == CommandLineManager.Current.RestartPid);

                process?.WaitForExit();
            }

            // Detect the current configuration
            ConfigurationManager.Detect();

            // Get assembly informations
            AssemblyManager.Load();

            // Load application settings (profiles/Profiles/clients are loaded when needed)
            try
            {
                // Update integrated settings %LocalAppData%\NETworkManager\NETworkManager_GUID (custom settings path)
                if (Settings.Default.UpgradeRequired)
                {
                    Settings.Default.Upgrade();
                    Settings.Default.UpgradeRequired = false;
                }

                SettingsManager.Load();

                // Update settings (Default --> %AppData%\NETworkManager\Settings)
                if (AssemblyManager.Current.Version > new Version(SettingsManager.Current.SettingsVersion))
                {
                    SettingsManager.Update(AssemblyManager.Current.Version, new Version(SettingsManager.Current.SettingsVersion));
                }
            }
            catch (InvalidOperationException)
            {
                SettingsManager.InitDefault();
                ConfigurationManager.Current.ShowSettingsResetNoteOnStartup = true;
            }

            // Load localization (requires settings to be loaded first)
            LocalizationManager.Load();

            NETworkManager.Resources.Localization.Strings.Culture = LocalizationManager.Culture;

            if (CommandLineManager.Current.Help)
            {
                StartupUri = new Uri("/Views/CommandLineHelpWindow.xaml", UriKind.Relative);
                return;
            }

            // Create mutex
            _mutex = new Mutex(true, "{" + Guid + "}");
            var mutexIsAcquired = _mutex.WaitOne(TimeSpan.Zero, true);

            // Release mutex
            if (mutexIsAcquired)
            {
                _mutex.ReleaseMutex();
            }

            if (SettingsManager.Current.Window_MultipleInstances || mutexIsAcquired)
            {
                StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
            }
            else
            {
                // Bring the already running application into the foreground
                SingleInstance.PostMessage((IntPtr)SingleInstance.HWND_BROADCAST, SingleInstance.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);

                _singleInstanceClose = true;
                Shutdown();
            }
        }
Ejemplo n.º 6
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Parse the command line arguments and store them in the current configuration
            CommandLineManager.Parse();

            // If we have restart our application... wait until it has finished
            if (CommandLineManager.Current.RestartPid != 0)
            {
                var processList = Process.GetProcesses();

                var process = processList.FirstOrDefault(x => x.Id == CommandLineManager.Current.RestartPid);

                process?.WaitForExit();
            }

            // Detect the current configuration
            ConfigurationManager.Detect();

            // Get assembly informations
            AssemblyManager.Load();

            bool profileUpdateRequired = false;

            // Load application settings
            try
            {
                // Update integrated settings %LocalAppData%\NETworkManager\NETworkManager_GUID (custom settings path)
                if (Settings.Default.UpgradeRequired)
                {
                    Settings.Default.Upgrade();
                    Settings.Default.UpgradeRequired = false;
                }

                SettingsManager.Load();

                // Update settings (Default --> %AppData%\NETworkManager\Settings)
                Version assemblyVersion = AssemblyManager.Current.Version;
                Version settingsVersion = new Version(SettingsManager.Current.SettingsVersion);

                if (AssemblyManager.Current.Version > settingsVersion)
                {
                    SettingsManager.Update(AssemblyManager.Current.Version, settingsVersion);
                }
            }
            catch (InvalidOperationException)
            {
                SettingsManager.InitDefault();

                profileUpdateRequired = true; // Because we don't know if a profile update is required

                ConfigurationManager.Current.ShowSettingsResetNoteOnStartup = true;
            }

            // Upgrade profile if version has changed or settings have been reset (mthis happens mostly, because the version has changed and values are wrong)
            if (profileUpdateRequired)
            {
                try
                {
                    ProfileManager.Upgrade();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to update profiles...\n\n" + ex.Message, "Profile Manager - Update Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }

            // Load localization (requires settings to be loaded first)
            LocalizationManager.Load();

            NETworkManager.Resources.Localization.Strings.Culture = LocalizationManager.Culture;

            if (CommandLineManager.Current.Help)
            {
                StartupUri = new Uri("/Views/CommandLineHelpWindow.xaml", UriKind.Relative);
                return;
            }

            // Create mutex
            _mutex = new Mutex(true, "{" + GUID + "}");
            var mutexIsAcquired = _mutex.WaitOne(TimeSpan.Zero, true);

            // Release mutex
            if (mutexIsAcquired)
            {
                _mutex.ReleaseMutex();
            }

            if (SettingsManager.Current.Window_MultipleInstances || mutexIsAcquired)
            {
                if (SettingsManager.Current.General_BackgroundJobInterval != 0)
                {
                    _dispatcherTimer = new DispatcherTimer
                    {
                        Interval = TimeSpan.FromMinutes(SettingsManager.Current.General_BackgroundJobInterval)
                    };

                    _dispatcherTimer.Tick += DispatcherTimer_Tick;

                    _dispatcherTimer.Start();
                }

                StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
            }
            else
            {
                // Bring the already running application into the foreground
                SingleInstance.PostMessage((IntPtr)SingleInstance.HWND_BROADCAST, SingleInstance.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);

                _singleInstanceClose = true;
                Shutdown();
            }
        }