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

C# Serializer类代码示例

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

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



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

示例1: YamlManager

 /// <summary>
 /// Initializes a new instance of the <see cref="GameSystem" /> class.
 /// </summary>
 /// <param name="game">The game.</param>
 public YamlManager(Game game) : base(game)
 {
     Services.AddService(this);
     yamlSettings = new SerializerSettings();
     attributeRegistry = yamlSettings.Attributes;
     serializer = new Serializer(yamlSettings);
 }
开发者ID:GrafSeismo,项目名称:SharpDX,代码行数:11,代码来源:YamlManager.cs


示例2: Serialize

        public override void Serialize(Serializer serializer)
        {
            base.Serialize(serializer);

            serializer.Serialize(ref delta, "delta");
            serializer.Serialize(ref itemDefinition, "itemDefinition");
        }
开发者ID:carriercomm,项目名称:CubeWorld,代码行数:7,代码来源:TileRuleCreateItem.cs


示例3: BuildSerializer

        public override ValueSerializer BuildSerializer(Serializer serializer, Type type,
            ConcurrentDictionary<Type, ValueSerializer> typeMapping)
        {
            var x = new ObjectSerializer(type);
            typeMapping.TryAdd(type, x);

            var elementType = GetEnumerableType(type);
            var arrType = elementType.MakeArrayType();
            var listModule = type.Assembly.GetType("Microsoft.FSharp.Collections.ListModule");
            var ofArray = listModule.GetMethod("OfArray");
            var ofArrayConcrete = ofArray.MakeGenericMethod(elementType);
            var ofArrayCompiled = CodeGenerator.CompileToDelegate(ofArrayConcrete, arrType);
            var toArray = listModule.GetMethod("ToArray");
            var toArrayConcrete = toArray.MakeGenericMethod(elementType);
            var toArrayCompiled = CodeGenerator.CompileToDelegate(toArrayConcrete, type);

            ValueWriter writer = (stream, o, session) =>
            {
                var arr = toArrayCompiled(o);
                var arrSerializer = serializer.GetSerializerByType(arrType);
                arrSerializer.WriteValue(stream,arr,session);
            };

            ValueReader reader = (stream, session) =>
            {               
                var arrSerializer = serializer.GetSerializerByType(arrType);
                var items = (Array)arrSerializer.ReadValue(stream, session);                          
                var res = ofArrayCompiled(items);
                return res;
            };
            x.Initialize(reader, writer);
            return x;
        }
开发者ID:philiplaureano,项目名称:Wire,代码行数:33,代码来源:FSharpListSerializerFactory.cs


示例4: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.Sync("block", ref block);
			ser.Sync("prg", ref prg);
			ser.Sync("mode", ref mode);
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:7,代码来源:Mapper049.cs


示例5: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.Sync("toggle1", ref _toggle1);
			ser.Sync("toggle2", ref _toggle2);
			ser.Sync("toggle3", ref _toggle3);
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:7,代码来源:mE0.cs


示例6: SyncState

		public override void SyncState(Serializer ser)
		{
			ser.Sync("bank_4k", ref _bank4K);
			ser.Sync("gameTotal", ref _gameTotal);
			ser.Sync("currentGame", ref _currentGame);
			base.SyncState(ser);
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:7,代码来源:Multicart8K.cs


示例7: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.BeginSection("FDS");
			ser.BeginSection("RamAdapter");
			diskdrive.SyncState(ser);
			ser.EndSection();
			ser.BeginSection("audio");
			audio.SyncState(ser);
			ser.EndSection();
			{
				// silly little hack
				int tmp = currentside != null ? (int)currentside : 1234567;
				ser.Sync("currentside", ref tmp);
				currentside = tmp == 1234567 ? null : (int?)tmp;
			}
			for (int i = 0; i < NumSides; i++)
				ser.Sync("diskdiffs" + i, ref diskdiffs[i], true);
			ser.Sync("_timerirq", ref _timerirq);
			ser.Sync("_diskirq", ref _diskirq);
			ser.Sync("diskenable", ref diskenable);
			ser.Sync("soundenable", ref soundenable);
			ser.Sync("reg4026", ref reg4026);
			ser.Sync("timerlatch", ref timerlatch);
			ser.Sync("timervalue", ref timervalue);
			ser.Sync("timerreg", ref timerreg);
			ser.EndSection();

			SetIRQ();
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:30,代码来源:FDS.cs


示例8: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.Sync("reg_addr", ref reg_addr);
			ser.Sync("regs", ref regs);
			Sync();
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:7,代码来源:Mapper112.cs


示例9: Serialize

        public override void Serialize(Serializer serializer)
        {
            base.Serialize(serializer);

            serializer.Serialize(ref delta, "delta");
            serializer.Serialize(ref soundId, "soundId");
        }
开发者ID:carriercomm,项目名称:CubeWorld,代码行数:7,代码来源:TileRulePlaySound.cs


示例10: GenXML

    public void GenXML()
    {
        String sourceUri = Server.MapPath("5648.xml");
        String xqUri = Server.MapPath("graph.xq");

        using (FileStream sXml = File.OpenRead(sourceUri))
        {
            using (FileStream sXq = File.OpenRead(xqUri))
            {
                Processor processor = new Processor();
                XQueryCompiler compiler = processor.NewXQueryCompiler();
                compiler.BaseUri = sourceUri;
                XQueryExecutable exp = compiler.Compile(sXq);
                XQueryEvaluator eval = exp.Load();

                DocumentBuilder loader = processor.NewDocumentBuilder();
                loader.BaseUri = new Uri(sourceUri);
                XdmNode indoc = loader.Build(new FileStream(sourceUri, FileMode.Open, FileAccess.Read));

                eval.ContextItem = indoc;
                Serializer qout = new Serializer();
                qout.SetOutputProperty(Serializer.METHOD, "xml");
                qout.SetOutputProperty(Serializer.INDENT, "yes");
                qout.SetOutputProperty(Serializer.SAXON_INDENT_SPACES, "1");
                qout.SetOutputWriter(Response.Output);
                eval.Run(qout);
            }
        }
    }
开发者ID:plasma-umass,项目名称:Hound,代码行数:29,代码来源:Default.aspx.cs


示例11: Deserialize

		public void Deserialize(System.IO.TextReader rdr, Serializer serializer) {
			string name, value;
			var parameters = new System.Collections.Specialized.NameValueCollection();
			while (rdr.Property(out name, out value, parameters) && !string.IsNullOrEmpty(name)) {
				switch (name.ToUpper()) {
					case "BEGIN":
						switch (value) {
							case "VALARM":
								var a = serializer.GetService<Alarm>();
								a.Deserialize(rdr, serializer);
								Alarms.Add(a);
								break;
						}
						break;
					case "ATTENDEE":
						var contact = new Contact();
						contact.Deserialize(value, parameters);
						Attendees.Add(contact);
						break;
					case "CATEGORIES":
						Categories = value.SplitEscaped().ToList();
						break;
					case "CLASS": Class = value.ToEnum<Classes>(); break;
					case "CREATED": Created = value.ToDateTime(); break;
					case "DESCRIPTION": Description = value; break;
					case "DTEND": End = value.ToDateTime(); break;
					case "DTSTAMP": DTSTAMP = value.ToDateTime().GetValueOrDefault(); break;
					case "DTSTART": Start = value.ToDateTime(); break;
					case "LAST-MODIFIED": LastModified = value.ToDateTime(); break;
					case "LOCATION": Location = value; break;
					case "ORGANIZER":
						Organizer = serializer.GetService<Contact>();
						Organizer.Deserialize(value, parameters);
						break;
					case "PRIORITY": Priority = value.ToInt(); break;
					case "SEQUENCE": Sequence = value.ToInt(); break;
					case "STATUS": Status = value.ToEnum<Statuses>(); break;
					case "SUMMARY": Summary = value; break;
					case "TRANSP": Transparency = value; break;
					case "UID": UID = value; break;
					case "URL": Url = value.ToUri(); break;
					case "ATTACH":
						var attach = value.ToUri();
						if (attach != null)
							Attachments.Add(attach);
						break;
					case "RRULE":
						var rule = serializer.GetService<Recurrence>();
						rule.Deserialize(null, parameters);
						Recurrences.Add(rule);
						break;
					case "END": return;
					default:
						Properties.Add(Tuple.Create(name, value, parameters));
						break;
				}
			}

			IsAllDay = Start == End;
		}
开发者ID:hiblen,项目名称:CalDav,代码行数:60,代码来源:Event.cs


示例12: LoadXML

 public virtual void LoadXML(string filename)
 {
     Serializer<List<StringMap>> serializer = new Serializer<List<StringMap>>();
     List<StringMap> tmp = serializer.Load(filename);
     if (tmp != null)
         stringmap = tmp;
 }
开发者ID:MedStarSiTEL,项目名称:UnityTrauma,代码行数:7,代码来源:StringMgr.cs


示例13: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.Sync("irq_target", ref irq_target);
			ser.Sync("irq_counter", ref irq_counter);
			ser.Sync("irq_enabled", ref irq_enabled);
			ser.Sync("irq_pending", ref irq_pending);
			ser.Sync("in_frame", ref in_frame);
			ser.Sync("exram_mode", ref exram_mode);
			ser.Sync("chr_mode", ref chr_mode);
			ser.Sync("prg_mode", ref prg_mode);
			ser.Sync("chr_reg_high", ref chr_reg_high);
			ser.Sync("ab_mode", ref ab_mode);
			ser.Sync("regs_a", ref regs_a);
			ser.Sync("regs_b", ref regs_b);
			ser.Sync("regs_prg", ref regs_prg);
			ser.Sync("nt_modes", ref nt_modes);
			ser.Sync("nt_fill_tile", ref nt_fill_tile);
			ser.Sync("nt_fill_attrib", ref nt_fill_attrib);
			ser.Sync("wram_bank", ref wram_bank);
			ser.Sync("last_nt_read", ref last_nt_read);
			ser.Sync("EXRAM", ref EXRAM, false);

			SyncPRGBanks();
			SyncCHRBanks();
			SyncMultiplier();
			SyncIRQ();
			audio.SyncState(ser);
		}
