用于生成 Office 文件的 .NET 组件。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

8 years ago
using System.IO;
using Npoi.Core.Util;
8 years ago
namespace Npoi.Core.HPSF
8 years ago
{
public class Filetime
{
public const int SIZE = LittleEndian.INT_SIZE * 2;
private int _dwHighDateTime;
private int _dwLowDateTime;
public Filetime(byte[] data, int offset)
{
_dwLowDateTime = LittleEndian.GetInt(data, offset + 0
* LittleEndian.INT_SIZE);
_dwHighDateTime = LittleEndian.GetInt(data, offset + 1
* LittleEndian.INT_SIZE);
}
public Filetime(int low, int high)
{
_dwLowDateTime = low;
_dwHighDateTime = high;
}
public long High
{
get { return _dwHighDateTime; }
}
public long Low
{
get { return _dwLowDateTime; }
}
public byte[] ToByteArray()
{
byte[] result = new byte[SIZE];
LittleEndian.PutInt(result, 0 * LittleEndian.INT_SIZE, _dwLowDateTime);
LittleEndian.PutInt(result, 1 * LittleEndian.INT_SIZE, _dwHighDateTime);
return result;
}
public int Write(Stream out1)
{
LittleEndian.PutInt(_dwLowDateTime, out1);
LittleEndian.PutInt(_dwHighDateTime, out1);
return SIZE;
}
}
}