本文整理匯總了C#中System.Guid.GetVersionFile方法的典型用法代碼示例。如果您正苦於以下問題:C# Guid.GetVersionFile方法的具體用法?C# Guid.GetVersionFile怎麽用?C# Guid.GetVersionFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Guid
的用法示例。
在下文中一共展示了Guid.GetVersionFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetVersion
private long GetVersion(Guid id)
{
var file = id.GetVersionFile(_path);
return file.Length/8;
}
示例2: UpdateEventSourceIndexFile
private void UpdateEventSourceIndexFile(Guid id, params long[] indicies)
{
var file = id.GetVersionFile(_path);
var bytes = new byte[indicies.Length * 8];
for (int i = 0; i < indicies.Length; i += 8)
{
var bytesIndex = i * 8;
var intbytes = BitConverter.GetBytes(indicies[i]);
for (int byteIndexOffset = 0; byteIndexOffset < 8; byteIndexOffset++)
{
bytes[bytesIndex + byteIndexOffset] = intbytes[byteIndexOffset];
}
}
using (var writer = file.OpenWrite())
{
writer.Seek(0, SeekOrigin.End);
writer.Write(bytes, 0, 8);
}
}
示例3: GetEventSourceIndexForVersion
private long GetEventSourceIndexForVersion(Guid id, long version)
{
var file = id.GetVersionFile(_path);
using (var reader = file.OpenRead())
{
reader.Seek(version*8, SeekOrigin.Begin);
var indexBytes = new byte[8];
reader.Read(indexBytes, 0, 8);
return BitConverter.ToInt64(indexBytes, 0);
}
}