using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DACS.Infrastructure.Network;
namespace DACS.Infrastructure.Protocol.Imp
{
public class ParameterDPK : DACSDataPackge, IParameterDataPackage
{
#region IParameterDataPackage 成员
public IPersistent[] PersistentObj
{
get { throw new NotImplementedException(); }
}
public bool IsFirst
{
get { throw new NotImplementedException(); }
}
public bool IsEnd
{
get { throw new NotImplementedException(); }
}
#endregion
public ParameterDPK(int informationType, DateTime sendingTime, UInt32 ordinalNumber, params IBytes[] data)
: base(informationType, sendingTime, ordinalNumber, data)
{
}
public ParameterDPK(int informationType, DateTime sendingTime, params IBytes[] data)
: this(informationType, sendingTime, 0, data)
{
}
}
}**********************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DACS.Infrastructure.Protocol
{
public interface IParameterDataPackage:IDACSDataPackge
{
/// <summary>
/// 采集数据,不是采集数据包的返回null
/// </summary>
IPersistent[] PersistentObj { get; }
/// <summary>
/// 第一包
/// </summary>
Boolean IsFirst { get; }
/// <summary>
/// 最后一包
/// </summary>
Boolean IsEnd { get; }
}
}
***************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DACS.Infrastructure.Protocol
{
/// <summary>
/// 符合DACS文件存储协议的持久化数据接口
/// </summary>
public interface IPersistent
{
/// <summary>
/// 文件名
/// </summary>
String FileName { get; }
/// <summary>
/// 是否是包含文件字段信息的数据包
/// </summary>
Boolean IsFileInformation { get; }
/// <summary>
/// TAB字符分隔的CSV字符串
/// </summary>
String TextPersistentString { get; }
/// <summary>
/// 逗号分隔的CSV字符串
/// </summary>
String DBPersistentString { get; }
}
}
4 个解决方案
#1
private class Persistent : IPersistent
{
}
public IPersistent[] PersistentObj
{
get
{
Persistent persistent = new Persistent();
persistent.xx = xxx;
return persistent;
}
}
#2
刚没看是个数组:
private class Persistent : IPersistent
{
private string m_FileName = "";
public string FileName
{
get
{
return m_FileName;
}
set
{
m_FileName =value;
}
}
}
public IPersistent[] PersistentObj
{
get
{
int length = xxxx;
Persistent[] persistents = new Persistent[length ];
for(int i=0;i<length ;i++)
{
persistents[i] = new Persistent();
persistents[i].FileName = "xx";
}
return persistents ;
}
}
#3
内部类。。
#1
private class Persistent : IPersistent
{
}
public IPersistent[] PersistentObj
{
get
{
Persistent persistent = new Persistent();
persistent.xx = xxx;
return persistent;
}
}
#2
刚没看是个数组:
private class Persistent : IPersistent
{
private string m_FileName = "";
public string FileName
{
get
{
return m_FileName;
}
set
{
m_FileName =value;
}
}
}
public IPersistent[] PersistentObj
{
get
{
int length = xxxx;
Persistent[] persistents = new Persistent[length ];
for(int i=0;i<length ;i++)
{
persistents[i] = new Persistent();
persistents[i].FileName = "xx";
}
return persistents ;
}
}
#3
内部类。。