• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Serialization.SerializationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnSerialize

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


示例17: OnDeserialize

		internal protected override object OnDeserialize (SerializationContext serCtx, object mapData, DataNode data)
		{
			return String.Equals (((DataValue)data).Value, "true", StringComparison.OrdinalIgnoreCase);
		}
开发者ID:drasticactions,项目名称:monodevelop,代码行数:4,代码来源:MSBuildProjectService.cs


示例18: CanHandleProperty

		internal protected virtual bool CanHandleProperty (ItemProperty property, SerializationContext serCtx, object instance)
		{
			return true;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:DataSerializer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Serialization.XmlDataSerializer类代码示例发布时间:2022-05-26
下一篇:
C# Serialization.DataNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap