Exemplo n.º 1
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();
            }
        }