Пример #1
0
 public static void WriteToRegistry(ObservableCollection <TabOptions> options)
 {
     try
     {
         using (MemoryStream stream = new MemoryStream())
         {
             BinaryFormatter bin = new BinaryFormatter();
             bin.Serialize(stream, options);
             var data = stream.ToArray();
             BblRegistryKey.GetKey().SetValue("savedOptions", data, Microsoft.Win32.RegistryValueKind.Binary);
         }
     }
     catch { Console.WriteLine("Failed to write bookmarks to Registry"); }
 }
Пример #2
0
 public static void WriteToRegistry(List <BblTabState> tabStates)
 {
     try
     {
         using (MemoryStream stream = new MemoryStream())
         {
             BinaryFormatter bin = new BinaryFormatter();
             bin.Serialize(stream, tabStates);
             var data = stream.ToArray();
             BblRegistryKey.GetKey().SetValue("TabStates", data, RegistryValueKind.Binary);
         }
     }
     catch { Console.WriteLine("Failed to write tabStates to Registry"); }
 }
Пример #3
0
        public static ObservableCollection <TabOptions> ReadFromRegistry()
        {
            ObservableCollection <TabOptions> options = null;

            try
            {
                byte[] data = BblRegistryKey.GetKey().GetValue("savedOptions") as byte[];
                if (data != null)
                {
                    using (MemoryStream stream = new MemoryStream(data))
                    {
                        BinaryFormatter bin = new BinaryFormatter();
                        options = (ObservableCollection <TabOptions>)bin.Deserialize(stream);
                    }
                }
            }
            catch { Console.WriteLine("Failed to retrieve bookmarks from registry."); }


            return(options);
        }
Пример #4
0
        public static List <BblTabState> ReadFromRegistry()
        {
            List <BblTabState> tabStates = new List <BblTabState>();

            try
            {
                byte[] data = BblRegistryKey.GetKey().GetValue("TabStates") as byte[];
                if (data != null)
                {
                    using (MemoryStream stream = new MemoryStream(data))
                    {
                        BinaryFormatter bin = new BinaryFormatter();

                        tabStates = (List <BblTabState>)bin.Deserialize(stream);
                    }
                }
            }
            catch { Console.WriteLine("Failed to retrieve tabStates from registry."); }


            return(tabStates);
        }