private ContractException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     _Kind = (ContractFailureKind)info.GetInt32("Kind");
     _UserMessage = info.GetString("UserMessage");
     _Condition = info.GetString("Condition");
 }
Example #2
0
 protected ManagedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     mIsWrapper = false;
     mMessage = info.GetString("ManagedException.Message");
     mStackTrace = info.GetString("ManagedException.StackTrace");
 }
        private VariantReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            _valueReference = null;
            _unityObjectReference = null;

            _type = (VariantType)info.GetInt32("type");
            switch (_type)
            {
                case VariantType.Object:
                case VariantType.GameObject:
                case VariantType.Component:
                    //do nothing
                    break;
                case VariantType.Vector2:
                case VariantType.Vector3:
                case VariantType.Quaternion:
                case VariantType.Color:
                    var arr = StringUtil.SplitFixedLength(info.GetString("vector"), ",", 4);
                    //_vectorStore = new Vector4(ConvertUtil.ToSingle(arr[0]),
                    //                           ConvertUtil.ToSingle(arr[1]),
                    //                           ConvertUtil.ToSingle(arr[2]),
                    //                           ConvertUtil.ToSingle(arr[3]));
                    break;
                default:
                    _valueReference = info.GetString("value");
                    break;
            }
            (this as ISerializationCallbackReceiver).OnAfterDeserialize();
        }
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this AccountBanTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;

i = dataRecord.GetOrdinal("account_id");

source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i);

i = dataRecord.GetOrdinal("end_time");

source.EndTime = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);

i = dataRecord.GetOrdinal("expired");

source.Expired = (System.Boolean)(System.Boolean)dataRecord.GetBoolean(i);

i = dataRecord.GetOrdinal("id");

source.ID = (System.Int32)(System.Int32)dataRecord.GetInt32(i);

i = dataRecord.GetOrdinal("issued_by");

source.IssuedBy = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));

i = dataRecord.GetOrdinal("reason");

source.Reason = (System.String)(System.String)dataRecord.GetString(i);

i = dataRecord.GetOrdinal("start_time");

source.StartTime = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
}
Example #5
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 #6
0
 public object MapRow(System.Data.IDataReader reader, int rowNum)
 {
     User model = new User();
     model.id = reader.GetInt32(0);
     model.name = reader.GetString(1);
     model.pwd = reader.GetString(2);
     return model;
 }
Example #7
0
 public override void Load(System.Data.IDataRecord record)
 {
     Id = record.GetInt32(0);
     OKPO = record.GetString(1);
     SOATO = record.GetString(2);
     INN = record.GetString(3);
     Name = record.GetString(4);
     Type = (OrgType)record.GetByte(5);
 }
Example #8
0
 public override DTOBase PopulateDTO(System.Data.IDataReader reader)
 {
     var credential = base.PopulateId(reader, new Credential());
     if (!reader.IsDBNull(_ordinals.EmailAddress)) { credential.EmailAddress = reader.GetString(_ordinals.EmailAddress); }
     if (!reader.IsDBNull(_ordinals.Salt)) { credential.Salt = reader.GetString(_ordinals.Salt); }
     if (!reader.IsDBNull(_ordinals.PasswordHash)) { credential.PasswordHash = reader.GetString(_ordinals.PasswordHash); }
     if (!reader.IsDBNull(_ordinals.CreateDateTimeUtc)) { credential.CreateDateTimeUtc = reader.GetDateTime(_ordinals.CreateDateTimeUtc); }
     credential.IsNew = false;
     return credential;
 }
Example #9
0
        private CommunityInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        {
            this._id = info.GetInt32("id");
            this._universalID = new Guid(info.GetString("universalID"));
            this._title = info.GetString("title");
            this._touched = info.GetDateTime("touched");

            // setup events
            this.SetupEvents();
        }
Example #10
0
 private SiteInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     this._id = info.GetInt32("id");
     this._domain = info.GetString("domain");
     this._subDomain = info.GetString("subDomain");
     this._touched = info.GetDateTime("touched");
     this._section_id = info.GetInt32("section_id");
     this._originalTheme = info.GetString("originalTheme");
     this._originalStyle = info.GetString("originalStyle");
 }
