示例#1
0
        public void UpdateListView(CatalogItem dir)
        {
            List <File> filesList = new List <File>();

            if (dir.son != null)
            {
                CatalogItem son = dir.son;
                do
                {
                    filesList.Add(catalog_table.map(son));
                    son = son.next;
                } while (son != null);
            }
            ObservableCollection <File> filesView = new ObservableCollection <File>(filesList);

            FilesListView.DataContext = filesView;
            addressBar.Text           = catalog_table.map(current_item).Path;
        }
示例#2
0
        public void SerializeNow()
        {
            // for init
            root_item          = new CatalogItem();
            catalog_table      = new CatalogTable();
            folderStack        = new Stack <CatalogItem>();
            stateRecord        = new StateRecord();
            disk               = new Disk();
            root_item.fileName = "root";
            File root_file = new File(root_item);

            root_file.Path = "root";
            catalog_table.map(root_item, root_file);
            current_item = root_item;

            FileStream      fileStream = new FileStream(System.IO.Path.Combine(dir, "catalogTree.dat"), FileMode.Create);
            BinaryFormatter b          = new BinaryFormatter();

            b.Serialize(fileStream, root_item);
            fileStream.Close();

            FileStream fileStream2 = new FileStream(System.IO.Path.Combine(dir, "catalogTable.dat"), FileMode.Create);

            b.Serialize(fileStream2, catalog_table);
            fileStream2.Close();

            FileStream fileStream3 = new FileStream(System.IO.Path.Combine(dir, "disk.dat"), FileMode.Create);

            b.Serialize(fileStream3, disk);
            fileStream3.Close();

            stateRecord.fileCount = CatalogItem.fileCount;
            FileStream fileStream4 = new FileStream(System.IO.Path.Combine(dir, "stateRecord.dat"), FileMode.Create);

            b.Serialize(fileStream4, stateRecord);
            fileStream4.Close();
        }