/// <summary>
        /// 真实类型
        /// </summary>
        /// <param name="deSerializer">二进制数据反序列化</param>
        /// <param name="value">数据对象</param>
        private static void realType(DeSerializer deSerializer, ref valueType value)
        {
            RemoteType remoteType = default(RemoteType);

            TypeDeSerializer <RemoteType> .GetDeSerializer(deSerializer.GlobalVersion).MemberDeSerialize(deSerializer, ref remoteType);

            if (deSerializer.State == DeSerializeState.Success)
            {
                Type type;
                if (remoteType.TryGet(out type))
                {
                    if (value == null || type.IsValueType)
                    {
                        //value = (valueType)DeSerializeMethodCache.GetRealDeSerializer(type)(deSerializer, value);
                        value = (valueType)GenericType.Get(type).BinaryDeSerializeRealTypeObjectDelegate(deSerializer, value);
                    }
                    //else DeSerializeMethodCache.GetRealDeSerializer(type)(deSerializer, value);
                    else
                    {
                        GenericType.Get(type).BinaryDeSerializeRealTypeObjectDelegate(deSerializer, value);
                    }
                }
                else
                {
                    deSerializer.State = DeSerializeState.RemoteTypeError;
                }
            }
        }
Beispiel #2
0
        public IRemote Connect(ServerDetails sd, RemoteType rt)
        {
            if (sd == null)
            {
                return(null);
            }
            IRemote rem = null;

            switch (rt)
            {
            case RemoteType.SSH:
                rem = new SSHRemote();
                break;

            default:
                break;
            }
            if (rem == null)
            {
                return(null);
            }
            rem.Connect(sd);
            remotes.Add(rem);
            return(rem);
        }
Beispiel #3
0
 /// <summary>
 /// 插入远程连接条目,返回Id
 /// </summary>
 public static string Insert(RemoteType type, string parentId, string name)
 {
     if (type == RemoteType.dir)
     {
         return(_tableDirectory.Insert(new DbItemDirectory {
             Id = ObjectId.NewObjectId().ToString(), ParentId = parentId, Name = name
         }));
     }
     else
     {
         string userName = type == RemoteType.rdp ? "Administrator" : "root";
         string uuid     = ObjectId.NewObjectId().ToString();
         if (type == RemoteType.rdp)
         {
             _tableSetting_rdp.Insert(new DbItemSettingRdp {
                 Id = uuid
             });
         }
         if (type == RemoteType.ssh)
         {
             _tableSetting_ssh.Insert(new DbItemSettingSsh {
                 Id = uuid
             });
         }
         if (type == RemoteType.telnet)
         {
             _tableSetting_telnet.Insert(new DbItemSettingTelnet {
                 Id = uuid
             });
         }
         return(_tableRemoteLink.Insert(new DbItemRemoteLink {
             Id = uuid, ParentId = parentId, Name = name, UserName = userName, Type = (int)type, IsExpander1 = true
         }));
     }
 }