Example #11
0
        /// <summary>
        /// Permet remplir les propriétés de mappage de l'entité admin.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet adminDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            adminDTO admin = new adminDTO();

            if (!reader.IsDBNull(ordAdminGuid)) { admin.adminGuid = reader.GetGuid(ordAdminGuid); }
            if (!reader.IsDBNull(ordAdminLogin)) { admin.adminLogin = reader.GetString(ordAdminLogin); }
            if (!reader.IsDBNull(ordAdminPassword)) { admin.adminPassword = reader.GetString(ordAdminPassword); }

            admin.isNew = false;
            return admin;
        }
Example #12
0
        /// <summary>
        /// Permet remplir les propriétés de mappage de l'entité métier.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet metierDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            metierDTO metier = new metierDTO();

            if (!reader.IsDBNull(ordMetierGuid)) { metier.metierGuid = reader.GetGuid(ordMetierGuid); }
            if (!reader.IsDBNull(ordMetierNom)) { metier.metierNom = reader.GetString(ordMetierNom); }
            if (!reader.IsDBNull(ordMetierFiche)) { metier.metierFiche = reader.GetString(ordMetierFiche); }
            if (!reader.IsDBNull(ordMetierScoreReseau)) { metier.metierScoreReseau = reader.GetInt32(ordMetierScoreReseau); }
            if (!reader.IsDBNull(ordMetierScoreLogiciel)) { metier.metierScorelogiciel = reader.GetInt32(ordMetierScoreLogiciel); }

            metier.isNew = false;
            return metier;
        }
 /// <summary>
 /// Replacement of "Content" property for RestSharp.Portable
 /// </summary>
 /// <param name="response"></param>
 /// <param name="encoding"></param>
 /// <returns></returns>
 public static string GetContent(this IRestResponse response, System.Text.Encoding encoding)
 {
     var data = response.RawBytes;
     if (data == null)
         return null;
     return encoding.GetString(data, 0, data.Length);
 }
Example #14
0
 /// <summary>
 /// 从base64编码的字符串中还原字符串,支持中文
 /// </summary>
 /// <param name="base64String">base64加密后的字符串</param>
 /// <param name="ens">System.Text.Encoding 对象,如创建中文编码集对象:System.Text.Encoding.GetEncoding(54936)</param>
 /// <returns>还原后的文本字符串</returns>
 public static string DecodingForString(string base64String, System.Text.Encoding ens)
 {
     /**
     * ***********************************************************
     * 
     * 从base64String中取得的字节值为字符的机内码(ansi字符编码)
     * 一般的,用机内码转换为汉字是公式:
     * (char)(第一字节的二进制值*256+第二字节值)
     * 而在c#中的char或string由于采用了unicode编码,就不能按照上面的公式计算了
     * ansi的字节编和unicode编码不兼容
     * 故利用.net类库提供的编码类实现从ansi编码到unicode代码的转换
     * 
     * GetEncoding 方法依赖于基础平台支持大部分代码页。但是,对于下列情况提供系统支持:默认编码,即在执行此方法的计算机的区域设置中指定的编码;Little-Endian Unicode (UTF-16LE);Big-Endian Unicode (UTF-16BE);Windows 操作系统 (windows-1252);UTF-7;UTF-8;ASCII 以及 GB18030(简体中文)。
     *
     *指定下表中列出的其中一个名称以获取具有对应代码页的系统支持的编码。
     *
     * 代码页 名称 
     * 1200 “UTF-16LE”、“utf-16”、“ucs-2”、“unicode”或“ISO-10646-UCS-2” 
     * 1201 “UTF-16BE”或“unicodeFFFE” 
     * 1252 “windows-1252” 
     * 65000 “utf-7”、“csUnicode11UTF7”、“unicode-1-1-utf-7”、“unicode-2-0-utf-7”、“x-unicode-1-1-utf-7”或“x-unicode-2-0-utf-7” 
     * 65001 “utf-8”、“unicode-1-1-utf-8”、“unicode-2-0-utf-8”、“x-unicode-1-1-utf-8”或“x-unicode-2-0-utf-8” 
     * 20127 “us-ascii”、“us”、“ascii”、“ANSI_X3.4-1968”、“ANSI_X3.4-1986”、“cp367”、“csASCII”、“IBM367”、“iso-ir-6”、“ISO646-US”或“ISO_646.irv:1991” 
     * 54936 “GB18030” 
     *
     * 某些平台可能不支持特定的代码页。例如,Windows 98 的美国版本可能不支持日语 Shift-jis 代码页(代码页 932)。这种情况下,GetEncoding 方法将在执行下面的 C# 代码时引发 NotSupportedException:
     *
     * Encoding enc = Encoding.GetEncoding("shift-jis"); 
     *
     * **************************************************************/
     //从base64String中得到原始字符
     return ens.GetString(Convert.FromBase64String(base64String));
 }
