예제 #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);
            }
        }
예제 #2
0
        static async Task <int> Main(string[] args)
        {
            StadSettings.Initialize();
            Console.WriteLine("Hello World!");
            CommonDataSet commonDataSet = new CommonDataSet()
            {
                SampleSingleModel = new SampleSingleModel()
                {
                    IntField = 1, IntProperty = 2
                },
                SampleKeyValueModel = new StadKeyValueCollection <SampleKeyValueModel>(
                    new Dictionary <ModelKey, SampleKeyValueModel>()
                {
                    { new ModelKey(1), new SampleKeyValueModel()
                      {
                          StringValue = "1"
                      } },
                    { new ModelKey(2), new SampleKeyValueModel()
                      {
                          StringValue = "2"
                      } },
                    { new ModelKey(3), new SampleKeyValueModel()
                      {
                          StringValue = "3"
                      } }
                })
            };

            string dic = Utf8Json.JsonSerializer.ToJsonString(new Dictionary <int, string>()
            {
                { 1, "333" }, { 2, "32423" }
            });

            // load test
            commonDataSet = await StadSerializer.LoadDataAsync <CommonDataSet>(DataSetFactory.LocalFile("Common/"));

            Console.WriteLine($"SampleSingleModel : {commonDataSet.SampleSingleModel}");
            Console.WriteLine($"SampleKeyValueModel : {commonDataSet.SampleKeyValueModel}");

            // Source 분석은 일단 보류..
            //Console.WriteLine("Assembly analysis - by source analyze");
            //var registryFromSource = await StadAnalyzer.MakeRegistryFromSource("../../");
            //Console.WriteLine(registryFromSource);

            Console.WriteLine("Assembly analysis - by assembly analyze");
            string executingDir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var    registry     = await StadAnalyzer.MakeRegistry(new LocalFileAssemblySource(executingDir));

            Console.WriteLine(registry);

            return(0);
        }
        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);
                }
            }
        }