示例#1
0
        private static TTransportableObjectType Expand <TTransportableObjectType>(Stream objStream)
            where TTransportableObjectType : TransportableObject
        {
            if (objStream == null)
            {
                throw new ArgumentNullException("objStream", "A valid non-null Stream is required.");
            }

            TTransportableObjectType objTransportableObject = default(TTransportableObjectType);

            using (BinaryReaderExtension objBinaryReader = new BinaryReaderExtension(objStream))
            {
                byte[] bytSignature = objBinaryReader.ReadBytes(RemotableSignature.Length);
                if (AreByteArraysEqual(bytSignature, RemotableSignature) == false)
                {
                    throw new Exception("The binary data does not represent a valid, serialized ITransportableObject instance.");
                }

                string strAssemblyName = objBinaryReader.ReadString();
                string strTypeName     = objBinaryReader.ReadString();

                objTransportableObject = FastReflectionManager.CreateInstance <TTransportableObjectType>(typeof(TTransportableObjectType), new Type[] { typeof(BinaryReaderExtension) }, objBinaryReader);
            }

            return(objTransportableObject);
        }
示例#2
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Source = objBinaryReader.ReadString();
            Log    = objBinaryReader.ReadString();
        }
示例#3
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Message  = objBinaryReader.ReadString();
            Category = objBinaryReader.ReadString();
        }
示例#4
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Port        = objBinaryReader.ReadInt32();
            ChannelName = objBinaryReader.ReadString();
            MachineName = objBinaryReader.ReadString();
        }
示例#5
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            CreatedDate = objBinaryReader.ReadDateTime();
            MachineName = objBinaryReader.ReadString();
            WindowsId   = objBinaryReader.ReadString();
        }
示例#6
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Name     = objBinaryReader.ReadString();
            FullName = objBinaryReader.ReadString();
            Enabled  = objBinaryReader.ReadBoolean();
        }
示例#7
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            SqlStatement     = objBinaryReader.ReadString();
            SqlParameters    = objBinaryReader.ReadString();
            ConnectionString = objBinaryReader.ReadEncryptedString();
        }
示例#8
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Path         = objBinaryReader.ReadString();
            DisplayName  = objBinaryReader.ReadString();
            Size         = objBinaryReader.ReadInt64();
            ModifiedDate = objBinaryReader.ReadDateTime();
        }
示例#9
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Source      = objBinaryReader.ReadString();
            Destination = objBinaryReader.ReadString();
            Credentials = objBinaryReader.ReadTransportableObject <Credentials>();
            TimeOut     = objBinaryReader.ReadInt32();
        }
示例#10
0
        private static ITransportableObject Expand(Stream objStream)
        {
            if (objStream == null)
            {
                throw new ArgumentNullException("objStream", "A valid non-null Stream is required.");
            }

            ITransportableObject objTransportableObject = null;

            using (BinaryReaderExtension objBinaryReader = new BinaryReaderExtension(objStream))
            {
                byte[] bytSignature = objBinaryReader.ReadBytes(RemotableSignature.Length);
                if (AreByteArraysEqual(bytSignature, RemotableSignature) == false)
                {
                    throw new Exception("The binary data does not represent a valid, serialized ITransportableObject instance.");
                }

                string strAssemblyName = objBinaryReader.ReadString();
                string strTypeName     = objBinaryReader.ReadString();

                Assembly objAssembly = null;
                try
                {
                    objAssembly = Assembly.Load(strAssemblyName);
                }
                catch (Exception objException)
                {
                    string strErrorMessage = "An error was encountered while loading the assembly - Assembly.Load('" + strAssemblyName + "'):\n";
                    throw new Exception(strErrorMessage, objException);
                }

                Type objType = null;
                try
                {
                    objType = objAssembly.GetType(strTypeName, true, true);
                }
                catch (Exception objException)
                {
                    string strErrorMessage = "An error was encountered while loading the type - objAssemblyName.GetType('" + strTypeName + "', True, True):\n";
                    throw new Exception(strErrorMessage, objException);
                }

                try
                {
                    objTransportableObject = FastReflectionManager.CreateInstance <ITransportableObject>(objType, new Type[] { typeof(BinaryReaderExtension) }, objBinaryReader);
                }
                catch (Exception objException)
                {
                    string strErrorMessage = "An error was encountered while creating the object - Activator.CreateInstance('" + objType.FullName + "'):\n";
                    throw new Exception(strErrorMessage, objException);
                }
            }

            return(objTransportableObject);
        }
示例#11
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            From       = objBinaryReader.ReadString();
            Subject    = objBinaryReader.ReadString();
            IsBodyHtml = objBinaryReader.ReadBoolean();
            Body       = objBinaryReader.ReadString();
            DeliveryNotificationOptions = (NetMail.DeliveryNotificationOptions)objBinaryReader.ReadByte();
            To = objBinaryReader.ReadTransportableObject <ListBase <string> >();
        }
