用于生成 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.

46 lines
1.3 KiB

8 years ago
using Npoi.Core.Util;
using System.IO;
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;
8 years ago
public Filetime(byte[] data, int offset) {
8 years ago
_dwLowDateTime = LittleEndian.GetInt(data, offset + 0
* LittleEndian.INT_SIZE);
_dwHighDateTime = LittleEndian.GetInt(data, offset + 1
* LittleEndian.INT_SIZE);
}
8 years ago
public Filetime(int low, int high) {
8 years ago
_dwLowDateTime = low;
_dwHighDateTime = high;
}
8 years ago
public long High {
8 years ago
get { return _dwHighDateTime; }
}
8 years ago
public long Low {
8 years ago
get { return _dwLowDateTime; }
}
8 years ago
public byte[] ToByteArray() {
8 years ago
byte[] result = new byte[SIZE];
LittleEndian.PutInt(result, 0 * LittleEndian.INT_SIZE, _dwLowDateTime);
LittleEndian.PutInt(result, 1 * LittleEndian.INT_SIZE, _dwHighDateTime);
return result;
}
8 years ago
public int Write(Stream out1) {
8 years ago
LittleEndian.PutInt(_dwLowDateTime, out1);
LittleEndian.PutInt(_dwHighDateTime, out1);
return SIZE;
}
}
}