Beispiel #4
0
        /// <summary>
        /// 删除远程连接条目
        /// </summary>
        public static void Delete(RemoteType type, string id)
        {
            if (type == RemoteType.dir)
            {
                var dirItems = _tableDirectory.Find(m => m.ParentId == id);
                foreach (var item in dirItems)
                {
                    Delete(RemoteType.dir, item.Id);
                }
                var linkItems = _tableRemoteLink.Find(m => m.ParentId == id);
                foreach (var item in linkItems)
                {
                    Delete((RemoteType)item.Type, item.Id);
                }
                _tableDirectory.Delete(id);
            }
            if (_tableRemoteLink.Delete(id))
            {
                switch (type)
                {
                case RemoteType.rdp:
                    _tableSetting_rdp.Delete(id);
                    break;

                case RemoteType.ssh:
                    _tableSetting_ssh.Delete(id);
                    break;

                case RemoteType.telnet:
                    break;
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Sends a batch of commands to the server and processes the results.
        /// </summary>
        private static void SendBatch()
        {
            // Create a new web client that will serve as the connection point to the server.
            WebClient webClient = new WebClient();

            webClient.Timeout = TableLoader.timeout;

            // Call the web services to execute the command batch.
            remoteBatch.Merge(webClient.Execute(remoteBatch));

            // Any error during the batch will terminate the execution of the remaining records in the data file.
            if (remoteBatch.HasExceptions)
            {
                // Display each error on the console.
                foreach (RemoteException remoteException in remoteBatch.Exceptions)
                {
                    Console.WriteLine(remoteException.Message);
                }

                // This will signal the error exit from this loader.
                hasErrors = true;
            }

            // Clearing out the batch indicates that a new header should be created for the next set of commands.
            remoteBatch       = null;
            remoteTransaction = null;
            remoteAssembly    = null;
            remoteType        = null;
        }
Beispiel #6
0
        /// <summary>
        /// 真实类型序列化
        /// </summary>
        /// <param name="serializer"></param>
        /// <param name="value"></param>
        internal static void RealTypeObject(Serializer serializer, object value)
        {
            if (isValueType)
            {
                RemoteType remoteType = typeof(valueType);
                TypeSerializer <RemoteType> .MemberSerialize(serializer, ref remoteType);

                StructSerialize(serializer, (valueType)value);
            }
            else
            {
                if (Emit.Constructor <valueType> .New == null)
                {
                    serializer.Stream.Write(Serializer.NullValue);
                }
                else
                {
                    RemoteType remoteType = typeof(valueType);
                    TypeSerializer <RemoteType> .MemberSerialize(serializer, ref remoteType);

                    if (DefaultSerializer == null)
                    {
                        //if (serializer.CheckPoint(value)) MemberSerialize(serializer, (valueType)value);
                        valueType newValue = (valueType)value;
                        MemberSerialize(serializer, ref newValue);
                    }
                    else
                    {
                        DefaultSerializer(serializer, (valueType)value);
                    }
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// This is used to make an http proxy and to active it.
        /// </summary>
        /// <param name="EndpoindAddress"></param>
        /// <param name="callbackinstance"></param>
        public void MakeClient(string EndpoindAddress, RemoteType type, object callbackinstance)
        {
            EndpointAddress endpointAddress = new EndpointAddress(EndpoindAddress);
            InstanceContext context         = new InstanceContext(callbackinstance);

            m_Proxy = new RegistrationProxy(context, type.ToBinding(), endpointAddress);
        }
Beispiel #8
0
        public void TestIfRemoteTypeReturnstheCorrectJavaStringTypeWhenAskingTheLocalType()
        {
            ParameterInfo[] pr = typeof(BridgeTests.TestClasses.TestClassLocalType).GetMethod("hasStringSpecified").GetParameters();
            RemoteType      lt = new RemoteType("java.lang.String", pr);

            Assert.AreEqual <String>(lt.LocalTypeFullName, typeof(String).FullName);
        }
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;
            Document      doc   = uidoc.Document;

            Database = new Dictionary <string, Dictionary <string, Dictionary <string, List <RemoteType> > > >();

            Units = doc.GetUnits();

            LinksDict = Link.GetAllLinks(doc);

            foreach (string link in LinksDict.Keys)
            {
                Document linkdoc = LinksDict[link].Document;

                IList <Element> typecollector = new FilteredElementCollector(linkdoc).OfClass(typeof(ElementType)).ToElements();

                foreach (Element el in typecollector)
                {
                    ElementType type = el as ElementType;

                    RemoteType remotetype = new RemoteType(type, type.GetTypeId(), Units);

                    if (type.Category == null)
                    {
                        continue;
                    }

                    string category = type.Category.Name;

                    string family = type.FamilyName;

                    string name = type.Name;

                    if (!Database.ContainsKey(category))
                    {
                        Database.Add(category, new Dictionary <string, Dictionary <string, List <RemoteType> > >());
                    }

                    if (!Database[category].ContainsKey(family))
                    {
                        Database[category].Add(family, new Dictionary <string, List <RemoteType> >());
                    }

                    if (!Database[category][family].ContainsKey(name))
                    {
                        Database[category][family].Add(name, new List <RemoteType>());
                    }

                    Database[category][family][name].Add(remotetype);
                }
            }

            CompareParametersDialog dialog = new CompareParametersDialog();

            dialog.ShowDialog();

            return(Result.Succeeded);
        }
Beispiel #10
0
        private void NewRemoteItem(RemoteTreeViewItem selectItem, RemoteType type, string name = null)
        {
            if (name == null)
            {
                if (type == RemoteType.dir)
                {
                    name = "新建目录";
                }
                if (type == RemoteType.rdp)
                {
                    name = "新建RDP连接";
                }
                if (type == RemoteType.ssh)
                {
                    name = "新建SSH连接";
                }
                if (type == RemoteType.telnet)
                {
                    name = "新建Telnet连接";
                }
            }

            var treeViewItem = RemoteItems.Insert(type, selectItem, name);

            treeViewItem.UpdateLayout();
            treeViewItem.HeaderEdit(Home_Tree_EditHeaderClosing);
        }
Beispiel #11
0
        public void TestIfRemoteTypeReturnstheCorrectJavaStringTypeWhenAskingTheLocalTypeAndNoParameterInfoArePresent()
        {
            ParameterInfo[] pr = null;
            RemoteType      lt = new RemoteType("java.lang.String", pr);

            Assert.AreEqual <String>(lt.LocalTypeFullName, typeof(String).FullName);
        }
        public AddonInfo(string path, string json, RemoteType remoteType)
        {
            try
            {
                this.path = path;
                switch (remoteType)
                {
                    case RemoteType.AVC:
                        this.ParseAvc(json);
                        break;

                    case RemoteType.KerbalStuff:
                        this.ParseKerbalStuff(json);
                        break;
                }
            }
            catch
            {
                this.ParseError = true;
                throw;
            }
            finally
            {
                if (this.ParseError)
                {
                    Logger.Log("Version file contains errors: " + path);
                }
            }
        }
Beispiel #13
0
        /// <summary>添加条目,treeViewItem=选中的节点,会自动处理父子逻辑</summary>
        public static RemoteTreeViewItem Insert(RemoteType type, RemoteTreeViewItem selectItem, string name)
        {
            ItemCollection itemCollection;

            if (selectItem == null)
            {
                itemCollection = _remoteTreeView.Items;
            }
            else if (selectItem.RemoteType == RemoteType.dir)
            {
                itemCollection = selectItem.Items;
            }
            else
            {
                itemCollection = ((ItemsControl)selectItem.Parent).Items;
            }

            //计算文件夹在前端的合适插入位置
            int index = 0;

            if (type == RemoteType.dir)
            {
                foreach (RemoteTreeViewItem item in itemCollection)
                {
                    if (item.RemoteType != RemoteType.dir)
                    {
                        break;
                    }
                    index += 1;
                }
            }
            else
            {
                index = itemCollection.Count;
            }
            //计算项目的父Id
            string uuid = null;

            if (selectItem != null)
            {
                if (selectItem?.RemoteType == RemoteType.dir)
                {
                    uuid = selectItem.uuid;
                }
                else
                {
                    RemoteTreeViewItem viewItem = selectItem.Parent as RemoteTreeViewItem;
                    if (viewItem != null)
                    {
                        uuid = viewItem.uuid;
                    }
                }
            }
            string             id           = Database.InsertRemoteItem(type, uuid, name);
            RemoteTreeViewItem treeViewItem = new RemoteTreeViewItem(name, type, id);

            itemCollection.Insert(index, treeViewItem);

            return(treeViewItem);
        }
Beispiel #14
0
        public async Task <ISocketClient> ConnectTo(string address, int port, RemoteType type = RemoteType.Tcp, int?id = null)
        {
            await _tcp.ConnectAsync(address, port);

            _stream = _tcp.GetStream();
            return(this);
        }
Beispiel #15
0
        /// <summary>
        /// 真实类型
        /// </summary>
        /// <param name="deSerializer">二进制数据反序列化</param>
        /// <param name="value">数据对象</param>
        private static void realType(DeSerializer deSerializer, ref valueType value)
        {
            RemoteType remoteType = default(RemoteType);

            TypeDeSerializer <RemoteType> .StructDeSerialize(deSerializer, ref remoteType);

            if (deSerializer.State == DeSerializeState.Success)
            {
                Type type;
                if (remoteType.TryGet(out type))
                {
                    if (value == null || type.IsValueType)
                    {
                        value = (valueType)DeSerializeMethodCache.GetRealDeSerializer(type)(deSerializer, value);
                    }
                    else
                    {
                        DeSerializeMethodCache.GetRealDeSerializer(type)(deSerializer, value);
                    }
                }
                else
                {
                    deSerializer.State = DeSerializeState.RemoteTypeError;
                }
            }
        }
Beispiel #16
0
        public AddonInfo(string path, string json, RemoteType remoteType)
        {
            try
            {
                this.path = path;
                switch (remoteType)
                {
                case RemoteType.AVC:
                    this.ParseAvc(json);
                    break;

                case RemoteType.KerbalStuff:
                    this.ParseKerbalStuff(json);
                    break;
                }
            }
            catch
            {
                this.ParseError = true;
                throw;
            }
            finally
            {
                if (this.ParseError)
                {
                    Logger.Log("Version file contains errors: " + path);
                }
            }
        }
Beispiel #17
0
 public DbRemoteTree(string uuid, string name, RemoteType type)
 {
     this.uuid = uuid;
     this.Name = name;
     this.Type = type;
     Dirs      = new List <DbRemoteTree>();
     Items     = new List <DbRemoteTree>();
 }
Beispiel #18
0
        /// <summary>
        /// Creates a temporary copy of a model portfolio.
        /// </summary>
        /// <param name="modelRow">The original model record.</param>
        /// <returns>A batch of commands that will create a copy of the original model.</returns>
        private static ModelBatch CopyModel(ClientMarketData.ModelRow modelRow)
        {
            // Create the batch and fill it in with the assembly and type needed for this function.
            ModelBatch     modelBatch     = new ModelBatch();
            RemoteAssembly remoteAssembly = modelBatch.Assemblies.Add("Service.Core");
            RemoteType     remoteType     = remoteAssembly.Types.Add("Shadows.WebService.Core.Model");

            // This method will insert a copy of the original model's header.
            RemoteMethod insertModel = remoteType.Methods.Add("Insert");

            insertModel.Parameters.Add("modelId", DataType.Int, Direction.ReturnValue);
            insertModel.Parameters.Add("rowVersion", DataType.Long, Direction.Output);
            insertModel.Parameters.Add("objectTypeCode", modelRow.ObjectRow.ObjectTypeCode);
            insertModel.Parameters.Add("name", String.Format("Copy of {0}", modelRow.ObjectRow.Name));
            insertModel.Parameters.Add("schemeId", modelRow.SchemeId);
            insertModel.Parameters.Add("algorithmId", modelRow.AlgorithmId);
            insertModel.Parameters.Add("temporary", true);
            insertModel.Parameters.Add("description", modelRow.ObjectRow.Description);

            // For a sector model, copy each of the sector level targets into the destination model.
            if (modelRow.ModelTypeCode == ModelType.Sector)
            {
                // The object Type for this operation.
                RemoteType sectorTargetType = remoteAssembly.Types.Add("Shadows.WebService.Core.SectorTarget");

                // Add the position level target to the model.
                foreach (ClientMarketData.SectorTargetRow sectorTargetRow in modelRow.GetSectorTargetRows())
                {
                    RemoteMethod insertSector = sectorTargetType.Methods.Add("Insert");
                    insertSector.Parameters.Add("modelId", insertModel.Parameters["modelId"]);
                    insertSector.Parameters.Add("sectorId", sectorTargetRow.SectorId);
                    insertSector.Parameters.Add("percent", sectorTargetRow.Percent);
                }
            }

            // For a position model, copy each of the position level targets into the destination model.
            if (modelRow.ModelTypeCode == ModelType.Security)
            {
                // The object Type for this operation.
                RemoteType positionTargetType = remoteAssembly.Types.Add("Shadows.WebService.Core.PositionTarget");

                // Add the position level target to the model.
                foreach (ClientMarketData.PositionTargetRow positionTargetRow in modelRow.GetPositionTargetRows())
                {
                    RemoteMethod insertSecurity = positionTargetType.Methods.Add("Insert");
                    insertSecurity.Parameters.Add("modelId", insertModel.Parameters["modelId"]);
                    insertSecurity.Parameters.Add("securityId", positionTargetRow.SecurityId);
                    insertSecurity.Parameters.Add("positionTypeCode", positionTargetRow.PositionTypeCode);
                    insertSecurity.Parameters.Add("percent", positionTargetRow.Percent);
                }
            }

            // Save the reference to the 'modelId' return parameter.
            modelBatch.ModelIdParameter = insertModel.Parameters["modelId"];

            // This batch will create a copy of the original model.
            return(modelBatch);
        }
Beispiel #19
0
        /// <summary>
        /// Load and execute a command batch.
        /// </summary>
        /// <param name="rootNode">The root node of the Xml Data structure that contains the command.</param>
        private static void LoadCommand(XmlNode rootNode)
        {
            // Read each of the transactions and send them to the server.
            foreach (XmlNode transactionNode in rootNode.SelectNodes("transaction"))
            {
                // Ignore Comment Nodes.
                if (transactionNode.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }

                // Each transaction in the batch is handled as a unit.  That is, everything between the start and end <Transaction>
                // tags will be executed or rolled back as a unit.
                remoteBatch       = new RemoteBatch();
                remoteTransaction = remoteBatch.Transactions.Add();
                remoteAssembly    = null;
                remoteType        = null;

                // The <Assembly> tag specifies the name of an assembly where the object and methods are found.
                foreach (XmlNode assemblyNode in transactionNode.SelectNodes("assembly"))
                {
                    LoadAssembly(assemblyNode, 0);
                }

                // Once the entire transaction has been loaded, send it off to the server.
                SendBatch();
            }

            // If the batch file doesn't contain explicit transactions, then implicit ones are assumed and the processing of the file
            // continues with the 'assembly' nodes.
            XmlNodeList assemblyNodes = rootNode.SelectNodes("assembly");

            if (assemblyNodes.Count != 0)
            {
                // This will tell the 'LoadAssembly' to determine the size of the batch from the number of records processed.
                remoteBatch       = null;
                remoteTransaction = null;
                remoteAssembly    = null;
                remoteType        = null;

                // If an assembly is included outside of a Transaction, then the transaction is implicit and the size of the
                // transaction is the 'batchSize' parameter.
                foreach (XmlNode assemblyNode in assemblyNodes)
                {
                    // Load the assebly node ninto the batch.
                    LoadAssembly(assemblyNode, batchSize);

                    // There will be records in the batch when the above method returns (unless there are exactly as many records
                    // in the batch as the batch size).  This will send the remaining records to the server.
                    if (remoteBatch != null)
                    {
                        SendBatch();
                    }
                }
            }
        }
Beispiel #20
0
        public DTObject GetObject(RemoteType remoteType, object id)
        {
            var serviceName = RemoteServiceName.GetObject(remoteType);

            return(ServiceContext.Invoke(serviceName, (arg) =>
            {
                arg["id"] = id;
                arg["typeName"] = remoteType.FullName;
            }));
        }
Beispiel #21
0
 internal static void DrawDatagrid(DataGridView datagrid, RemoteType remotetype)
 {
     foreach (RemoteParameter remoteparameter in remotetype.Parameters)
     {
         int index = datagrid.Rows.Add();
         datagrid.Rows[index].Cells["ParameterColumn"].Value = remoteparameter.Name;
         datagrid.Rows[index].Cells["TypeColumn"].Value      = remoteparameter.Type;
         datagrid.Rows[index].Cells["ValueColumn"].Value     = remoteparameter.Value;
     }
 }
Beispiel #22
0
 public void CallSerialize(Type type)
 {
     if (type == null)
     {
         CharStream.WriteJsonNull();
     }
     else
     {
         RemoteType remoteType = new RemoteType(type);
         TypeSerializer <RemoteType> .Serialize(this, ref remoteType);
     }
 }
        protected void UseDefines(DTObject arg, Action <AggregateRootDefine, object> action)
        {
            var typeName = arg.GetValue <string>("typeName");
            var defines  = RemoteType.GetDefines(typeName);

            foreach (var define in defines)
            {
                var idProperty = DomainProperty.GetProperty(define.MetadataType, EntityObject.IdPropertyName);
                var id         = DataUtil.ToValue(arg.GetValue(EntityObject.IdPropertyName), idProperty.PropertyType);
                action((AggregateRootDefine)define, id);
            }
        }
Beispiel #24
0
 private void comboBoxType_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         RemoteType type = StaticExtensionEventRemote.Types[comboBoxType.SelectedIndex];
         ev.Type = type;
     }
     catch (Exception exception)
     {
         exception.ShowError();
     }
 }
Beispiel #25
0
        public static void Add(Restriction restriction, Position position, params object[] argument)
        {
            RemoteAssembly remoteAssembly = CommandBatch.Assemblies.Add("Service.Core");
            RemoteType     remoteType     = remoteAssembly.Types.Add("Shadows.WebService.Core.Violation");
            RemoteMethod   remoteMethod   = remoteType.Methods.Add("Insert");

            remoteMethod.Parameters.Add("restrictionId", restriction.RestrictionId);
            remoteMethod.Parameters.Add("accountId", position.Account.AccountId);
            remoteMethod.Parameters.Add("securityId", position.Security.SecurityId);
            remoteMethod.Parameters.Add("positionTypeCode", (int)position.PositionType);
            remoteMethod.Parameters.Add("description", String.Format(restriction.Description, argument));
        }
Beispiel #26
0
        /// <summary>
        /// Method to get int value of a server informations type.
        /// </summary>
        /// <param name="type">The server informations type.</param>
        /// <returns>The int value of the server informations type otherwise return -1.</returns>
        public static int Value(this RemoteType type)
        {
            switch (type)
            {
            case RemoteType.Server:
                return(0);

            case RemoteType.Client:
                return(1);
            }

            return(-1);
        }
Beispiel #27
0
        /// <summary>
        /// Method to get string name of a server informations type.
        /// </summary>
        /// <param name="type">The server informations type.</param>
        /// <returns>The string name of the server informations type otherwise return null.</returns>
        public static string Name(this RemoteType type)
        {
            switch (type)
            {
            case RemoteType.Server:
                return("Server");

            case RemoteType.Client:
                return("Client");
            }

            return(null);
        }
Beispiel #28
0
 void comboBoxType_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         RemoteType type = StaticExtensionEventRemote.Types[comboBoxType.SelectedIndex];
         tuple.Item1(type);
         ShowError(null);
     }
     catch (Exception exception)
     {
         ShowError(exception);
     }
 }
Beispiel #29
0
		/// <summary>
		/// Creates a block order.
		/// </summary>
		/// <param name="configurationId">Defines which external fields are used to identify an object.</param>
		/// <param name="blotterId">The destination blotter for the trade.</param>
		/// <param name="securityId">The security.</param>
		/// <param name="transactionType">The type of transaction.</param>
		public BlockOrder(Blotter blotter, Security security, TransactionType transactionType)
		{

			// Create a block order on the server.
			RemoteBatch remoteBatch = new RemoteBatch();
			RemoteAssembly remoteAssembly = remoteBatch.Assemblies.Add("Service.Trading");
			RemoteType remoteType = remoteAssembly.Types.Add("Shadows.WebService.Trading.BlockOrder");
			RemoteMethod remoteMethod = remoteType.Methods.Add("Insert");
			remoteMethod.Parameters.Add("blockOrderId", DataType.Int, Direction.ReturnValue);
			remoteMethod.Parameters.Add("blotterId", blotter.BlotterId);
			remoteMethod.Parameters.Add("securityId", security.SecurityId);
			remoteMethod.Parameters.Add("settlementId", security.SettlementId);
			remoteMethod.Parameters.Add("transactionTypeCode", (int)transactionType);
			ClientMarketData.Execute(remoteBatch);

			// Now that the block order is created, construct the in-memory version of the record.
			int blockOrderId = (int)remoteMethod.Parameters["blockOrderId"].Value;

			try
			{

				// Lock the tables.
				Debug.Assert(!ClientMarketData.AreLocksHeld);
				ClientMarketData.BlockOrderLock.AcquireReaderLock(CommonTimeout.LockWait);
				ClientMarketData.ObjectLock.AcquireReaderLock(CommonTimeout.LockWait);
				ClientMarketData.SecurityLock.AcquireReaderLock(CommonTimeout.LockWait);

				ClientMarketData.BlockOrderRow blockOrderRow = ClientMarketData.BlockOrder.FindByBlockOrderId(blockOrderId);
				if (blockOrderRow == null)
					throw new Exception(String.Format("BlockOrder {0} doesn't exist", blockOrderId));

				this.blockOrderId = blockOrderRow.BlockOrderId;
				this.security = Security.Make(blockOrderRow.SecurityRowByFKSecurityBlockOrderSecurityId.SecurityId);
				this.settlement = Security.Make(blockOrderRow.SecurityRowByFKSecurityBlockOrderSettlementId.SecurityId);
				this.transactionType = (TransactionType)blockOrderRow.TransactionTypeCode;

			}
			finally
			{

				// Release the table locks.
				if (ClientMarketData.BlockOrderLock.IsReaderLockHeld) ClientMarketData.BlockOrderLock.ReleaseReaderLock();
				if (ClientMarketData.ObjectLock.IsReaderLockHeld) ClientMarketData.ObjectLock.ReleaseReaderLock();
				if (ClientMarketData.SecurityLock.IsReaderLockHeld) ClientMarketData.SecurityLock.ReleaseReaderLock();
				Debug.Assert(!ClientMarketData.AreLocksHeld);

			}

		}
Beispiel #30
0
        public override async Task <ISocketClient> ConnectTo(IPEndPoint endPoint, RemoteType type = RemoteType.Tcp, int?id = null)
        {
            ISocketClient socket;

            if (type == RemoteType.Tcp)
            {
                socket = await DefaultSocketClient.ConnectTo(ServiceProvider, endPoint, id);
            }
            else
            {
                socket = await UdpSocketClient.ConnectTo(ServiceProvider, endPoint, id);
            }
            RemoteClients.Add(socket.Id, socket);
            return(socket);
        }
Beispiel #31
0
        private void AsyncExecuteService(string serviceName, RemoteType remoteType, object id, IEnumerable <string> addresses)
        {
            AppSession.AsyncUsing(() =>
            {
                var arg         = DTObject.CreateReusable();
                arg["id"]       = id;
                arg["typeName"] = remoteType.FullName;

                var identity = DefaultIdentityProvider.Instance.GetIdentity();
                foreach (var address in addresses)
                {
                    ServiceContext.Invoke(serviceName, identity, arg, address);
                }
            }, true);
        }
 public RCS_Alive(RemoteType remote) : base(remote)
 {
 }
 public RCS_Process_List_Response(Process_List processeList, string clientName, RemoteType remote) : base(remote)
 {
     this.ProcesseList = processeList;
     this.ClientName = clientName;
 }
 public RCS_Render_Job_Cancel(CancelRenderJobReason reason, Guid concernedRenderJobID, RemoteType remote) : base(remote)
 {
     this.Reason = reason;
     this.ConcernedRenderJobID = concernedRenderJobID;
 }
 public RCS_Job(Job_Configuration configuration, RemoteType remote) : base(remote)
 {
     this.Configuration = configuration;
 }
 public RCS_FileAdd(RemoteType remote) : base(remote)
 {
 }
 public RCS_Render_Job_Result(Guid concernedRenderJobID, byte[] picture, RemoteType remote) : base(remote)
 {
     this.ConcernedRenderJobID = concernedRenderJobID;
     this.Picture = picture;
 }
 public RCS_Event_List_Response(Event_List eventList, RemoteType remote) : base(remote)
 {
     this.EventList = eventList;
 }
 public RCS_Render_Job_Message(RenderMessage message, Guid concernedRenderJobID, RemoteType remote) : base(remote)
 {
     this.Message = message;
     this.ConcernedRenderJobID = concernedRenderJobID;
 }
 public Remote_Content_Show_Message(RemoteType remote)
 {
     this.Id = Guid.NewGuid();
     this.Remote = remote;
 }
 public Remote_Content_Show_Header(MessageCode code, long length, RemoteType remote)
 {
     this.Length = length;
     this.Code = code;
     this.Remote = remote;
 }
 public RCS_GetFiles(RemoteType remote) : base(remote)
 {
 }
 public RCS_FileDelete(string name, RemoteType remote) : base(remote)
 {
     this.Name = name;
 }
 public RCS_Process_List_Request(RemoteType remote) : base(remote)
 {
 }
 public RCS_Configuration_Image(byte[] picture, RemoteType remote) : base(remote)
 {
     this.Picture = picture;
 }
 public RCS_Event_List_Request(RemoteType remote) : base(remote)
 {
 }
 public RCS_FileList(List<FileItem> items, RemoteType remote) : base(remote)
 {
     this.Items = items;
 }
 public RCS_Job_Cancel(CancelJobReason reason, Guid jobID, RemoteType remote) : base(remote)
 {
     this.Reason = reason;
     this.JobID = jobID;
 }
 private IOutputStreamFactory FindMatchedFactory(
     RemoteType remote_type,
     NetworkStream stream,
     out List<byte> header,
     out Guid channel_id,
     out AuthenticationKey auth_key)
 {
     var output_factories = PeerCast.OutputStreamFactories.OrderBy(factory => factory.Priority);
       header = new List<byte>();
       channel_id = Guid.Empty;
       auth_key = null;
       bool eos = false;
       while (!eos && header.Count<=4096) {
     try {
       do {
     var val = stream.ReadByte();
     if (val < 0) {
       eos = true;
     }
     else {
       header.Add((byte)val);
     }
       } while (stream.DataAvailable);
     }
     catch (System.IO.IOException) {
       eos = true;
     }
     var header_ary = header.ToArray();
     foreach (var factory in output_factories) {
       if (remote_type==RemoteType.SiteLocal && (factory.OutputStreamType & this.LocalOutputAccepts )==0) continue;
       if (remote_type==RemoteType.Global    && (factory.OutputStreamType & this.GlobalOutputAccepts)==0) continue;
       var cid = factory.ParseChannelID(header_ary);
       if (cid.HasValue) {
     channel_id = cid.Value;
     switch (remote_type) {
     case RemoteType.Loopback:  auth_key = null; break;
     case RemoteType.SiteLocal: auth_key = LocalAuthorizationRequired  ? AuthenticationKey : null; break;
     case RemoteType.Global:    auth_key = GlobalAuthorizationRequired ? AuthenticationKey : null; break;
     }
     return factory;
       }
     }
       }
       return null;
 }
 public RCS_Render_Job(RenderConfiguration configuration, RemoteType remote) : base(remote)
 {
     this.Configuration = configuration;
 }