mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-19 19:39:54 +08:00
* 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
48 lines
1.2 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|