Beispiel #1
0
        private void Jsondeserialize()
        {
            OpenFileDialog test = new OpenFileDialog();

            test.Filter = "Text files (*.txt)|*.txt";
            test.ShowDialog();
            if (test.FileName.Length == 0)
            {
                MessageBox.Show("No files selected");
                log.Info("Wybrano pusty plik: ");
                flog.Log("Wybrano pusty plik: ");
            }
            else
            {
                string path = test.FileName;
                _visibility = Visibility.Visible;
                RaisePropertyChanged("ChangeControlVisibility");
                RaisePropertyChanged("PathVariable");
                log.Info("Deserializowano plik: " + path);
                flog.Log("Deserializowano plik: " + path);
                HierarchicalAreas.Clear();
                assemblyMetadata = des.Deserialize(path);
                //  SqlSerialization ss = new SqlSerialization();
                //   assemblyMetadata = ss.Deserialize(2);
                pathVariable = "DeserializedJsonItems";
                TreeViewLoaded(assemblyMetadata);
            }
        }
Beispiel #2
0
        public ConsoleView()
        {
            des = new Services.JsonDeserialization();
            srv = new Services.JsonSerialization();
            Console.WriteLine("1:Wczytaj Assebbli z pliku  ");
            Console.WriteLine("2:Wczytaj drzewo z pliku");
            Console.WriteLine("3:Wczytaj drzewo z Bazy");
            char key = Console.ReadKey().KeyChar;

            if (key == 49)
            {
                Console.WriteLine("Podaj sciezke");
                string path = Console.ReadLine();
                setPathVariable(path);

                try
                {
                    if (System.IO.Path.GetExtension(pathVariable) == ".dll" || System.IO.Path.GetExtension(pathVariable) == ".exe")
                    {
                        log.Info("Zaladowano plik: " + pathVariable);
                        run();
                        Console.WriteLine(rootItem.Name);
                        lastone = rootItem;
                        ExpandTree(rootItem, "/0");
                        WriteTree(rootItem, 1);
                        petla();
                    }
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine(e);
                }
            }
            if (key == 50)
            {
                Console.WriteLine("Podaj sciezke skad to odczytac");
                string path;
                path = Console.ReadLine();
                try
                {
                    assemblyMetadata = des.Deserialize(path);
                    pathVariable     = "DeserializedItemsJSON";
                    TreeViewLoaded(assemblyMetadata);
                    Console.WriteLine(rootItem.Name);
                    lastone = rootItem;
                    ExpandTree(rootItem, "/0");
                    WriteTree(rootItem, 1);
                    petla();
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine(e);
                }
            }
            if (key == 51)
            {
                Console.WriteLine("Podaj numer assembly");
                string             path = Console.ReadLine();
                SQLDeserialization ss   = new SQLDeserialization();
                assemblyMetadata = ss.Deserialize(path);
                pathVariable     = "DeserializedItemsSQL";
                TreeViewLoaded(assemblyMetadata);
                Console.WriteLine(rootItem.Name);
                lastone = rootItem;
                ExpandTree(rootItem, "/0");
                WriteTree(rootItem, 1);
                petla();
            }
        }