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


C# SerializationReader.ReadOptimizedInt32方法代码示例

本文整理汇总了C#中SerializationReader.ReadOptimizedInt32方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationReader.ReadOptimizedInt32方法的具体用法?C# SerializationReader.ReadOptimizedInt32怎么用?C# SerializationReader.ReadOptimizedInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SerializationReader的用法示例。


在下文中一共展示了SerializationReader.ReadOptimizedInt32方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeserializeStateBag

        public static StateBag DeserializeStateBag(SerializationReader reader)
        {
            var flags = reader.ReadOptimizedBitVector32();
            var stateBag = new StateBag(flags[StateBagIsIgnoreCase]);

            if (flags[StateBagHasDirtyEntries])
            {
                var count = reader.ReadOptimizedInt32();

                for(var i = 0; i < count; i++)
                {
                    var key = reader.ReadOptimizedString();
                    var value = reader.ReadObject();

            // ReSharper disable PossibleNullReferenceException
                    stateBag.Add(key, value).IsDirty = true;
            // ReSharper restore PossibleNullReferenceException
                }
            }

            if (flags[StateBagHasCleanEntries])
            {
                var count = reader.ReadOptimizedInt32();

                for(var i = 0; i < count; i++)
                {
                    var key = reader.ReadOptimizedString();
                    var value = reader.ReadObject();

                    stateBag.Add(key, value);
                }
            }
            return stateBag;
        }
开发者ID:bbqchickenrobot,项目名称:FastSerializer,代码行数:34,代码来源:WebFastSerializationHelper.cs

示例2: DeserializeColor

        public static Color DeserializeColor(SerializationReader reader)
        {
            var flags = reader.ReadOptimizedBitVector32();

            if (flags[ColorIsKnown]) return Color.FromKnownColor((KnownColor) reader.ReadOptimizedInt32());
            if (flags[ColorHasName]) return Color.FromName(reader.ReadOptimizedString());
            if (!flags[ColorHasValue]) return Color.Empty;

            var red = flags[ColorHasRed] ? reader.ReadByte() : (byte) 0;
            var green = flags[ColorHasGreen] ? reader.ReadByte() : (byte) 0;
            var blue = flags[ColorHasBlue] ? reader.ReadByte() : (byte) 0;
            var alpha = flags[ColorHasAlpha] ? reader.ReadByte() : (byte) 0;

            return Color.FromArgb(alpha, red, green, blue);
        }
开发者ID:bbqchickenrobot,项目名称:FastSerializer,代码行数:15,代码来源:DrawingFastSerializationHelper.cs

示例3: DeserializeUnit

        public static Unit DeserializeUnit(SerializationReader reader)
        {
            var state = reader.ReadOptimizedBitVector32();

            var unitType = state[UnitType];

            if (unitType == 0) return Unit.Empty;
            if (state[UnitIsDoubleValue]) return new Unit(reader.ReadDouble(), (UnitType) unitType);
            if (state[UnitIsZeroValue] == 1) return new Unit(0, (UnitType) unitType);

            var integerValue = state[UnitIsOptimizedValue] == 1 ? reader.ReadOptimizedInt32() : reader.ReadInt16();
            if (state[UnitIsNegativeValue] == 1) integerValue = -integerValue - 1;

            return new Unit(integerValue, (UnitType) unitType);
        }
开发者ID:bbqchickenrobot,项目名称:FastSerializer,代码行数:15,代码来源:WebFastSerializationHelper.cs

示例4: Load

        public void Load(SerializationReader reader, Fallen8 fallen8)
        {
            if (WriteResource())
            {
                reader.ReadOptimizedInt32();//parameter

                var keyCount = reader.ReadOptimizedInt32();

                _idx = new Dictionary<IComparable, List<AGraphElement>>(keyCount);

                for (var i = 0; i < keyCount; i++)
                {
                    var key = reader.ReadObject();
                    var value = new List<AGraphElement>();
                    var valueCount = reader.ReadOptimizedInt32();
                    for (var j = 0; j < valueCount; j++)
                    {
                        var graphElementId = reader.ReadInt32();
                        AGraphElement graphElement;
                        if(fallen8.TryGetGraphElement(out graphElement, graphElementId))
                        {
                            value.Add(graphElement);
                        }
                        else
                        {
                            Logger.LogError(String.Format("Error while deserializing the index. Could not find the graph element \"{0}\"", graphElementId));
                        }
                    }
                    _idx.Add((IComparable)key, value);
                }

                FinishWriteResource();

                return;
            }

            throw new CollisionException();
        }
