예제 #1
0
 public FileSystem(PFSSettings _settings)
 {
     settings      = _settings;
     loadedChunks  = new Dictionary <ulong, Chunk>();
     pendingDelete = new HashSet <string>();
     metadata      = new Metadata(settings);
     LoadMetadata(Directory.GetFiles(settings.basepath + settings.metafile + "\\"));
     lastSaveTime = DateTime.Now;
     Console.WriteLine("FS Created!");
 }
예제 #2
0
파일: Program.cs 프로젝트: Hamcha/pdisk
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            /*
             * ServiceBase[] ServicesToRun;
             * ServicesToRun = new ServiceBase[]
             * {
             *      new pdiskService()
             * };
             * ServiceBase.Run(ServicesToRun);
             * */
            // PFS Settings

            /* PFSSettings settings = new PFSSettings()
             * {
             *      basepath = "C:\\psf\\",
             *      chunkSize = 16 * 1024 * 1024, // 16 Megabytes
             *      maxChunks = 4 * 1024,		  // 2^12 chunks
             *      metafile = "metadata",
             *      chunkpath = "chunks",
             *      mountPoint = "Q:\\"
             * };*/
            string      settingfilecontent = File.ReadAllText("settings.conf");
            PFSSettings settings           = JsonConvert.DeserializeObject <PFSSettings>(settingfilecontent);
            FileSystem  pfs = new FileSystem(settings);

            // Dokan VFS Options
            DokanOptions opt = new DokanOptions()
            {
                DebugMode   = true,
                VolumeLabel = "Persistence",
                MountPoint  = settings.mountPoint,
                ThreadCount = 1
            };
            int status = DokanNet.DokanMain(opt, pfs);

            switch (status)
            {
            case DokanNet.DOKAN_DRIVE_LETTER_ERROR:
                Console.WriteLine("Drive letter error");
                break;

            case DokanNet.DOKAN_DRIVER_INSTALL_ERROR:
                Console.WriteLine("Driver install error");
                break;

            case DokanNet.DOKAN_MOUNT_ERROR:
                Console.WriteLine("Mount error");
                break;

            case DokanNet.DOKAN_START_ERROR:
                Console.WriteLine("Start error");
                break;

            case DokanNet.DOKAN_ERROR:
                Console.WriteLine("Unknown error");
                break;

            case DokanNet.DOKAN_SUCCESS:
                Console.WriteLine("Success");
                break;

            default:
                Console.WriteLine("Unknown status: %d", status);
                break;
            }
            while (true)
            {
                ;
            }
        }
예제 #3
0
파일: Metadata.cs 프로젝트: Hamcha/pdisk
 public Metadata(PFSSettings _set)
 {
     settings = _set;
 }