Example #1
0
 public APIError(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     Error = (string)info.GetValue("error", typeof(string));
     HttpStatusCode = (int)info.GetValue("@http_status_code", typeof(int));
     Warnings = (List<string>)info.GetValue("warnings", typeof(List<string>));
 }
Example #2
0
 protected CryExtInfo(System.Runtime.Serialization.SerializationInfo info, 
                 System.Runtime.Serialization.StreamingContext context)
 {
     this.Count = info.GetInt32 ("Count");
     this.Key = (byte[])info.GetValue ("Key", typeof(byte[]));
     this.Salt = (byte[])info.GetValue ("Salt", typeof(byte[]));
 }
Example #3
0
 ParserStack( System.Runtime.Serialization.SerializationInfo info,
     System.Runtime.Serialization.StreamingContext context)
 {
     this.states = (List<int>)info.GetValue("States", typeof(List<int>));
     this.States = this.states.AsReadOnly();
     this.symbols = (List<Symbol>)info.GetValue("Symbols", typeof(List<Symbol>));
     this.Symbols = this.symbols.AsReadOnly();
 }
Example #4
0
	protected HandlerNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
		: base (info, context)
	{
		handler_name = info.GetString ("HandlerName");
		signal_name = info.GetString ("SignalName");
		evnt = info.GetValue ("Event", typeof (System.Reflection.EventInfo)) as System.Reflection.EventInfo;
		delegate_type = info.GetValue ("DelegateType", typeof (Type)) as Type;
	}
Example #5
0
 /// <summary>
 /// Initializes a new instance of the Exception class with serialized data.
 /// </summary>
 /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
 /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
 protected IS24Exception(
   System.Runtime.Serialization.SerializationInfo info,
   System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     Messages = (Messages)info.GetValue("Messages", typeof(Messages));
     StatusCode = (HttpStatusCode)info.GetValue("StatusCode", typeof(HttpStatusCode));
 }
Example #6
0
 public RemoteVolume(System.Data.IDataReader rd)
 {
     this.ID = Convert.ToInt64(rd.GetValue(0));
     this.Name = rd.GetValue(1).ToString();
     this.Size = Convert.ToInt64(rd.GetValue(2));
     this.Hash = rd.GetValue(3).ToString();
     this.VerificationCount = Convert.ToInt64(rd.GetValue(4));
 }
Example #7
0
 public SettingsState(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctxt)
 {
     this.tidVist = (Decimal)info.GetValue("tidvist", typeof(Decimal));
     this.tidFoerFortoning = (Decimal)info.GetValue("tidfoerfortoning", typeof(Decimal)); ;
     this.tidFortoning = (Decimal)info.GetValue("tidfortoning", typeof(Decimal)); ;
     this.tidVend = (Decimal)info.GetValue("tidvend", typeof(Decimal)); ;
     this.screen = (string)info.GetValue("skaerm", typeof(string));
 }
      /// <summary>
      /// Deserializes the DensityImagePlotItem Version 0.
      /// </summary>
      /// <param name="obj">The empty DensityImagePlotItem object to deserialize into.</param>
      /// <param name="info">The serialization info.</param>
      /// <param name="context">The streaming context.</param>
      /// <param name="selector">The deserialization surrogate selector.</param>
      /// <returns>The deserialized DensityImagePlotItem.</returns>
      public object SetObjectData(object obj,System.Runtime.Serialization.SerializationInfo info,System.Runtime.Serialization.StreamingContext context,System.Runtime.Serialization.ISurrogateSelector selector)
      {
        DensityImagePlotItem s = (DensityImagePlotItem)obj;

        s.m_PlotAssociation = (XYZMeshedColumnPlotData)info.GetValue("Data",typeof(XYZMeshedColumnPlotData));
        s.m_PlotStyle = (DensityImagePlotStyle)info.GetValue("Style",typeof(DensityImagePlotStyle));
    
        return s;
      }
	/// <summary> Read the specified integer property.
	/// <p>
	/// Throws an exception if the property value isn't an integer.
	/// *
	/// </summary>
	/// <param name="key">the name of the property
	/// </param>
	/// <returns> the integer value of the property
	/// 
	/// </returns>
	public static int getIntProperty(System.Configuration.AppSettingsReader properties, System.Object key)
	{
		System.String string_Renamed = (System.String) properties.GetValue(key.ToString(), Type.GetType("System.String"));
		
		if (string_Renamed == null)
			System.Console.Error.WriteLine("WARN: couldn't find integer value under '" + key + "'");
		
		return System.Int32.Parse((System.String) properties.GetValue(key.ToString(), Type.GetType("System.String")));
	}
      /// <summary>
      /// Deserializes the XYColumnPlotItem Version 0.
      /// </summary>
      /// <param name="obj">The empty XYColumnPlotItem object to deserialize into.</param>
      /// <param name="info">The serialization info.</param>
      /// <param name="context">The streaming context.</param>
      /// <param name="selector">The deserialization surrogate selector.</param>
      /// <returns>The deserialized XYColumnPlotItem.</returns>
      public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
      {
        XYColumnPlotItem s = (XYColumnPlotItem)obj;

        s.Data = (XYColumnPlotData)info.GetValue("Data", typeof(XYColumnPlotData));
        s.Style = (G2DPlotStyleCollection)info.GetValue("Style", typeof(G2DPlotStyleCollection));

        return s;
      }
