当前位置: 首页>>代码示例>>C#>>正文


C# Database.CreatePullReplication方法代码示例

本文整理汇总了C#中Couchbase.Lite.Database.CreatePullReplication方法的典型用法代码示例。如果您正苦于以下问题:C# Database.CreatePullReplication方法的具体用法?C# Database.CreatePullReplication怎么用?C# Database.CreatePullReplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Couchbase.Lite.Database的用法示例。


在下文中一共展示了Database.CreatePullReplication方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

	private IEnumerator Start () {
		Debug.LogFormat ("Data path = {0}", Application.persistentDataPath);

#if UNITY_EDITOR_WIN
		Log.SetLogger(new UnityLogger());
#endif
		_db = Manager.SharedInstance.GetDatabase ("spaceshooter");
		_pull = _db.CreatePullReplication (GameController.SYNC_URL);
		_pull.Continuous = true;
		_pull.Start ();
		while (_pull != null && _pull.Status == ReplicationStatus.Active) {
			yield return new WaitForSeconds(0.5f);
		}

		var doc = _db.GetExistingDocument ("player_data");
		if (doc != null) {
			//We have a record!  Get the ship data, if possible.
			string assetName = String.Empty;
			if(doc.UserProperties.ContainsKey("ship_data")) {
				assetName = doc.UserProperties ["ship_data"] as String;
			}
			StartCoroutine(LoadAsset (assetName));
		} else {
			//Create a new record
			doc = _db.GetDocument("player_data");
			doc.PutProperties(new Dictionary<string, object> { { "ship_data", String.Empty } });
		}

		doc.Change += DocumentChanged;
		_push = _db.CreatePushReplication (new Uri ("http://127.0.0.1:4984/spaceshooter"));
		_push.Start();
	}
开发者ID:serjee,项目名称:space-shooter,代码行数:32,代码来源:AssetChangeListener.cs

示例2: CreateReplication

        private Replication CreateReplication(Database db, bool push)
        {
            Replication repl = null;
            if (push) {
                repl = db.CreatePushReplication(_listenerDBUri);
            } else {
                repl = db.CreatePullReplication(_listenerDBUri);
            }

            #if USE_AUTH
            repl.Authenticator = new DigestAuthenticator("bob", "slack");
            #endif

            return repl;
        }
开发者ID:pkdevboxy,项目名称:couchbase-lite-net,代码行数:15,代码来源:PeerToPeerTest.cs

示例3: CreateReplication

        private Replication CreateReplication(Database db, bool push)
        {
            Replication repl = null;
            if (push) {
                repl = db.CreatePushReplication(_listenerDBUri);
            } else {
                repl = db.CreatePullReplication(_listenerDBUri);
            }

            if (_authScheme == AuthenticationSchemes.Basic) {
                repl.Authenticator = new BasicAuthenticator("bob", "slack");
            } else if (_authScheme == AuthenticationSchemes.Digest) {
                repl.Authenticator = new DigestAuthenticator("bob", "slack");
            }

            return repl;
        }
开发者ID:jonfunkhouser,项目名称:couchbase-lite-net,代码行数:17,代码来源:PeerToPeerTest.cs


注:本文中的Couchbase.Lite.Database.CreatePullReplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。