Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
v1.0.9 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
scaryghost committed Sep 17, 2018
1 parent de75b64 commit 3f77af1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 33 deletions.
13 changes: 3 additions & 10 deletions MetaWear.Win10.DotNet/MetaWear.Win10.DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,9 @@
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\MbientLab.MetaWear.DotNet.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="MbientLab.MetaWear, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f347d771e6582141, processorArchitecture=MSIL">
<HintPath>..\packages\MetaWear.CSharp.1.0.0\lib\netstandard2.0\MbientLab.MetaWear.dll</HintPath>
<Reference Include="MbientLab.MetaWear, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f347d771e6582141, processorArchitecture=MSIL">
<HintPath>..\packages\MetaWear.CSharp.1.1.0\lib\netstandard2.0\MbientLab.MetaWear.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -67,4 +60,4 @@
</ItemGroup>
<Import Project="..\MetaWear.Win10\MetaWear.Win10.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
2 changes: 1 addition & 1 deletion MetaWear.Win10.DotNet/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.5")]
[assembly: AssemblyFileVersion("1.0.9")]
2 changes: 1 addition & 1 deletion MetaWear.Win10.DotNet/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MetaWear.CSharp" version="1.0.0" targetFramework="net461" />
<package id="MetaWear.CSharp" version="1.1.0" targetFramework="net461" />
</packages>
9 changes: 1 addition & 8 deletions MetaWear.Win10.Uwp/MetaWear.Win10.Uwp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\MetaWear.Win10.Uwp.rd.xml" />
Expand All @@ -133,4 +126,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
4 changes: 2 additions & 2 deletions MetaWear.Win10.Uwp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.5")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.9")]
[assembly: ComVisible(false)]
20 changes: 11 additions & 9 deletions MetaWear.Win10/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ namespace MbientLab.MetaWear.Win10 {
/// </summary>
public class Application {
private class IO : ILibraryIO {
private string macAddr;
private readonly string macAddrStr;

public IO(ulong macAddr) {
this.macAddr = macAddr.ToString("X");
macAddrStr = macAddr.ToString("X");
}

#if WINDOWS_UWP
Expand All @@ -29,7 +29,7 @@ public async Task<Stream> LocalLoadAsync(string key) {
root = await ((await ApplicationData.Current.LocalFolder.TryGetItemAsync(cachePath) != null) ?
ApplicationData.Current.LocalFolder.GetFolderAsync(cachePath) :
ApplicationData.Current.LocalFolder.CreateFolderAsync(cachePath));
folder = await (await root.TryGetItemAsync(macAddr) == null ? root.CreateFolderAsync(macAddr) : root.GetFolderAsync(macAddr));
folder = await (await root.TryGetItemAsync(macAddrStr) == null ? root.CreateFolderAsync(macAddrStr) : root.GetFolderAsync(macAddrStr));

return await folder.OpenStreamForReadAsync(string.Format("{0}.bin", key));
}
Expand All @@ -40,19 +40,19 @@ public async Task LocalSaveAsync(string key, byte[] data) {
root = await ((await ApplicationData.Current.LocalFolder.TryGetItemAsync(cachePath) != null) ?
ApplicationData.Current.LocalFolder.GetFolderAsync(cachePath) :
ApplicationData.Current.LocalFolder.CreateFolderAsync(cachePath));
folder = await (await root.TryGetItemAsync(macAddr) == null ? root.CreateFolderAsync(macAddr) : root.GetFolderAsync(macAddr));
folder = await (await root.TryGetItemAsync(macAddrStr) == null ? root.CreateFolderAsync(macAddrStr) : root.GetFolderAsync(macAddrStr));

using (var stream = await folder.OpenStreamForWriteAsync(string.Format("{0}.bin", key), CreationCollisionOption.ReplaceExisting)) {
stream.Write(data, 0, data.Length);
}
}
#else
public async Task<Stream> LocalLoadAsync(string key) {
return await Task.FromResult(File.Open(Path.Combine(Directory.GetCurrentDirectory(), cachePath, macAddr, key), FileMode.Open));
return await Task.FromResult(File.Open(Path.Combine(Directory.GetCurrentDirectory(), cachePath, macAddrStr, key), FileMode.Open));
}

public Task LocalSaveAsync(string key, byte[] data) {
var root = Path.Combine(Directory.GetCurrentDirectory(), cachePath, macAddr);
var root = Path.Combine(Directory.GetCurrentDirectory(), cachePath, macAddrStr);
if (!Directory.Exists(root)) {
Directory.CreateDirectory(root);
}
Expand Down Expand Up @@ -110,8 +110,9 @@ public static void RemoveMetaWearBoard(BluetoothLEDevice device, bool dispose =
/// <param name="device">BluetoothLE device to clear</param>
/// <returns>Null task</returns>
public static async Task ClearDeviceCacheAsync(BluetoothLEDevice device) {
#if WINDOWS_UWP
var macAddr = device.BluetoothAddress.ToString("X");

#if WINDOWS_UWP
var root = await((await ApplicationData.Current.LocalFolder.TryGetItemAsync(cachePath) != null) ?
ApplicationData.Current.LocalFolder.GetFolderAsync(cachePath) :
ApplicationData.Current.LocalFolder.CreateFolderAsync(cachePath));
Expand All @@ -120,10 +121,11 @@ public static async Task ClearDeviceCacheAsync(BluetoothLEDevice device) {
await (await root.GetFolderAsync(macAddr)).DeleteAsync();
}
#else
var macAddr = device.BluetoothAddress.ToString("X");
var path = Path.Combine(cachePath, macAddr);

File.Delete(path);
if (Directory.Exists(path)) {
Directory.Delete(path, true);
}
await Task.CompletedTask;
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata minClientVersion="4.1">
<id>MetaWear.CSharp.Win10</id>
<title>MetaWear C# SDK (Windows 10)</title>
<version>1.0.1</version>
<version>1.0.9</version>
<authors>MbientLab</authors>
<owners>MbientLab</owners>
<licenseUrl>https://raw.githubusercontent.com/mbientlab/MetaWear-SDK-CSharp/master/LICENSE.md</licenseUrl>
Expand All @@ -12,7 +12,7 @@
<copyright>Copyright 2014 - 2018(c). MbientLab Inc</copyright>
<summary>Windows 10 plugins for the MetaWear C# SDK</summary>
<description>Provides Windows 10 specific Bluetooth LE and file i/o code for the MetaWear C# SDK, compatible with both UWP and .NET applications.</description>
<releaseNotes>https://github.com/mbientlab/MetaWear-SDK-CSharp-Plugin-Win10/releases/tag/1.0.1</releaseNotes>
<releaseNotes>https://github.com/mbientlab/MetaWear-SDK-CSharp-Plugin-Win10/releases/tag/1.0.9</releaseNotes>
<tags>bluetoothle metawear metamotion metatracker sensors net4.6.1 uap</tags>
<dependencies>
<group>
Expand Down

0 comments on commit 3f77af1

Please sign in to comment.