Example #11
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="info">The SerializationInfo to get the data from.</param>
        /// <param name="context">The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.</param>
        protected Html(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            if (info == null)
                throw new System.ArgumentNullException("info");

            htmlData = (string)info.GetValue("htmlData", typeof(string));
            flowDocumentData = (string)info.GetValue("flowDocumentData", typeof(string));
            vModellDirectory = (string)info.GetValue("vModellDirectory", typeof(string));
        }
Example #12
0
 protected FileSyncException(System.Runtime.Serialization.SerializationInfo info,
     System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     if (info != null)
     {
         this.Operation = (FileSyncOperation)info.GetValue("Operation", typeof(FileSyncOperation));
         this.SourceFile = (IcyFileSystemInfo)info.GetValue("SourceFile", typeof(IcyFileSystemInfo));
         this.DestinationFile = (IcyFileSystemInfo)info.GetValue("DestinationFile", typeof(IcyFileSystemInfo));
     }
 }
        public void ClearAll()
        {
            // Type
            Array @this = new[] {"Fizz", "Buzz"};

            // Exemples
            @this.ClearAll(); // Remove all entries.

            // Unit Test
            Assert.AreEqual(null, @this.GetValue(0));
            Assert.AreEqual(null, @this.GetValue(1));
        }
 private TaskService(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
     this.BeginInit();
     this.AllowReadOnlyTasks = false;
     this.TargetServer = (string)info.GetValue("TargetServer", typeof(string));
     this.UserName = (string)info.GetValue("UserName", typeof(string));
     this.UserAccountDomain = (string)info.GetValue("UserAccountDomain", typeof(string));
     this.UserPassword = (string)info.GetValue("UserPassword", typeof(string));
     this.forceV1 = (bool)info.GetValue("forceV1", typeof(bool));
     ResetHighestSupportedVersion();
     this.EndInit();
 }
Example #15
0
        public void WriteArray(System.Array _array)
        {
            // Initialise with symbol to indicate start of array
            StringBuilder.Append('[');

            switch (_array.Rank)
            {
            case 1:
                int _1DArrayLength				= _array.Length;

                for (int _iter = 0; _iter < _1DArrayLength; _iter++)
                {
                    if (_iter != 0)
                        StringBuilder.Append(',');

                    WriteObjectValue(_array.GetValue(_iter));
                }

                break;

            case 2:
                int _outerArrayLength				= _array.GetLength(0);
                int _innerArrayLength				= _array.GetLength(1);

                for (int _outerIter = 0; _outerIter < _outerArrayLength; _outerIter++)
                {
                    if (_outerIter != 0)
                        StringBuilder.Append(',');

                    // Append symbol to indicate start of json string representation of inner array
                    StringBuilder.Append('[');

                    for (int _innerIter = 0; _innerIter < _innerArrayLength; _innerIter++)
                    {
                        if (_innerIter != 0)
                            StringBuilder.Append(',');

                        WriteObjectValue(_array.GetValue(_outerIter, _innerIter));
                    }

                    // Append symbol to indicate end of json string representation of inner array
                    StringBuilder.Append(']');
                }

                break;
            }

            // Append symbol to indicate end of json string representation of array
            StringBuilder.Append(']');
            return;
        }
	/// <summary> Read the specified float property.
	/// <p>
	/// Throws an exception if the property value isn't a floating-point number.
	/// *
	/// </summary>
	/// <param name="key">the name of the property
	/// </param>
	/// <returns> the float value of the property
	/// 
	/// </returns>
	public static float getFloatProperty(System.Configuration.AppSettingsReader properties, System.Object key)
	{
		System.String string_Renamed=null;
		try
		{
			string_Renamed = (System.String) properties.GetValue(key.ToString(), Type.GetType("System.String"));
		}
		catch//was: if (string_Renamed == null)
		{
			System.Console.Error.WriteLine("WARN: couldn't find float value under '" + key + "'");
			return 0;
		}
		return System.Single.Parse((System.String) properties.GetValue(key.ToString(), Type.GetType("System.String")));
	}
