public LocalFile Create(LocalDrive drive, FileSystemInfo file, bool isRoot) { Func<LocalDrive, FileSystemInfo, bool, LocalFile> creator; if (!creators.TryGetValue(Environment.OSVersion.Platform, out creator)) { throw new PlatformNotSupportedException(); } return creator(drive, file, isRoot); }
public LocalFile Create(LocalDrive drive, FileSystemInfo file, bool isRoot) { Func <LocalDrive, FileSystemInfo, bool, LocalFile> creator; if (!creators.TryGetValue(Environment.OSVersion.Platform, out creator)) { throw new PlatformNotSupportedException(); } return(creator(drive, file, isRoot)); }
protected LocalFile(LocalDrive drive, string path) : base(drive) { if (System.IO.File.Exists(path)) { this.file = new FileInfo(path); } else { this.file = new DirectoryInfo(path); } }
protected LocalFile(LocalDrive drive, string path) : base(drive) { if (System.IO.File.Exists(path)) { this.file = new FileInfo(path); } else { this.file = new DirectoryInfo(path); } }
public NtfsLocalFile(LocalDrive drive, FileSystemInfo file) : base(drive, file) { }
protected LocalFile(LocalDrive drive, FileSystemInfo file) : base(drive) { this.file = file; }
public UnixLocalFile(LocalDrive drive, FileSystemInfo file) :base(drive, file) { }
public async Task <Account> CreateAccountAsync(AccountInfo info) { var token = new CancellationToken(); var storage = new Glacier(info.StorageVault, info.StorageRootPath, info.StorageAccessKeyId, info.StorageSecretAccessKey, info.StorageRegionEndpoint); await storage.InitAsync(token); var account = new Account(storage); var accountCredPath = "accounts/" + info.AccountName + "/drive-credentials/"; foreach (var d in info.Drives) { switch (d.DriveType) { case DriveType.GoogleDrive: var drive = await GoogleDrive.CreateInstance(account, d.DriveId, GoogleClientSecrets.Load(new MemoryStream(Resources.client_secret)).Secrets, d.DriveRootPath, accountCredPath + d.DriveId, token); drive.ImageMaxSize = d.DriveImageMaxSize; await drive.GetServiceAsync(token); account.Drives.Add(drive); break; case DriveType.LocalDrive: var localDrive = new Local.LocalDrive(account, d.DriveId, d.DriveRootPath) { ImageMaxSize = d.DriveImageMaxSize }; account.Drives.Add(localDrive); break; default: throw new NotSupportedException("Drive with this type is not supported"); } } var accountInventoryPath = "accounts/" + info.AccountName + "/glacier-inventory.xml"; using (var store = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) { if (store.FileExists(accountInventoryPath)) { using (var input = store.OpenFile(accountInventoryPath, FileMode.Open)) { var reader = new StreamReader(input); var xml = await reader.ReadToEndAsync(); var doc = XDocument.Load(new XmlTextReader(new StringReader(xml))); var glacierDrive = new GlacierPseudoDrive(account, "inventory", doc); account.Drives.Add(glacierDrive); } } } return(account); }
protected LocalFile(LocalDrive drive, FileSystemInfo file) : base(drive) { this.file = file; }
public async Task<Account> CreateAccountAsync(AccountInfo info) { var token = new CancellationToken(); var storage = new Glacier(info.StorageVault, info.StorageRootPath, info.StorageAccessKeyId, info.StorageSecretAccessKey, info.StorageRegionEndpoint); await storage.InitAsync(token); var account = new Account(storage); var accountCredPath = "accounts/" + info.AccountName + "/drive-credentials/"; foreach (var d in info.Drives) { switch (d.DriveType) { case DriveType.GoogleDrive: var drive = await GoogleDrive.CreateInstance(account, d.DriveId, GoogleClientSecrets.Load(new MemoryStream(Resources.client_secret)).Secrets, d.DriveRootPath, accountCredPath + d.DriveId, token); drive.ImageMaxSize = d.DriveImageMaxSize; await drive.GetServiceAsync(token); account.Drives.Add(drive); break; case DriveType.LocalDrive: var localDrive = new Local.LocalDrive(account, d.DriveId, d.DriveRootPath) { ImageMaxSize = d.DriveImageMaxSize }; account.Drives.Add(localDrive); break; default: throw new NotSupportedException("Drive with this type is not supported"); } } var accountInventoryPath = "accounts/" + info.AccountName + "/glacier-inventory.xml"; using (var store = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) { if (store.FileExists(accountInventoryPath)) { using (var input = store.OpenFile(accountInventoryPath, FileMode.Open)) { var reader = new StreamReader(input); var xml = await reader.ReadToEndAsync(); var doc = XDocument.Load(new XmlTextReader(new StringReader(xml))); var glacierDrive = new GlacierPseudoDrive(account, "inventory", doc); account.Drives.Add(glacierDrive); } } } return account; }