Example #15
0
 ///     
 ///   从base64编码的字符串中还原字符串,支持中文   
 ///     
 ///   base64加密后的字符串   
 ///   system.text.encoding   对象,如创建中文编码集对象:system.text.encoding.getencoding(54936)   
 ///   还原后的文本字符串   
 public static string decodingforstring(string base64string, System.Text.Encoding ens)   
 {   
 /**   
 *   ***********************************************************   
 *     
 *   从base64string中取得的字节值为字符的机内码(ansi字符编码)   
 *   一般的,用机内码转换为汉字是公式:   
 *   (char)(第一字节的二进制值*256   第二字节值)   
 *   而在c#中的char或string由于采用了unicode编码,就不能按照上面的公式计算了   
 *   ansi的字节编和unicode编码不兼容   
 *   故利用.net类库提供的编码类实现从ansi编码到unicode代码的转换   
 *     
 *   getencoding   方法依赖于基础平台支持大部分代码页。但是,对于下列情况提供系统支持:默认编码,即在执行此方法的计算机的区域设置中指定的编码;little-endian   unicode   (utf-16le);big-endian   unicode   (utf-16be);windows   操作系统   (windows-1252);utf-7;utf-8;ascii   以及   gb18030(简体中文)。   
 *   
 *指定下表中列出的其中一个名称以获取具有对应代码页的系统支持的编码。   
 *   
 *   代码页   名称     
 *   1200   &#8220;utf-16le&#8221;、&#8220;utf-16&#8221;、&#8220;ucs-2&#8221;、&#8220;unicode&#8221;或&#8220;iso-10646-ucs-2&#8221;     
 *   1201   &#8220;utf-16be&#8221;或&#8220;unicodefffe&#8221;     
 *   1252   &#8220;windows-1252&#8221;     
 *   65000   &#8220;utf-7&#8221;、&#8220;csunicode11utf7&#8221;、&#8220;unicode-1-1-utf-7&#8221;、&#8220;unicode-2-0-utf-7&#8221;、&#8220;x-unicode-1-1-utf-7&#8221;或&#8220;x-unicode-2-0-utf-7&#8221;     
 *   65001   &#8220;utf-8&#8221;、&#8220;unicode-1-1-utf-8&#8221;、&#8220;unicode-2-0-utf-8&#8221;、&#8220;x-unicode-1-1-utf-8&#8221;或&#8220;x-unicode-2-0-utf-8&#8221;     
 *   20127   &#8220;us-ascii&#8221;、&#8220;us&#8221;、&#8220;ascii&#8221;、&#8220;ansi_x3.4-1968&#8221;、&#8220;ansi_x3.4-1986&#8221;、&#8220;cp367&#8221;、&#8220;csascii&#8221;、&#8220;ibm367&#8221;、&#8220;iso-ir-6&#8221;、&#8220;iso646-us&#8221;或&#8220;iso_646.irv:1991&#8221;     
 *   54936   &#8220;gb18030&#8221;     
 *   
 *   某些平台可能不支持特定的代码页。例如,windows   98   的美国版本可能不支持日语   shift-jis   代码页(代码页   932)。这种情况下,getencoding   方法将在执行下面的   c#   代码时引发   notsupportedexception:   
 *   
 *   encoding   enc   =   encoding.getencoding(shift-jis);     
 *   
 *   **************************************************************/   
 //从base64string中得到原始字符   
     return ens.GetString(Convert.FromBase64String(base64string));  
 }   
 public string ConvertEncoding(string _src
     , System.Text.Encoding _srcEncoding
     , System.Text.Encoding _destEncoding)
 {
     byte[] srcBytes = _srcEncoding.GetBytes(_src);
     return _destEncoding.GetString(srcBytes);
 }
        private EncryptedString(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            if (context.State != System.Runtime.Serialization.StreamingContextStates.Persistence && context.State != System.Runtime.Serialization.StreamingContextStates.File)
                throw new System.Runtime.Serialization.SerializationException("Cannot serialize to anything other than file or persistent storage");

            base64 = info.GetString("EncryptedString");
        }
