本文整理汇总了C#中NeoDatis.WriteBytes方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.WriteBytes方法的具体用法?C# NeoDatis.WriteBytes怎么用?C# NeoDatis.WriteBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.WriteBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Persist
public virtual void Persist(NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface
fsi, int index)
{
long currentPosition = fsi.GetPosition();
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
{
}
// DLogger.debug("# Writing WriteAction #" + index + " at " +
// currentPosition+" : " + toString());
int sizeOfLong = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.Long.GetSize();
int sizeOfInt = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.Integer.GetSize();
// build the full byte array to write once
byte[] bytes = new byte[sizeOfLong + sizeOfInt + size];
byte[] bytesOfPosition = byteArrayConverter.LongToByteArray(position);
byte[] bytesOfSize = byteArrayConverter.IntToByteArray(size);
for (int i = 0; i < sizeOfLong; i++)
{
bytes[i] = bytesOfPosition[i];
}
int offset = sizeOfLong;
for (int i = 0; i < sizeOfInt; i++)
{
bytes[offset] = bytesOfSize[i];
offset++;
}
for (int i = 0; i < listOfBytes.Count; i++)
{
byte[] tmp = listOfBytes[i];
System.Array.Copy(tmp, 0, bytes, offset, tmp.Length);
offset += tmp.Length;
}
fsi.WriteBytes(bytes, false, "Transaction");
int fixedSize = sizeOfLong + sizeOfInt;
long positionAfterWrite = fsi.GetPosition();
long writeSize = positionAfterWrite - currentPosition;
if (writeSize != size + fixedSize)
{
throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.DifferentSizeInWriteAction
.AddParameter(size).AddParameter(writeSize));
}
}
示例2: ApplyTo
public virtual void ApplyTo(NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface
fsi, int index)
{
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
{
NeoDatis.Tool.DLogger.Debug("Applying WriteAction #" + index + " : " + ToString()
);
}
fsi.SetWritePosition(position, false);
for (int i = 0; i < listOfBytes.Count; i++)
{
fsi.WriteBytes(GetBytes(i), false, "WriteAction");
}
}