废弃第二代序列化框架,影响到ZipFile、Json、Xml等功能。 ZipFile升级到第三代序列化,简单测试压缩解压缩通过。 XCode用到Json/Xml部分暂时注释。 XCode废弃访问器框架 网络库NewLife.Net暂时屏蔽DNS/Sock5nnhy authored at 2016-02-12 17:21:55
diff --git a/NewLife.Core/Common/SysConfig.cs b/NewLife.Core/Common/SysConfig.cs
index dcb4ce8..521193a 100644
--- a/NewLife.Core/Common/SysConfig.cs
+++ b/NewLife.Core/Common/SysConfig.cs
@@ -16,68 +16,61 @@ namespace NewLife.Common
public class SysConfig<TSetting> : XmlConfig<TSetting> where TSetting : SysConfig<TSetting>, new()
{
#region 属性
- private String _Name;
/// <summary>系统名称</summary>
[DisplayName("系统名称")]
[Description("用于标识系统的英文名")]
- public String Name { get { return _Name; } set { _Name = value; } }
+ public String Name { get; set; }
- private String _Version;
/// <summary>系统版本</summary>
[DisplayName("系统版本")]
- public String Version { get { return _Version; } set { _Version = value; } }
+ public String Version { get; set; }
- private String _DisplayName;
/// <summary>显示名称</summary>
[DisplayName("显示名称")]
[Description("用户可见的名称")]
- public String DisplayName { get { return _DisplayName; } set { _DisplayName = value; } }
+ public String DisplayName { get; set; }
- private String _Company;
/// <summary>公司</summary>
[DisplayName("公司")]
- public String Company { get { return _Company; } set { _Company = value; } }
+ public String Company { get; set; }
- private String _Address;
/// <summary>地址</summary>
[DisplayName("地址")]
- public String Address { get { return _Address; } set { _Address = value; } }
+ public String Address { get; set; }
- private String _Tel;
/// <summary>电话</summary>
[DisplayName("电话")]
- public String Tel { get { return _Tel; } set { _Tel = value; } }
+ public String Tel { get; set; }
- private String _Fax;
/// <summary>传真</summary>
[DisplayName("传真")]
- public String Fax { get { return _Fax; } set { _Fax = value; } }
+ public String Fax { get; set; }
- private String _EMail;
/// <summary>电子邮件</summary>
[DisplayName("电子邮件")]
- public String EMail { get { return _EMail; } set { _EMail = value; } }
+ public String EMail { get; set; }
- private Boolean _Develop = true;
/// <summary>开发者模式</summary>
[DisplayName("开发者模式")]
- public Boolean Develop { get { return _Develop; } set { _Develop = value; } }
+ public Boolean Develop { get; set; }
- private Boolean _Enable = true;
/// <summary>启用</summary>
[DisplayName("启用")]
- public Boolean Enable { get { return _Enable; } set { _Enable = value; } }
+ public Boolean Enable { get; set; }
- private DateTime _InstallTime = DateTime.Now;
/// <summary>安装时间</summary>
[DisplayName("安装时间")]
- public DateTime InstallTime { get { return _InstallTime; } set { _InstallTime = value; } }
+ public DateTime InstallTime { get; set; }
#endregion
#region 构造
/// <summary>实例化</summary>
public SysConfig()
{
+ Develop = true;
+ Enable = true;
+ InstallTime = DateTime.Now;
+
var asmx = SysAssembly;
Name = asmx != null ? asmx.Name : "NewLife.Cube";
diff --git a/NewLife.Core/Compression/ZipEntry.cs b/NewLife.Core/Compression/ZipEntry.cs
index 22c9513..a86b1c5 100644
--- a/NewLife.Core/Compression/ZipEntry.cs
+++ b/NewLife.Core/Compression/ZipEntry.cs
@@ -141,21 +141,29 @@ namespace NewLife.Compression
{
var reader = zipfile.CreateReader(stream);
// 读取文件头时忽略掉这些字段,这些都是DirEntry的字段
- reader.Settings.IgnoreMembers = dirMembers;
+ //reader.Settings.IgnoreMembers = dirMembers;
+
+ var handler = (reader as Binary).GetHandler<BinaryComposite>();
+ if (handler != null) handler.IgnoreMembers = dirMembers;
// 有时候Zip文件以PK00开头
- if (first && reader.Expect(ZipConstants.PackedToRemovableMedia)) reader.ReadBytes(4);
+ if (first)
+ {
+ if (reader.Read<UInt32>() != ZipConstants.PackedToRemovableMedia) reader.Stream.Position -= 4;
+ }
// 验证头部
- if (!reader.Expect(ZipConstants.ZipEntrySignature))
+ var v = reader.Read<UInt32>();
+ if (v != ZipConstants.ZipEntrySignature)
{
- if (!reader.Expect(ZipConstants.ZipDirEntrySignature, ZipConstants.EndOfCentralDirectorySignature))
+ if (v != ZipConstants.ZipDirEntrySignature && v != ZipConstants.EndOfCentralDirectorySignature)
throw new ZipException("0x{0:X8}处签名错误!", stream.Position);
return null;
}
+ reader.Stream.Position -= 4;
- var entry = reader.ReadObject<ZipEntry>();
+ var entry = reader.Read<ZipEntry>();
if (entry.IsDirectory) return entry;
// 0长度的实体不要设置数据源
@@ -175,9 +183,9 @@ namespace NewLife.Compression
//stream.Seek(20, SeekOrigin.Current);
// 在某些只读流中,可能无法回头设置校验和大小,此时可通过描述符在文件内容之后设置
- entry.Crc = reader.ReadUInt32();
- entry.CompressedSize = reader.ReadUInt32();
- entry.UncompressedSize = reader.ReadUInt32();
+ entry.Crc = reader.Read<UInt32>();
+ entry.CompressedSize = reader.Read<UInt32>();
+ entry.UncompressedSize = reader.Read<UInt32>();
}
return entry;
@@ -187,25 +195,24 @@ namespace NewLife.Compression
{
var reader = zipfile.CreateReader(stream);
- if (!reader.Expect(ZipConstants.ZipDirEntrySignature))
+ var v = reader.Read<UInt32>();
+ if (v != ZipConstants.ZipDirEntrySignature)
{
- if (!reader.Expect(
- ZipConstants.EndOfCentralDirectorySignature,
- //ZipConstants.Zip64EndOfCentralDirectoryRecordSignature,
- ZipConstants.ZipEntrySignature))
+ if (v != ZipConstants.EndOfCentralDirectorySignature && v != ZipConstants.ZipEntrySignature)
{
throw new ZipException("0x{0:X8}处签名错误!", stream.Position);
}
return null;
}
+ reader.Stream.Position -= 4;
- var entry = reader.ReadObject<ZipEntry>();
+ var entry = reader.Read<ZipEntry>();
return entry;
}
#endregion
#region 写入核心
- internal void Write(IWriter writer)
+ internal void Write(IFormatterX writer)
{
Signature = ZipConstants.ZipEntrySignature;
@@ -215,7 +222,7 @@ namespace NewLife.Compression
if (IsDirectory)
{
// 写入头部
- writer.WriteObject(this);
+ writer.Write(this);
return;
}
@@ -230,7 +237,7 @@ namespace NewLife.Compression
if (DataSource.IsCompressed) CompressedSize = (UInt32)dsLen;
// 写入头部
- writer.WriteObject(this);
+ writer.Write(this);
// 没有数据,直接跳过
if (dsLen <= 0) return;
@@ -266,8 +273,9 @@ namespace NewLife.Compression
p = writer.Stream.Position;
// 计算好压缩大小字段所在位置
writer.Stream.Seek(RelativeOffsetOfLocalHeader + 18, SeekOrigin.Begin);
- var wr = writer as IWriter2;
- wr.Write(CompressedSize);
+ //var wr = writer as IWriter2;
+ //wr.Write(CompressedSize);
+ writer.Write(CompressedSize);
writer.Stream.Seek(p, SeekOrigin.Begin);
}
@@ -298,12 +306,12 @@ namespace NewLife.Compression
#endregion
}
- internal void WriteDir(IWriter writer)
+ internal void WriteDir(IFormatterX writer)
{
Signature = ZipConstants.ZipDirEntrySignature;
// 写入头部
- writer.WriteObject(this);
+ writer.Write(this);
}
#endregion
@@ -475,7 +483,7 @@ namespace NewLife.Compression
/// <param name="entry"></param>
internal void CopyFromDirEntry(ZipEntry entry)
{
- Type type = this.GetType();
+ var type = this.GetType();
foreach (var item in dirMembers)
{
this.SetValue(item, entry.GetValue(item));
diff --git a/NewLife.Core/Compression/ZipFile.cs b/NewLife.Core/Compression/ZipFile.cs
index 4f70438..16855c7 100644
--- a/NewLife.Core/Compression/ZipFile.cs
+++ b/NewLife.Core/Compression/ZipFile.cs
@@ -4,8 +4,9 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
-using BinaryReaderX = NewLife.Serialization.BinaryReaderX;
-using BinaryWriterX = NewLife.Serialization.BinaryWriterX;
+using NewLife.Serialization;
+//using BinaryReaderX = NewLife.Serialization.BinaryReaderX;
+//using BinaryWriterX = NewLife.Serialization.BinaryWriterX;
namespace NewLife.Compression
{
@@ -227,17 +228,22 @@ namespace NewLife.Compression
}
// 这里应该是数字签名
- if (reader.Expect(ZipConstants.DigitalSignature))
+ if (reader.Read<UInt32>() == ZipConstants.DigitalSignature)
{
- UInt16 n = reader.ReadUInt16();
- if (n > 0) reader.ReadBytes(n);
+ // 抛弃数据
+ var n = reader.Read<UInt16>();
+ if (n > 0) reader.Stream.Position += n;
}
+ else
+ reader.Stream.Position -= 4;
}
// 读取目录结构尾记录
- if (reader.Expect(ZipConstants.EndOfCentralDirectorySignature))
+ var v = reader.Read<UInt32>();
+ if (v == ZipConstants.EndOfCentralDirectorySignature)
{
- var ecd = reader.ReadObject<EndOfCentralDirectory>();
+ reader.Stream.Position -= 4;
+ var ecd = reader.Read<EndOfCentralDirectory>();
if (!String.IsNullOrEmpty(ecd.Comment)) Comment = ecd.Comment.TrimEnd('\0');
}
}
@@ -255,9 +261,12 @@ namespace NewLife.Compression
if (Entries.Count < 1) throw new ZipException("没有添加任何文件!");
var writer = CreateWriter(stream);
- writer.Settings.IgnoreMembers = null;
- // 写入文件头时忽略掉这些字段,这些都是DirEntry的字段
- writer.Settings.IgnoreMembers = ZipEntry.dirMembers;
+ //writer.Settings.IgnoreMembers = null;
+ //// 写入文件头时忽略掉这些字段,这些都是DirEntry的字段
+ //writer.Settings.IgnoreMembers = ZipEntry.dirMembers;
+
+ var handler = (writer as Binary).GetHandler<BinaryComposite>();
+ if (handler != null) handler.IgnoreMembers = ZipEntry.dirMembers;
foreach (var item in Entries.Values)
{
@@ -267,7 +276,7 @@ namespace NewLife.Compression
var ecd = new EndOfCentralDirectory();
ecd.Offset = (UInt32)writer.Stream.Position;
- writer.Settings.IgnoreMembers = null;
+ //writer.Settings.IgnoreMembers = null;
Int32 num = 0;
foreach (var item in Entries.Values)
{
@@ -286,9 +295,9 @@ namespace NewLife.Compression
ecd.NumberOfEntriesOnThisDisk = (UInt16)num;
ecd.Size = (UInt32)writer.Stream.Position - ecd.Offset;
- writer.WriteObject(ecd);
+ writer.Write(ecd);
- writer.Flush();
+ writer.Stream.Flush();
}
/// <summary>把Zip格式数据写入到文件中</summary>
@@ -520,31 +529,39 @@ namespace NewLife.Compression
#endregion
#region 辅助
- internal BinaryReaderX CreateReader(Stream stream)
+ internal IFormatterX CreateReader(Stream stream)
{
- var reader = new BinaryReaderX() { Stream = stream };
- reader.Settings.EncodeInt = false;
- reader.Settings.UseObjRef = false;
- reader.Settings.SizeFormat = TypeCode.Int16;
- reader.Settings.Encoding = Encoding;
- //#if DEBUG
- // reader.Debug = true;
- // reader.EnableTraceStream();
- //#endif
+#if DEBUG
+ stream = new NewLife.Log.TraceStream(stream);
+#endif
+ var reader = new Binary() { Stream = stream };
+ reader.EncodeInt = false;
+ reader.UseFieldSize = true;
+ reader.SizeWidth = 2;
+ reader.IsLittleEndian = true;
+ reader.Encoding = Encoding;
+#if DEBUG
+ reader.Log = NewLife.Log.XTrace.Log;
+#endif
+
return reader;
}
- internal BinaryWriterX CreateWriter(Stream stream)
+ internal IFormatterX CreateWriter(Stream stream)
{
- var writer = new BinaryWriterX() { Stream = stream };
- writer.Settings.EncodeInt = false;
- writer.Settings.UseObjRef = false;
- writer.Settings.SizeFormat = TypeCode.Int16;
- writer.Settings.Encoding = Encoding;
#if DEBUG
- writer.Debug = true;
- //writer.EnableTraceStream();
+ stream = new NewLife.Log.TraceStream(stream);
+#endif
+ var writer = new Binary() { Stream = stream };
+ writer.EncodeInt = false;
+ writer.UseFieldSize = true;
+ writer.SizeWidth = 2;
+ writer.IsLittleEndian = true;
+ writer.Encoding = Encoding;
+#if DEBUG
+ writer.Log = NewLife.Log.XTrace.Log;
#endif
+
return writer;
}
diff --git a/NewLife.Core/Data/PageParameter.cs b/NewLife.Core/Data/PageParameter.cs
index dea9682..418e00e 100644
--- a/NewLife.Core/Data/PageParameter.cs
+++ b/NewLife.Core/Data/PageParameter.cs
@@ -38,9 +38,8 @@ namespace NewLife.Data
}
}
- private Boolean _Desc;
/// <summary>是否降序</summary>
- public virtual Boolean Desc { get { return _Desc; } set { _Desc = value; } }
+ public virtual Boolean Desc { get; set; }
private Int32 _PageIndex = 1;
/// <summary>页面索引</summary>
@@ -52,9 +51,8 @@ namespace NewLife.Data
#endregion
#region 扩展属性
- private Int32 _TotalCount;
/// <summary>总记录数</summary>
- public virtual Int32 TotalCount { get { return _TotalCount; } set { _TotalCount = value; } }
+ public virtual Int32 TotalCount { get; set; }
/// <summary>页数</summary>
public virtual Int32 PageCount
diff --git a/NewLife.Core/IO/FileSource.cs b/NewLife.Core/IO/FileSource.cs
index 5c0880c..80dab2a 100644
--- a/NewLife.Core/IO/FileSource.cs
+++ b/NewLife.Core/IO/FileSource.cs
@@ -4,7 +4,6 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
-using NewLife.Reflection;
namespace NewLife.IO
{
diff --git a/NewLife.Core/IO/IOHelper.cs b/NewLife.Core/IO/IOHelper.cs
index 0c5a786..7c8b784 100644
--- a/NewLife.Core/IO/IOHelper.cs
+++ b/NewLife.Core/IO/IOHelper.cs
@@ -4,7 +4,6 @@ using System.IO;
using System.IO.Compression;
using System.Text;
using NewLife;
-using NewLife.Log;
using NewLife.Reflection;
namespace System
@@ -209,7 +208,7 @@ namespace System
// 如果还有数据,说明是目标数据流缓冲区不够大
#if DEBUG
- XTrace.WriteLine("目标数据流缓冲区不够大,设计上建议加大(>{0})以提升性能!", count);
+ NewLife.Log.XTrace.WriteLine("目标数据流缓冲区不够大,设计上建议加大(>{0})以提升性能!", count);
#endif
}
}
diff --git a/NewLife.Core/NewLife.Core.csproj b/NewLife.Core/NewLife.Core.csproj
index 1794651..ec68ac4 100644
--- a/NewLife.Core/NewLife.Core.csproj
+++ b/NewLife.Core/NewLife.Core.csproj
@@ -150,13 +150,9 @@
<Compile Include="Security\RC4.cs" />
<Compile Include="Security\RSAHelper.cs" />
<Compile Include="Security\SecurityHelper.cs" />
- <Compile Include="Serialization\Base\TextReaderBase.cs" />
<Compile Include="Serialization\Binary\BinaryDictionary.cs" />
<Compile Include="Serialization\Binary\BinaryList.cs" />
- <Compile Include="Serialization\Binary\BinaryReaderX.cs" />
<Compile Include="Serialization\Binary\Binary.cs" />
- <Compile Include="Serialization\Binary\BinarySettings.cs" />
- <Compile Include="Serialization\Binary\BinaryWriterX.cs" />
<Compile Include="Serialization\Binary\BinaryComposite.cs" />
<Compile Include="Serialization\Binary\BitSizeAttribute.cs" />
<Compile Include="Serialization\Binary\FieldSizeAttribute.cs" />
@@ -166,59 +162,25 @@
<Compile Include="Serialization\Binary\BinaryFont.cs" />
<Compile Include="Serialization\Binary\BinaryColor.cs" />
<Compile Include="Serialization\Interface\IFormatterX.cs" />
- <Compile Include="Serialization\Interface\IReader2.cs" />
- <Compile Include="Serialization\Interface\IWriter2.cs" />
- <Compile Include="Serialization\Json\JsonAtomStringReader.cs" />
- <Compile Include="Serialization\Json\SimpleJsonUtil.cs" />
- <Compile Include="Serialization\NameValue\NameValueReader.cs" />
- <Compile Include="Serialization\Interface\IAccessor.cs" />
<Compile Include="Serialization\Info\IObjectMemberInfo.cs" />
- <Compile Include="Serialization\Interface\IReader.cs" />
- <Compile Include="Serialization\Interface\IReaderWriter.cs" />
- <Compile Include="Serialization\Interface\IWriter.cs" />
- <Compile Include="IO\Json.cs" />
- <Compile Include="Serialization\Json\JsonReader.cs" />
- <Compile Include="Serialization\Json\JsonSettings.cs" />
- <Compile Include="Serialization\Json\JsonWriter.cs" />
- <Compile Include="Serialization\Base\ReaderBase.cs" />
- <Compile Include="Serialization\Base\ReaderWriterBase.cs" />
- <Compile Include="IO\ReadWriteStream.cs" />
<Compile Include="Serialization\Info\ReflectMemberInfo.cs" />
<Compile Include="Serialization\Info\SimpleMemberInfo.cs" />
<Compile Include="Serialization\Info\ObjectInfo.cs" />
- <Compile Include="Serialization\Event\ReaderEventArgs.cs" />
- <Compile Include="Serialization\Event\ReadMemberEventArgs.cs" />
- <Compile Include="Serialization\Event\ReadObjectEventArgs.cs" />
- <Compile Include="Serialization\NameValue\NameValueSetting.cs" />
- <Compile Include="Serialization\NameValue\NameValueWriter.cs" />
- <Compile Include="Serialization\Base\WriterBase.cs" />
<Compile Include="Log\CodeTimer.cs" />
<Compile Include="Reflection\AssemblyX.cs" />
<Compile Include="Reflection\AttributeX.cs" />
<Compile Include="Reflection\快速反射\ConstructorInfoX.cs" />
<Compile Include="Reflection\EmitHelper.cs" />
<Compile Include="Reflection\DynamicAssembly.cs" />
- <Compile Include="Serialization\Base\ReaderWriterSettings.cs" />
- <Compile Include="Serialization\Event\ReaderWriterEventArgs.cs" />
- <Compile Include="Serialization\Base\TextWriterBase.cs" />
- <Compile Include="Serialization\Base\TextReaderWriterSetting.cs" />
- <Compile Include="Serialization\Event\WriterEventArgs.cs" />
- <Compile Include="Serialization\Event\WriteMemberEventArgs.cs" />
- <Compile Include="Serialization\Event\WriteObjectEventArgs.cs" />
<Compile Include="Serialization\Protocol.cs" />
- <Compile Include="Serialization\RWKinds.cs" />
- <Compile Include="Serialization\RWService.cs" />
<Compile Include="Serialization\Xml\XmlComposite.cs" />
<Compile Include="Serialization\Xml\XmlGeneral.cs" />
<Compile Include="Serialization\Xml\IXml.cs" />
<Compile Include="Serialization\Xml\Xml.cs" />
- <Compile Include="Serialization\XSerializationException.cs" />
<Compile Include="Setting.cs" />
- <Compile Include="Threading\ReadWriteLock.cs" />
<Compile Include="Reflection\快速反射\TypeX.cs" />
<Compile Include="Common\WeakReference.cs" />
<Compile Include="Event\EventArgs.cs" />
- <Compile Include="IO\ReadWriteMemoryStream.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Reflection\FastIndexAccessor.cs" />
<Compile Include="Reflection\快速反射\FieldInfoX.cs" />
@@ -230,8 +192,6 @@
<Compile Include="Security\Crc32.cs" />
<Compile Include="Common\HardInfo.cs" />
<Compile Include="Common\IdentityCard.cs" />
- <None Include="Serialization\Event\事件参数.cd" />
- <Compile Include="Threading\SpinWait.cs" />
<Compile Include="Threading\TaskState.cs" />
<Compile Include="Threading\ThreadPoolX.cs" />
<Compile Include="Threading\ThreadTask.cs" />
@@ -241,16 +201,11 @@
<Compile Include="Web\Js.cs" />
<Compile Include="Web\Link.cs" />
<Compile Include="Web\Modules\ErrorModule.cs" />
- <Compile Include="Web\Modules\HttpModuleLoader.cs" />
<Compile Include="Web\Modules\CompressionModule.cs" />
<Compile Include="Web\ControlHelper.cs" />
- <Compile Include="Web\HttpStream.cs" />
<Compile Include="Log\WriteLogEventArgs.cs" />
<Compile Include="Log\XTrace.cs" />
<Compile Include="Web\Modules\RunTimeModule.cs" />
- <Compile Include="Web\Modules\ViewStateCompressionModule.cs" />
- <Compile Include="Web\Modules\SystemStartModule.cs" />
- <Compile Include="Web\Modules\UrlRewrite.cs" />
<Compile Include="Data\PageParameter.cs" />
<Compile Include="Web\Pager.cs" />
<Compile Include="Web\PluginHelper.cs" />
@@ -273,30 +228,24 @@
<Compile Include="Xml\XmlConfigFileAttribute.cs" />
<Compile Include="Xml\XmlEntity.cs" />
<Compile Include="Xml\XmlHelper.cs" />
- <Compile Include="Xml\XmlReaderX.cs" />
- <Compile Include="Xml\XmlReaderWriterSettings.cs" />
- <Compile Include="Xml\XmlWriterX.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Windows\SerialPortList.resx">
<DependentUpon>SerialPortList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="X组件.txt" />
- <EmbeddedResource Include="Web\Modules\SystemStart.htm" />
<Content Include="说明.txt" />
<EmbeddedResource Include="UpdateInfo.txt" />
- <None Include="Serialization\序列化_写入器.png" />
- <None Include="Serialization\序列化_读取器.png" />
- <None Include="Serialization\说明.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="App.config">
<SubType>Designer</SubType>
</EmbeddedResource>
- <None Include="Serialization\序列化架构.edx" />
- <None Include="Serialization\读写器模型.cd" />
</ItemGroup>
- <ItemGroup />
+ <ItemGroup>
+ <Folder Include="Serialization\Json\" />
+ <Folder Include="Serialization\NameValue\" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/NewLife.Core/Serialization/Binary/Binary.cs b/NewLife.Core/Serialization/Binary/Binary.cs
index 32d0f1f..62effea 100644
--- a/NewLife.Core/Serialization/Binary/Binary.cs
+++ b/NewLife.Core/Serialization/Binary/Binary.cs
@@ -11,21 +11,20 @@ namespace NewLife.Serialization
public class Binary : FormatterBase, IBinary
{
#region 属性
- private Boolean _EncodeInt;
/// <summary>使用7位编码整数。默认false不使用</summary>
- public Boolean EncodeInt { get { return _EncodeInt; } set { _EncodeInt = value; } }
+ public Boolean EncodeInt { get; set; }
- private Boolean _IsLittleEndian;
/// <summary>小端字节序。默认false,是大端而不是小端</summary>
- public Boolean IsLittleEndian { get { return _IsLittleEndian; } set { _IsLittleEndian = value; } }
+ public Boolean IsLittleEndian { get; set; }
- private Boolean _UseFieldSize;
/// <summary>使用指定大小的FieldSizeAttribute特性,默认false</summary>
- public Boolean UseFieldSize { get { return _UseFieldSize; } set { _UseFieldSize = value; } }
+ public Boolean UseFieldSize { get; set; }
+
+ /// <summary>大小宽度。可选0/1/2/4,默认0表示压缩编码整数</summary>
+ public Int32 SizeWidth { get; set; }
- private List<IBinaryHandler> _Handlers = new List<IBinaryHandler>();
/// <summary>处理器列表</summary>
- public List<IBinaryHandler> Handlers { get { return _Handlers; } }
+ public IList<IBinaryHandler> Handlers { get; private set; }
#endregion
#region 构造
@@ -47,7 +46,7 @@ namespace NewLife.Serialization
// 根据优先级排序
list.Sort();
- _Handlers = list;
+ Handlers = list;
}
#endregion
@@ -60,9 +59,9 @@ namespace NewLife.Serialization
if (handler != null)
{
handler.Host = this;
- _Handlers.Add(handler);
+ Handlers.Add(handler);
// 根据优先级排序
- _Handlers.Sort();
+ (Handlers as List<IBinaryHandler>).Sort();
}
return this;
@@ -80,6 +79,19 @@ namespace NewLife.Serialization
return AddHandler(handler);
}
+
+ /// <summary>获取处理器</summary>
+ /// <typeparam name="T"></typeparam>
+ /// <returns></returns>
+ public T GetHandler<T>() where T : class,IBinaryHandler
+ {
+ foreach (var item in Handlers)
+ {
+ if (item is T) return item as T;
+ }
+
+ return default(T);
+ }
#endregion
#region 写入
@@ -131,10 +143,25 @@ namespace NewLife.Serialization
if (fieldsize >= 0) return fieldsize;
}
- if (EncodeInt)
- WriteEncoded(size);
- else
- Write(size);
+ switch (SizeWidth)
+ {
+ case 1:
+ Write((Byte)size);
+ break;
+ case 2:
+ Write((Int16)size);
+ break;
+ case 4:
+ Write(size);
+ break;
+ case 0:
+ default:
+ if (EncodeInt)
+ WriteEncoded(size);
+ else
+ Write(size);
+ break;
+ }
return -1;
}
@@ -231,26 +258,21 @@ namespace NewLife.Serialization
if (size >= 0) return size;
}
- if (EncodeInt)
- return ReadEncodedInt32();
- else
- //return ReadInt32();
- return (Int32)Read(typeof(Int32));
- //var sizeFormat = TypeCode.Int32;
- //switch (sizeFormat)
- //{
- // case TypeCode.Int16:
- // return ReadInt16();
- // case TypeCode.UInt16:
- // return ReadEncodedInt16();
- // case TypeCode.Int32:
- // case TypeCode.Int64:
- // default:
- // return ReadInt32();
- // case TypeCode.UInt32:
- // case TypeCode.UInt64:
- // return ReadEncodedInt32();
- //}
+ switch (SizeWidth)
+ {
+ case 1:
+ return ReadByte();
+ case 2:
+ return (Int16)Read(typeof(Int16));
+ case 4:
+ return (Int32)Read(typeof(Int32));
+ case 0:
+ default:
+ if (EncodeInt)
+ return ReadEncodedInt32();
+ else
+ return (Int32)Read(typeof(Int32));
+ }
}
Int32 GetFieldSize()
@@ -283,7 +305,7 @@ namespace NewLife.Serialization
/// <summary>从当前流中读取 2 字节有符号整数,并使流的当前位置提升 2 个字节。</summary>
/// <returns></returns>
- short ReadInt16() { return BitConverter.ToInt16(ReadIntBytes(2), 0); }
+ Int16 ReadInt16() { return BitConverter.ToInt16(ReadIntBytes(2), 0); }
/// <summary>从当前流中读取 4 字节有符号整数,并使流的当前位置提升 4 个字节。</summary>
/// <returns></returns>
diff --git a/NewLife.Core/Serialization/Binary/BinaryColor.cs b/NewLife.Core/Serialization/Binary/BinaryColor.cs
index 00b9e66..be42312 100644
--- a/NewLife.Core/Serialization/Binary/BinaryColor.cs
+++ b/NewLife.Core/Serialization/Binary/BinaryColor.cs
@@ -1,12 +1,5 @@
using System;
-using System.Collections.Generic;
using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.Serialization.Formatters.Binary;
-using NewLife.Collections;
-using NewLife.Reflection;
namespace NewLife.Serialization
{
diff --git a/NewLife.Core/Serialization/Binary/BinaryComposite.cs b/NewLife.Core/Serialization/Binary/BinaryComposite.cs
index 56adc7b..3a17fb5 100644
--- a/NewLife.Core/Serialization/Binary/BinaryComposite.cs
+++ b/NewLife.Core/Serialization/Binary/BinaryComposite.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NewLife.Collections;
-using NewLife.Log;
using NewLife.Reflection;
namespace NewLife.Serialization
@@ -11,10 +10,16 @@ namespace NewLife.Serialization
/// <summary>复合对象处理器</summary>
public class BinaryComposite : BinaryHandlerBase
{
+ /// <summary>要忽略的成员</summary>
+ public ICollection<String> IgnoreMembers { get; set; }
+
/// <summary>实例化</summary>
public BinaryComposite()
{
Priority = 100;
+
+ //IgnoreMembers = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
+ IgnoreMembers = new HashSet<String>();
}
/// <summary>写入对象</summary>
@@ -51,6 +56,8 @@ namespace NewLife.Serialization
// 获取成员
foreach (var member in ms)
{
+ if (IgnoreMembers != null && IgnoreMembers.Contains(member.Name)) continue;
+
var mtype = GetMemberType(member);
Host.Member = member;
@@ -126,6 +133,8 @@ namespace NewLife.Serialization
// 获取成员
foreach (var member in ms)
{
+ if (IgnoreMembers != null && IgnoreMembers.Contains(member.Name)) continue;
+
var mtype = GetMemberType(member);
Host.Member = member;
WriteLog(" {0}.{1}", type.Name, member.Name);
diff --git a/NewLife.Core/Serialization/Binary/BinaryFont.cs b/NewLife.Core/Serialization/Binary/BinaryFont.cs
index f63ee6f..94fe6a1 100644
--- a/NewLife.Core/Serialization/Binary/BinaryFont.cs
+++ b/NewLife.Core/Serialization/Binary/BinaryFont.cs
@@ -1,12 +1,5 @@
using System;
-using System.Collections.Generic;
using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.Serialization.Formatters.Binary;
-using NewLife.Collections;
-using NewLife.Reflection;
namespace NewLife.Serialization
{
diff --git a/NewLife.Core/Serialization/Binary/BinaryGeneral.cs b/NewLife.Core/Serialization/Binary/BinaryGeneral.cs
index 4b24691..518584d 100644
--- a/NewLife.Core/Serialization/Binary/BinaryGeneral.cs
+++ b/NewLife.Core/Serialization/Binary/BinaryGeneral.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
namespace NewLife.Serialization
{
diff --git a/NewLife.Core/Serialization/Binary/BinaryUnknown.cs b/NewLife.Core/Serialization/Binary/BinaryUnknown.cs
index 3d35335..684d1db 100644
--- a/NewLife.Core/Serialization/Binary/BinaryUnknown.cs
+++ b/NewLife.Core/Serialization/Binary/BinaryUnknown.cs
@@ -1,11 +1,6 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
-using NewLife.Collections;
-using NewLife.Reflection;
namespace NewLife.Serialization
{
@@ -36,27 +31,6 @@ namespace NewLife.Serialization
// 调用.Net的二进制序列化来解决剩下的事情
var bf = new BinaryFormatter();
- //var ms = new MemoryStream();
- //bf.Serialize(ms, value);
- //ms.Position = 0;
- //var buf = ms.ToArray();
-
- //Host.WriteSize(buf.Length);
- //Host.Write(buf);
-
- //Int32 size = 0;
- //// 为了预估大小,调试进行两次序列化
- //if (Host.Debug)
- //{
- // var ms = new MemoryStream();
- // bf.Serialize(ms, value);
- // size = (Int32)ms.Length;
- //}
-
- //// 先写入一个长度,待会回来覆盖
- //var p = Host.Stream.Position;
- //Host.WriteSize(size);
- //var start = Host.Stream.Position;
var ms = new MemoryStream();
bf.Serialize(ms, value);
@@ -64,13 +38,6 @@ namespace NewLife.Serialization
Host.WriteSize((Int32)ms.Length);
ms.CopyTo(Host.Stream);
- //// 写入长度
- //var end = Host.Stream.Position;
- //size = (Int32)(end - start);
- //Host.Stream.Position = p;
- //Host.WriteSize(size);
- //Host.Stream.Position = end;
-
return true;
}
@@ -88,8 +55,6 @@ namespace NewLife.Serialization
if (len == 0) return true;
var bf = new BinaryFormatter();
- //var ms = new MemoryStream(Host.ReadBytes(len));
- //value = bf.Deserialize(ms);
var p = Host.Stream.Position;
value = bf.Deserialize(Host.Stream);
diff --git a/NewLife.Core/Serialization/Binary/BitSizeAttribute.cs b/NewLife.Core/Serialization/Binary/BitSizeAttribute.cs
index f88780b..93ec528 100644
--- a/NewLife.Core/Serialization/Binary/BitSizeAttribute.cs
+++ b/NewLife.Core/Serialization/Binary/BitSizeAttribute.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections;
-using System.Reflection;
-using System.Text;
-using NewLife.Reflection;
namespace NewLife.Serialization
{
diff --git a/NewLife.Core/Serialization/Binary/IBinary.cs b/NewLife.Core/Serialization/Binary/IBinary.cs
index 899128d..acacd3d 100644
--- a/NewLife.Core/Serialization/Binary/IBinary.cs
+++ b/NewLife.Core/Serialization/Binary/IBinary.cs
@@ -1,7 +1,6 @@
using System;
-using System.Text;
using System.Collections.Generic;
-using NewLife.Log;
+using System.Text;
namespace NewLife.Serialization
{
@@ -22,7 +21,7 @@ namespace NewLife.Serialization
Boolean UseFieldSize { get; }
/// <summary>处理器列表</summary>
- List<IBinaryHandler> Handlers { get; }
+ IList<IBinaryHandler> Handlers { get; }
#endregion
#region 写入
@@ -61,38 +60,10 @@ namespace NewLife.Serialization
/// <summary>二进制读写处理器接口</summary>
public interface IBinaryHandler : IHandler<IBinary>
{
- ///// <summary>宿主读写器</summary>
- //IBinary Host { get; set; }
-
- ///// <summary>优先级</summary>
- //Int32 Priority { get; set; }
-
- ///// <summary>写入一个对象</summary>
- ///// <param name="value">目标对象</param>
- ///// <param name="type">类型</param>
- ///// <returns></returns>
- //Boolean Write(Object value, Type type);
-
- ///// <summary>尝试读取指定类型对象</summary>
- ///// <param name="type"></param>
- ///// <param name="value"></param>
- ///// <returns></returns>
- //Boolean TryRead(Type type, ref Object value);
}
/// <summary>二进制读写处理器基类</summary>
public abstract class BinaryHandlerBase : HandlerBase<IBinary, IBinaryHandler>, IBinaryHandler
{
- ///// <summary>写入一个对象</summary>
- ///// <param name="value">目标对象</param>
- ///// <param name="type">类型</param>
- ///// <returns></returns>
- //public abstract Boolean Write(Object value, Type type);
-
- ///// <summary>尝试读取指定类型对象</summary>
- ///// <param name="type"></param>
- ///// <param name="value"></param>
- ///// <returns></returns>
- //public abstract Boolean TryRead(Type type, ref Object value);
}
}
\ No newline at end of file
diff --git a/NewLife.Net/Http/HttpHeader.cs b/NewLife.Net/Http/HttpHeader.cs
index f17aa3c..f62348e 100644
--- a/NewLife.Net/Http/HttpHeader.cs
+++ b/NewLife.Net/Http/HttpHeader.cs
@@ -93,9 +93,9 @@ namespace NewLife.Net.Http
HttpHeader entity = null;
var p = stream.Position;
- var reader = new BinaryReaderX(stream);
+ //var reader = new BinaryReaderX(stream);
- entity = ReadFirst(reader);
+ entity = ReadFirst(stream);
if (entity == null) return null;
switch (mode)
@@ -110,7 +110,7 @@ namespace NewLife.Net.Http
break;
}
- entity.ReadHeaders(reader);
+ entity.ReadHeaders(stream);
//// 因为涉及字符编码,所以跟流位置可能不同。对于ASCII编码没有问题。
//stream.Position = p + reader.CharPosition;
@@ -119,15 +119,16 @@ namespace NewLife.Net.Http
}
/// <summary>仅读取第一行。如果不是Http头部,指针要回到原来位置</summary>
- /// <param name="reader"></param>
+ /// <param name="stream"></param>
/// <returns></returns>
- public static HttpHeader ReadFirst(BinaryReaderX reader)
+ public static HttpHeader ReadFirst(Stream stream)
{
// 如果不是Http头部,指针要回到原来位置
- var stream = reader.Stream;
+ //var stream = reader.Stream;
+ var reader = new StreamReaderX(stream, null, false);
var p = stream.Position;
- String line = reader.ReadLine();
+ var line = reader.ReadLine();
if (line.IsNullOrWhiteSpace()) { stream.Position = p; return null; }
var ss = line.Split(new Char[] { ' ' }, 3);
@@ -157,9 +158,11 @@ namespace NewLife.Net.Http
}
/// <summary>读取头部键值</summary>
- /// <param name="reader"></param>
- public void ReadHeaders(BinaryReaderX reader)
+ /// <param name="stream"></param>
+ public void ReadHeaders(Stream stream)
{
+ var reader = new StreamReaderX(stream, null, false);
+
IsFinish = true;
while (true)
{
diff --git a/NewLife.Net/NewLife.Net.csproj b/NewLife.Net/NewLife.Net.csproj
index 3e721e3..ab49d7f 100644
--- a/NewLife.Net/NewLife.Net.csproj
+++ b/NewLife.Net/NewLife.Net.csproj
@@ -60,15 +60,6 @@
<Compile Include="Dhcp\DhcpOption.cs" />
<Compile Include="Dhcp\DhcpServer.cs" />
<Compile Include="Dhcp\DhcpSession.cs" />
- <Compile Include="DNS\BinaryDNS.cs" />
- <Compile Include="DNS\DNSOpcodeType.cs" />
- <Compile Include="DNS\DNSRcodeType.cs" />
- <Compile Include="DNS\DNS_NS.cs" />
- <Compile Include="DNS\DNS_MX.cs" />
- <Compile Include="DNS\DNS_SOA.cs" />
- <Compile Include="DNS\DNS_TXT.cs" />
- <Compile Include="DNS\NetBIOS.cs" />
- <Compile Include="DNS\DNS_NB.cs" />
<Compile Include="Fetion\WapFetion.cs">
<SubType>Code</SubType>
</Compile>
@@ -106,23 +97,12 @@
<Compile Include="MQTT\MqttMessage.cs" />
<Compile Include="MQTT\MqttType.cs" />
<Compile Include="MQTT\QualityOfService.cs" />
- <Compile Include="DNS\DNSClient.cs" />
- <Compile Include="DNS\DNSEntity.cs" />
- <Compile Include="DNS\DNSHeader.cs" />
- <Compile Include="DNS\DNSNameAccessor.cs" />
- <Compile Include="DNS\DNSRecord.cs" />
- <Compile Include="DNS\DNSServer.cs" />
- <Compile Include="DNS\DNS_AAAA.cs" />
- <Compile Include="DNS\DNS_CNAME.cs" />
- <Compile Include="DNS\DNS_PTR.cs" />
<Compile Include="Http\HttpHeader.cs" />
<Compile Include="NTP\NTPClient.cs" />
<Compile Include="Application\TimeServer.cs" />
<Compile Include="IO\FileClient.cs" />
<Compile Include="IO\FileFormat.cs" />
<Compile Include="IO\FileServer.cs" />
- <Compile Include="DNS\DNSQueryType.cs" />
- <Compile Include="DNS\DNS_A.cs" />
<Compile Include="NTP\NTPEnum.cs" />
<Compile Include="NTP\NTP.cs" />
<Compile Include="P2P\HoleServer.cs" />
@@ -144,9 +124,6 @@
<Compile Include="Proxy\ProxySession.cs" />
<Compile Include="Proxy\ProxyBase.cs" />
<Compile Include="Proxy\NATProxy.cs" />
- <Compile Include="Proxy\Socks5\Socks5Entity.cs" />
- <Compile Include="Proxy\Socks5\Socks5Client.cs" />
- <Compile Include="Proxy\Socks5\Socks5Server.cs" />
<Compile Include="Sdp\SdpAttribute.cs">
<SubType>Code</SubType>
</Compile>
diff --git a/NewLife.Net/Proxy/HttpProxy.cs b/NewLife.Net/Proxy/HttpProxy.cs
index fa47500..35f9b9c 100644
--- a/NewLife.Net/Proxy/HttpProxy.cs
+++ b/NewLife.Net/Proxy/HttpProxy.cs
@@ -192,7 +192,7 @@ namespace NewLife.Net.Proxy
else if (!entity.IsFinish)
{
// 如果请求未完成,说明现在的数据内容还是头部
- entity.ReadHeaders(new BinaryReaderX(stream));
+ entity.ReadHeaders(stream);
if (entity.IsFinish)
{
Request = entity;
@@ -445,7 +445,7 @@ namespace NewLife.Net.Proxy
{
#region 未完成响应,继续读取头部
// 如果请求未完成,说明现在的数据内容还是头部
- entity.ReadHeaders(new BinaryReaderX(stream));
+ entity.ReadHeaders(stream);
if (entity.IsFinish)
{
Response = entity;
diff --git a/NewLife.Net/SGIP/SGIPEntity.cs b/NewLife.Net/SGIP/SGIPEntity.cs
index 92cf6ee..2d03305 100644
--- a/NewLife.Net/SGIP/SGIPEntity.cs
+++ b/NewLife.Net/SGIP/SGIPEntity.cs
@@ -69,15 +69,17 @@ namespace NewLife.Net.SGIP
/// <returns></returns>
public static SGIPEntity Read(Stream stream)
{
- var reader = new BinaryReaderX(stream);
- reader.Settings.EncodeInt = false;
+ //var reader = new BinaryReaderX(stream);
+ //reader.Settings.EncodeInt = false;
+ var reader = new Binary();
+ reader.Stream = stream;
// 先读取包长度和命令类型
- var len = reader.ReadInt32();
- var cmd = (SGIPCommands)reader.ReadUInt32();
+ var len = reader.Read<Int32>();
+ var cmd = (SGIPCommands)reader.Read<UInt32>();
var type = ObjectContainer.Current.ResolveType<SGIPEntity>(cmd);
- var entity = reader.ReadObject(type) as SGIPEntity;
+ var entity = reader.Read(type) as SGIPEntity;
entity.Command = cmd;
return entity;
}
@@ -87,10 +89,13 @@ namespace NewLife.Net.SGIP
/// <returns></returns>
public void Write(Stream stream)
{
- var writer = new BinaryWriterX();
- writer.Settings.EncodeInt = false;
+ //var writer = new BinaryWriterX();
+ //writer.Settings.EncodeInt = false;
+ var writer = new Binary();
+ writer.Stream = stream;
+
writer.Write((UInt32)Command);
- writer.WriteObject(this);
+ writer.Write(this);
// 拿出内部流,换一个流,为了用这个读写器
var ms = writer.Stream;
diff --git a/Test/Program.cs b/Test/Program.cs
index 9d0fc13..ef91fc4 100644
--- a/Test/Program.cs
+++ b/Test/Program.cs
@@ -39,7 +39,7 @@ namespace Test
try
{
#endif
- Test1();
+ Test1();
#if !DEBUG
}
catch (Exception ex)
@@ -57,30 +57,16 @@ namespace Test
static void Test1()
{
- //using (var fs = File.OpenRead("Config.7z"))
- //{
- // var sz = new SevenZip();
- // if (!sz.Read(fs))
- // {
- // Console.WriteLine("不是7z格式");
- // return;
- // }
-
- // Console.WriteLine("版本:\t{0}", sz.Version);
- // Console.WriteLine("CRC:\t{0:X8}", sz.Crc);
- //}
- //var lib = @"E:\Auto\扫描枪\SmartOS\SmartOS_F1x0D.lib";
- //var lzma = @"E:\Auto\扫描枪\SmartOS\SmartOS_F1x0D.lzma";
- //File.OpenRead(lib).CompressLzma(File.OpenWrite(lzma), 9);
- //using (var fs = File.OpenRead(@"E:\Auto\扫描枪\SmartOS\SmartOS_F1x0D_2.zip"))
- //{
- // var zip = new ZipFile(fs);
- // //foreach (var item in zip.Entries)
- // //{
+ using (var zip = new ZipFile(@"..\System.Data.SQLite.zip".GetFullPath()))
+ {
+ foreach (var item in zip.Entries)
+ {
+ Console.WriteLine("{0}\t{1}\t{2}", item.Key, item.Value.FileName, item.Value.UncompressedSize);
+ }
+ zip.Extract("SQLite".GetFullPath());
+ }
- // //}
- // zip.Extract(".\\");
- //}
+ ZipFile.CompressDirectory("SQLite".GetFullPath());
}
static void Test2()
diff --git a/Test/Test.csproj b/Test/Test.csproj
index a5d0841..b6580ee 100644
--- a/Test/Test.csproj
+++ b/Test/Test.csproj
@@ -45,10 +45,6 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\NewLife.CommonEntity\NewLife.CommonEntity.csproj">
- <Project>{50D7FAE5-2304-4395-A6FA-7D35279D9D84}</Project>
- <Name>NewLife.CommonEntity</Name>
- </ProjectReference>
<ProjectReference Include="..\NewLife.Core\NewLife.Core.csproj">
<Project>{5813C22E-EEB3-4DEE-A45C-BB218041193A}</Project>
<Name>NewLife.Core</Name>
diff --git a/XCode/Entity/Entity.cs b/XCode/Entity/Entity.cs
index f9a4b64..3ff68bf 100644
--- a/XCode/Entity/Entity.cs
+++ b/XCode/Entity/Entity.cs
@@ -1378,7 +1378,11 @@ namespace XCode
//[Obsolete("该成员在后续版本中将不再被支持!")]
public static TEntity FromJson(String json)
{
+#if NET4
+ return null;
+#else
return new Json().Deserialize<TEntity>(json);
+#endif
}
#endregion
diff --git a/XCode/Entity/EntityBase.cs b/XCode/Entity/EntityBase.cs
index 8485a12..3c329c1 100644
--- a/XCode/Entity/EntityBase.cs
+++ b/XCode/Entity/EntityBase.cs
@@ -105,8 +105,9 @@ namespace XCode
/// <returns></returns>
public virtual String ToJson()
{
- Json json = new Json();
- return json.Serialize(this);
+ //Json json = new Json();
+ //return json.Serialize(this);
+ return null;
}
#endregion
diff --git a/XCode/Entity/EntityList.cs b/XCode/Entity/EntityList.cs
index f0a24f9..5e2da44 100644
--- a/XCode/Entity/EntityList.cs
+++ b/XCode/Entity/EntityList.cs
@@ -748,7 +748,8 @@ namespace XCode
/// <returns></returns>
public virtual String ToJson()
{
- return new Json().Serialize(this);
+ //return new Json().Serialize(this);
+ return null;
}
/// <summary>导入Json</summary>
@@ -756,7 +757,8 @@ namespace XCode
/// <returns></returns>
public static EntityList<T> FromJson(String json)
{
- return new Json().Deserialize<EntityList<T>>(json);
+ //return new Json().Deserialize<EntityList<T>>(json);
+ return null;
}
#endregion
diff --git a/XCode/Model/XCodeService.cs b/XCode/Model/XCodeService.cs
index 9403f60..65def5f 100644
--- a/XCode/Model/XCodeService.cs
+++ b/XCode/Model/XCodeService.cs
@@ -1,6 +1,5 @@
using System;
using NewLife.Model;
-using XCode.Accessors;
using XCode.DataAccessLayer;
namespace XCode.Model
@@ -24,7 +23,7 @@ namespace XCode.Model
DbFactory.Reg(container);
- EntityAccessorFactory.Reg(container);
+ //EntityAccessorFactory.Reg(container);
}
#region 方法
diff --git a/XCode/XCode.csproj b/XCode/XCode.csproj
index f1cc318..3501d45 100644
--- a/XCode/XCode.csproj
+++ b/XCode/XCode.csproj
@@ -53,26 +53,6 @@
<Compile Include="..\NewLife.Core\Properties\AssemblyInfo_.cs">
<Link>Properties\AssemblyInfo_.cs</Link>
</Compile>
- <Compile Include="Accessors\BinaryEntityAccessor.cs">
- </Compile>
- <Compile Include="Accessors\EntityAccessorBase.cs">
- </Compile>
- <Compile Include="Accessors\EntityAccessorEventArgs.cs" />
- <Compile Include="Accessors\EntityAccessorFactory.cs" />
- <Compile Include="Accessors\EntityAccessorOptions.cs" />
- <Compile Include="Accessors\EntityAccessorTypes.cs" />
- <Compile Include="Accessors\HttpEntityAccessor.cs">
- </Compile>
- <Compile Include="Accessors\JsonEntityAccessor.cs">
- </Compile>
- <Compile Include="Accessors\SerializationEntityAccessorBase.cs">
- </Compile>
- <Compile Include="Accessors\WebFormEntityAccessor.cs">
- </Compile>
- <Compile Include="Accessors\WinFormEntityAccessor.cs">
- </Compile>
- <Compile Include="Accessors\XmlEntityAccessor.cs">
- </Compile>
<Compile Include="Attributes\BindColumnAttribute.cs" />
<Compile Include="Attributes\BindIndexAttribute.cs" />
<Compile Include="Attributes\BindTableAttribute.cs" />
@@ -201,12 +181,10 @@
<Compile Include="Entity\IEntity.cs" />
<Compile Include="Entity\IEntityOperate.cs" />
<Compile Include="Cache\SingleEntityCache.cs" />
- <Compile Include="Accessors\IEntityAccessor.cs" />
<Compile Include="Model\OrderExpression.cs" />
<Compile Include="Model\WhereExpression.cs" />
<Compile Include="Model\XCodeService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Web\EntityForm.cs" />
<Compile Include="Web\EntityGrid.cs" />
<None Include="Membership\XCoder.log">
<AutoGen>True</AutoGen>
diff --git "a/X\347\273\204\344\273\266.sln" "b/X\347\273\204\344\273\266.sln"
index 840ae44..cd7e312 100644
--- "a/X\347\273\204\344\273\266.sln"
+++ "b/X\347\273\204\344\273\266.sln"
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
+VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XControl", "XControl\XControl.csproj", "{A82E3AA8-6181-460D-A6EE-CC453B83D340}"
EndProject
@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XCode", "XCode\XCode.csproj", "{B49ABA5A-C5DA-45F4-87F1-B435EC51D710}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewLife.CommonEntity", "NewLife.CommonEntity\NewLife.CommonEntity.csproj", "{50D7FAE5-2304-4395-A6FA-7D35279D9D84}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XAgent", "XAgent\XAgent.csproj", "{A18FB4FB-5AA8-4781-A898-82DBEE6A6631}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XTemplate", "XTemplate\XTemplate.csproj", "{55BA37EE-01A2-438F-A0FB-6B57440BF2F0}"
@@ -49,10 +47,6 @@ Global
{B49ABA5A-C5DA-45F4-87F1-B435EC51D710}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B49ABA5A-C5DA-45F4-87F1-B435EC51D710}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B49ABA5A-C5DA-45F4-87F1-B435EC51D710}.Release|Any CPU.Build.0 = Release|Any CPU
- {50D7FAE5-2304-4395-A6FA-7D35279D9D84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {50D7FAE5-2304-4395-A6FA-7D35279D9D84}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {50D7FAE5-2304-4395-A6FA-7D35279D9D84}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {50D7FAE5-2304-4395-A6FA-7D35279D9D84}.Release|Any CPU.Build.0 = Release|Any CPU
{A18FB4FB-5AA8-4781-A898-82DBEE6A6631}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A18FB4FB-5AA8-4781-A898-82DBEE6A6631}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A18FB4FB-5AA8-4781-A898-82DBEE6A6631}.Release|Any CPU.ActiveCfg = Release|Any CPU