Merge pull request #115 from onerain88/unity-support

Unity support
oneRain 2021-04-08 13:58:18 +08:00 committed by GitHub
commit 93bc79f9c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 495 additions and 200 deletions

View File

@ -12,7 +12,9 @@
<Folder Include="Task\" /> <Folder Include="Task\" />
<Folder Include="Exception\" /> <Folder Include="Exception\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Libs\Newtonsoft.Json\LC.Newtonsoft.Json.csproj" /> <ProjectReference Include="..\..\Libs\Newtonsoft.Json\LC.Newtonsoft.Json.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -14,7 +14,7 @@ namespace LeanCloud.Engine {
return new Dictionary<string, string> { return new Dictionary<string, string> {
{ "runtime", $"dotnet-{Environment.Version}" }, { "runtime", $"dotnet-{Environment.Version}" },
{ "version", LCApplication.SDKVersion } { "version", LCInternalApplication.SDKVersion }
}; };
} }
} }

View File

@ -8,8 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common\Common.csproj" /> <ProjectReference Include="..\Storage\Storage.Standard\Storage.Standard.csproj" />
<ProjectReference Include="..\Storage\Storage\Storage.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" /> <FrameworkReference Include="Microsoft.AspNetCore.App" />

View File

@ -99,7 +99,7 @@ namespace LeanCloud.Engine {
LCApplication.Initialize(Environment.GetEnvironmentVariable("LEANCLOUD_APP_ID"), LCApplication.Initialize(Environment.GetEnvironmentVariable("LEANCLOUD_APP_ID"),
Environment.GetEnvironmentVariable("LEANCLOUD_APP_KEY"), Environment.GetEnvironmentVariable("LEANCLOUD_APP_KEY"),
Environment.GetEnvironmentVariable("LEANCLOUD_API_SERVER")); Environment.GetEnvironmentVariable("LEANCLOUD_API_SERVER"));
LCApplication.AddHeader(LCHookKeyName, Environment.GetEnvironmentVariable("LEANCLOUD_APP_HOOK_KEY")); LCInternalApplication.AddHeader(LCHookKeyName, Environment.GetEnvironmentVariable("LEANCLOUD_APP_HOOK_KEY"));
Assembly assembly = Assembly.GetCallingAssembly(); Assembly assembly = Assembly.GetCallingAssembly();
ClassHooks = assembly.GetTypes() ClassHooks = assembly.GetTypes()

View File

@ -23,7 +23,7 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<!-- Include PDB in the built .nupkg --> <!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<ReleaseVersion>0.7.1</ReleaseVersion> <ReleaseVersion>0.7.2</ReleaseVersion>
<PackageId>LC.Google.Protobuf</PackageId> <PackageId>LC.Google.Protobuf</PackageId>
</PropertyGroup> </PropertyGroup>

View File

@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<LibraryFrameworks>netstandard2.0</LibraryFrameworks>
<UnityBuild>AOT</UnityBuild> <UnityBuild>AOT</UnityBuild>
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">netstandard2.0;net45;portable-net45+win8+wpa81+wp8</TargetFrameworks> <TargetFrameworks Condition="'$(LibraryFrameworks)'==''">netstandard2.0;net45;portable-net45+win8+wpa81+wp8</TargetFrameworks>
<TargetFrameworks Condition="'$(LibraryFrameworks)'!=''">$(LibraryFrameworks)</TargetFrameworks> <TargetFrameworks Condition="'$(LibraryFrameworks)'!=''">$(LibraryFrameworks)</TargetFrameworks>
@ -35,7 +34,7 @@
<!-- including PDB files in NuGet for source link because symbolsource.org does not support portable PDBs --> <!-- including PDB files in NuGet for source link because symbolsource.org does not support portable PDBs -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ReleaseVersion>0.7.1</ReleaseVersion> <ReleaseVersion>0.7.2</ReleaseVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="**\*.orig" /> <None Remove="**\*.orig" />

View File

@ -30,7 +30,7 @@
<IncludeSymbols>true</IncludeSymbols> <IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat> <SymbolPackageFormat>snupkg</SymbolPackageFormat>
<CodeAnalysisRuleset>Newtonsoft.Json.ruleset</CodeAnalysisRuleset> <CodeAnalysisRuleset>Newtonsoft.Json.ruleset</CodeAnalysisRuleset>
<ReleaseVersion>0.7.1</ReleaseVersion> <ReleaseVersion>0.7.2</ReleaseVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="**\*.orig" /> <None Remove="**\*.orig" />

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>LiveQuery.Standard</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LiveQuery\LiveQuery.csproj" />
<ProjectReference Include="..\..\Realtime\Realtime.Standard\Realtime.Standard.csproj" />
</ItemGroup>
</Project>

View File

@ -14,6 +14,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LiveQuery\LiveQuery.csproj" /> <ProjectReference Include="..\LiveQuery.Standard\LiveQuery.Standard.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>LiveQuery.Unity</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LiveQuery.AOT\LiveQuery.AOT.csproj" />
<ProjectReference Include="..\..\Realtime\Realtime.Unity\Realtime.Unity.csproj" />
</ItemGroup>
</Project>

View File

@ -80,7 +80,7 @@ namespace LeanCloud.LiveQuery {
data.Add("sessionToken", user.SessionToken); data.Add("sessionToken", user.SessionToken);
} }
string path = "LiveQuery/subscribe"; string path = "LiveQuery/subscribe";
Dictionary<string, object> result = await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, Dictionary<string, object> result = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
data: data); data: data);
if (result.TryGetValue("query_id", out object id)) { if (result.TryGetValue("query_id", out object id)) {
Id = id as string; Id = id as string;
@ -95,7 +95,7 @@ namespace LeanCloud.LiveQuery {
{ "query_id", Id } { "query_id", Id }
}; };
string path = "LiveQuery/unsubscribe"; string path = "LiveQuery/unsubscribe";
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
data: data); data: data);
// 移除 // 移除
liveQueries.Remove(Id); liveQueries.Remove(Id);
@ -104,7 +104,7 @@ namespace LeanCloud.LiveQuery {
private static async Task Login() { private static async Task Login() {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "cmd", "login" }, { "cmd", "login" },
{ "appId", LCApplication.AppId }, { "appId", LCInternalApplication.AppId },
{ "installationId", DeviceId }, { "installationId", DeviceId },
{ "clientTs", DateTimeOffset.Now.ToUnixTimeMilliseconds() }, { "clientTs", DateTimeOffset.Now.ToUnixTimeMilliseconds() },
{ "service", 1 } { "service", 1 }

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.1</ReleaseVersion> <ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>Realtime</AssemblyName> <AssemblyName>Realtime</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>Realtime.Standard</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Realtime\Realtime.csproj" />
<ProjectReference Include="..\..\Storage\Storage.Standard\Storage.Standard.csproj" />
</ItemGroup>
</Project>

View File

@ -43,19 +43,19 @@ namespace Realtime.Test {
} }
} }
[Test] //[Test]
public async Task QueryCompact() { //public async Task QueryCompact() {
string memberId = "m1"; // string memberId = "m1";
LCIMConversationQuery query = new LCIMConversationQuery(client) // LCIMConversationQuery query = new LCIMConversationQuery(client)
.WhereEqualTo("m", memberId); // .WhereEqualTo("m", memberId);
query.Compact = true; // query.Compact = true;
ReadOnlyCollection<LCIMConversation> conversations = await query.Find(); // ReadOnlyCollection<LCIMConversation> conversations = await query.Find();
foreach (LCIMConversation conversation in conversations) { // foreach (LCIMConversation conversation in conversations) {
Assert.True(conversation.MemberIds.Count == 0); // Assert.True(conversation.MemberIds.Count == 0);
await conversation.Fetch(); // await conversation.Fetch();
Assert.True(conversation.MemberIds.Count > 0); // Assert.True(conversation.MemberIds.Count > 0);
} // }
} //}
[Test] [Test]
public async Task QueryWithLastMessage() { public async Task QueryWithLastMessage() {

View File

@ -14,7 +14,7 @@ namespace Realtime.Test {
public Task<LCIMSignature> CreateConnectSignature(string clientId) { public Task<LCIMSignature> CreateConnectSignature(string clientId) {
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce(); string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, string.Empty, timestamp.ToString(), nonce); string signature = GenerateSignature(LCInternalApplication.AppId, clientId, string.Empty, timestamp.ToString(), nonce);
return Task.FromResult(new LCIMSignature { return Task.FromResult(new LCIMSignature {
Signature = signature, Signature = signature,
Timestamp = timestamp, Timestamp = timestamp,
@ -31,7 +31,7 @@ namespace Realtime.Test {
} }
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce(); string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, sortedMemberIds, timestamp.ToString(), nonce); string signature = GenerateSignature(LCInternalApplication.AppId, clientId, sortedMemberIds, timestamp.ToString(), nonce);
return Task.FromResult(new LCIMSignature { return Task.FromResult(new LCIMSignature {
Signature = signature, Signature = signature,
Timestamp = timestamp, Timestamp = timestamp,
@ -48,7 +48,7 @@ namespace Realtime.Test {
} }
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce(); string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action); string signature = GenerateSignature(LCInternalApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
return Task.FromResult(new LCIMSignature { return Task.FromResult(new LCIMSignature {
Signature = signature, Signature = signature,
Timestamp = timestamp, Timestamp = timestamp,
@ -65,7 +65,7 @@ namespace Realtime.Test {
} }
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce(); string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action); string signature = GenerateSignature(LCInternalApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
return Task.FromResult(new LCIMSignature { return Task.FromResult(new LCIMSignature {
Signature = signature, Signature = signature,
Timestamp = timestamp, Timestamp = timestamp,

View File

@ -14,6 +14,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Realtime\Realtime\Realtime.csproj" /> <ProjectReference Include="..\Realtime\Realtime.csproj" />
<ProjectReference Include="..\..\Storage\Storage.Standard\Storage.Standard.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -6,7 +6,9 @@ namespace Realtime.Test {
public static class Utils { public static class Utils {
internal static void SetUp() { internal static void SetUp() {
LCLogger.LogDelegate += Print; LCLogger.LogDelegate += Print;
LCApplication.Initialize("3zWMOXuO9iSdnjXM942i6DdI-gzGzoHsz", "bkwiNq4Tj417eUaHlTWS5sPm", "https://3zwmoxuo.lc-cn-n1-shared.com"); LCApplication.Initialize("3zWMOXuO9iSdnjXM942i6DdI-gzGzoHsz",
"bkwiNq4Tj417eUaHlTWS5sPm",
"https://3zwmoxuo.lc-cn-n1-shared.com");
} }
internal static void TearDown() { internal static void TearDown() {

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>Realtime.Unity</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Realtime.AOT\Realtime.AOT.csproj" />
<ProjectReference Include="..\..\Storage\Storage.Unity\Storage.Unity.csproj" />
</ItemGroup>
</Project>

View File

@ -56,7 +56,7 @@ namespace LeanCloud.Realtime.Internal.Connection {
// 发送 ping 包 // 发送 ping 包
GenericCommand command = new GenericCommand { GenericCommand command = new GenericCommand {
Cmd = CommandType.Echo, Cmd = CommandType.Echo,
AppId = LCApplication.AppId, AppId = LCInternalApplication.AppId,
PeerId = connection.id PeerId = connection.id
}; };
try { try {

View File

@ -15,7 +15,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
protected LCConnection Connection { protected LCConnection Connection {
get { get {
return LCRealtime.GetConnection(LCApplication.AppId); return LCRealtime.GetConnection(LCInternalApplication.AppId);
} }
} }
@ -28,7 +28,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
protected GenericCommand NewCommand(CommandType cmd) { protected GenericCommand NewCommand(CommandType cmd) {
return new GenericCommand { return new GenericCommand {
Cmd = cmd, Cmd = cmd,
AppId = LCApplication.AppId, AppId = LCInternalApplication.AppId,
PeerId = Client.Id, PeerId = Client.Id,
}; };
} }

View File

@ -284,7 +284,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
{ "client_id", Client.Id }, { "client_id", Client.Id },
{ "cid", convId } { "cid", convId }
}; };
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path,
headers: headers, queryParams: queryParams); headers: headers, queryParams: queryParams);
List<object> results = response["results"] as List<object>; List<object> results = response["results"] as List<object>;
return results.Select(item => { return results.Select(item => {
@ -341,7 +341,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
GenericCommand command = new GenericCommand { GenericCommand command = new GenericCommand {
Cmd = CommandType.Conv, Cmd = CommandType.Conv,
Op = OpType.Query, Op = OpType.Query,
AppId = LCApplication.AppId, AppId = LCInternalApplication.AppId,
PeerId = Client.Id, PeerId = Client.Id,
}; };
ConvCommand convMessage = new ConvCommand(); ConvCommand convMessage = new ConvCommand();

View File

@ -83,7 +83,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
signature = await Client.SignatureFactory.CreateConnectSignature(Client.Id); signature = await Client.SignatureFactory.CreateConnectSignature(Client.Id);
} }
if (signature == null && !string.IsNullOrEmpty(Client.SessionToken)) { if (signature == null && !string.IsNullOrEmpty(Client.SessionToken)) {
Dictionary<string, object> ret = await LCApplication.HttpClient.Post<Dictionary<string, object>>("rtm/sign", data: new Dictionary<string, object> { Dictionary<string, object> ret = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("rtm/sign", data: new Dictionary<string, object> {
{ "session_token", Client.SessionToken } { "session_token", Client.SessionToken }
}); });
signature = new LCIMSignature { signature = new LCIMSignature {

View File

@ -22,8 +22,8 @@ namespace LeanCloud.Realtime.Internal.Router {
} }
async Task<LCRTMServer> Fetch() { async Task<LCRTMServer> Fetch() {
string server = await LCApplication.AppRouter.GetRealtimeServer(); string server = await LCInternalApplication.AppRouter.GetRealtimeServer();
string url = $"{server}/v1/route?appId={LCApplication.AppId}&secure=1"; string url = $"{server}/v1/route?appId={LCInternalApplication.AppId}&secure=1";
HttpRequestMessage request = new HttpRequestMessage { HttpRequestMessage request = new HttpRequestMessage {
RequestUri = new Uri(url), RequestUri = new Uri(url),

View File

@ -7,6 +7,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\LiveQuery\LiveQuery\LiveQuery.csproj" /> <ProjectReference Include="..\..\LiveQuery\LiveQuery.Standard\LiveQuery.Standard.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -7,6 +7,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Realtime\Realtime\Realtime.csproj" /> <ProjectReference Include="..\..\Realtime\Realtime.Standard\Realtime.Standard.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.1</ReleaseVersion> <ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>Storage</AssemblyName> <AssemblyName>Storage</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
@ -41,8 +41,8 @@
<Compile Include="..\Storage\LCStatus.cs"> <Compile Include="..\Storage\LCStatus.cs">
<Link>Storage\LCStatus.cs</Link> <Link>Storage\LCStatus.cs</Link>
</Compile> </Compile>
<Compile Include="..\Storage\LCApplication.cs"> <Compile Include="..\Storage\LCInternalApplication.cs">
<Link>Storage\LCApplication.cs</Link> <Link>Storage\LCInternalApplication.cs</Link>
</Compile> </Compile>
<Compile Include="..\Storage\LCUser.cs"> <Compile Include="..\Storage\LCUser.cs">
<Link>Storage\LCUser.cs</Link> <Link>Storage\LCUser.cs</Link>
@ -158,6 +158,12 @@
<Compile Include="..\Storage\Internal\Query\LCCompositionalCondition.cs"> <Compile Include="..\Storage\Internal\Query\LCCompositionalCondition.cs">
<Link>Storage\Internal\Query\LCCompositionalCondition.cs</Link> <Link>Storage\Internal\Query\LCCompositionalCondition.cs</Link>
</Compile> </Compile>
<Compile Include="..\Storage\Internal\Storage\StorageController.cs">
<Link>Storage\Internal\Storage\StorageController.cs</Link>
</Compile>
<Compile Include="..\Storage\Internal\Storage\IStorage.cs">
<Link>Storage\Internal\Storage\IStorage.cs</Link>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\Storage\Storage.csproj"> <None Include="..\Storage\Storage.csproj">

View File

@ -0,0 +1,16 @@
using LeanCloud.Storage.Internal.Storage;
namespace LeanCloud {
public class LCApplication {
public static void Initialize(string appId,
string appKey,
string server = null,
string masterKey = null) {
LCLogger.Debug("Application Initializes on Standard.");
LCInternalApplication.Initialize(appId, appKey, server, masterKey);
LCInternalApplication.StorageController = new StorageController(null);
}
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace LeanCloud.Storage.Internal.Storage {
public class StandardStorage : IStorage {
public string GetStoragePath() {
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>Storage.Standard</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Storage\Storage.csproj" />
</ItemGroup>
</Project>

View File

@ -8,13 +8,12 @@ namespace Storage.Test {
public class ACLTest { public class ACLTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -9,13 +9,12 @@ namespace Storage.Test {
public class CaptchaTest { public class CaptchaTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer);
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
//[Test] //[Test]

View File

@ -12,13 +12,12 @@ namespace Storage.Test {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]
@ -72,7 +71,7 @@ namespace Storage.Test {
[Test] [Test]
public async Task AWS() { public async Task AWS() {
LCApplication.Initialize("UlCpyvLm8aMzQsW6KnP6W3Wt-MdYXbMMI", "PyCTYoNoxCVoKKg394PBeS4r"); LCInternalApplication.Initialize("UlCpyvLm8aMzQsW6KnP6W3Wt-MdYXbMMI", "PyCTYoNoxCVoKKg394PBeS4r");
LCFile file = new LCFile("avatar", AvatarFilePath); LCFile file = new LCFile("avatar", AvatarFilePath);
await file.Save((count, total) => { await file.Save((count, total) => {
TestContext.WriteLine($"progress: {count}/{total}"); TestContext.WriteLine($"progress: {count}/{total}");

View File

@ -38,14 +38,12 @@ namespace Storage.Test {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo",
"https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -14,16 +14,15 @@ namespace Storage.Test {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer, Utils.MasterKey); LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer, Utils.MasterKey);
LCApplication.UseMasterKey = true; LCInternalApplication.UseMasterKey = true;
leaderboardName = $"Leaderboard_{DateTimeOffset.Now.DayOfYear}"; leaderboardName = $"Leaderboard_{DateTimeOffset.Now.DayOfYear}";
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCApplication.UseMasterKey = false; LCInternalApplication.UseMasterKey = false;
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -11,13 +11,12 @@ namespace Storage.Test {
public class ObjectTest { public class ObjectTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -1,20 +1,18 @@
using NUnit.Framework; using NUnit.Framework;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage; using LeanCloud.Storage;
namespace Storage.Test { namespace Storage.Test {
public class OperationTest { public class OperationTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -2,20 +2,18 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage; using LeanCloud.Storage;
namespace Storage.Test { namespace Storage.Test {
public class QueryTest { public class QueryTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -1,20 +1,18 @@
using NUnit.Framework; using NUnit.Framework;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using LeanCloud;
using LeanCloud.Storage; using LeanCloud.Storage;
namespace Storage.Test { namespace Storage.Test {
public class RelationTest { public class RelationTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -2,7 +2,6 @@
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Threading.Tasks; using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage; using LeanCloud.Storage;
namespace Storage.Test { namespace Storage.Test {
@ -10,13 +9,12 @@ namespace Storage.Test {
public class RoleTest { public class RoleTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -1,20 +1,18 @@
using NUnit.Framework; using NUnit.Framework;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage; using LeanCloud.Storage;
namespace Storage.Test { namespace Storage.Test {
public class SMSTest { public class SMSTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer);
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
//[Test] //[Test]

View File

@ -3,7 +3,6 @@ using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using LeanCloud;
using LeanCloud.Storage; using LeanCloud.Storage;
namespace Storage.Test { namespace Storage.Test {
@ -14,14 +13,12 @@ namespace Storage.Test {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo",
"https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -17,6 +17,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Storage\Storage\Storage.csproj" /> <ProjectReference Include="..\Storage.Standard\Storage.Standard.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -39,13 +39,12 @@ namespace Storage.Test {
public class SubClassTest { public class SubClassTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]

View File

@ -10,13 +10,12 @@ namespace Storage.Test {
public class UserTest { public class UserTest {
[SetUp] [SetUp]
public void SetUp() { public void SetUp() {
LCLogger.LogDelegate += Utils.Print; Utils.SetUp();
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
} }
[TearDown] [TearDown]
public void TearDown() { public void TearDown() {
LCLogger.LogDelegate -= Utils.Print; Utils.TearDown();
} }
[Test] [Test]
@ -48,7 +47,7 @@ namespace Storage.Test {
LCUser current = await LCUser.GetCurrent(); LCUser current = await LCUser.GetCurrent();
Assert.NotNull(current.ObjectId); Assert.NotNull(current.ObjectId);
Assert.IsFalse(current.EmailVerified); Assert.IsFalse(current.EmailVerified);
Assert.IsFalse(current.MobileVerified); Assert.IsFalse(!current.MobileVerified);
Assert.AreEqual(current.Mobile, "15101006007"); Assert.AreEqual(current.Mobile, "15101006007");
} }

View File

@ -24,5 +24,14 @@ namespace Storage.Test {
break; break;
} }
} }
internal static void SetUp() {
LCLogger.LogDelegate += Print;
LCApplication.Initialize(AppId, AppKey, AppServer);
}
internal static void TearDown() {
LCLogger.LogDelegate -= Print;
}
} }
} }

View File

@ -0,0 +1,16 @@
using LeanCloud.Storage.Internal.Storage;
namespace LeanCloud {
public class LCApplication {
public static void Initialize(string appId,
string appKey,
string server = null,
string masterKey = null) {
LCLogger.Debug("Application Initializes on Unity.");
LCInternalApplication.Initialize(appId, appKey, server, masterKey);
LCInternalApplication.StorageController = new StorageController(new UnityStorage());
}
}
}

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ReleaseVersion>0.7.2</ReleaseVersion>
<AssemblyName>Storage.Unity</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Storage.AOT\Storage.AOT.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="UnityEngine">
<HintPath>..\..\Unity\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
using UnityEngine;
namespace LeanCloud.Storage.Internal.Storage {
public class UnityStorage : IStorage {
public string GetStoragePath() {
return Application.persistentDataPath;
}
}
}

View File

@ -120,7 +120,7 @@ namespace LeanCloud.Storage.Internal.Http {
} }
async Task<string> BuildUrl(string path, Dictionary<string, object> queryParams = null) { async Task<string> BuildUrl(string path, Dictionary<string, object> queryParams = null) {
string apiServer = await LCApplication.AppRouter.GetApiServer(); string apiServer = await LCInternalApplication.AppRouter.GetApiServer();
string url = $"{apiServer}/{apiVersion}/{path}"; string url = $"{apiServer}/{apiVersion}/{path}";
if (queryParams != null) { if (queryParams != null) {
IEnumerable<string> queryPairs = queryParams.Select(kv => $"{kv.Key}={kv.Value}"); IEnumerable<string> queryPairs = queryParams.Select(kv => $"{kv.Key}={kv.Value}");
@ -137,9 +137,9 @@ namespace LeanCloud.Storage.Internal.Http {
headers.Add(kv.Key, kv.Value.ToString()); headers.Add(kv.Key, kv.Value.ToString());
} }
} }
if (LCApplication.UseMasterKey && !string.IsNullOrEmpty(LCApplication.MasterKey)) { if (LCInternalApplication.UseMasterKey && !string.IsNullOrEmpty(LCInternalApplication.MasterKey)) {
// Master Key // Master Key
headers.Add("X-LC-Key", $"{LCApplication.MasterKey},master"); headers.Add("X-LC-Key", $"{LCInternalApplication.MasterKey},master");
} else { } else {
// 签名 // 签名
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
@ -148,8 +148,8 @@ namespace LeanCloud.Storage.Internal.Http {
string sign = $"{hash},{timestamp}"; string sign = $"{hash},{timestamp}";
headers.Add("X-LC-Sign", sign); headers.Add("X-LC-Sign", sign);
} }
if (LCApplication.AdditionalHeaders.Count > 0) { if (LCInternalApplication.AdditionalHeaders.Count > 0) {
foreach (KeyValuePair<string, string> kv in LCApplication.AdditionalHeaders) { foreach (KeyValuePair<string, string> kv in LCInternalApplication.AdditionalHeaders) {
headers.Add(kv.Key, kv.Value); headers.Add(kv.Key, kv.Value);
} }
} }

View File

@ -0,0 +1,7 @@
using System;
namespace LeanCloud.Storage.Internal.Storage {
public interface IStorage {
string GetStoragePath();
}
}

View File

@ -0,0 +1,71 @@
using System;
using System.Reflection;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using System.Text;
using System.Collections.Generic;
using IOFile = System.IO.File;
namespace LeanCloud.Storage.Internal.Storage {
public class StorageController {
private readonly IStorage storage;
public StorageController(IStorage storage) {
this.storage = storage;
}
public async Task WriteText(string filename, string text) {
if (storage == null) {
return;
}
string path = GetFileFullPath(filename);
LCLogger.Debug($"WRITE: {path}");
LCLogger.Debug($"WRITE: {text}");
using (FileStream fs = IOFile.OpenWrite(path)) {
byte[] buffer = Encoding.UTF8.GetBytes(text);
await fs.WriteAsync(buffer, 0, buffer.Length);
}
}
public async Task<string> ReadText(string filename) {
if (storage == null) {
return null;
}
string path = GetFileFullPath(filename);
LCLogger.Debug($"READ: {path}");
if (IOFile.Exists(path)) {
string text;
using (FileStream fs = IOFile.OpenRead(path)) {
byte[] buffer = new byte[fs.Length];
await fs.ReadAsync(buffer, 0, (int)fs.Length);
text = Encoding.UTF8.GetString(buffer);
}
LCLogger.Debug($"READ: {text}");
return text;
}
return null;
}
public Task Delete(string filename) {
if (storage == null) {
return Task.CompletedTask;
}
string path = GetFileFullPath(filename);
return Task.Run(() => {
IOFile.Delete(path);
});
}
private string GetFileFullPath(string filename) {
if (storage == null) {
throw new Exception("no IStrorage.");
}
return Path.Combine(storage.GetStoragePath(), filename);
}
}
}

View File

@ -33,7 +33,7 @@ namespace LeanCloud.Storage {
{ "width", width }, { "width", width },
{ "height", height } { "height", height }
}; };
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: queryParams); Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: queryParams);
return new LCCapture { return new LCCapture {
Url = response["captcha_url"] as string, Url = response["captcha_url"] as string,
Token = response["captcha_token"] as string Token = response["captcha_token"] as string
@ -60,7 +60,7 @@ namespace LeanCloud.Storage {
{ "captcha_code", code }, { "captcha_code", code },
{ "captcha_token", token } { "captcha_token", token }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
} }
} }

View File

@ -30,7 +30,7 @@ namespace LeanCloud.Storage {
{ PRODUCTION_KEY, IsProduction ? 1 : 0 } { PRODUCTION_KEY, IsProduction ? 1 : 0 }
}; };
object encodeParams = LCEncoder.Encode(parameters); object encodeParams = LCEncoder.Encode(parameters);
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, Dictionary<string, object> response = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
headers: headers, headers: headers,
data: encodeParams); data: encodeParams);
return response; return response;
@ -57,7 +57,7 @@ namespace LeanCloud.Storage {
{ PRODUCTION_KEY, IsProduction ? 1 : 0 } { PRODUCTION_KEY, IsProduction ? 1 : 0 }
}; };
object encodeParams = Encode(parameters); object encodeParams = Encode(parameters);
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, Dictionary<string, object> response = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
headers: headers, headers: headers,
data: encodeParams); data: encodeParams);
return LCDecoder.Decode(response["result"]); return LCDecoder.Decode(response["result"]);

View File

@ -92,12 +92,12 @@ namespace LeanCloud.Storage {
} }
LCObjectData objectData = LCObjectData.Decode(uploadToken); LCObjectData objectData = LCObjectData.Decode(uploadToken);
Merge(objectData); Merge(objectData);
_ = LCApplication.HttpClient.Post<Dictionary<string, object>>("fileCallback", data: new Dictionary<string, object> { _ = LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("fileCallback", data: new Dictionary<string, object> {
{ "result", true }, { "result", true },
{ "token", token } { "token", token }
}); });
} catch (Exception e) { } catch (Exception e) {
_ = LCApplication.HttpClient.Post<Dictionary<string, object>>("fileCallback", data: new Dictionary<string, object> { _ = LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("fileCallback", data: new Dictionary<string, object> {
{ "result", false }, { "result", false },
{ "token", token } { "token", token }
}); });
@ -112,7 +112,7 @@ namespace LeanCloud.Storage {
return; return;
} }
string path = $"files/{ObjectId}"; string path = $"files/{ObjectId}";
await LCApplication.HttpClient.Delete(path); await LCInternalApplication.HttpClient.Delete(path);
} }
public string GetThumbnailUrl(int width, int height, int quality = 100, bool scaleToFit = true, string format = "png") { public string GetThumbnailUrl(int width, int height, int quality = 100, bool scaleToFit = true, string format = "png") {
@ -128,7 +128,7 @@ namespace LeanCloud.Storage {
{ "mime_type", MimeType }, { "mime_type", MimeType },
{ "metaData", MetaData } { "metaData", MetaData }
}; };
return await LCApplication.HttpClient.Post<Dictionary<string, object>>("fileTokens", data: data); return await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("fileTokens", data: data);
} }
public static LCQuery<LCFile> GetQuery() { public static LCQuery<LCFile> GetQuery() {

View File

@ -19,7 +19,7 @@ namespace LeanCloud.Storage {
if (attributes != null) { if (attributes != null) {
data["friendship"] = attributes; data["friendship"] = attributes;
} }
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
public static async Task AcceptRequest(LCFriendshipRequest request, Dictionary<string, object> attributes = null) { public static async Task AcceptRequest(LCFriendshipRequest request, Dictionary<string, object> attributes = null) {
@ -33,7 +33,7 @@ namespace LeanCloud.Storage {
{ "friendship", attributes } { "friendship", attributes }
}; };
} }
await LCApplication.HttpClient.Put<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>(path, data: data);
} }
public static async Task DeclineRequest(LCFriendshipRequest request) { public static async Task DeclineRequest(LCFriendshipRequest request) {
@ -41,7 +41,7 @@ namespace LeanCloud.Storage {
throw new ArgumentNullException(nameof(request)); throw new ArgumentNullException(nameof(request));
} }
string path = $"users/friendshipRequests/{request.ObjectId}/decline"; string path = $"users/friendshipRequests/{request.ObjectId}/decline";
await LCApplication.HttpClient.Put<Dictionary<string, object>>(path); await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>(path);
} }
} }
} }

View File

@ -3,12 +3,13 @@ using System.Collections.Generic;
using LeanCloud.Common; using LeanCloud.Common;
using LeanCloud.Storage; using LeanCloud.Storage;
using LeanCloud.Storage.Internal.Http; using LeanCloud.Storage.Internal.Http;
using LeanCloud.Storage.Internal.Storage;
namespace LeanCloud { namespace LeanCloud {
/// <summary> /// <summary>
/// LeanCloud Application /// LeanCloud Application
/// </summary> /// </summary>
public class LCApplication { public class LCInternalApplication {
// SDK 版本号,用于 User-Agent 统计 // SDK 版本号,用于 User-Agent 统计
public const string SDKVersion = "0.7.2"; public const string SDKVersion = "0.7.2";
@ -43,6 +44,10 @@ namespace LeanCloud {
get; set; get; set;
} }
public static StorageController StorageController {
get; set;
}
internal static Dictionary<string, string> AdditionalHeaders { internal static Dictionary<string, string> AdditionalHeaders {
get; get;
} = new Dictionary<string, string>(); } = new Dictionary<string, string>();

View File

@ -304,7 +304,7 @@ namespace LeanCloud.Storage {
{ "requests", LCEncoder.Encode(requestList) } { "requests", LCEncoder.Encode(requestList) }
}; };
List<Dictionary<string, object>> results = await LCApplication.HttpClient.Post<List<Dictionary<string, object>>>("batch", data: data); List<Dictionary<string, object>> results = await LCInternalApplication.HttpClient.Post<List<Dictionary<string, object>>>("batch", data: data);
List<LCObjectData> resultList = results.Select(item => { List<LCObjectData> resultList = results.Select(item => {
if (item.TryGetValue("error", out object error)) { if (item.TryGetValue("error", out object error)) {
Dictionary<string, object> err = error as Dictionary<string, object>; Dictionary<string, object> err = error as Dictionary<string, object>;
@ -342,8 +342,8 @@ namespace LeanCloud.Storage {
queryParams["where"] = query.BuildWhere(); queryParams["where"] = query.BuildWhere();
} }
Dictionary<string, object> response = ObjectId == null ? Dictionary<string, object> response = ObjectId == null ?
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: LCEncoder.Encode(operationDict) as Dictionary<string, object>, queryParams: queryParams) : await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: LCEncoder.Encode(operationDict) as Dictionary<string, object>, queryParams: queryParams) :
await LCApplication.HttpClient.Put<Dictionary<string, object>>(path, data: LCEncoder.Encode(operationDict) as Dictionary<string, object>, queryParams: queryParams); await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>(path, data: LCEncoder.Encode(operationDict) as Dictionary<string, object>, queryParams: queryParams);
LCObjectData data = LCObjectData.Decode(response); LCObjectData data = LCObjectData.Decode(response);
Merge(data); Merge(data);
return this; return this;
@ -368,7 +368,7 @@ namespace LeanCloud.Storage {
return; return;
} }
string path = $"classes/{ClassName}/{ObjectId}"; string path = $"classes/{ClassName}/{ObjectId}";
await LCApplication.HttpClient.Delete(path); await LCInternalApplication.HttpClient.Delete(path);
} }
public static async Task DeleteAll(IEnumerable<LCObject> objects) { public static async Task DeleteAll(IEnumerable<LCObject> objects) {
@ -377,7 +377,7 @@ namespace LeanCloud.Storage {
} }
HashSet<LCObject> objectSet = new HashSet<LCObject>(objects.Where(item => item.ObjectId != null)); HashSet<LCObject> objectSet = new HashSet<LCObject>(objects.Where(item => item.ObjectId != null));
List<Dictionary<string, object>> requestList = objectSet.Select(item => { List<Dictionary<string, object>> requestList = objectSet.Select(item => {
string path = $"/{LCApplication.APIVersion}/classes/{item.ClassName}/{item.ObjectId}"; string path = $"/{LCInternalApplication.APIVersion}/classes/{item.ClassName}/{item.ObjectId}";
return new Dictionary<string, object> { return new Dictionary<string, object> {
{ "path", path }, { "path", path },
{ "method", "DELETE" } { "method", "DELETE" }
@ -386,7 +386,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "requests", LCEncoder.Encode(requestList) } { "requests", LCEncoder.Encode(requestList) }
}; };
await LCApplication.HttpClient.Post<List<object>>("batch", data: data); await LCInternalApplication.HttpClient.Post<List<object>>("batch", data: data);
} }
public async Task<LCObject> Fetch(IEnumerable<string> keys = null, IEnumerable<string> includes = null) { public async Task<LCObject> Fetch(IEnumerable<string> keys = null, IEnumerable<string> includes = null) {
@ -398,7 +398,7 @@ namespace LeanCloud.Storage {
queryParams["include"] = string.Join(",", includes); queryParams["include"] = string.Join(",", includes);
} }
string path = $"classes/{ClassName}/{ObjectId}"; string path = $"classes/{ClassName}/{ObjectId}";
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: queryParams); Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: queryParams);
LCObjectData objectData = LCObjectData.Decode(response); LCObjectData objectData = LCObjectData.Decode(response);
Merge(objectData); Merge(objectData);
return this; return this;
@ -411,7 +411,7 @@ namespace LeanCloud.Storage {
IEnumerable<LCObject> uniqueObjects = objects.Where(item => item.ObjectId != null); IEnumerable<LCObject> uniqueObjects = objects.Where(item => item.ObjectId != null);
List<Dictionary<string, object>> requestList = uniqueObjects.Select(item => { List<Dictionary<string, object>> requestList = uniqueObjects.Select(item => {
string path = $"/{LCApplication.APIVersion}/classes/{item.ClassName}/{item.ObjectId}"; string path = $"/{LCInternalApplication.APIVersion}/classes/{item.ClassName}/{item.ObjectId}";
return new Dictionary<string, object> { return new Dictionary<string, object> {
{ "path", path }, { "path", path },
{ "method", "GET" } { "method", "GET" }
@ -421,7 +421,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "requests", LCEncoder.Encode(requestList) } { "requests", LCEncoder.Encode(requestList) }
}; };
List<Dictionary<string, object>> results = await LCApplication.HttpClient.Post<List<Dictionary<string, object>>>("batch", List<Dictionary<string, object>> results = await LCInternalApplication.HttpClient.Post<List<Dictionary<string, object>>>("batch",
data: data); data: data);
Dictionary<string, LCObjectData> dict = new Dictionary<string, LCObjectData>(); Dictionary<string, LCObjectData> dict = new Dictionary<string, LCObjectData>();
foreach (Dictionary<string, object> item in results) { foreach (Dictionary<string, object> item in results) {
@ -455,7 +455,7 @@ namespace LeanCloud.Storage {
public override string ToString() { public override string ToString() {
Dictionary<string, object> originalData = LCObjectData.Encode(data); Dictionary<string, object> originalData = LCObjectData.Encode(data);
Dictionary<string, object> currentData = estimatedData.Union(originalData.Where(kv => !estimatedData.ContainsKey(kv.Key))) Dictionary<string, object> currentData = estimatedData.Union(originalData.Where(kv => !estimatedData.ContainsKey(kv.Key)))
.ToDictionary(k => k.Key, v => v.Value); .ToDictionary(k => k.Key, v => LCEncoder.Encode(v.Value));
return JsonConvert.SerializeObject(currentData); return JsonConvert.SerializeObject(currentData);
} }

View File

@ -342,7 +342,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> parameters = BuildParams(); Dictionary<string, object> parameters = BuildParams();
parameters["limit"] = 0; parameters["limit"] = 0;
parameters["count"] = 1; parameters["count"] = 1;
Dictionary<string, object> ret = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: parameters); Dictionary<string, object> ret = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: parameters);
return (int)ret["count"]; return (int)ret["count"];
} }
@ -358,14 +358,14 @@ namespace LeanCloud.Storage {
{ "include", includes } { "include", includes }
}; };
} }
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: queryParams); Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: queryParams);
return DecodeLCObject(response); return DecodeLCObject(response);
} }
public async Task<ReadOnlyCollection<T>> Find() { public async Task<ReadOnlyCollection<T>> Find() {
string path = $"classes/{ClassName}"; string path = $"classes/{ClassName}";
Dictionary<string, object> parameters = BuildParams(); Dictionary<string, object> parameters = BuildParams();
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: parameters); Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path, queryParams: parameters);
List<object> results = response["results"] as List<object>; List<object> results = response["results"] as List<object>;
List<T> list = new List<T>(); List<T> list = new List<T>();
foreach (object item in results) { foreach (object item in results) {

View File

@ -43,7 +43,7 @@ namespace LeanCloud.Storage {
data[kv.Key] = kv.Value; data[kv.Key] = kv.Value;
} }
} }
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
/// <summary> /// <summary>
@ -57,7 +57,7 @@ namespace LeanCloud.Storage {
{ "mobilePhoneNumber", mobile }, { "mobilePhoneNumber", mobile },
{ "smsType", "voice" } { "smsType", "voice" }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
public static async Task VerifyMobilePhone(string mobile, string code) { public static async Task VerifyMobilePhone(string mobile, string code) {
@ -65,7 +65,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "mobilePhoneNumber", mobile } { "mobilePhoneNumber", mobile }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
} }
} }

View File

@ -109,7 +109,7 @@ namespace LeanCloud.Storage {
} }
formData["query"] = queryData; formData["query"] = queryData;
} }
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>("statuses", Dictionary<string, object> response = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("statuses",
data: formData); data: formData);
LCObjectData objectData = LCObjectData.Decode(response); LCObjectData objectData = LCObjectData.Decode(response);
Merge(objectData); Merge(objectData);
@ -125,14 +125,14 @@ namespace LeanCloud.Storage {
LCUser source = (Data[SourceKey] ?? this[SourceKey]) as LCUser; LCUser source = (Data[SourceKey] ?? this[SourceKey]) as LCUser;
if (source != null && source.ObjectId == user.ObjectId) { if (source != null && source.ObjectId == user.ObjectId) {
await LCApplication.HttpClient.Delete($"statuses/{ObjectId}"); await LCInternalApplication.HttpClient.Delete($"statuses/{ObjectId}");
} else { } else {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ OwnerKey, JsonConvert.SerializeObject(LCEncoder.Encode(user)) }, { OwnerKey, JsonConvert.SerializeObject(LCEncoder.Encode(user)) },
{ InboxTypeKey, InboxType }, { InboxTypeKey, InboxType },
{ MessageIdKey, MessageId } { MessageIdKey, MessageId }
}; };
await LCApplication.HttpClient.Delete("subscribe/statuses/inbox", queryParams: data); await LCInternalApplication.HttpClient.Delete("subscribe/statuses/inbox", queryParams: data);
} }
} }
@ -148,7 +148,7 @@ namespace LeanCloud.Storage {
if (!string.IsNullOrEmpty(inboxType)) { if (!string.IsNullOrEmpty(inboxType)) {
queryParams[InboxTypeKey] = inboxType; queryParams[InboxTypeKey] = inboxType;
} }
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>("subscribe/statuses/count", Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>("subscribe/statuses/count",
queryParams: queryParams); queryParams: queryParams);
LCStatusCount statusCount = new LCStatusCount { LCStatusCount statusCount = new LCStatusCount {
Total = (int)response["total"], Total = (int)response["total"],
@ -169,7 +169,7 @@ namespace LeanCloud.Storage {
if (!string.IsNullOrEmpty(inboxType)) { if (!string.IsNullOrEmpty(inboxType)) {
queryParams[InboxTypeKey] = inboxType; queryParams[InboxTypeKey] = inboxType;
} }
await LCApplication.HttpClient.Post<Dictionary<string, object>>("subscribe/statuses/resetUnreadCount", await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("subscribe/statuses/resetUnreadCount",
queryParams:queryParams); queryParams:queryParams);
} }
} }

View File

@ -41,7 +41,7 @@ namespace LeanCloud.Storage {
{ "maxId", MaxId }, { "maxId", MaxId },
{ "limit", Condition.Limit } { "limit", Condition.Limit }
}; };
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>("subscribe/statuses", Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>("subscribe/statuses",
queryParams: queryParams); queryParams: queryParams);
List<object> results = response["results"] as List<object>; List<object> results = response["results"] as List<object>;
List<LCStatus> statuses = new List<LCStatus>(); List<LCStatus> statuses = new List<LCStatus>();

View File

@ -8,6 +8,8 @@ namespace LeanCloud.Storage {
public class LCUser : LCObject { public class LCUser : LCObject {
public const string CLASS_NAME = "_User"; public const string CLASS_NAME = "_User";
private const string USER_DATA = ".userdata";
public string Username { public string Username {
get { get {
return this["username"] as string; return this["username"] as string;
@ -76,10 +78,21 @@ namespace LeanCloud.Storage {
static LCUser currentUser; static LCUser currentUser;
public static Task<LCUser> GetCurrent() { public static async Task<LCUser> GetCurrent() {
// TODO 加载持久化数据 if (currentUser != null) {
return currentUser;
}
return Task.FromResult(currentUser); string data = await LCInternalApplication.StorageController.ReadText(USER_DATA);
if (!string.IsNullOrEmpty(data)) {
try {
currentUser = ParseObject(data) as LCUser;
} catch (Exception e) {
LCLogger.Error(e);
await LCInternalApplication.StorageController.Delete(USER_DATA);
}
}
return currentUser;
} }
public LCUser() : base(CLASS_NAME) { public LCUser() : base(CLASS_NAME) {
@ -106,7 +119,8 @@ namespace LeanCloud.Storage {
} }
await Save(); await Save();
currentUser = this; currentUser = this;
// TODO Persistence
await SaveToLocal();
return this; return this;
} }
@ -123,7 +137,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "mobilePhoneNumber", mobile } { "mobilePhoneNumber", mobile }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>("requestLoginSmsCode", data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("requestLoginSmsCode", data: data);
} }
/// <summary> /// <summary>
@ -143,9 +157,12 @@ namespace LeanCloud.Storage {
{ "mobilePhoneNumber", mobile }, { "mobilePhoneNumber", mobile },
{ "smsCode", code } { "smsCode", code }
}; };
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>("usersByMobilePhone", data: data); Dictionary<string, object> response = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("usersByMobilePhone", data: data);
LCObjectData objectData = LCObjectData.Decode(response); LCObjectData objectData = LCObjectData.Decode(response);
currentUser = new LCUser(objectData); currentUser = new LCUser(objectData);
await SaveToLocal();
return currentUser; return currentUser;
} }
@ -353,7 +370,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "email", email } { "email", email }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>("requestEmailVerify", data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("requestEmailVerify", data: data);
} }
/// <summary> /// <summary>
@ -368,7 +385,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "mobilePhoneNumber", mobile } { "mobilePhoneNumber", mobile }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>("requestMobilePhoneVerify", data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("requestMobilePhoneVerify", data: data);
} }
/// <summary> /// <summary>
@ -388,7 +405,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "mobilePhoneNumber", mobile } { "mobilePhoneNumber", mobile }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
/// <summary> /// <summary>
@ -403,7 +420,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> headers = new Dictionary<string, object> { Dictionary<string, object> headers = new Dictionary<string, object> {
{ "X-LC-Session", sessionToken } { "X-LC-Session", sessionToken }
}; };
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>("users/me", Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>("users/me",
headers: headers); headers: headers);
LCObjectData objectData = LCObjectData.Decode(response); LCObjectData objectData = LCObjectData.Decode(response);
currentUser = new LCUser(objectData); currentUser = new LCUser(objectData);
@ -422,7 +439,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "email", email } { "email", email }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>("requestPasswordReset", await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("requestPasswordReset",
data: data); data: data);
} }
@ -438,7 +455,7 @@ namespace LeanCloud.Storage {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "mobilePhoneNumber", mobile } { "mobilePhoneNumber", mobile }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>("requestPasswordResetBySmsCode", await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("requestPasswordResetBySmsCode",
data: data); data: data);
} }
@ -463,7 +480,7 @@ namespace LeanCloud.Storage {
{ "mobilePhoneNumber", mobile }, { "mobilePhoneNumber", mobile },
{ "password", newPassword } { "password", newPassword }
}; };
await LCApplication.HttpClient.Put<Dictionary<string, object>>($"resetPasswordBySmsCode/{code}", await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>($"resetPasswordBySmsCode/{code}",
data: data); data: data);
} }
@ -484,7 +501,7 @@ namespace LeanCloud.Storage {
{ "old_password", oldPassword }, { "old_password", oldPassword },
{ "new_password", newPassword } { "new_password", newPassword }
}; };
Dictionary<string, object> response = await LCApplication.HttpClient.Put<Dictionary<string, object>>( Dictionary<string, object> response = await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>(
$"users/{ObjectId}/updatePassword", data:data); $"users/{ObjectId}/updatePassword", data:data);
LCObjectData objectData = LCObjectData.Decode(response); LCObjectData objectData = LCObjectData.Decode(response);
Merge(objectData); Merge(objectData);
@ -495,9 +512,8 @@ namespace LeanCloud.Storage {
/// </summary> /// </summary>
public static Task Logout() { public static Task Logout() {
currentUser = null; currentUser = null;
// TODO 清理持久化数据 // 清理持久化数据
return LCInternalApplication.StorageController.Delete(USER_DATA);
return Task.FromResult<object>(null);
} }
/// <summary> /// <summary>
@ -509,7 +525,7 @@ namespace LeanCloud.Storage {
return false; return false;
} }
try { try {
await LCApplication.HttpClient.Get<Dictionary<string, object>>("users/me"); await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>("users/me");
return true; return true;
} catch (Exception) { } catch (Exception) {
return false; return false;
@ -532,7 +548,7 @@ namespace LeanCloud.Storage {
try { try {
await Save(); await Save();
oriAuthData[authType] = data; oriAuthData[authType] = data;
UpdateAuthData(oriAuthData); await UpdateAuthData(oriAuthData);
} catch (Exception e) { } catch (Exception e) {
AuthData = oriAuthData; AuthData = oriAuthData;
throw e; throw e;
@ -547,23 +563,27 @@ namespace LeanCloud.Storage {
try { try {
await Save(); await Save();
oriAuthData.Remove(authType); oriAuthData.Remove(authType);
UpdateAuthData(oriAuthData); await UpdateAuthData(oriAuthData);
} catch (Exception e) { } catch (Exception e) {
AuthData = oriAuthData; AuthData = oriAuthData;
throw e; throw e;
} }
} }
private void UpdateAuthData(Dictionary<string, object> authData) { private async Task UpdateAuthData(Dictionary<string, object> authData) {
LCObjectData objData = new LCObjectData(); LCObjectData objData = new LCObjectData();
objData.CustomPropertyDict["authData"] = authData; objData.CustomPropertyDict["authData"] = authData;
Merge(objData); Merge(objData);
await SaveToLocal();
} }
static async Task<LCUser> Login(Dictionary<string, object> data) { static async Task<LCUser> Login(Dictionary<string, object> data) {
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>("login", data: data); Dictionary<string, object> response = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("login", data: data);
LCObjectData objectData = LCObjectData.Decode(response); LCObjectData objectData = LCObjectData.Decode(response);
currentUser = new LCUser(objectData); currentUser = new LCUser(objectData);
await SaveToLocal();
return currentUser; return currentUser;
} }
@ -572,11 +592,14 @@ namespace LeanCloud.Storage {
{ authType, data } { authType, data }
}; };
string path = failOnNotExist ? "users?failOnNotExist=true" : "users"; string path = failOnNotExist ? "users?failOnNotExist=true" : "users";
Dictionary<string, object> response = await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: new Dictionary<string, object> { Dictionary<string, object> response = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: new Dictionary<string, object> {
{ "authData", authData } { "authData", authData }
}); });
LCObjectData objectData = LCObjectData.Decode(response); LCObjectData objectData = LCObjectData.Decode(response);
currentUser = new LCUser(objectData); currentUser = new LCUser(objectData);
await SaveToLocal();
return currentUser; return currentUser;
} }
@ -586,6 +609,15 @@ namespace LeanCloud.Storage {
authData["unionid"] = unionId; authData["unionid"] = unionId;
} }
private static async Task SaveToLocal() {
try {
string json = currentUser.ToString();
await LCInternalApplication.StorageController.WriteText(USER_DATA, json);
} catch (Exception e) {
LCLogger.Error(e.Message);
}
}
/// <summary> /// <summary>
/// Requests an SMS code for updating phone number. /// Requests an SMS code for updating phone number.
/// </summary> /// </summary>
@ -602,7 +634,7 @@ namespace LeanCloud.Storage {
if (!string.IsNullOrEmpty(captchaToken)) { if (!string.IsNullOrEmpty(captchaToken)) {
data["validate_token"] = captchaToken; data["validate_token"] = captchaToken;
} }
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
/// <summary> /// <summary>
@ -617,7 +649,7 @@ namespace LeanCloud.Storage {
{ "mobilePhoneNumber", mobile }, { "mobilePhoneNumber", mobile },
{ "code", code } { "code", code }
}; };
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
} }
/// <summary> /// <summary>
@ -631,7 +663,7 @@ namespace LeanCloud.Storage {
throw new ArgumentNullException(nameof(targetId)); throw new ArgumentNullException(nameof(targetId));
} }
string path = $"users/self/friendship/{targetId}"; string path = $"users/self/friendship/{targetId}";
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: attrs); await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path, data: attrs);
} }
/// <summary> /// <summary>
@ -644,7 +676,7 @@ namespace LeanCloud.Storage {
throw new ArgumentNullException(nameof(targetId)); throw new ArgumentNullException(nameof(targetId));
} }
string path = $"users/self/friendship/{targetId}"; string path = $"users/self/friendship/{targetId}";
await LCApplication.HttpClient.Delete(path); await LCInternalApplication.HttpClient.Delete(path);
} }
/// <summary> /// <summary>
@ -684,7 +716,7 @@ namespace LeanCloud.Storage {
queryParams["include"] = string.Join(",", includes); queryParams["include"] = string.Join(",", includes);
} }
string path = $"users/{ObjectId}/followersAndFollowees"; string path = $"users/{ObjectId}/followersAndFollowees";
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path,
queryParams: queryParams); queryParams: queryParams);
LCFollowersAndFollowees result = new LCFollowersAndFollowees(); LCFollowersAndFollowees result = new LCFollowersAndFollowees();
if (response.TryGetValue("followers", out object followersObj) && if (response.TryGetValue("followers", out object followersObj) &&

View File

@ -68,7 +68,7 @@ namespace LeanCloud.Storage {
{ "updateStrategy", updateStrategy.ToString().ToLower() }, { "updateStrategy", updateStrategy.ToString().ToLower() },
}; };
string path = "leaderboard/leaderboards"; string path = "leaderboard/leaderboards";
Dictionary<string, object> result = await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, Dictionary<string, object> result = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
data:data); data:data);
LCLeaderboard leaderboard = new LCLeaderboard(); LCLeaderboard leaderboard = new LCLeaderboard();
leaderboard.Merge(result); leaderboard.Merge(result);
@ -112,7 +112,7 @@ namespace LeanCloud.Storage {
if (overwrite) { if (overwrite) {
path = $"{path}?overwrite=1"; path = $"{path}?overwrite=1";
} }
Dictionary<string, object> result = await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, Dictionary<string, object> result = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
data: data); data: data);
if (result.TryGetValue("results", out object results) && if (result.TryGetValue("results", out object results) &&
results is List<object> list) { results is List<object> list) {
@ -137,7 +137,7 @@ namespace LeanCloud.Storage {
string names = string.Join(",", statisticNames); string names = string.Join(",", statisticNames);
path = $"{path}?statistics={names}"; path = $"{path}?statistics={names}";
} }
Dictionary<string, object> result = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path); Dictionary<string, object> result = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path);
if (result.TryGetValue("results", out object results) && if (result.TryGetValue("results", out object results) &&
results is List<object> list) { results is List<object> list) {
List<LCStatistic> statistics = new List<LCStatistic>(); List<LCStatistic> statistics = new List<LCStatistic>();
@ -161,7 +161,7 @@ namespace LeanCloud.Storage {
} }
string names = string.Join(",", statisticNames); string names = string.Join(",", statisticNames);
string path = $"leaderboard/users/{user.ObjectId}/statistics?statistics={names}"; string path = $"leaderboard/users/{user.ObjectId}/statistics?statistics={names}";
await LCApplication.HttpClient.Delete(path); await LCInternalApplication.HttpClient.Delete(path);
} }
/// <summary> /// <summary>
@ -179,7 +179,7 @@ namespace LeanCloud.Storage {
throw new ArgumentOutOfRangeException(nameof(limit)); throw new ArgumentOutOfRangeException(nameof(limit));
} }
string path = $"leaderboard/leaderboards/{StatisticName}/archives?skip={skip}&limit={limit}"; string path = $"leaderboard/leaderboards/{StatisticName}/archives?skip={skip}&limit={limit}";
Dictionary<string, object> result = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path); Dictionary<string, object> result = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path);
if (result.TryGetValue("results", out object results) && if (result.TryGetValue("results", out object results) &&
results is List<object> list) { results is List<object> list) {
List<LCLeaderboardArchive> archives = new List<LCLeaderboardArchive>(); List<LCLeaderboardArchive> archives = new List<LCLeaderboardArchive>();
@ -235,7 +235,7 @@ namespace LeanCloud.Storage {
string statistics = string.Join(",", includeStatistics); string statistics = string.Join(",", includeStatistics);
path = $"{path}&includeStatistics={statistics}"; path = $"{path}&includeStatistics={statistics}";
} }
Dictionary<string, object> result = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path); Dictionary<string, object> result = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path);
if (result.TryGetValue("results", out object results) && if (result.TryGetValue("results", out object results) &&
results is List<object> list) { results is List<object> list) {
List<LCRanking> rankings = new List<LCRanking>(); List<LCRanking> rankings = new List<LCRanking>();
@ -254,7 +254,7 @@ namespace LeanCloud.Storage {
{ "updateStrategy", updateStrategy.ToString().ToLower() } { "updateStrategy", updateStrategy.ToString().ToLower() }
}; };
string path = $"leaderboard/leaderboards/{StatisticName}"; string path = $"leaderboard/leaderboards/{StatisticName}";
Dictionary<string, object> result = await LCApplication.HttpClient.Put<Dictionary<string, object>>(path, Dictionary<string, object> result = await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>(path,
data: data); data: data);
if (result.TryGetValue("updateStrategy", out object strategy) && if (result.TryGetValue("updateStrategy", out object strategy) &&
Enum.TryParse(strategy as string, true, out LCLeaderboardUpdateStrategy s)) { Enum.TryParse(strategy as string, true, out LCLeaderboardUpdateStrategy s)) {
@ -269,7 +269,7 @@ namespace LeanCloud.Storage {
{ "versionChangeInterval", versionChangeInterval.ToString().ToLower() } { "versionChangeInterval", versionChangeInterval.ToString().ToLower() }
}; };
string path = $"leaderboard/leaderboards/{StatisticName}"; string path = $"leaderboard/leaderboards/{StatisticName}";
Dictionary<string, object> result = await LCApplication.HttpClient.Put<Dictionary<string, object>>(path, Dictionary<string, object> result = await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>(path,
data: data); data: data);
if (result.TryGetValue("versionChangeInterval", out object interval) && if (result.TryGetValue("versionChangeInterval", out object interval) &&
Enum.TryParse(interval as string, true, out LCLeaderboardVersionChangeInterval i)) { Enum.TryParse(interval as string, true, out LCLeaderboardVersionChangeInterval i)) {
@ -284,7 +284,7 @@ namespace LeanCloud.Storage {
/// <returns></returns> /// <returns></returns>
public async Task<LCLeaderboard> Fetch() { public async Task<LCLeaderboard> Fetch() {
string path = $"leaderboard/leaderboards/{StatisticName}"; string path = $"leaderboard/leaderboards/{StatisticName}";
Dictionary<string, object> result = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path); Dictionary<string, object> result = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path);
Merge(result); Merge(result);
return this; return this;
} }
@ -295,7 +295,7 @@ namespace LeanCloud.Storage {
/// <returns></returns> /// <returns></returns>
public async Task<LCLeaderboard> Reset() { public async Task<LCLeaderboard> Reset() {
string path = $"leaderboard/leaderboards/{StatisticName}/incrementVersion"; string path = $"leaderboard/leaderboards/{StatisticName}/incrementVersion";
Dictionary<string, object> result = await LCApplication.HttpClient.Put<Dictionary<string, object>>(path); Dictionary<string, object> result = await LCInternalApplication.HttpClient.Put<Dictionary<string, object>>(path);
Merge(result); Merge(result);
return this; return this;
} }
@ -306,7 +306,7 @@ namespace LeanCloud.Storage {
/// <returns></returns> /// <returns></returns>
public async Task Destroy() { public async Task Destroy() {
string path = $"leaderboard/leaderboards/{StatisticName}"; string path = $"leaderboard/leaderboards/{StatisticName}";
await LCApplication.HttpClient.Delete(path); await LCInternalApplication.HttpClient.Delete(path);
} }
private void Merge(Dictionary<string, object> data) { private void Merge(Dictionary<string, object> data) {

View File

@ -7,9 +7,6 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Class1.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Internal\" /> <Folder Include="Internal\" />
<Folder Include="Internal\Codec\" /> <Folder Include="Internal\Codec\" />
@ -19,8 +16,10 @@
<Folder Include="Internal\Operation\" /> <Folder Include="Internal\Operation\" />
<Folder Include="Internal\Query\" /> <Folder Include="Internal\Query\" />
<Folder Include="Leaderboard\" /> <Folder Include="Leaderboard\" />
<Folder Include="Internal\Storage\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Common\Common\Common.csproj" /> <ProjectReference Include="..\..\Common\Common\Common.csproj">
</ProjectReference>
</ItemGroup> </ItemGroup>
</Project> </Project>

BIN
Unity/UnityEngine.dll Normal file

Binary file not shown.

View File

@ -3,4 +3,8 @@
<assembly fullname="Storage" preserve="all"/> <assembly fullname="Storage" preserve="all"/>
<assembly fullname="Realtime" preserve="all"/> <assembly fullname="Realtime" preserve="all"/>
<assembly fullname="LiveQuery" preserve="all"/> <assembly fullname="LiveQuery" preserve="all"/>
<assembly fullname="LC.Google.Protobuf" preserve="all"/>
<assembly fullname="LC.Newtonsoft.Json" preserve="all"/>
<assembly fullname="Realtime.Unity" preserve="all"/>
<assembly fullname="Storage.Unity" preserve="all"/>
</linker> </linker>

View File

@ -43,11 +43,23 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Storage.AOT", "Storage\Stor
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.AOT", "Realtime\Realtime.AOT\Realtime.AOT.csproj", "{C68C9392-5100-4614-B238-103905C12566}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.AOT", "Realtime\Realtime.AOT\Realtime.AOT.csproj", "{C68C9392-5100-4614-B238-103905C12566}"
EndProject EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "LC.Google.Protobuf", "Libs\Google.Protobuf\LC.Google.Protobuf.csproj", "{7F40B1C2-D8AF-4678-8F9B-18682C58D12A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Storage.Unity", "Storage\Storage.Unity\Storage.Unity.csproj", "{BEBBDE63-D215-4790-BA98-FC612EFC383C}"
EndProject EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "LC.Newtonsoft.Json", "Libs\Newtonsoft.Json\LC.Newtonsoft.Json.csproj", "{5D01C4BB-F44D-4BD4-96BC-078616637CCE}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Storage.Standard", "Storage\Storage.Standard\Storage.Standard.csproj", "{3C73FBA3-83BC-49D9-982D-93057978F203}"
EndProject EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "LC.Newtonsoft.Json.AOT", "Libs\Newtonsoft.Json.AOT\LC.Newtonsoft.Json.AOT.csproj", "{A60FA5E1-673B-4269-B8D8-BEE0C653B8CA}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Google.Protobuf", "Libs\Google.Protobuf\LC.Google.Protobuf.csproj", "{3D05DEDF-A256-4D3F-B5AE-FB643B8F82F7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Newtonsoft.Json", "Libs\Newtonsoft.Json\LC.Newtonsoft.Json.csproj", "{577FD4B4-FE9C-4FF8-9D3D-C42F22C3A9EF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Newtonsoft.Json.AOT", "Libs\Newtonsoft.Json.AOT\LC.Newtonsoft.Json.AOT.csproj", "{48FB2373-D0E5-45CA-A227-280DEAE4486F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.Unity", "Realtime\Realtime.Unity\Realtime.Unity.csproj", "{5BC77445-B0C9-4331-99EF-A623195AD4E5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.Standard", "Realtime\Realtime.Standard\Realtime.Standard.csproj", "{E7553E94-6424-4899-B9B7-5DC0ECD95C51}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveQuery.Standard", "LiveQuery\LiveQuery.Standard\LiveQuery.Standard.csproj", "{0C0AE72C-1086-42CC-A415-40C001219B5F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveQuery.Unity", "LiveQuery\LiveQuery.Unity\LiveQuery.Unity.csproj", "{A6CD4EB4-1696-4A70-BC9D-73DF1291250C}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -111,18 +123,42 @@ Global
{C68C9392-5100-4614-B238-103905C12566}.Debug|Any CPU.Build.0 = Debug|Any CPU {C68C9392-5100-4614-B238-103905C12566}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C68C9392-5100-4614-B238-103905C12566}.Release|Any CPU.ActiveCfg = Release|Any CPU {C68C9392-5100-4614-B238-103905C12566}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C68C9392-5100-4614-B238-103905C12566}.Release|Any CPU.Build.0 = Release|Any CPU {C68C9392-5100-4614-B238-103905C12566}.Release|Any CPU.Build.0 = Release|Any CPU
{7F40B1C2-D8AF-4678-8F9B-18682C58D12A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEBBDE63-D215-4790-BA98-FC612EFC383C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F40B1C2-D8AF-4678-8F9B-18682C58D12A}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEBBDE63-D215-4790-BA98-FC612EFC383C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F40B1C2-D8AF-4678-8F9B-18682C58D12A}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEBBDE63-D215-4790-BA98-FC612EFC383C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F40B1C2-D8AF-4678-8F9B-18682C58D12A}.Release|Any CPU.Build.0 = Release|Any CPU {BEBBDE63-D215-4790-BA98-FC612EFC383C}.Release|Any CPU.Build.0 = Release|Any CPU
{5D01C4BB-F44D-4BD4-96BC-078616637CCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3C73FBA3-83BC-49D9-982D-93057978F203}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D01C4BB-F44D-4BD4-96BC-078616637CCE}.Debug|Any CPU.Build.0 = Debug|Any CPU {3C73FBA3-83BC-49D9-982D-93057978F203}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D01C4BB-F44D-4BD4-96BC-078616637CCE}.Release|Any CPU.ActiveCfg = Release|Any CPU {3C73FBA3-83BC-49D9-982D-93057978F203}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D01C4BB-F44D-4BD4-96BC-078616637CCE}.Release|Any CPU.Build.0 = Release|Any CPU {3C73FBA3-83BC-49D9-982D-93057978F203}.Release|Any CPU.Build.0 = Release|Any CPU
{A60FA5E1-673B-4269-B8D8-BEE0C653B8CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D05DEDF-A256-4D3F-B5AE-FB643B8F82F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A60FA5E1-673B-4269-B8D8-BEE0C653B8CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D05DEDF-A256-4D3F-B5AE-FB643B8F82F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A60FA5E1-673B-4269-B8D8-BEE0C653B8CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D05DEDF-A256-4D3F-B5AE-FB643B8F82F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A60FA5E1-673B-4269-B8D8-BEE0C653B8CA}.Release|Any CPU.Build.0 = Release|Any CPU {3D05DEDF-A256-4D3F-B5AE-FB643B8F82F7}.Release|Any CPU.Build.0 = Release|Any CPU
{577FD4B4-FE9C-4FF8-9D3D-C42F22C3A9EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{577FD4B4-FE9C-4FF8-9D3D-C42F22C3A9EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{577FD4B4-FE9C-4FF8-9D3D-C42F22C3A9EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{577FD4B4-FE9C-4FF8-9D3D-C42F22C3A9EF}.Release|Any CPU.Build.0 = Release|Any CPU
{48FB2373-D0E5-45CA-A227-280DEAE4486F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48FB2373-D0E5-45CA-A227-280DEAE4486F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48FB2373-D0E5-45CA-A227-280DEAE4486F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48FB2373-D0E5-45CA-A227-280DEAE4486F}.Release|Any CPU.Build.0 = Release|Any CPU
{5BC77445-B0C9-4331-99EF-A623195AD4E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5BC77445-B0C9-4331-99EF-A623195AD4E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BC77445-B0C9-4331-99EF-A623195AD4E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BC77445-B0C9-4331-99EF-A623195AD4E5}.Release|Any CPU.Build.0 = Release|Any CPU
{E7553E94-6424-4899-B9B7-5DC0ECD95C51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7553E94-6424-4899-B9B7-5DC0ECD95C51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7553E94-6424-4899-B9B7-5DC0ECD95C51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7553E94-6424-4899-B9B7-5DC0ECD95C51}.Release|Any CPU.Build.0 = Release|Any CPU
{0C0AE72C-1086-42CC-A415-40C001219B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C0AE72C-1086-42CC-A415-40C001219B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C0AE72C-1086-42CC-A415-40C001219B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C0AE72C-1086-42CC-A415-40C001219B5F}.Release|Any CPU.Build.0 = Release|Any CPU
{A6CD4EB4-1696-4A70-BC9D-73DF1291250C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6CD4EB4-1696-4A70-BC9D-73DF1291250C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6CD4EB4-1696-4A70-BC9D-73DF1291250C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6CD4EB4-1696-4A70-BC9D-73DF1291250C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{4194FE34-327C-42C2-971F-6B07904E20A5} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3} {4194FE34-327C-42C2-971F-6B07904E20A5} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3}
@ -139,9 +175,15 @@ Global
{5BE8789B-56C6-444F-87BF-F9447EE1E128} = {A1A24E0F-6901-4A9A-9BB8-4F586BC7EE17} {5BE8789B-56C6-444F-87BF-F9447EE1E128} = {A1A24E0F-6901-4A9A-9BB8-4F586BC7EE17}
{6695E495-CAF9-4CDB-9CB8-8CC867771CA1} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3} {6695E495-CAF9-4CDB-9CB8-8CC867771CA1} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3}
{C68C9392-5100-4614-B238-103905C12566} = {319A9989-3B69-4AD0-9E43-F6D31C1D2A4A} {C68C9392-5100-4614-B238-103905C12566} = {319A9989-3B69-4AD0-9E43-F6D31C1D2A4A}
{7F40B1C2-D8AF-4678-8F9B-18682C58D12A} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D} {BEBBDE63-D215-4790-BA98-FC612EFC383C} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3}
{5D01C4BB-F44D-4BD4-96BC-078616637CCE} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D} {3C73FBA3-83BC-49D9-982D-93057978F203} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3}
{A60FA5E1-673B-4269-B8D8-BEE0C653B8CA} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D} {3D05DEDF-A256-4D3F-B5AE-FB643B8F82F7} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D}
{577FD4B4-FE9C-4FF8-9D3D-C42F22C3A9EF} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D}
{48FB2373-D0E5-45CA-A227-280DEAE4486F} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D}
{5BC77445-B0C9-4331-99EF-A623195AD4E5} = {319A9989-3B69-4AD0-9E43-F6D31C1D2A4A}
{E7553E94-6424-4899-B9B7-5DC0ECD95C51} = {319A9989-3B69-4AD0-9E43-F6D31C1D2A4A}
{0C0AE72C-1086-42CC-A415-40C001219B5F} = {A1A24E0F-6901-4A9A-9BB8-4F586BC7EE17}
{A6CD4EB4-1696-4A70-BC9D-73DF1291250C} = {A1A24E0F-6901-4A9A-9BB8-4F586BC7EE17}
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
version = 0.7.2 version = 0.7.2

View File

@ -9,6 +9,7 @@ pack() {
rsync -avz $path $dir rsync -avz $path $dir
if [ $copyLink == true ] ; then if [ $copyLink == true ] ; then
cp ./Unity/link.xml $dir cp ./Unity/link.xml $dir
rm $dir/UnityEngine.dll
fi fi
zip -r $output $dir zip -r $output $dir
rm -r $dir rm -r $dir