开发者ID:henke37,项目名称:BizHawk,代码行数:29,代码来源:ExROM.cs


示例14: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.Sync("prg_mode_mapper", ref prg_mode_mapper);
			ser.Sync("prg_page", ref prg_page);
			ser.Sync("chr_block_or", ref chr_block_or);
		}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:7,代码来源:Mapper115.cs


示例15: Serialize

        public override void Serialize(Serializer serializer)
        {
            base.Serialize(serializer);

            serializer.Serialize(ref delta, "delta");
            serializer.Serialize(ref damage, "damage");
        }
开发者ID:carriercomm,项目名称:CubeWorld,代码行数:7,代码来源:TileRuleDamage.cs


示例16: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.Sync("prg", ref prg, false);
			ser.Sync("chr", ref chr, false);
			ser.Sync("wramenable", ref wramenable);
		}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:7,代码来源:Namcot175_340.cs


示例17: Serialize

        public override void Serialize(Serializer serializer)
        {
            base.Serialize(serializer);

            serializer.Serialize(ref delta, "delta");
            serializer.Serialize(ref tileType, "tileType");
        }
开发者ID:carriercomm,项目名称:CubeWorld,代码行数:7,代码来源:TileRuleConditionIsType.cs


示例18: Deserialize

        protected virtual Serializer Deserialize(Serializer serializer)
        {
            Bones.Clear();
            PrimaryBoneID = "";

            List<XElement> subObjects = (from el
                                    in serializer.SerializedData.Elements("dataitem").Elements("object")
                                    select el).ToList();

            for (int i = 0; i < subObjects.Count; i++)
            {
                if ((Type.GetType((string)subObjects[i].Attribute("type")) != null) &&
                    (Type.GetType((string)subObjects[i].Attribute("type")).GetInterfaces().Contains(typeof(IBone))))
                {
                    ReinstateBone(subObjects[i]);
                }
            }

            WorldPosition = serializer.GetDataItem<Vector2>("world-position");
            Rotation = serializer.GetDataItem<float>("rotation");
            Scale = serializer.GetDataItem<float>("scale");
            Mirror = serializer.GetDataItem<bool>("mirror");
            Tint = serializer.GetDataItem<Color>("tint");
            RenderDepth = serializer.GetDataItem<float>("render-depth");
            RenderLayer = serializer.GetDataItem<int>("render-layer");
            Visible = serializer.GetDataItem<bool>("visible");

            return serializer;
        }
开发者ID:Ben-P-Leda,项目名称:Bopscotch-Android,代码行数:29,代码来源:StorableSkeleton.cs


示例19: SyncState

		public override void SyncState(Serializer ser)
		{
			base.SyncState(ser);
			ser.Sync("prg_bank_mask_16k", ref prg_bank_mask_16k);
			ser.Sync("prg_bank_16k", ref prg_bank_16k);
			ser.Sync("prg_banks_16k", ref prg_banks_16k);
		}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:7,代码来源:Sunsoft2_m93.cs


示例20: Serialize

        public override void Serialize(Serializer serializer)
        {
            base.Serialize(serializer);

            serializer.Serialize(ref delta, "delta");
            serializer.Serialize(ref effectId, "effectId");
        }
开发者ID:carriercomm,项目名称:CubeWorld,代码行数:7,代码来源:TileRulePlayEffect.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SerializerSession类代码示例发布时间:2022-05-24
下一篇:
C# SerializedSignature类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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