-
Notifications
You must be signed in to change notification settings - Fork 983
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #695 from MungeParty/master
Added .Net46 side of windows support.
- Loading branch information
Showing
8 changed files
with
869 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RNFS | ||
{ | ||
public struct DiskStatus | ||
{ | ||
public ulong free; | ||
public ulong total; | ||
} | ||
|
||
public class DiskUtil | ||
{ | ||
// Pinvoke for API function | ||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern bool GetDiskFreeSpaceEx(string lpDirectoryName, | ||
out ulong lpFreeBytesAvailable, | ||
out ulong lpTotalNumberOfBytes, | ||
out ulong lpTotalNumberOfFreeBytes); | ||
|
||
public static bool DriveFreeBytes(string folderName, out DiskStatus status) | ||
{ | ||
if (string.IsNullOrEmpty(folderName)) | ||
{ | ||
throw new ArgumentNullException("folderName"); | ||
} | ||
|
||
if (!folderName.EndsWith("\\")) | ||
{ | ||
folderName += '\\'; | ||
} | ||
|
||
ulong dummy; | ||
if (GetDiskFreeSpaceEx(folderName, out status.free, out status.total, out dummy)) | ||
{ | ||
return true; | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("RNFS")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("RNFS")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// 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.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] | ||
[assembly: ComVisible(false)] | ||
|
||
[assembly: InternalsVisibleTo("RNFS.Tests")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
This file contains Runtime Directives, specifications about types your application accesses | ||
through reflection and other dynamic code patterns. Runtime Directives are used to control the | ||
.NET Native optimizer and ensure that it does not remove code accessed by your library. If your | ||
library does not do any reflection, then you generally do not need to edit this file. However, | ||
if your library reflects over types, especially types passed to it or derived from its types, | ||
then you should write Runtime Directives. | ||
The most common use of reflection in libraries is to discover information about types passed | ||
to the library. Runtime Directives have three ways to express requirements on types passed to | ||
your library. | ||
1. Parameter, GenericParameter, TypeParameter, TypeEnumerableParameter | ||
Use these directives to reflect over types passed as a parameter. | ||
2. SubTypes | ||
Use a SubTypes directive to reflect over types derived from another type. | ||
3. AttributeImplies | ||
Use an AttributeImplies directive to indicate that your library needs to reflect over | ||
types or methods decorated with an attribute. | ||
For more information on writing Runtime Directives for libraries, please visit | ||
http://go.microsoft.com/fwlink/?LinkID=391919 | ||
--> | ||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> | ||
<Library Name="RNFS"> | ||
|
||
<!-- add directives for your library here --> | ||
|
||
</Library> | ||
</Directives> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.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> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform> | ||
<ProjectGuid>{746610D0-8693-11E7-A20D-BF83F7366778}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>RNFS</RootNamespace> | ||
<AssemblyName>RNFS</AssemblyName> | ||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<OutputPath>bin\x86\Debug\</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<OutputPath>bin\x86\Release\</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<OutputPath>bin\x64\Debug\</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<OutputPath>bin\x64\Release\</OutputPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Syroot.KnownFolders, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>$(SolutionDir)\packages\Syroot.Windows.IO.KnownFolders.1.2.1\lib\net452\Syroot.KnownFolders.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Security" /> | ||
<Reference Include="WindowsBase" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="DiskUtil.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="RNFSManager.cs" /> | ||
<Compile Include="RNFSPackage.cs" /> | ||
<EmbeddedResource Include="Properties\RNFS.rd.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="$(SolutionDir)\..\node_modules\react-native-windows\ReactWindows\ReactNative.Net46\ReactNative.Net46.csproj"> | ||
<Project>{22cbff9c-fe36-43e8-a246-266c7635e662}</Project> | ||
<Name>ReactNative.Net46</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- 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> |
Oops, something went wrong.