Go to file
oneRain 65183c63bf chore: storage readme 2020-04-30 16:03:01 +08:00
Common chore: 整理工程目录 2020-04-30 15:36:06 +08:00
Realtime chore: 整理工程目录 2020-04-30 15:36:06 +08:00
Sample/RealtimeApp chore: 整理工程目录 2020-04-30 15:36:06 +08:00
Storage release 2020-04-30 15:41:40 +08:00
UnityLibs chore: 整理工程目录 2020-04-30 15:36:06 +08:00
assets chore: 整理工程目录 2020-04-30 15:36:06 +08:00
script chore: 整理工程目录 2020-04-30 15:36:06 +08:00
.gitignore chore: 完善 API 文档 2020-03-05 11:28:14 +08:00
.travis.yml chore: 整理工程目录 2020-04-30 15:36:06 +08:00
Doxyfile chore: 整理工程目录 2020-04-30 15:36:06 +08:00
LICENSE Initial commit 2019-07-18 11:02:59 +08:00
README.md chore: storage readme 2020-04-30 16:03:01 +08:00
csharp-sdk.sln release 2020-04-30 15:41:40 +08:00

README.md

csharp-sdk

LeanCloud 数据存储,即时通讯 C# SDK基于 .Net Standard 2.0 标准开发。

安装

Release 下载指定版本 SDK暂不支持 Nuget 方式。

导入

using LeanCloud;
// 数据存储
using LeanCloud.Storage;
// 即时通讯
using LeanCloud.Realtime;

初始化

LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");

调试

开启调试日志

LCLogger.LogDelegate += (level, info) => {
    switch (level) {
        case LCLogLevel.Debug:
            WriteLine($"[DEBUG] {DateTime.Now} {info}\n");
            break;
        case LCLogLevel.Warn:
            WriteLine($"[WARNING] {DateTime.Now} {info}\n");
            break;
        case LCLogLevel.Error:
            WriteLine($"[ERROR] {DateTime.Now} {info}\n");
            break;
        default:
            WriteLine(info);
            break;
    }
}

用法

对象

LCObject obj = new LCObject("Hello");
obj["intValue"] = 123;
await obj.Save();

查询

LCQuery<LCObject> query = new LCQuery<LCObject>("Hello");
query.Limit(2);
List<LCObject> list = await query.Find();

文件

LCFile file = new LCFile("avatar", AvatarFilePath);
await file.Save((count, total) => {
    TestContext.WriteLine($"progress: {count}/{total}");
});

用户

await LCUser.Login("hello", "world");

GeoPoint

LCGeoPoint p1 = new LCGeoPoint(20.0059, 110.3665);

API 文档