Inheritance: FileOrFolder
コード例 #1
0
ファイル: Folder.cs プロジェクト: VelocityDB/VelocityDB
 public Folder(string name, Folder parentFolder, SessionBase session) : base(name)
 {
   CompareByField<FileInDb> comparerByFileName = new CompareByField<FileInDb>("m_name", session, false, true);
   m_files = new BTreeSet<FileInDb>(comparerByFileName, session, 10000, CommonTypes.s_sizeOfUInt32);
   CompareByField<Folder> comparerByFolderName = new CompareByField<Folder>("m_name", session, false, true);
   m_subFolders = new BTreeSet<Folder>(comparerByFolderName, session, 10000, CommonTypes.s_sizeOfUInt32);
   if (parentFolder != null)
   {
     m_parentFolder = parentFolder;
     m_parentFolder.Folders.AddFast(this);
   }
 }
コード例 #2
0
 public void DoFileFolderTest()
 {
   using (SessionNoServer session = new SessionNoServer(s_systemDir))
   {
     session.NotifyBeforeCommit = NotifyBeforeCommit;
     session.BeginUpdate();
     DirectoryInfo dirInfo = new DirectoryInfo(s_sampleFolder);
     Folder folder = new Folder(dirInfo.Name, null, session);
     CreateDirectoriesAndFiles(dirInfo, folder, session);
     session.Persist(folder);
     session.Commit();
   }
 }
コード例 #3
0
 void CreateDirectoriesAndFiles(DirectoryInfo dirInfo, Folder folder, SessionBase session)
 {
   foreach (DirectoryInfo dir in dirInfo.GetDirectories())
   {
     Folder subFolder = new Folder(dir.Name, folder, session);
     CreateDirectoriesAndFiles(dir, subFolder, session);
   }
   foreach (FileInfo fileInfo in dirInfo.GetFiles())
   {
     FileInDb file = new FileInDb(fileInfo.Name, folder);
     byte[] bytes = File.ReadAllBytes(fileInfo.FullName);
     FileContent fileContent = new FileContent(bytes);
     session.Persist(fileContent);
     file.Content = fileContent;
   }
 }
コード例 #4
0
ファイル: FileInDb.cs プロジェクト: VelocityDB/VelocityDB
 public FileInDb(string name, Folder parentFolder):base(name)
 {
   m_folder = parentFolder;
   m_folder.Files.AddFast(this);
 }