提交 57c7a1f1 编写于 作者: cdy816's avatar cdy816

日常更新

上级 d39d2015
......@@ -583,33 +583,41 @@ namespace Cdy.Tag
/// <param name="endtime"></param>
/// <param name="Id"></param>
/// <returns></returns>
public List<DataFileInfo> GetDataFiles(DateTime starttime, DateTime endtime,out Tuple<DateTime,DateTime> logFileTimes, int Id)
public List<DataFileInfo> GetDataFiles(DateTime starttime, DateTime endtime, out Tuple<DateTime, DateTime> logFileTimes, int Id)
{
string sid = mDatabaseName + Id;
if (CurrentDateTime.ContainsKey(sid))
//string sid = mDatabaseName + Id;
//if (CurrentDateTime.ContainsKey(sid))
//{
// if (starttime > CurrentDateTime[sid])
// {
// logFileTimes = new Tuple<DateTime, DateTime>(starttime, endtime);
// return new List<DataFileInfo>();
// }
// else if (endtime <= CurrentDateTime[sid])
// {
// logFileTimes = new Tuple<DateTime, DateTime>(DateTime.MinValue, DateTime.MinValue);
// return GetDataFiles(starttime, endtime - starttime, Id);
// }
// else
// {
// logFileTimes = new Tuple<DateTime, DateTime>(CurrentDateTime[sid], endtime);
// return GetDataFiles(starttime, CurrentDateTime[sid] - starttime, Id);
// }
//}
//else
//{
// logFileTimes = new Tuple<DateTime, DateTime>(starttime, endtime);
// return GetDataFiles(starttime, endtime - starttime, Id);
//}
DateTime dt = DateTime.MinValue;
var vfiles = GetDataFiles(starttime, endtime - starttime, Id);
foreach (var vv in vfiles)
{
if (starttime > CurrentDateTime[sid])
{
logFileTimes = new Tuple<DateTime, DateTime>(starttime, endtime);
return new List<DataFileInfo>();
}
else if (endtime <= CurrentDateTime[sid])
{
logFileTimes = new Tuple<DateTime, DateTime>(DateTime.MinValue, DateTime.MinValue);
return GetDataFiles(starttime, endtime - starttime, Id);
}
else
{
logFileTimes = new Tuple<DateTime, DateTime>(CurrentDateTime[sid], endtime);
return GetDataFiles(starttime, CurrentDateTime[sid] - starttime, Id);
}
}
else
{
logFileTimes = new Tuple<DateTime, DateTime>(starttime, endtime);
return GetDataFiles(starttime, endtime - starttime, Id);
dt = vv.LastTime>dt?vv.LastTime:dt;
}
logFileTimes = new Tuple<DateTime, DateTime>(dt, endtime);
return vfiles;
}
/// <summary>
......
......@@ -191,7 +191,7 @@ namespace Cdy.Tag
e.ReadAllValue(id, sstart, eend, result);
});
if (mLogFileTimes.Item1 != DateTime.MinValue)
if (mLogFileTimes.Item1 <mLogFileTimes.Item2)
{
ReadLogFileAllValue(id, mLogFileTimes.Item1, mLogFileTimes.Item2, result);
}
......
......@@ -43,6 +43,18 @@ namespace Cdy.Tag
#region ... Properties ...
/// <summary>
///
/// </summary>
public DateTime LastTime
{
get
{
return mLastTime;
}
}
/// <summary>
///
/// </summary>
......
......@@ -2,7 +2,7 @@
"profiles": {
"DBInRun": {
"commandName": "Executable",
"executablePath": "C:\\Users\\chongdaoyang\\source\\repos\\mars\\Output\\DBInRun.exe"
"executablePath": "C:\\Users\\cdy81\\source\\repos\\mars\\Output\\DBInRun.exe"
}
}
}
\ No newline at end of file
......@@ -194,8 +194,8 @@ namespace Cdy.Tag
int rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -223,8 +223,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -251,8 +251,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -277,8 +277,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -303,8 +303,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -328,8 +328,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -353,8 +353,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -378,8 +378,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -404,8 +404,8 @@ namespace Cdy.Tag
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -431,8 +431,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -466,8 +466,8 @@ namespace Cdy.Tag
datas = CompressTimers2(source, sourceAddr, (int)count, emptys2);
rcount = count - emptys2.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -490,8 +490,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -517,8 +517,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -541,8 +541,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -565,8 +565,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -589,8 +589,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -613,8 +613,9 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -637,8 +638,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -661,8 +662,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......@@ -685,8 +686,8 @@ namespace Cdy.Tag
datas = CompressTimers(source, sourceAddr, (int)count, emptys);
rcount = count - emptys.WriteIndex - 1;
//写入时间
target.WriteUShort(targetAddr, (ushort)rcount);
rsize += 2;
target.WriteInt(targetAddr, rcount);
rsize += 4;
target.Write((int)datas.Length);
target.Write(datas);
rsize += 4;
......
......@@ -67,6 +67,9 @@ namespace Cdy.Tag
public override long Compress(IMemoryBlock source, long sourceAddr, MarshalMemoryBlock target, long targetAddr, long size)
{
target.WriteDatetime(targetAddr, this.StartTime);
LoggerService.Service.Debug("LosslessCompressUnit2", "Record time: "+this.StartTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
target.Write(TimeTick);
switch (TagType)
{
......@@ -857,6 +860,7 @@ namespace Cdy.Tag
{
mVarintMemory = new ProtoMemory(count * 10);
}
var datas = CompressTimers(source, sourceAddr, (int)count, emptys);
long rsize = 0;
......@@ -1152,18 +1156,18 @@ namespace Cdy.Tag
/// <param name="timerVals"></param>
/// <param name="emptyIds"></param>
/// <returns></returns>
private List<ushort> DeCompressTimers(byte[] timerVals, int count)
private List<int> DeCompressTimers(byte[] timerVals, int count)
{
List<ushort> re = new List<ushort>();
List<int> re = new List<int>();
using (ProtoMemory memory = new ProtoMemory(timerVals))
{
ushort sval = (ushort)memory.ReadInt32();
int sval = (int)memory.ReadInt32();
re.Add(sval);
ushort preval = sval;
int preval = sval;
for (int i = 1; i < count; i++)
{
var ss = (ushort)memory.ReadInt32();
var val = (ushort)(preval + ss);
var ss = memory.ReadInt32();
var val = (preval + ss);
re.Add(val);
preval = val;
}
......
......@@ -2,7 +2,7 @@
"profiles": {
"HisDataTools": {
"commandName": "Executable",
"executablePath": "C:\\Users\\chongdaoyang\\source\\repos\\mars\\Output\\HisDataTools.exe"
"executablePath": "C:\\Users\\cdy81\\source\\repos\\mars\\Output\\HisDataTools.exe"
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册