本文整理汇总了C#中SerializationFormat类的典型用法代码示例。如果您正苦于以下问题:C# SerializationFormat类的具体用法?C# SerializationFormat怎么用?C# SerializationFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerializationFormat类属于命名空间,在下文中一共展示了SerializationFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetCurrent
public static ISerializer GetCurrent(SerializationFormat format)
{
var serializers = Container.GetAll<ISerializer>();
return (from s in serializers
where s.Format == format
select s).FirstOrDefault();
}
开发者ID:Narinyir,项目名称:caching,代码行数:7,代码来源:Serializer.cs
示例2: ToClaim
public Claim ToClaim(SerializationFormat serializationFormat = SerializationFormat.Json)
{
return new Claim(ClaimTypes.GroupSid, Sid);
//var serialized = serializationFormat == SerializationFormat.Json
// ? this.ToJson()
// : this.ToXml();
//return new Claim(LDAPClaimTypes.ActiveDirectoryGroup, serialized);
}
开发者ID:blinds52,项目名称:Owin.Security.ActiveDirectoryLDAP,代码行数:9,代码来源:Group.cs
示例3: RESTDataClient
/// <summary>
/// Creates a new instance of RESTDataClient.
/// </summary>
/// <param name="serviceUrl">The url endpoint of the service to send data to.</param>
/// <param name="timeout">A timeout for all requests.</param>
/// <param name="compress">Whether to compress data before sending. Only applies when posting JSON or XML, not with HttpQueryString mode.</param>
/// <param name="serializationFormat">The version number to send to the server.</param>
/// <param name="version">The version number to send to the server.</param>
public RESTDataClient(Uri serviceUrl, int timeout, bool compress, SerializationFormat serializationFormat, int version)
{
Version = version;
ServiceUrl = serviceUrl;
Timeout = TimeSpan.FromSeconds(timeout);
Compress = compress;
SerializationFormat = serializationFormat;
AdditionalHttpHeaders = new Dictionary<string, string>();
}
开发者ID:bondarenkod,项目名称:pf-arm-deploy-error,代码行数:17,代码来源:RESTDataClient.cs
示例4: SerializedValue
public SerializedValue([NotNull] string assemblyQualifiedName)
{
if (assemblyQualifiedName == null)
{
throw new ArgumentNullException("assemblyQualifiedName");
}
_assemblyQualifiedName = assemblyQualifiedName;
_format = SerializationFormat.Null;
}
开发者ID:JackTheRipper42,项目名称:Binding,代码行数:10,代码来源:SerializedValue.cs
示例5: HttpCacheRequestHandler
// private SyncReader syncReader;
// private SyncWriter syncWriter;
public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
{
baseUri = serviceUri;
serializationFormat = behaviors.SerializationFormat;
scopeName = behaviors.ScopeName;
credentials = behaviors.Credentials;
knownTypes = new Type[behaviors.KnownTypes.Count];
behaviors.KnownTypes.CopyTo(knownTypes, 0);
scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
}
开发者ID:dkmehta,项目名称:SyncWinRT,代码行数:13,代码来源:HttpCacheRequestHandlerAsync.cs
示例6: JsonResult
public JsonResult(object data, string contentType,
Encoding contentEncoding, SerializationFormat format,
IEnumerable<JavaScriptConverter> converters)
{
_converters = new List<JavaScriptConverter>(
converters ?? Enumerable.Empty<JavaScriptConverter>());
_data = data;
_contentType = contentType;
_contentEncoding = contentEncoding;
_format = format;
}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:12,代码来源:JsonResult.cs
示例7: HttpCacheRequestHandler
// private SyncReader syncReader;
// private SyncWriter syncWriter;
public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
{
baseUri = serviceUri;
serializationFormat = behaviors.SerializationFormat;
scopeName = behaviors.ScopeName;
credentials = behaviors.Credentials;
knownTypes = new Type[behaviors.KnownTypes.Count];
behaviors.KnownTypes.CopyTo(knownTypes, 0);
scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
customHeaders = new Dictionary<string, string>(behaviors.CustomHeadersInternal);
automaticDecompression = behaviors.AutomaticDecompression;
this.CookieContainer = behaviors.CookieContainer;
}
开发者ID:erpframework,项目名称:SyncWinRT,代码行数:16,代码来源:HttpCacheRequestHandlerAsync.cs
示例8: Run
public void Run(AmfFile file, out string name, out SerializationFormat format)
{
// Case for "save to file". Fenoxo only serializes ones object and there is no header.
if (_reader.PeekChar() == 0x0A)
{
format = SerializationFormat.Exported;
ReadPlainDataFile(file, out name);
}
// Case for "save to slot". Real AMF3 file with a proper header.
else
{
format = SerializationFormat.Slot;
ReadStandardFile(file, out name);
}
}
开发者ID:Belgrath,项目名称:CoCEd,代码行数:15,代码来源:AmfReader.cs
示例9: SerializeSystemBoolean
public static Stream SerializeSystemBoolean(bool obj, SerializationFormat serializationFormat, WebMessageFormat webMessageFormat)
{
if (IsXml(serializationFormat, webMessageFormat))
{
var root = new XElement(XName.Get("Boolean"));
var xDocument = new XDocument(root);
root.Add(XmlConvert.ToString(obj));
var stream = GetStream(xDocument);
return stream;
}
else
{
return GetStream(obj.ToJsonString());
}
}
开发者ID:nguyenkien,项目名称:api,代码行数:15,代码来源:SerializationHelperBase.cs
示例10: Get
public ISerializer Get(SerializationFormat format)
{
switch (format)
{
case SerializationFormat.None:
return this.Null;
case SerializationFormat.Json:
return this.Json;
case SerializationFormat.Xml:
return this.Xml;
case SerializationFormat.Binary:
return this.Binary;
case SerializationFormat.Null:
throw new Exception("You must specify a valid SerializationFormat");
default:
throw new Exception(string.Format("There is no serializer with format '{0}'", format));
}
}
开发者ID:Sunzhuokai,项目名称:caching,代码行数:18,代码来源:Serializer.cs
示例11: SerializeSystemBooleanArray
public static Stream SerializeSystemBooleanArray(bool[] objs, SerializationFormat serializationFormat, WebMessageFormat webMessageFormat)
{
if (IsXml(serializationFormat, webMessageFormat))
{
var root = new XElement(XName.Get("BooleanArray"));
var xDocument = new XDocument(root);
foreach (var obj in objs)
{
var child = new XElement(XName.Get("Boolean"));
child.Add(XmlConvert.ToString(obj));
}
var stream = GetStream(xDocument);
return stream;
}
else
{
return GetStream(objs.ToJsonString());
}
}
开发者ID:nguyenkien,项目名称:api,代码行数:19,代码来源:SerializationHelperBase.cs
示例12: Run
public void Run(AmfFile file, string newName, SerializationFormat format)
{
switch (format)
{
case SerializationFormat.Slot:
WriteStandardFile(file, newName);
break;
case SerializationFormat.Exported:
WritePlainDataFile(file);
break;
default:
throw new NotImplementedException();
}
// Flush
_writer.Flush();
}
开发者ID:Belgrath,项目名称:CoCEd,代码行数:19,代码来源:AmfWriter.cs
示例13: CacheControllerBehavior
internal CacheControllerBehavior()
{
this._userSession = new SessionInfo();
this._knownTypes = new List<EntityType>();
this._serFormat = SerializationFormat.ODataAtom;
this._scopeParameters = new Dictionary<string, string>();
}
开发者ID:Fedorm,项目名称:core-master,代码行数:7,代码来源:CacheControllerBehavior.cs
示例14: GenerateReader
//*******************************************************
// Reader generation
//
public void GenerateReader (string readerClassName, ArrayList maps)
{
if (_config == null || !_config.GenerateAsInternal)
WriteLine ("public class " + readerClassName + " : XmlSerializationReader");
else
WriteLine ("internal class " + readerClassName + " : XmlSerializationReader");
WriteLineInd ("{");
// FromBinHexString() is not public, so use reflection here.
WriteLine ("static readonly System.Reflection.MethodInfo fromBinHexStringMethod = typeof (XmlConvert).GetMethod (\"FromBinHexString\", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type [] {typeof (string)}, null);");
WriteLine ("static byte [] FromBinHexString (string input)");
WriteLineInd ("{");
WriteLine ("return input == null ? null : (byte []) fromBinHexStringMethod.Invoke (null, new object [] {input});");
WriteLineUni ("}");
_mapsToGenerate = new ArrayList ();
_fixupCallbacks = new ArrayList ();
InitHooks ();
for (int n=0; n<maps.Count; n++)
{
GenerationResult res = (GenerationResult) maps [n];
_typeMap = res.Mapping;
_format = _typeMap.Format;
_result = res;
GenerateReadRoot ();
}
for (int n=0; n<_mapsToGenerate.Count; n++)
{
XmlTypeMapping map = _mapsToGenerate [n] as XmlTypeMapping;
if (map == null) continue;
GenerateReadObject (map);
if (map.TypeData.SchemaType == SchemaTypes.Enum)
GenerateGetEnumValueMethod (map);
}
GenerateReadInitCallbacks ();
if (_format == SerializationFormat.Encoded)
{
GenerateFixupCallbacks ();
GenerateFillerCallbacks ();
}
WriteLineUni ("}");
UpdateGeneratedTypes (_mapsToGenerate);
}
开发者ID:thenextman,项目名称:mono,代码行数:53,代码来源:SerializationCodeGenerator.cs
示例15: CacheRequestHandler
protected CacheRequestHandler(Uri baseUri, SerializationFormat format, string scopeName)
{
this._baseUri = baseUri;
this._serializationFormat = format;
this._scopeName = scopeName;
}
开发者ID:Fedorm,项目名称:core-master,代码行数:6,代码来源:CacheRequestHandler.cs
示例16: DeserializeDataSetSchema
private void DeserializeDataSetSchema(SerializationInfo info, StreamingContext context, SerializationFormat remotingFormat, System.Data.SchemaSerializationMode schemaSerializationMode)
{
if (remotingFormat != SerializationFormat.Xml)
{
if (schemaSerializationMode == System.Data.SchemaSerializationMode.IncludeSchema)
{
this.DeserializeDataSetProperties(info, context);
int num4 = info.GetInt32("DataSet.Tables.Count");
for (int i = 0; i < num4; i++)
{
byte[] buffer = (byte[]) info.GetValue(string.Format(CultureInfo.InvariantCulture, "DataSet.Tables_{0}", new object[] { i }), typeof(byte[]));
MemoryStream serializationStream = new MemoryStream(buffer) {
Position = 0L
};
BinaryFormatter formatter = new BinaryFormatter(null, new StreamingContext(context.State, false));
DataTable table = (DataTable) formatter.Deserialize(serializationStream);
this.Tables.Add(table);
}
for (int j = 0; j < num4; j++)
{
this.Tables[j].DeserializeConstraints(info, context, j, true);
}
this.DeserializeRelations(info, context);
for (int k = 0; k < num4; k++)
{
this.Tables[k].DeserializeExpressionColumns(info, context, k);
}
}
else
{
this.DeserializeDataSetProperties(info, context);
}
}
else
{
string s = (string) info.GetValue("XmlSchema", typeof(string));
if (s != null)
{
this.ReadXmlSchema(new XmlTextReader(new StringReader(s)), true);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:42,代码来源:DataSet.cs
示例17: DeserializeDataSetData
private void DeserializeDataSetData(SerializationInfo info, StreamingContext context, SerializationFormat remotingFormat)
{
if (remotingFormat != SerializationFormat.Xml)
{
for (int i = 0; i < this.Tables.Count; i++)
{
this.Tables[i].DeserializeTableData(info, context, i);
}
}
else
{
string s = (string) info.GetValue("XmlDiffGram", typeof(string));
if (s != null)
{
this.ReadXml(new XmlTextReader(new StringReader(s)), XmlReadMode.DiffGram);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:DataSet.cs
示例18: SerializeDataSet
private void SerializeDataSet(SerializationInfo info, StreamingContext context, SerializationFormat remotingFormat)
{
info.AddValue("DataSet.RemotingVersion", new Version(2, 0));
if (remotingFormat != SerializationFormat.Xml)
{
info.AddValue("DataSet.RemotingFormat", remotingFormat);
}
if (System.Data.SchemaSerializationMode.IncludeSchema != this.SchemaSerializationMode)
{
info.AddValue("SchemaSerializationMode.DataSet", this.SchemaSerializationMode);
}
if (remotingFormat != SerializationFormat.Xml)
{
if (this.SchemaSerializationMode == System.Data.SchemaSerializationMode.IncludeSchema)
{
this.SerializeDataSetProperties(info, context);
info.AddValue("DataSet.Tables.Count", this.Tables.Count);
for (int j = 0; j < this.Tables.Count; j++)
{
BinaryFormatter formatter = new BinaryFormatter(null, new StreamingContext(context.State, false));
MemoryStream serializationStream = new MemoryStream();
formatter.Serialize(serializationStream, this.Tables[j]);
serializationStream.Position = 0L;
info.AddValue(string.Format(CultureInfo.InvariantCulture, "DataSet.Tables_{0}", new object[] { j }), serializationStream.GetBuffer());
}
for (int k = 0; k < this.Tables.Count; k++)
{
this.Tables[k].SerializeConstraints(info, context, k, true);
}
this.SerializeRelations(info, context);
for (int m = 0; m < this.Tables.Count; m++)
{
this.Tables[m].SerializeExpressionColumns(info, context, m);
}
}
else
{
this.SerializeDataSetProperties(info, context);
}
for (int i = 0; i < this.Tables.Count; i++)
{
this.Tables[i].SerializeTableData(info, context, i);
}
}
else
{
string xmlSchemaForRemoting = this.GetXmlSchemaForRemoting(null);
string str = null;
info.AddValue("XmlSchema", xmlSchemaForRemoting);
StringBuilder sb = new StringBuilder(this.EstimatedXmlStringSize() * 2);
StringWriter w = new StringWriter(sb, CultureInfo.InvariantCulture);
XmlTextWriter writer = new XmlTextWriter(w);
this.WriteXml(writer, XmlWriteMode.DiffGram);
str = w.ToString();
info.AddValue("XmlDiffGram", str);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:DataSet.cs
示例19: SerializeDataTable
// Serialize the table schema and data.
private void SerializeDataTable(SerializationInfo info, StreamingContext context, bool isSingleTable, SerializationFormat remotingFormat) {
info.AddValue("DataTable.RemotingVersion", new Version(2, 0));
// SqlHotFix 299, SerializationFormat enumeration types don't exist in V1.1 SP1
if (SerializationFormat.Xml != remotingFormat) {
info.AddValue("DataTable.RemotingFormat", remotingFormat);
}
if (remotingFormat != SerializationFormat.Xml) {//Binary
SerializeTableSchema(info, context, isSingleTable);
if (isSingleTable) {
SerializeTableData(info, context, 0);
}
} else {//XML/V1.0/V1.1
string tempDSNamespace = "";
Boolean fCreatedDataSet = false;
if (dataSet == null) {
DataSet ds = new DataSet("tmpDataSet");
// if user set values on DataTable, it isn't necessary
// to set them on the DataSet because they won't be inherited
// but it is simpler to set them in both places
// if user did not set values on DataTable, it is required
// to set them on the DataSet so the table will inherit
// the value already on the Datatable
ds.SetLocaleValue(_culture, _cultureUserSet);
ds.CaseSensitive = this.CaseSensitive;
ds.namespaceURI = this.Namespace;
Debug.Assert(ds.RemotingFormat == SerializationFormat.Xml, "RemotingFormat must be SerializationFormat.Xml");
ds.Tables.Add(this);
fCreatedDataSet = true;
} else {
tempDSNamespace = this.DataSet.Namespace;
this.DataSet.namespaceURI = this.Namespace; //this.DataSet.Namespace = this.Namespace; ??
}
info.AddValue(KEY_XMLSCHEMA, dataSet.GetXmlSchemaForRemoting(this));
info.AddValue(KEY_XMLDIFFGRAM, dataSet.GetRemotingDiffGram(this));
if (fCreatedDataSet) {
dataSet.Tables.Remove(this);
}
else{
dataSet.namespaceURI = tempDSNamespace;
}
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:49,代码来源:DataTable.cs
示例20: Write
private void Write(string path, SerializationFormat format, string name)
{
EnsureDeleted(path);
using (var stream = File.Create(path))
{
using (var writer = new AmfWriter(stream))
{
writer.Run(this, name, format);
stream.Flush();
stream.Close();
}
}
}
开发者ID:Belgrath,项目名称:CoCEd,代码行数:13,代码来源:AmfFile.cs
注:本文中的SerializationFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论