Example #17
0
        public void ClearTestCase()
        {
            Array array = new[]
            {
                "0",
                "1",
                "2"
            };
            array.Clear( 0, 2 );

            Assert.AreEqual( null, array.GetValue( 0 ) );
            Assert.AreEqual( null, array.GetValue( 1 ) );
            Assert.AreEqual( "2", array.GetValue( 2 ) );
        }
Example #18
0
        public void ReverseTestCase1()
        {
            Array array = new[]
            {
                "0",
                "1",
                "2"
            };
            array.Reverse( 1, 2 );

            Assert.AreEqual( "0", array.GetValue( 0 ) );
            Assert.AreEqual( "2", array.GetValue( 1 ) );
            Assert.AreEqual( "1", array.GetValue( 2 ) );
        }
 protected EmployeeDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["employee"] != null)) {
             base.Tables.Add(new employeeDataTable(ds.Tables["employee"]));
         }
         this.DataSetName = ds.DataSetName;
         this.Prefix = ds.Prefix;
         this.Namespace = ds.Namespace;
         this.Locale = ds.Locale;
         this.CaseSensitive = ds.CaseSensitive;
         this.EnforceConstraints = ds.EnforceConstraints;
         this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
         this.InitVars();
     }
     else {
         this.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
	internal FbException(
           System.Runtime.Serialization.SerializationInfo info, 
           System.Runtime.Serialization.StreamingContext context) : base(info, context)
	{
		this.errors = (FbErrorCollection)info.GetValue("errors", typeof(FbErrorCollection));
		this.errorCode = info.GetInt32("errorCode");
	}
Example #21
0
        public override Dictionary<string, string> GetParams(object obj, System.Reflection.PropertyInfo p) {
            var value = p.GetValue(obj, null);
            if (value != null) {
                var attr = value.GetType()
                        .GetRuntimeField(value.ToString())
                        .GetCustomAttributes(false)
                        .OfType<SpecifyNameValueAttribute>().FirstOrDefault();

                if (attr != null) {
                    value = this.Use == EnumUseNameOrValue.Name ? (object)attr.Name : attr.Value;
                } else {
                    var t = p.PropertyType;
                    var tf = t.GetTypeInfo();
                    if (tf.IsGenericType && tf.GetGenericTypeDefinition().Equals(typeof(Nullable<>))) {
                        t = Nullable.GetUnderlyingType(t);
                    }
                    value = this.Use == EnumUseNameOrValue.Name ? Enum.GetName(t, value) : value;
                }
            }


            if (value == null && this.Required)
                return new Dictionary<string, string>(){
                    {this.Name, ""}
                };
            else if (value == null && !this.Required)
                return null;
            else
                return new Dictionary<string, string>(){
                    {this.Name, value.ToString()}
                };
        }
 protected JobExecutionException(
   System.Runtime.Serialization.SerializationInfo info,
   System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     Errors = (ErrorSummary)info.GetValue(ErrorSummaryKey, typeof(ErrorSummary));
 }
Example #23
0
 /// <summary>
 /// Creates an instance of the object for serialization.
 /// </summary>
 /// <param name="info">Serialiation info object.</param>
 /// <param name="context">Serialization context object.</param>
 protected DataPortalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     _result = (DataPortalResult)info.GetValue(
       "_result", typeof(DataPortalResult));
     _innerStackTrace = info.GetString("_innerStackTrace");
 }
