本文整理汇总了C#中Couchbase.Lite.BlobKey.GetBytes方法的典型用法代码示例。如果您正苦于以下问题:C# BlobKey.GetBytes方法的具体用法?C# BlobKey.GetBytes怎么用?C# BlobKey.GetBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Couchbase.Lite.BlobKey
的用法示例。
在下文中一共展示了BlobKey.GetBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PathForKey
public string PathForKey(BlobKey key)
{
return path + FilePath.separator + BlobKey.ConvertToHex(key.GetBytes()) + FileExtension;
}
示例2: InsertAttachmentForSequenceWithNameAndType
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception>
internal void InsertAttachmentForSequenceWithNameAndType(long sequence, string name, string contentType, int revpos, BlobKey key)
{
try
{
var args = new ContentValues(); // TODO: Create Add override and refactor to use initializer syntax.
args["sequence"] = sequence;
args["filename"] = name;
if (key != null)
{
args.Put("key", key.GetBytes());
args.Put("length", Attachments.GetSizeOfBlob(key));
}
args["type"] = contentType;
args["revpos"] = revpos;
var result = StorageEngine.Insert("attachments", null, args);
if (result == -1)
{
var msg = "Insert attachment failed (returned -1)";
Log.E(Tag, msg);
throw new CouchbaseLiteException(msg, StatusCode.InternalServerError);
}
}
catch (SQLException e)
{
Log.E(Tag, "Error inserting attachment", e);
throw new CouchbaseLiteException(StatusCode.InternalServerError);
}
}
示例3: InsertAttachmentForSequenceWithNameAndType
public void InsertAttachmentForSequenceWithNameAndType(long sequence, string name
, string contentType, int revpos, BlobKey key)
{
try
{
ContentValues args = new ContentValues();
args.Put("sequence", sequence);
args.Put("filename", name);
if (key != null)
{
args.Put("key", key.GetBytes());
args.Put("length", attachments.GetSizeOfBlob(key));
}
args.Put("type", contentType);
args.Put("revpos", revpos);
long result = database.Insert("attachments", null, args);
if (result == -1)
{
string msg = "Insert attachment failed (returned -1)";
Log.E(Database.Tag, msg);
throw new CouchbaseLiteException(msg, Status.InternalServerError);
}
}
catch (SQLException e)
{
Log.E(Database.Tag, "Error inserting attachment", e);
throw new CouchbaseLiteException(e, Status.InternalServerError);
}
}