本文整理汇总了C#中IndexEntry类的典型用法代码示例。如果您正苦于以下问题:C# IndexEntry类的具体用法?C# IndexEntry怎么用?C# IndexEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexEntry类属于命名空间,在下文中一共展示了IndexEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: the_items_are_sorted
public void the_items_are_sorted()
{
var last = new IndexEntry(ulong.MaxValue, long.MaxValue);
foreach (var item in _newtable.IterateAllInOrder())
{
Assert.IsTrue(last.Key > item.Key || last.Key == item.Key && last.Position > item.Position);
last = item;
}
}
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:9,代码来源:when_merging_two_ptables.cs
示例2: GetId
private string GetId(IndexEntry e)
{
if (e == null)
{
return null;
}
return e.Id.ToString();
}
开发者ID:KindDragon,项目名称:libgit2sharp,代码行数:9,代码来源:ConflictFixture.cs
示例3: WriteIndexEntry
public void WriteIndexEntry(IContext context, ByteArrayBuffer writer, object obj)
{
var indexEntry = obj as IndexEntry;
if (indexEntry == null)
{
indexEntry = new IndexEntry(ClassMetadataIdFor(context, obj), Convert.ToInt64(obj));
}
writer.WriteInt(indexEntry.ClassMetadataId);
writer.WriteLong(indexEntry.EnumValue);
}
开发者ID:masroore,项目名称:db4o,代码行数:10,代码来源:EnumTypeHandler.cs
示例4: the_items_are_sorted
public void the_items_are_sorted()
{
var last = new IndexEntry(ulong.MaxValue, 0, long.MaxValue);
foreach(var item in _newtable.IterateAllInOrder())
{
Assert.IsTrue((last.Stream == item.Stream ? last.Version > item.Version : last.Stream > item.Stream) ||
((last.Stream == item.Stream && last.Version == item.Version) && last.Position > item.Position));
last = item;
}
}
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:10,代码来源:when_merging_four_ptables.cs
示例5: CanCallAddAfterUsingNameConstructor
public void CanCallAddAfterUsingNameConstructor()
{
// ReSharper disable UseObjectOrCollectionInitializer
var entry = new IndexEntry("index-entry");
entry.Add("qak", "qoo");
// ReSharper restore UseObjectOrCollectionInitializer
Assert.AreEqual(1, entry.KeyValues.Count());
Assert.AreEqual("qak", entry.KeyValues.ElementAt(0).Key);
Assert.AreEqual("qoo", entry.KeyValues.ElementAt(0).Value);
}
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:11,代码来源:IndexEntryTests.cs
示例6: AddAfterAssigningCustomListShouldThrowException
public void AddAfterAssigningCustomListShouldThrowException()
{
var entry = new IndexEntry
{
KeyValues = new[]
{
new KeyValuePair<string, object>("foo", 123)
}
};
Assert.Throws<InvalidOperationException>(() => entry.Add("qak", "qoo"));
}
开发者ID:Winsto,项目名称:Neo4jClient,代码行数:12,代码来源:IndexEntryTests.cs
示例7: CanInitializeWithCollectionIntializer
public void CanInitializeWithCollectionIntializer()
{
var entry = new IndexEntry("index-entry")
{
{ "foo", 123 },
{ "bar", "baz" }
};
Assert.AreEqual("index-entry", entry.Name);
Assert.AreEqual(2, entry.KeyValues.Count());
Assert.AreEqual("foo", entry.KeyValues.ElementAt(0).Key);
Assert.AreEqual(123, entry.KeyValues.ElementAt(0).Value);
Assert.AreEqual("bar", entry.KeyValues.ElementAt(1).Key);
Assert.AreEqual("baz", entry.KeyValues.ElementAt(1).Value);
}
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:15,代码来源:IndexEntryTests.cs
示例8: CanCallAddAfterUsingCollectionIntializer
public void CanCallAddAfterUsingCollectionIntializer()
{
// ReSharper disable UseObjectOrCollectionInitializer
var entry = new IndexEntry("index-entry")
{
{ "foo", 123 },
{ "bar", "baz" }
};
// ReSharper restore UseObjectOrCollectionInitializer
entry.Add("qak", "qoo");
Assert.AreEqual(3, entry.KeyValues.Count());
Assert.AreEqual("qak", entry.KeyValues.ElementAt(2).Key);
Assert.AreEqual("qoo", entry.KeyValues.ElementAt(2).Value);
}
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:16,代码来源:IndexEntryTests.cs
示例9: GetNext
public IndexEntry GetNext()
{
IndexEntry entry = null;
//make sure there are still lines to read
if (position <= _fileLines.Count() - 1)
{
string[] entryAsStrings = _fileLines[position].Split(";".ToCharArray())
.Select(str => Regex.Replace(str, @"[""\\]", string.Empty).Trim()).ToArray();
entry = new IndexEntry(int.Parse(entryAsStrings[0]), entryAsStrings[1], entryAsStrings[3], entryAsStrings[4], entryAsStrings[5]);
}
position++;
return entry;
}
开发者ID:harlannorth,项目名称:OrderingWill,代码行数:17,代码来源:IndexIterator.cs
示例10: LoadEntries
private void LoadEntries() {
_entries = new List<IndexEntry>();
HashSet<ulong> recordNumbers = new HashSet<ulong>(); // to check for dupes
ulong offset = _entriesStart;
IndexEntry entry;
do {
entry = new IndexEntry(_stream, offset, _folder);
if (!recordNumbers.Contains(entry.RecordNum)) {
// check for dupes
_entries.Add(entry);
if (!entry.DummyEntry) {
recordNumbers.Add(entry.RecordNum);
}
}
offset += entry.EntryLength;
} while (!entry.LastEntry && offset < _entriesEnd);
}
开发者ID:Alex-Jaeger,项目名称:BitcoinFindAndRecover,代码行数:17,代码来源:FolderNTFS.cs
示例11: CanInitializeWithLongForm
public void CanInitializeWithLongForm()
{
var entry = new IndexEntry
{
Name = "index-entry",
KeyValues = new[]
{
new KeyValuePair<string, object>("foo", 123),
new KeyValuePair<string, object>("bar", "baz")
}
};
Assert.AreEqual("index-entry", entry.Name);
Assert.AreEqual(2, entry.KeyValues.Count());
Assert.AreEqual("foo", entry.KeyValues.ElementAt(0).Key);
Assert.AreEqual(123, entry.KeyValues.ElementAt(0).Value);
Assert.AreEqual("bar", entry.KeyValues.ElementAt(1).Key);
Assert.AreEqual("baz", entry.KeyValues.ElementAt(1).Value);
}
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:19,代码来源:IndexEntryTests.cs
示例12: bytes_is_made_of_key_and_position
public void bytes_is_made_of_key_and_position()
{
unsafe
{
var entry = new IndexEntry {Stream = 0x0101, Version = 0x1234, Position = 0xFFFF};
Assert.AreEqual(0x34, entry.Bytes[0]);
Assert.AreEqual(0x12, entry.Bytes[1]);
Assert.AreEqual(0x00, entry.Bytes[2]);
Assert.AreEqual(0x00, entry.Bytes[3]);
Assert.AreEqual(0x01, entry.Bytes[4]);
Assert.AreEqual(0x01, entry.Bytes[5]);
Assert.AreEqual(0x00, entry.Bytes[6]);
Assert.AreEqual(0x00, entry.Bytes[7]);
Assert.AreEqual(0xFF, entry.Bytes[8]);
Assert.AreEqual(0xFF, entry.Bytes[9]);
Assert.AreEqual(0x00, entry.Bytes[10]);
Assert.AreEqual(0x00, entry.Bytes[11]);
Assert.AreEqual(0x00, entry.Bytes[12]);
Assert.AreEqual(0x00, entry.Bytes[13]);
Assert.AreEqual(0x00, entry.Bytes[14]);
Assert.AreEqual(0x00, entry.Bytes[15]);
}
}
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:23,代码来源:IndexEntryTests.cs
示例13: AddIndexEntry
public void AddIndexEntry (IndexEntry index_entry)
{
index_entries.Add (index_entry);
}
开发者ID:jack-pappas,项目名称:mono,代码行数:4,代码来源:create-category-table.cs
示例14: BuildIndex
static void BuildIndex(string inputFolder)
{
var files = Directory.GetFiles(@inputFolder, "*.*");
foreach (string fullpath in files)
{
IndexEntry entry = new IndexEntry();
string filename = Path.GetFileName(fullpath);
entry.fullpath = fullpath;
entry.filename = filename;
entry.offset = 0;
entry.filesize = 0;
entries.Add(entry);
}
}
开发者ID:Zhaochenguang,项目名称:vn_translation_tools,代码行数:18,代码来源:Program.cs
示例15: Load
public void Load(string path)
{
stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
//skip header
stream.Seek(4, SeekOrigin.Current);
long logOffset = 0;
for (; ; )
{
//read block count. this format is really stupid. maybe its good for detecting non-ecm files or something.
int b = stream.ReadByte();
if (b == -1) MisformedException();
int bytes = 1;
int T = b & 3;
long N = (b >> 2) & 0x1F;
int nbits = 5;
while (b.Bit(7))
{
if (bytes == 5) MisformedException(); //if we're gonna need a 6th byte, this file is broken
b = stream.ReadByte();
bytes++;
if (b == -1) MisformedException();
N |= (long)(b & 0x7F) << nbits;
nbits += 7;
}
//end of blocks section
if (N == 0xFFFFFFFF)
break;
//the 0x80000000 business is confusing, but this is almost positively an error
if (N >= 0x100000000)
MisformedException();
uint todo = (uint)N + 1;
IndexEntry ie = new IndexEntry
{
Number = todo,
ECMOffset = stream.Position,
LogicalOffset = logOffset,
Type = T
};
Index.Add(ie);
if (T == 0)
{
stream.Seek(todo, SeekOrigin.Current);
logOffset += todo;
}
else if (T == 1)
{
stream.Seek(todo * (2048 + 3), SeekOrigin.Current);
logOffset += todo * 2352;
}
else if (T == 2)
{
stream.Seek(todo * 2052, SeekOrigin.Current);
logOffset += todo * 2336;
}
else if (T == 3)
{
stream.Seek(todo * 2328, SeekOrigin.Current);
logOffset += todo * 2336;
}
else MisformedException();
}
//TODO - endian bug. need an endian-independent binary reader with good license (miscutils is apache license)
//extension methods on binary reader wont suffice, we need something that lets you control the endianness used for reading. a complete replacement.
var br = new BinaryReader(stream);
EDC = br.ReadInt32();
Length = logOffset;
}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:77,代码来源:Blob_ECM.cs
示例16: TryGetSmallestEntry
private bool TryGetSmallestEntry(uint stream, int startNumber, int endNumber, out IndexEntry entry)
{
Ensure.Nonnegative(startNumber, "startNumber");
Ensure.Nonnegative(endNumber, "endNumber");
entry = TableIndex.InvalidIndexEntry;
var startKey = BuildKey(stream, startNumber);
var endKey = BuildKey(stream, endNumber);
if (startKey > _maxEntry || endKey < _minEntry)
return false;
var workItem = GetWorkItem();
try
{
var recordRange = LocateRecordRange(startKey);
int low = recordRange.Lower;
int high = recordRange.Upper;
while (low < high)
{
var mid = low + (high - low + 1) / 2;
IndexEntry midpoint = ReadEntry(mid, workItem);
if (midpoint.Key < startKey)
high = mid - 1;
else
low = mid;
}
var candEntry = ReadEntry(high, workItem);
if (candEntry.Key < startKey)
throw new Exception(string.Format("candEntry.Key {0} < startKey {1}, stream {2}, startNum {3}, endNum {4}, PTable: {5}.", candEntry.Key, startKey, stream, startNumber, endNumber, Filename));
if (candEntry.Key > endKey)
return false;
entry = candEntry;
return true;
}
finally
{
ReturnWorkItem(workItem);
}
}
开发者ID:nishanperera,项目名称:EventStore,代码行数:43,代码来源:PTable.cs
示例17: loadChildrenIndexRoot
private void loadChildrenIndexRoot() {
NTFSFileStream stream = _indexRoot;
_rootEntries = new List<IndexEntry>();
//Index Root
UInt32 attrTypes = Util.GetUInt32(stream, 0x0);
UInt32 indexBufferSize = Util.GetUInt32(stream, 0x8);
Byte clustersPerIndexBuffer = Util.GetByte(stream, 0xC);
UInt32 size = Util.GetUInt32(stream, 0x14);
UInt32 size2 = Util.GetUInt32(stream, 0x18);
UInt32 flags = Util.GetUInt32(stream, 0x1C);
ulong offset = 0x20;
IndexEntry entry;
do {
entry = new IndexEntry(stream, offset, this);
_rootEntries.Add(entry);
offset += entry.EntryLength;
} while (!entry.LastEntry);
}
开发者ID:Alex-Jaeger,项目名称:BitcoinFindAndRecover,代码行数:20,代码来源:FolderNTFS.cs
示例18: TryGetLatestEntry
public bool TryGetLatestEntry(uint stream, out IndexEntry entry)
{
return TryGetLargestEntry(stream, 0, int.MaxValue, out entry);
}
开发者ID:nishanperera,项目名称:EventStore,代码行数:4,代码来源:PTable.cs
示例19: TryGetOldestEntry
public bool TryGetOldestEntry(uint stream, out IndexEntry entry)
{
return TryGetSmallestEntry(stream, 0, int.MaxValue, out entry);
}
开发者ID:nishanperera,项目名称:EventStore,代码行数:4,代码来源:PTable.cs
示例20: GetMaxOf
private static int GetMaxOf(List<IEnumerator<IndexEntry>> enumerators)
{
var max = new IndexEntry(ulong.MinValue, 0, long.MinValue);
int idx = 0;
for (int i = 0; i < enumerators.Count; i++)
{
var cur = enumerators[i].Current;
if (cur.CompareTo(max) > 0)
{
max = cur;
idx = i;
}
}
return idx;
}
开发者ID:EventStore,项目名称:EventStore,代码行数:15,代码来源:TableIndex.cs
注:本文中的IndexEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论