Example #1
0
        private void DeSerial()
        {
            try
            {
                Bak.InstCol();
                string md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам


                try
                {
                    md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам
                    XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection <Bak>));
                    using (StreamReader wr = new StreamReader(md + "\\UranSetUp\\" + "settingBAAK12-100.xml"))
                    {
                        Bak._DataColecBAAK100 = (ObservableCollection <Bak>)xs.Deserialize(wr);
                    }
                }
                catch (Exception)
                {
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ошибка серилизации");
            }
        }
        private void DeSerial()
        {
            try
            {
                Bak.InstCol();
                string md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам

                ClassSerilization.DeSerialUserSetting100(out set);
                try
                {
                    XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection <Bak>));
                    using (StreamReader wr = new StreamReader(md + "\\UranSetUp\\" + "setting100.xml"))
                    {
                        Bak._DataColec1 = (ObservableCollection <Bak>)xs.Deserialize(wr);
                        wr.Close();
                    }
                }
                catch (Exception)
                {
                }
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Ошибка серилизации");
            }
        }
Example #3
0
        private void DeSerial()
        {
            try
            {
                string md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам

                FileStream fs = new FileStream(md + "\\UranSetUp\\" + "ClassOtborNeutron.dat", FileMode.Open);
                try
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    otb = (ClassOtborNeutron)bf.Deserialize(fs);
                    fs.Close();
                }
                catch (SerializationException)
                {
                    System.Windows.MessageBox.Show("ошибка");
                    fs.Close();
                }
                finally
                {
                    fs.Close();
                }

                Bak.InstCol();


                FileStream fs1 = new FileStream(md + "\\UranSetUp\\" + "setting.dat", FileMode.Open);
                try
                {
                    BinaryFormatter bf1 = new BinaryFormatter();
                    set = (UserSetting)bf1.Deserialize(fs1);
                }
                catch (SerializationException)
                {
                    System.Windows.MessageBox.Show("ошибка");
                }
                finally
                {
                    fs1.Close();
                }
                try
                {
                    XmlSerializer xs = new XmlSerializer(typeof(ObservableCollection <Bak>));
                    using (StreamReader wr = new StreamReader(md + "\\UranSetUp\\" + "setting1.xml"))
                    {
                        Bak._DataColec1 = (ObservableCollection <Bak>)xs.Deserialize(wr);
                        wr.Close();
                    }
                }
                catch (Exception)
                {
                }
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Ошибка серилизации");
            }
        }
Example #4
0
        private void DeSerial()
        {
            Bak.InstCol();
            string     md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам
            FileStream fs = new FileStream(md + "\\UranSetUp\\" + "setting.dat", FileMode.Open);

            BinaryFormatter bf = new BinaryFormatter();

            set = (UserSetting)bf.Deserialize(fs);



            fs.Close();
        }
Example #5
0
        private void DeSerial()
        {
            try
            {
                Bak.InstCol();
                ClassTestRan.InstCol();
                string     md = Environment.GetFolderPath(Environment.SpecialFolder.Personal);//путь к Документам
                FileStream fs = new FileStream(md + "\\UranSetUp\\" + "setting.dat", FileMode.Open);
                try
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    set = (UserSetting)bf.Deserialize(fs);
                }
                catch (SerializationException)
                {
                    System.Windows.MessageBox.Show("ошибка");
                }
                finally
                {
                    fs.Close();
                }

                try
                {
                    XmlSerializer xs1 = new XmlSerializer(typeof(ObservableCollection <ClassTestRan>));
                    using (StreamReader wr1 = new StreamReader(md + "\\UranSetUp\\" + "ClassTestRanSetting1.xml"))
                    {
                        ClassTestRan._DataColec2 = (ObservableCollection <ClassTestRan>)xs1.Deserialize(wr1);
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Ошибка серилизации настроек тестового набора");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ошибка серилизации общих настроик");
            }
        }