Example #24
0
 public override Dictionary<string, string> GetParams(object obj, System.Reflection.PropertyInfo p)
 {
     var value = p.GetValue(obj, null);
     if (value == null && this.Required)
         return new Dictionary<string, string>(){
             {this.Name, ""}
         };
     else if (value == null && !this.Required)
         return null;
     else {
         var settig = new JsonSerializerSettings();
         return new Dictionary<string, string>(){
             {this.Name, JsonConvert.SerializeObject( p.GetValue(obj, null))}
         };
     }
 }
		/// <summary>
		/// Validate the attribute data for the given <paramref name="instance"/> and the <paramref name="propertyInfo"/>.
		/// </summary>
		/// <param name="instance">
		/// The instance to validate.
		/// </param>
		/// <param name="propertyInfo">
		/// The property containing the value to validate.
		/// </param>
		/// <param name="errors">
		/// The collection to add any errors that occur during the validation.
		/// </param>		
		protected override void ValidateCore(object instance, System.Reflection.PropertyInfo propertyInfo, IList<ValidationError> errors)
        {
            List<EditableKeyValue> customAttributes = propertyInfo.GetValue(instance, new object[0]) as List<EditableKeyValue>;
            if (customAttributes != null)
            {
                int position = -1;
                List<string> keys = new List<string>();
                foreach (EditableKeyValue item in customAttributes)
                {
                    position++;
                    if (string.IsNullOrEmpty(item.Key))
                    {
                        string errorMessage = string.Format(Resources.Culture, Resources.CustomAttributesKeyNullError, position);
                        errors.Add(new ValidationError(instance, propertyInfo.Name, errorMessage));
                        continue;
                    }
                    if (keys.Contains(item.Key))
                    {
                        string errorMessage = string.Format(Resources.Culture, Resources.CustomAttributesDuplicateKeyError, item.Key);
                        errors.Add(new ValidationError(instance, propertyInfo.Name, errorMessage));
                        continue;
                    }

                    keys.Add(item.Key);
                    
                }
            }
        }
Example #26
0
        public override Dictionary<string, string> GetParams(object obj, System.Reflection.PropertyInfo p) {
            var value = p.GetValue(obj, null);
            if (value != null) {
                var skv = value.GetType()
                        .GetRuntimeField(value.ToString())
                        .GetCustomAttributes(false)
                        .OfType<SpecifyNameValueAttribute>().FirstOrDefault();

                if (skv != null) {
                    value = this.Use == EnumUseNameOrValue.Name ? (object)skv.Name : skv.Value;
                } else {
                    value = this.Use == EnumUseNameOrValue.Name ? Enum.GetName(obj.GetType(), obj) : value;
                }
            }


            if (value == null && this.Required)
                return new Dictionary<string, string>(){
                    {this.Name, ""}
                };
            else if (value == null && !this.Required)
                return null;
            else
                return new Dictionary<string, string>(){
                    {this.Name, value.ToString()}
                };
        }
Example #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Exception"/> class with serialized data.
 /// </summary>
 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
 /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
 ///   
 /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
 /// <remarks></remarks>
 protected EDSDKException(
   System.Runtime.Serialization.SerializationInfo info,
   System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     this.ReturnValue = (ReturnValue)info.GetValue(RETURN_VALUE_STRING_IDENTIFIER, typeof(ReturnValue));
 }
Example #28
0
    /// <summary>Initializes the exception from its serialized state</summary>
    /// <param name="info">Contains the serialized fields of the exception</param>
    /// <param name="context">Additional environmental informations</param>
    protected HttpException(
      System.Runtime.Serialization.SerializationInfo info,
      System.Runtime.Serialization.StreamingContext context
    ) :
      base(info, context) {

      this.statusCode = (StatusCode)info.GetValue("statusCode", typeof(StatusCode));
    }
Example #29
0
 public virtual object SetObjectData(object obj,System.Runtime.Serialization.SerializationInfo info,System.Runtime.Serialization.StreamingContext context,System.Runtime.Serialization.ISurrogateSelector selector)
 {
   _position = (PointF)info.GetValue("Position", typeof(PointF));
   _bounds = (RectangleF)info.GetValue("Bounds", typeof(RectangleF));
   _rotation = info.GetSingle("Rotation");
   _autoSize = info.GetBoolean("AutoSize");
   return this;
 }
Example #30
0
      private FloatImage(
	System.Runtime.Serialization.SerializationInfo info,
	System.Runtime.Serialization.StreamingContext context )
      {
          width = info.GetInt32( "width" );
          data = (float[][])info.GetValue( "data", typeof( float[][] ) );
          height = data[0].Length / width;
      }