Files
react-native-code-push/windows/CodePush/CodePushUtils.cs
Alexander Bodalevsky 6a1d1ffcac WPF:WINDOWS Added ability to update application installed in Program Files folder (#813)
* Updated Windows Example

* Organized usings

* Fix for update application in write protected folder

* Typo fixed

* Examples updated to RNW 0.43.0

* Fixed Warning  CS0108
2017-06-16 13:52:06 +03:00

48 lines
1.2 KiB
C#

using Newtonsoft.Json.Linq;
using System;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.System.Profile;
namespace CodePush.ReactNative
{
internal partial class CodePushUtils
{
internal static string GetFileBundlePrefix()
{
return CodePushConstants.FileBundlePrefix;
}
internal async static Task<JObject> GetJObjectFromFileAsync(StorageFile file)
{
string jsonString = await FileIO.ReadTextAsync(file).AsTask().ConfigureAwait(false);
if (jsonString.Length == 0)
{
return new JObject();
}
try
{
return JObject.Parse(jsonString);
}
catch (Exception)
{
return null;
}
}
static string GetDeviceIdImpl()
{
HardwareToken token = HardwareIdentification.GetPackageSpecificToken(null);
IBuffer hardwareId = token.Id;
var dataReader = DataReader.FromBuffer(hardwareId);
var bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes);
}
}
}