private async void Assembly_Open() { var openDialog = new OpenDialog("Open Assembly", "Select Assembly directory") { AllowsMultipleSelection = false, CanChooseDirectories = true, CanChooseFiles = false }; Application.Run(openDialog); if (openDialog.FilePaths.Count != 1) { return; } string dirPath = openDialog.FilePaths[0]; var source = new LocalFileAssemblySource(dirPath); if (await source.Initialize() == false) { return; } _stadRegistry = await StadAnalyzer.MakeRegistry(source); if (_stadRegistry != null) { _assemblyWindow = new Window("Assembly") { X = 1, Y = 1, Width = Dim.Fill(), Height = Dim.Fill() }; _assemblyWindow.Add(new Label(0, 0, $"Assembly : {_stadRegistry}")); Add(_assemblyWindow); } }
private static StadRegistry MakeRegistry(TypeCollectorResult result) { AnalyzeContext context = new AnalyzeContext(result); List <DataSetModel> dataSetModels = new List <DataSetModel>(); foreach (ObjectSerializationInfo info in result.CollectedObjectInfo) { if (info.Attributes.IsDefaultOrEmpty == true) { continue; } var dataSetDefinitionAttribute = info.Attributes.FirstOrDefault(a => a.Type.Contains(nameof(Stad.Annotation.DataSetDefinition))); if (dataSetDefinitionAttribute != null) { var dataSetModel = MakeDataSetModel(context, info); if (dataSetModel != null) { dataSetModels.Add(dataSetModel); } } } return(StadRegistry.Create(new ReadOnlyCollection <DataSetModel>(dataSetModels))); }
private async void Button_Click(object sender, RoutedEventArgs e) { if (DataSourceType == DataSourceType.LocalFile) { var dialog = new System.Windows.Forms.FolderBrowserDialog(); if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } try { var assemblySource = new LocalFileAssemblySource(dialog.SelectedPath); if (await assemblySource.Initialize() == false) { MessageBox.Show("Assembly initialize failed!"); return; } StadApplication.SetAssemblySource(assemblySource); StadRegistry stadRegistry = await StadAnalyzer.MakeRegistry(assemblySource); // TODO: analyze 스텝 분리? if (stadRegistry == null) { MessageBox.Show("Make Registry failed!"); return; } StadApplication.SetStadRegitry(stadRegistry); } catch (Exception exception) { MessageBox.Show(exception.Message); } } }
public static void SetStadRegistry(StadRegistry stadRegistry) { StadRegistry = stadRegistry; RaiseEvent(StadEventType.StadRegistryChanged); }