示例#12
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            string strType = objBinaryReader.ReadString();

            Type = System.Type.GetType(strType);

            Binding = objBinaryReader.ReadTransportableObject <IWcfBinding>();
            Address = objBinaryReader.ReadString();
        }
示例#13
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            FileName  = objBinaryReader.ReadString();
            Directory = objBinaryReader.ReadString();

            _objSyncObject = null;
            _objFileStream = null;
            _objTextWriter = null;
        }
示例#14
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Guid     = objBinaryReader.ReadGuid();
            UserName = objBinaryReader.ReadString();
        }
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Url         = objBinaryReader.ReadString();
            Credentials = objBinaryReader.ReadTransportableObject <Credentials>();
        }
示例#16
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Details   = objBinaryReader.ReadString();
            Exception = (Exception)objBinaryReader.ReadObject();
        }
示例#17
0
文件: Job.cs 项目: wuhaiying83/EMR
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            _strName   = objBinaryReader.ReadString();
            _enuStatus = (JobStatusType)objBinaryReader.ReadByte();
            _objTasks  = objBinaryReader.ReadTransportableObject <ITaskList>();
        }
示例#18
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            ApplicationManager.Logs     = objBinaryReader.ReadTransportableObject <LogManager>();
            ApplicationManager.Settings = objBinaryReader.ReadTransportableObject <SettingsManager>();
            ApplicationManager.FilePath = objBinaryReader.ReadString();
        }
示例#19
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            PerformanceCounters = objBinaryReader.ReadString();
            ConcurrencyMode     = objBinaryReader.ReadEnum <ConcurrencyMode>();
            InstanceContextMode = objBinaryReader.ReadEnum <InstanceContextMode>();
        }
示例#20
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            UploadRequest = objBinaryReader.ReadTransportableObject <UploadRequest>();
            Result        = (TaskResultType)objBinaryReader.ReadByte();
            UploadStats   = objBinaryReader.ReadTransportableObject <UploadStats>();
            Details       = objBinaryReader.ReadString();
        }
示例#21
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Enabled               = objBinaryReader.ReadBoolean();
            Address               = objBinaryReader.ReadString();
            Port                  = objBinaryReader.ReadInt32();
            Credentials           = objBinaryReader.ReadTransportableObject <Credentials>();
            BypassProxyOnLocal    = objBinaryReader.ReadBoolean();
            UseDefaultCredentials = objBinaryReader.ReadBoolean();
        }
示例#22
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Host                  = objBinaryReader.ReadString();
            Port                  = objBinaryReader.ReadInt32();
            EnableSsl             = objBinaryReader.ReadBoolean();
            TimeOut               = objBinaryReader.ReadInt32();
            DeliveryMethod        = (NetMail.SmtpDeliveryMethod)objBinaryReader.ReadByte();
            UseDefaultCredentials = objBinaryReader.ReadBoolean();
            Credentials           = objBinaryReader.ReadTransportableObject <Credentials>();
        }
示例#23
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Hash             = objBinaryReader.ReadString();
            Name             = objBinaryReader.ReadString();
            Description      = objBinaryReader.ReadString();
            ProductId        = objBinaryReader.ReadString();
            ProcessorId      = objBinaryReader.ReadString();
            SerialNumber     = objBinaryReader.ReadString();
            ArchitectureType = (ComputerProcessorArchitectureType)objBinaryReader.ReadByte();
            VersionString    = objBinaryReader.ReadString();
            ServicePack      = objBinaryReader.ReadString();
            Version          = objBinaryReader.ReadTransportableObject <VersionToken>();
        }
示例#24
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            int intCount = objBinaryReader.ReadInt32();

            for (int intIndex = 0; intIndex < intCount; intIndex++)
            {
                string strKey   = objBinaryReader.ReadString();
                object objValue = objBinaryReader.ReadObject();

                Settings.Add(strKey, objValue);
            }
        }
示例#25
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Behavior   = objBinaryReader.ReadTransportableObject <WcfServiceBehavior>();
            Throttling = objBinaryReader.ReadTransportableObject <WcfServiceThrottling>();

            string strType = objBinaryReader.ReadString();

            Type = System.Type.GetType(strType);

            BaseAddresses    = objBinaryReader.ReadTransportableObject <ListBase <string> >();
            ServiceEndpoints = objBinaryReader.ReadTransportableObject <WcfServiceEndpointList>();
            MetadataEndpoint = objBinaryReader.ReadTransportableObject <WcfMetadataEndpoint>();
        }
示例#26
0
        public override void ReadData(BinaryReaderExtension objBinaryReader)
        {
            base.ReadData(objBinaryReader);

            Address = objBinaryReader.ReadString();
        }