Example #1
0
        private void SaveDocuments()
        {
            DirectoryInfo dir = this.DocumentsDirectory;

            dir.Create();
            foreach (FileInfo file in dir.GetFiles())
            {
                file.Delete();
            }

            EasyProperties ps = new EasyProperties();

            foreach (IDockContent docContent in this.Documents)
            {
                ITabbedDocument document = docContent as ITabbedDocument;
                if (document == null)
                {
                    continue;
                }

                EasyPropertiesNode node = ps[document.GUID];
                node.SetValue <string>("Type", docContent.GetType().FullName);

                FileInfo file = new FileInfo(Path.Combine(dir.FullName, document.GUID + ".xml"));
                document.SaveProperties(file);
            }
            ps.Save(this.DocumentsListFile);
        }
Example #2
0
 public static void SaveFileSystem(EasyPropertiesNode ps, TMFileSystem fileSystem)
 {
     foreach (TMRootFolder rootFolder in fileSystem)
     {
         EasyPropertiesNode node = ps[rootFolder.RootFolderType.ToString()];
         SaveFolder(node, rootFolder);
     }
 }
Example #3
0
        public RecentFilesManager(ToolStripMenuItem recentMenuItem, EasyPropertiesNode properties)
        {
            _recentMenuItem = recentMenuItem;
            _properties     = properties;
            _recentMenuItem.DropDownOpening += new EventHandler(_recentMenuItem_DropDownOpening);

            this.Load();
            this.Update();
        }
Example #4
0
 public static void LoadFileSystem(EasyPropertiesNode pnode, TMFileSystem fileSystem)
 {
     foreach (EasyPropertiesNode node in pnode.GetChildProperties())
     {
         TMRootFolder rootFolder = new TMRootFolder((LURootFolderType)Enum.Parse(typeof(LURootFolderType), node.Name));
         LoadFolders(node, rootFolder);
         LoadFiles(node, rootFolder);
         fileSystem.Add(rootFolder);
     }
 }
Example #5
0
 private static void LoadFolders(EasyPropertiesNode node, TMFolder folder)
 {
     EasyPropertiesNode[] childProps = node.GetChildProperties();
     foreach (EasyPropertiesNode childProp in childProps)
     {
         TMFolder tmFolder = new TMFolder(childProp.Name, folder);
         LoadFolders(childProp, tmFolder);
         LoadFiles(childProp, tmFolder);
         folder.Folders.Add(tmFolder);
     }
 }
Example #6
0
        public void SaveDataGridView(DataGridView dgv)
        {
            string id = _views[dgv];

            _views.Remove(dgv);

            EasyPropertiesNode ps = _props[id]["ColumsWidth"];

            foreach (DataGridViewColumn col in dgv.Columns)
            {
                ps.SetValue <int>(col.Name, col.Width);
            }
        }
Example #7
0
        public void InitializeDataGridView(DataGridView dgv)
        {
            string id = this.GetDataGridViewId(dgv);

            this._views.Add(dgv, id);

            EasyPropertiesNode ps = _props[id]["ColumsWidth"];

            foreach (DataGridViewColumn col in dgv.Columns)
            {
                col.Width = ps.GetValue <int>(col.Name, col.Width);
            }
        }
Example #8
0
        public void SaveSettings()
        {
            EasyPropertiesNode ps = Global.Properties["Updates"];

            ps.SetValue <bool>("Auto", _autoCheckForUpdates);

            ps = Global.Properties["Updates"]["Proxy"];
            ProxySettings proxy = Configure.Proxy;

            ps.SetValue <bool>("Enable", proxy.Enable);
            ps.SetValue <string>("Server", proxy.Server);
            ps.SetValue <int>("Port", proxy.Port);
            ps.SetValue <string>("UserName", proxy.UserName);
            ps.SetValue <string>("UserPassword", proxy.UserPassword);
        }
Example #9
0
        public void LoadSettings()
        {
            /* Загрузка настроек подключения к серверу */
            EasyPropertiesNode ps = Global.Properties["Updates"];

            _autoCheckForUpdates = ps.GetValue <bool>("Auto", true);

            ps = Global.Properties["Updates"]["Proxy"];
            ProxySettings proxy = LiteUpdate.Configure.Proxy;

            proxy.Enable       = ps.GetValue <bool>("Enable", false);
            proxy.Server       = ps.GetValue <string>("Server", "");
            proxy.Port         = ps.GetValue <int>("Port", 0);
            proxy.UserName     = ps.GetValue <string>("UserName", "");
            proxy.UserPassword = ps.GetValue <string>("UserPassword", "");
        }
Example #10
0
        private static void LoadFiles(EasyPropertiesNode node, TMFolder folder)
        {
            int count = node.GetValue <int>("Count", 0);

            for (int i = 0; i < count; i++)
            {
                string pname    = "File" + i.ToString();
                string fileName = node.GetValue <string>(pname + "_fullname", "");

                TMFile tmFile = new TMFile(new FileInfo(fileName), folder);
                tmFile.Version    = node.GetValue <int>(pname + "_version", 1);
                tmFile.ModifyTime = node.GetValue <DateTime>(pname + "_time", DateTime.Now);
                tmFile.Length     = node.GetValue <long>(pname + "_length", 0);

                folder.Files.Add(tmFile);
            }
        }
Example #11
0
        private static void SaveFolder(EasyPropertiesNode node, TMFolder folder)
        {
            foreach (TMFolder tmFolder in folder.Folders)
            {
                EasyPropertiesNode childNode = node[tmFolder.Name];
                SaveFolder(childNode, tmFolder);
            }

            node.SetValue <int>("Count", folder.Files.Count);
            for (int i = 0; i < folder.Files.Count; i++)
            {
                TMFile   tmFile = folder.Files[i];
                string   pname  = "File" + i.ToString();
                string[] sa     = new string[] { };
                node.SetValue <int>(pname + "_version", tmFile.Version);
                node.SetValue <string>(pname + "_fullname", tmFile.File.FullName);
                node.SetValue <DateTime>(pname + "_time", tmFile.ModifyTime);
                node.SetValue <long>(pname + "_length", tmFile.Length);
            }
        }
Example #12
0
 public TablesManager()
 {
     _props = Global.Properties["Tables"];
 }