Example #18
0
        /// <summary>
        /// 读取最新文件内容,只管读就是了,FileWatch会自动加载最新的文件
        /// </summary>
        /// <param name="file"></param>
        /// <param name="encoding"> </param>
        /// <returns></returns>
        /// <exception cref="FileNotFoundException"></exception>
        /// <exception cref="NullReferenceException"></exception>
        public static string GetFileCurrentContent(string file, System.Text.Encoding encoding)
        {
            if (!File.Exists(file))
            {
                throw new FileNotFoundException(file);
            }

            var content = FileWatchStorageProvider.Provider.Get(file);

            if (content == null)
            {
                Action readFile = () =>
                                      {
                                          content = IOUtility.ReadAsBypeArray(file);
                                          FileWatchStorageProvider.Provider.AddOrUpdate(file, content);
                                      };
                readFile();

                var fw = new FileWatcher(file)
                {
                    OnChanged = (o, e) => readFile()
                };
            }



            if (content == null) throw new NullReferenceException("content");

            return encoding.GetString(content);
        }
Example #19
0
		static public string ReadAllText(string path, System.Text.Encoding encoding = null)
		{
			if (encoding == null)
				encoding = System.Text.Encoding.UTF8;

			return encoding.GetString(ReadAllBytes(path));
		}
 private CalendricUrlRangeModel(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     this.startDate = info.GetDateTime("startDate");
     this.endDate = info.GetDateTime("endDate");
     this.format = info.GetString("format");
 }
Example #21
0
 /// <summary>
 /// Gets stored resource as text.
 /// </summary>
 /// <returns></returns>
 public static string GetText(string fileName,System.Text.Encoding encoding)
 {
     Stream rs = Assembly.GetExecutingAssembly().GetManifestResourceStream("LumiSoft.MailServer.Resources." + fileName);
     byte[] text = new byte[rs.Length];
     rs.Read(text,0,text.Length);
     return encoding.GetString(text);
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected QueueNotFoundException(
     System.Runtime.Serialization.SerializationInfo info, 
     System.Runtime.Serialization.StreamingContext context) : base(info, context)
 {
     if (info != null)
         Queue = Address.Parse(info.GetString("Queue"));
 }
Example #23
0
 public static CustTreeItems FillCustTreeItems(System.Data.IDataReader r)
 {
     CustTreeItems cti = new CustTreeItems();
     cti.Name = r.GetString(0);
     cti.HasPermissions = Convert.ToBoolean(r.GetByte(1));
     return cti;
 }
Example #24
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 #25
0
        public static string Base64Decoding(string DecodingText, System.Text.Encoding oEncoding = null)
        {
            if (oEncoding == null)
                oEncoding = Encoding.UTF8;

            byte[] arr = Convert.FromBase64String(DecodingText);
            return oEncoding.GetString(arr);
        }
Example #26
0
		public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
		{
			if(info==null) throw new ArgumentNullException("info");

			this.errorCode = info.GetInt32("errorCode");
			this.errorText = info.GetString("errorText");
			base.GetObjectData(info, context);
		}
Example #27
0
 public RemoteVolume(System.Data.IDataReader rd)
 {
     this.ID = rd.GetInt64(0);
     this.Name = rd.GetString(1);
     this.Size = rd.ConvertValueToInt64(2);
     this.Hash = rd.ConvertValueToString(3);
     this.VerificationCount = rd.ConvertValueToInt64(4);
 }
 /// <summary>
 /// Constructs a new instance of the AmazonDateTimeUnmarshallingException 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>
 protected AmazonDateTimeUnmarshallingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
     : base(info, context)
 {
     if (info != null)
     {
         this.InvalidDateTimeToken = info.GetString("InvalidDateTimeToken");
     }
 }
Example #29
0
 private static hierarchy2b ORM_CreateProxy(System.Data.IDataReader result, System.Collections.Generic.IDictionary<string, int> ordinals)
 {
     return new hierarchy2b()
     {
         pid = result.IsDBNull(ordinals["pid"]) ? 0 : result.GetInt64(ordinals["pid"]),
         fid = result.IsDBNull(ordinals["fid"]) ? 0 : result.GetInt64(ordinals["fid"]),
         textfield = result.IsDBNull(ordinals["textfield"]) ? null : result.GetString(ordinals["textfield"])
     };
 }
Example #30
0
        protected MincostLiblinearClassifier(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context1)
            : base(info, context1)
        {
            m_delta = info.GetDouble("delta");
            m_mustValue = info.GetInt32("mustValue");

            string modelFileName = info.GetString("BaseCls");
            base.m_Classifier = (Classifier)weka.core.SerializationHelper.read(modelFileName);
        }