public static async Task <StorageFile> CreateFileAsync( string path, StorageStrategy location = StorageStrategy.Local, CreationCollisionOption option = CreationCollisionOption.OpenIfExists) { return(await CreateFileAsync(path, GetFolderFromStrategy(location), option)); }
private static IFolder GetFolderFromStrategy(StorageStrategy location) { switch (location) { case StorageStrategy.Roaming: return FileSystem.Current.RoamingStorage; default: return FileSystem.Current.LocalStorage; } }
static Either() { if (Either.IsMutuallyNotConvertable(typeof(T1), typeof(T2))) { Strategy = StorageStrategy.ReferenceConversion; } else { Strategy = StorageStrategy.Box; } }
private static IFolder GetFolderFromStrategy(StorageStrategy location) { switch (location) { case StorageStrategy.Roaming: return(FileSystem.Current.RoamingStorage); default: return(FileSystem.Current.LocalStorage); } }
public static async Task <bool> DeleteFileAsync(string path, StorageStrategy location = StorageStrategy.Local) { var file = await GetIfFileExistsAsync(path, GetFolderFromStrategy(location)).ConfigureAwait(false); if (file != null) { await file.DeleteAsync(); } return(!(await FileExistsAsync(path, location).ConfigureAwait(false))); }
public Repo CreateRepository(StorageStrategy strategy) { var factory = factories.FirstOrDefault(f => f.CanHandle(strategy)); if (factory != null) { return(factory.GetRepository()); } else { throw new Exception("Strategy not implemented: " + strategy.ToString()); } }
private int ComputetHashCode() { var hashCode = 112535552; hashCode = hashCode * -1521134295 + PropKind.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <Type> .Default.GetHashCode(Type); hashCode = hashCode * -1521134295 + StorageStrategy.GetHashCode(); hashCode = hashCode * -1521134295 + ComparerIsDefault.GetHashCode(); hashCode = hashCode * -1521134295 + ComparerIsRefEquality.GetHashCode(); hashCode = hashCode * -1521134295 + DefaultValFuncIsDefault.GetHashCode(); return(hashCode); }
public static IStorage Create(StorageStrategy storageStrategy) { IEngine engine = null; switch (storageStrategy) { case StorageStrategy.Speed: engine = Engine.Create(); break; case StorageStrategy.SpeedEsent: break; default: break; } return new Storage(engine, DefaultSerializer.Create()); }
public static StorageFolder GetFolderFromStrategy(StorageStrategy location) { switch (location) { case StorageStrategy.Roaming: return ApplicationData.Current.RoamingFolder; case StorageStrategy.Temporary: return ApplicationData.Current.TemporaryFolder; case StorageStrategy.Installation: return Package.Current.InstalledLocation; default: return ApplicationData.Current.LocalFolder; } }
private static StorageFolder GetFolderFromStrategy(StorageStrategy location) { switch (location) { case StorageStrategy.Roaming: return(ApplicationData.Current.RoamingFolder); case StorageStrategy.Temporary: return(ApplicationData.Current.TemporaryFolder); case StorageStrategy.Installation: return(Package.Current.InstalledLocation); default: return(ApplicationData.Current.LocalFolder); } }
public static async Task<BinaryWriter> GetWriterForFileAsync(string path, StorageStrategy location = StorageStrategy.Local) { return await GetWriterForFileAsync(path, GetFolderFromStrategy(location)).ConfigureAwait(false); }
public static async Task <IFile> GetIfFileExistsAsync(string path, StorageStrategy strategy = StorageStrategy.Local) { return(await GetIfFileExistsAsync(path, GetFolderFromStrategy(strategy)).DontMarshall()); }
public static async Task<IFile> GetIfFileExistsAsync(string path, StorageStrategy strategy = StorageStrategy.Local) { return await GetIfFileExistsAsync(path, GetFolderFromStrategy(strategy)).ConfigureAwait(false); }
public static async Task <BinaryWriter> GetWriterForFileAsync(string path, StorageStrategy location = StorageStrategy.Local) { return(await GetWriterForFileAsync(path, GetFolderFromStrategy(location)).DontMarshall()); }
public static async Task <IFolder> EnsureFolderExistsAsync(string path, StorageStrategy location = StorageStrategy.Local) { return(await EnsureFolderExistsAsync(path, GetFolderFromStrategy(location)).DontMarshall()); }
public static async Task<IFile> CreateFileAsync(string path, StorageStrategy location = StorageStrategy.Local, CreationCollisionOption option = CreationCollisionOption.OpenIfExists) { return await CreateFileAsync(path, GetFolderFromStrategy(location), option); }
public bool CanHandle(StorageStrategy strategy) { return(strategy == StorageStrategy.Synchronised); }
public bool CanHandle(StorageStrategy strategy) { return(strategy == StorageStrategy.Local); }
public static Task DeleteFolderContentAsync(StorageStrategy location) { var folder = GetFolderFromStrategy(location); return DeleteFolderContentAsync(folder); }
public static async Task<IFile> GetIfFileExistsAsync(string path, StorageStrategy strategy = StorageStrategy.Local) { return await GetIfFileExistsAsync(path, GetFolderFromStrategy(strategy)).DontMarshall(); }
public static async Task<IFolder> EnsureFolderExistsAsync(string path, StorageStrategy location = StorageStrategy.Local) { return await EnsureFolderExistsAsync(path, GetFolderFromStrategy(location)).DontMarshall(); }
public static async Task<IFile> GetFileAsync(string path, StorageStrategy location = StorageStrategy.Local) { return await CreateFileAsync(path, GetFolderFromStrategy(location)); }
public static async Task <StorageFolder> EnsureFolderExistsAsync( string path, StorageStrategy location = StorageStrategy.Local) { return(await EnsureFolderExistsAsync(path, GetFolderFromStrategy(location)).ConfigureAwait(false)); }
public bool CanHandle(StorageStrategy strategy) { return(strategy == StorageStrategy.Online); }
public static async Task <BinaryWriter> GetWriterForFileAsync( string path, StorageStrategy location = StorageStrategy.Local) { return(await GetWriterForFileAsync(path, GetFolderFromStrategy(location)).ConfigureAwait(false)); }
public static async Task<bool> FileExistsAsync(string path, StorageStrategy location = StorageStrategy.Local) { return await FileExistsAsync(path, GetFolderFromStrategy(location)).ConfigureAwait(false); }
public static async Task <StorageFile> GetFileAsync( string path, StorageStrategy location = StorageStrategy.Local) { return(await CreateFileAsync(path, GetFolderFromStrategy(location))); }
public static async Task<BinaryWriter> GetWriterForFileAsync(string path, StorageStrategy location = StorageStrategy.Local) { return await GetWriterForFileAsync(path, GetFolderFromStrategy(location)).DontMarshall(); }
public static async Task <StorageFile> GetIfFileExistsAsync( string path, StorageStrategy strategy = StorageStrategy.Local) { return(await GetIfFileExistsAsync(path, GetFolderFromStrategy(strategy)).ConfigureAwait(false)); }
public static Task DeleteFolderContentAsync(StorageStrategy location) { var folder = GetFolderFromStrategy(location); return(DeleteFolderContentAsync(folder)); }