private void Grammar_GetLibraryButton_Click(object sender, RoutedEventArgs e) { var librarySettings = new LibrarySettingsWindow(); librarySettings.Input_Namespace.Text = !String.IsNullOrEmpty(OpenedGrammarFilename) ? Path.GetFileNameWithoutExtension(OpenedGrammarFilename) : null; librarySettings.Input_OutputDirectory.Text = DOCUMENTS_DLL_DIRECTORY; if (librarySettings.ShowDialog() == true) { /// Для генерации подписанной библиотеки понадобятся права администратора if (librarySettings.Input_IsSignedAssembly.IsChecked == true) { var pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); if (!pricipal.IsInRole(WindowsBuiltInRole.Administrator)) { Grammar_StatusBar.Background = LightRed; Grammar_StatusBarLabel.Content = "Для генерации строго именованной сборки необходимы права администратора"; return; } } var messages = new List <Message>(); var success = BuilderBase.GenerateLibrary( ParsingLL.IsChecked ?? false ? GrammarType.LL : GrammarType.LR, Grammar_Editor.Text, librarySettings.Input_Namespace.Text, librarySettings.Input_OutputDirectory.Text, librarySettings.Input_IsSignedAssembly.IsChecked == true ? String.IsNullOrWhiteSpace(librarySettings.Input_KeysFile.Text) ? Path.Combine(librarySettings.Input_OutputDirectory.Text, $"{librarySettings.Input_Namespace.Text}.snk") : librarySettings.Input_KeysFile.Text : null, messages ); Grammar_LogList.Text = String.Join(Environment.NewLine, messages.Where(m => m.Type == MessageType.Trace).Select(m => m.Text)); Grammar_ErrorsList.ItemsSource = messages.Where(m => m.Type == MessageType.Error || m.Type == MessageType.Warning); if (!success) { Grammar_StatusBarLabel.Content = "Не удалось сгенерировать библиотеку"; Grammar_StatusBar.Background = LightRed; } else { Grammar_StatusBarLabel.Content = "Библиотека успешно сгенерирована"; Grammar_StatusBar.Background = Brushes.LightGreen; } } }