Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
590 changes: 295 additions & 295 deletions PCLStorage.sln

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build - Copy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msbuild %~dp0build\build.proj /p:Configuration=Release /t:Clean;BuildPackage
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msbuild %~dp0build\build.proj /p:Configuration=Release /t:Clean;BuildPackage
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild build\build.proj /p:Configuration=Release /t:Clean;BuildPackage
2 changes: 1 addition & 1 deletion build/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PropertyGroup>
<MajorVersion>1</MajorVersion>
<MinorVersion>0</MinorVersion>
<Build>2</Build>
<Build>23</Build>
<Revision>0</Revision>


Expand Down
4 changes: 2 additions & 2 deletions common/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyVersion("1.0.23.0")]
[assembly: AssemblyFileVersion("1.0.23.0")]
39 changes: 20 additions & 19 deletions src/PCLStorage.Abstractions/FileExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,25 @@ public static async Task<string> ReadAllTextAsync(this IFile file)
return text;
}
}
}

/// <summary>
/// Writes text to a file, overwriting any existing data
/// </summary>
/// <param name="file">The file to write to</param>
/// <param name="contents">The content to write to the file</param>
/// <returns>A task which completes when the write operation finishes</returns>
public static async Task WriteAllTextAsync(this IFile file, string contents)
{
using (var stream = await file.OpenAsync(FileAccess.ReadAndWrite).ConfigureAwait(false))
{
stream.SetLength(0);
using (var sw = new StreamWriter(stream))
{
await sw.WriteAsync(contents).ConfigureAwait(false);
}
}
}
}

/// <summary>
/// Writes text to a file, overwriting any existing data
/// </summary>
/// <param name="file">The file to write to</param>
/// <param name="contents">The content to write to the file</param>
/// <returns>A task which completes when the write operation finishes</returns>
public static async Task WriteAllTextAsync(this IFile file, string contents)
{
using (var stream = await file.OpenAsync(FileAccess.ReadAndWrite).ConfigureAwait(false))
{
stream.SetLength(0);
using (var sw = new StreamWriter(stream))
{
await sw.WriteAsync(contents).ConfigureAwait(false);
}
}
}

}
}
46 changes: 36 additions & 10 deletions src/PCLStorage.Abstractions/IFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public interface IFile
/// <returns>A <see cref="Stream"/> which can be used to read from or write to the file</returns>
Task<Stream> OpenAsync(FileAccess fileAccess, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Writes a stream to the file
/// </summary>
/// <param name="stream">The data stream which should be written to the file.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns><see cref="bool"/>Returns true for success.</returns>
Task<bool> WriteAsync(Stream stream, CancellationToken cancellationToken);

/// <summary>
/// Deletes the file
/// </summary>
Expand All @@ -63,15 +71,33 @@ public interface IFile
/// <returns>
/// A task which will complete after the file is renamed.
/// </returns>
Task RenameAsync(string newName, NameCollisionOption collisionOption = NameCollisionOption.FailIfExists, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Moves a file.
/// </summary>
/// <param name="newPath">The new full path of the file.</param>
/// <param name="collisionOption">How to deal with collisions with existing files.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task which will complete after the file is moved.</returns>
Task MoveAsync(string newPath, NameCollisionOption collisionOption = NameCollisionOption.ReplaceExisting, CancellationToken cancellationToken = default(CancellationToken));
Task RenameAsync(string newName, NameCollisionOption collisionOption = NameCollisionOption.FailIfExists, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Moves a file.
/// </summary>
/// <param name="newPath">The new full path of the file.</param>
/// <param name="collisionOption">How to deal with collisions with existing files.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task which will complete after the file is moved.</returns>
Task MoveAsync(string newPath, NameCollisionOption collisionOption = NameCollisionOption.ReplaceExisting, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Copy a file.
/// </summary>
/// <param name="newPath">The new full path of the file.</param>
/// <param name="collisionOption">How to deal with collisions with existing files.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task which will complete after the file is moved.</returns>
Task CopyAsync(string newPath, NameCollisionOption collisionOption = NameCollisionOption.ReplaceExisting, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Extract a zip file.
/// </summary>
/// <param name="desinationFolder">The destination folder for zip file extraction</param>
/// <param name="collisionOption">How to deal with collisions with existing files.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task which will complete after the file is moved.</returns>
Task<List<string>> ExtractZipAsync(IFolder desinationFolder, NameCollisionOption collisionOption = NameCollisionOption.ReplaceExisting, CancellationToken cancellationToken = default(CancellationToken));
}
}
9 changes: 9 additions & 0 deletions src/PCLStorage.Abstractions/IFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,14 @@ public interface IFileSystem
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A folder for the specified path, or null if it does not exist.</returns>
Task<IFolder> GetFolderFromPathAsync(string path, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// Gets a file from the App Bundle. Returns null if the file does not exist.
/// </summary>
/// <param name="path">The path to a file, as returned from the <see cref="IFile.Path"/> property.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A file for the given path, or null if it does not exist.</returns>
Task<IFile> GetFileFromAppBundleAsync(string path, CancellationToken cancellationToken);

}
}
166 changes: 83 additions & 83 deletions src/PCLStorage.Abstractions/PCLStorage.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EEBB53F3-EBDF-4DD0-82E5-FF9A2C8DBD72}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PCLStorage</RootNamespace>
<AssemblyName>PCLStorage.Abstractions</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile158</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\PCLStorage.Abstractions.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\PCLStorage.Abstractions.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\common\strongnamekey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\common\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ExistenceCheckResult.cs" />
<Compile Include="FileExtensions.cs" />
<Compile Include="IFile.cs" />
<Compile Include="IFileSystem.cs" />
<Compile Include="IFolder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NameCollisionOption.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.IO">
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl5+win8+wp8\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl5+win8+wp8\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl5+win8+wp8\System.Threading.Tasks.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EEBB53F3-EBDF-4DD0-82E5-FF9A2C8DBD72}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PCLStorage</RootNamespace>
<AssemblyName>PCLStorage.Abstractions</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile158</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\PCLStorage.Abstractions.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\PCLStorage.Abstractions.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\common\strongnamekey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\common\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ExistenceCheckResult.cs" />
<Compile Include="FileExtensions.cs" />
<Compile Include="IFile.cs" />
<Compile Include="IFileSystem.cs" />
<Compile Include="IFolder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NameCollisionOption.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.165\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.IO">
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl5+win8+wp8\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl5+win8+wp8\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\..\packages\Microsoft.Bcl.1.1.6\lib\portable-net40+sl5+win8+wp8\System.Threading.Tasks.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.13\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-->
</Project>
Loading