Beispiel #1
0
        private void  SQLdeserialize()
        {
            string UserAnswer = Microsoft.VisualBasic.Interaction.InputBox("Wprowadz sciezke ", "Serialization", "");

            if (UserAnswer == "")
            {
                MessageBox.Show("nic nie wprowadziles");
            }
            else
            {
                string path = UserAnswer;
                _visibility = Visibility.Visible;
                RaisePropertyChanged("ChangeControlVisibility");
                RaisePropertyChanged("PathVariable");
                log.Info("Deserializowano Assembly: " + path);
                flog.Log("Deserializowano Assembly: " + path);
                HierarchicalAreas.Clear();

                SQLDeserialization ss = new SQLDeserialization();
                assemblyMetadata = ss.Deserialize(path);
                pathVariable     = "DeserializedSQLItems";
                // assemblyMetadata.IsExpanded = true;
                TreeViewLoaded(assemblyMetadata);
            }
        }
Beispiel #2
0
        public void  SqlSerializationTest()
        {
            SqlSerialization ss = new SqlSerialization();
            AssemblyMetadata am = new AssemblyMetadata()
            {
                m_Name = "test1", IsExpanded = false
            };

            ss.Serialize(am, "nima");

            SQLDeserialization sd     = new SQLDeserialization();
            AssemblyMetadata   dodane = sd.Deserialize(Convert.ToString(ss.number));

            Assert.IsTrue(dodane.m_Name == "test1");
            ss.Dispose();
        }
Beispiel #3
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();
            }
        }