当前位置: 首页>>代码示例>>C#>>正文


C# Serialization.SerializationContext类代码示例

本文整理汇总了C#中MonoDevelop.Core.Serialization.SerializationContext的典型用法代码示例。如果您正苦于以下问题:C# SerializationContext类的具体用法?C# SerializationContext怎么用?C# SerializationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SerializationContext类属于MonoDevelop.Core.Serialization命名空间,在下文中一共展示了SerializationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DataSerializer

		public DataSerializer (DataContext ctx, string baseFile)
		{
			dataContext = ctx;
			serializationContext = ctx.CreateSerializationContext ();
			serializationContext.BaseFile = baseFile;
			serializationContext.Serializer = this;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:DataSerializer.cs

示例2: OnSerialize

		internal protected override DataNode OnSerialize (SerializationContext serCtx, object mapData, object value)
		{
			FilePath path = value is string ? new FilePath ((string) value) : (FilePath) value;
			if (path.IsNullOrEmpty) return null;
			FilePath basePath = Path.GetDirectoryName (serCtx.BaseFile);
			string file = path.ToRelative (basePath);
			if (Path.DirectorySeparatorChar != serCtx.DirectorySeparatorChar)
				file = file.Replace (Path.DirectorySeparatorChar, serCtx.DirectorySeparatorChar);
			return new DataValue (Name, file);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:10,代码来源:ProjectPathItemPropertyAttribute.cs

示例3: OnDeserialize

		internal protected override object OnDeserialize (SerializationContext serCtx, object mapData, DataNode data)
		{
			string file = ((DataValue)data).Value;
			if (!string.IsNullOrEmpty (file)) {
				if (Path.DirectorySeparatorChar != serCtx.DirectorySeparatorChar)
					file = file.Replace (serCtx.DirectorySeparatorChar, Path.DirectorySeparatorChar);
				string basePath = Path.GetDirectoryName (serCtx.BaseFile);
				file = FileService.RelativeToAbsolutePath (basePath, file);
			}
			if (ValueType == typeof (string))
				return file;
			else
				return (FilePath) file;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:14,代码来源:ProjectPathItemPropertyAttribute.cs

示例4: OnSerialize

		internal protected override DataNode OnSerialize (SerializationContext serCtx, object mapData, object value)
		{
			string str = value as string;
			switch (str) {
			case "None":
				str = Nothing;
				break;
			case "EmbeddedResource":
				str = EmbedAsResource;
				break;
			case "Content":
				str = Exclude;
				break;
			}
			return new DataValue (Name, str);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:16,代码来源:BuildActionDataType.cs

示例5: OnDeserialize

		internal protected override object OnDeserialize (SerializationContext serCtx, object mapData, DataNode data)
		{
			string str = ((DataValue)data).Value;
			switch (str) {
			case "Nothing":
				str = BuildAction.None;
				break;
			case "EmbedAsResource":
				str = BuildAction.EmbeddedResource;
				break;
			case "FileCopy":
			case "Exclude":
				str = BuildAction.Content;
				break;
			}
			return str;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:17,代码来源:BuildActionDataType.cs

示例6: OnDeserialize

		internal protected override object OnDeserialize (SerializationContext serCtx, object mapData, DataNode data)
		{
			return TimeSpan.FromTicks (long.Parse (((DataValue)data).Value, CultureInfo.InvariantCulture));
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:4,代码来源:PrimitiveDataType.cs

示例7: OnSerialize

		internal protected override DataNode OnSerialize (SerializationContext serCtx, object mapData, object value)
		{
			return new DataValue (Name, ((TimeSpan)value).Ticks.ToString (CultureInfo.InvariantCulture));
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:4,代码来源:PrimitiveDataType.cs

示例8: OnSerialize

		internal protected override DataNode OnSerialize (SerializationContext serCtx, object mapData, object value)
		{
			return new DataValue (Name, ((FilePath) value).ToString ());
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:4,代码来源:PrimitiveDataType.cs

示例9: OnDeserialize

		internal protected override object OnDeserialize (SerializationContext serCtx, object mapData, DataNode data)
		{
			return XmlConvert.ToDateTime (((DataValue)data).Value, XmlDateTimeSerializationMode.Local);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:4,代码来源:PrimitiveDataType.cs

示例10: OnSerialize

		internal protected override DataNode OnSerialize (SerializationContext serCtx, object mapData, object value)
		{
			return new DataValue (Name, (bool)value ? "true" : "false");
		}
开发者ID:natosha,项目名称:monodevelop,代码行数:4,代码来源:MSBuildProjectService.cs

示例11: OnDeserialize

		internal protected override void OnDeserialize (SerializationContext serCtx, object mdata, DataNode data, object collectionInstance)
		{
			MapData mapData = (mdata != null) ? (MapData) mdata : GetDefaultData ();
			
			DataCollection items = ((DataItem) data).ItemData;
			IDictionary dict = (IDictionary) collectionInstance;
			foreach (DataItem item in items) {
				DataNode key = item.ItemData [mapData.KeyName];
				if (key == null)
					continue;
				DataNode val = item.ItemData [mapData.ValueName];
				object keyObj = mapData.KeyType.Deserialize (serCtx, null, key);
				object valueObj = val != null ? mapData.ValueType.Deserialize (serCtx, null, val) : null;
				dict [keyObj] = valueObj;
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:16,代码来源:DictionaryDataType.cs

示例12: OnSerialize

		internal protected override DataNode OnSerialize (SerializationContext serCtx, object mdata, object collection)
		{
			MapData mapData = (mdata != null) ? (MapData) mdata : GetDefaultData ();
			DataItem colItem = new DataItem ();
			colItem.Name = Name;
			colItem.UniqueNames = false;
			IDictionary dict = (IDictionary) collection;
			
			foreach (DictionaryEntry e in dict) {
				DataItem item = new DataItem ();
				item.Name = mapData.ItemName;
				item.UniqueNames = true;
				
				DataNode key = mapData.KeyType.Serialize (serCtx, null, e.Key);
				key.Name = mapData.KeyName;
				DataNode value = mapData.ValueType.Serialize (serCtx, null, e.Value);
				value.Name = mapData.ValueName;
				item.ItemData.Add (key);
				item.ItemData.Add (value);
				
				colItem.ItemData.Add (item);
			}
			return colItem;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:24,代码来源:DictionaryDataType.cs

示例13: OnDeserialize

		internal protected virtual object OnDeserialize (DataType dataType, SerializationContext serCtx, object mapData, DataNode data)
		{
			return dataType.OnDeserialize (serCtx, mapData, data);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:DataSerializer.cs

示例14: OnSerialize

		internal protected virtual DataNode OnSerialize (DataType dataType, SerializationContext serCtx, object mapData, object value)
		{
			return dataType.OnSerialize (serCtx, mapData, value);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:DataSerializer.cs

示例15: OnDeserializeProperty

		internal protected virtual void OnDeserializeProperty (ItemProperty prop, SerializationContext serCtx, object instance, DataNode data, object valueInstance)
		{
			prop.OnDeserialize (serCtx, data, valueInstance);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:DataSerializer.cs


注:本文中的MonoDevelop.Core.Serialization.SerializationContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。