예제 #1
0
        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 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);
                }
            }
        }