开发者ID:knocte,项目名称:fallen-8,代码行数:38,代码来源:RangeIndex.cs

示例5: DeserializeStateBag

		public static StateBag DeserializeStateBag(SerializationReader reader)
		{
			BitVector32 flags = reader.ReadOptimizedBitVector32();
			StateBag stateBag = new StateBag(flags[StateBagIsIgnoreCase]);

			if (flags[StateBagHasDirtyEntries])
			{
				int count = reader.ReadOptimizedInt32();
				for(int i = 0; i < count; i++)
				{
					string key = reader.ReadOptimizedString();
					object value = reader.ReadObject();
					stateBag.Add(key, value).IsDirty = true;
				}
			}

			if (flags[StateBagHasCleanEntries]) 
			{
				int count = reader.ReadOptimizedInt32();
				for(int i = 0; i < count; i++)
				{
					string key = reader.ReadOptimizedString();
					object value = reader.ReadObject();
					stateBag.Add(key, value);
				}
			}
			return stateBag;
		}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:28,代码来源:WebFastSerializationHelper.cs

示例6: DeserializeUnit

		public static Unit DeserializeUnit(SerializationReader reader)
		{
			BitVector32 state = reader.ReadOptimizedBitVector32();

			int unitType = state[UnitType];

			if(unitType == 0)
				return System.Web.UI.WebControls.Unit.Empty;
			else if(state[UnitIsDoubleValue])
				return new Unit(reader.ReadDouble(), (UnitType) unitType);
			else if(state[UnitIsZeroValue] == 1)
				return new Unit(0, (UnitType) unitType);
			else
			{
				int integerValue = state[UnitIsOptimizedValue] == 1 ? reader.ReadOptimizedInt32() : reader.ReadInt16();
				if(state[UnitIsNegativeValue] == 1) integerValue = -integerValue - 1;
				return new Unit(integerValue, (UnitType) unitType);
			}
		}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:19,代码来源:WebFastSerializationHelper.cs

示例7: DeserializeSimpleTypedDataTable

            public DataTable DeserializeSimpleTypedDataTable(DataTable dataTable, byte[] serializedData)
            {
                reader = new SerializationReader(serializedData);

                int rowCount = reader.ReadOptimizedInt32();

                dataTable.BeginLoadData();
                for(int i = 0; i < rowCount; i++)
                {
                    dataTable.LoadDataRow(reader.ReadOptimizedObjectArray(), true);
                }
                dataTable.EndLoadData();

                throwIfRemainingBytes();
                return dataTable;
            }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:16,代码来源:AdoNetHelper.cs

示例8: DeserializeDataSetDataOnly

            public DataSet DeserializeDataSetDataOnly(DataSet dataSet, byte[] serializedData)
            {
                this.dataSet = dataSet;
                bool originalConstraintsSetting = dataSet.EnforceConstraints;
                dataSet.EnforceConstraints = false;

                reader = new SerializationReader(serializedData);

                int count = reader.ReadOptimizedInt32();
                for(int i = 0; i < count; i++)
                {
                    deserializeRows(dataSet.Tables[i]);
                }

                dataSet.EnforceConstraints = originalConstraintsSetting;

                throwIfRemainingBytes();
                return dataSet;
            }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:19,代码来源:AdoNetHelper.cs

示例9: DeserializeDataSet

            public DataSet DeserializeDataSet(DataSet dataSet, byte[] serializedData)
            {
                this.dataSet = dataSet;
                reader = new SerializationReader(serializedData);

                dataSet.EnforceConstraints = false;

                BitVector32 flags = reader.ReadOptimizedBitVector32();

                if (flags[DataSetHasName]) dataSet.DataSetName = reader.ReadOptimizedString();

                dataSet.Locale = new CultureInfo(reader.ReadOptimizedInt32());
                dataSet.CaseSensitive = flags[DataSetIsCaseSensitive];

                if (flags[DataSetHasNamespace]) dataSet.Namespace = reader.ReadOptimizedString();

                if (flags[DataSetHasPrefix]) dataSet.Prefix = reader.ReadOptimizedString();

                if (flags[DataSetHasTables]) deserializeTables();
                if (flags[DataSetHasForeignKeyConstraints]) deserializeForeignKeyConstraints();

                if (flags[DataSetHasRelationships]) deserializeRelationships();
                if (flags[DataSetHasExtendedProperties]) deserializeExtendedProperties(dataSet.ExtendedProperties);

                dataSet.EnforceConstraints = flags[DataSetAreConstraintsEnabled];

                throwIfRemainingBytes();
                return dataSet;
            }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:29,代码来源:AdoNetHelper.cs


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