Пример #1
0
 private void UnsubscribeFromLogs()
 {
     foreach (ILoggingReceiver receiver in LoggingFrameworkHelpers.GetLoggingReceivers())
     {
         receiver.NewLogMessage -= this.OnNewLogMessage;
     }
 }
Пример #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            LoggingFrameworkHelpers.InitializeLogFramework();

            try { this.Arguments = new Arguments(Environment.GetCommandLineArgs()); }
            catch (Exception exc)
            {
                string msg = exc.Message + Environment.NewLine;
                MessageBox.Show(msg, "Command Line Error", MessageBoxButton.OK, MessageBoxImage.Error);
                this.Shutdown(1);
                return;
            }

            if (string.IsNullOrWhiteSpace(this.Arguments.ToHash) == false)
            {
                string key = Arguments.Key;

                ConsoleWindow.WriteLine();
                if (string.IsNullOrEmpty(key))
                {
                    key = Password.CreateKey();
                    ConsoleWindow.WriteLine("Key: " + key);
                }

                string pw = Password.HashPassword(Arguments.ToHash, key);

                ConsoleWindow.WriteLine("Hash: " + pw);
                ConsoleWindow.WriteLine(Environment.NewLine + "Example config:");
                ConsoleWindow.WriteLine(@"
                    <Authentication Type=""Password"" AuthID=""conf_auth"">
                        <Password>
                            <PasswordHash>" + pw + @"</ PasswordHash >
                            <Key>" + key + @"</Key>
                        </Password>
                    </Authentication>");
                ConsoleWindow.Pause();
            }
            else
            {
                this.StartTsGui();
            }
        }