Пример #1
0
        ProtocolInfo WaitRequest()
        {
            var context = _listener.GetContext();

            using (var response = context.Response)
            {
                ProtocolInfo info = null;
                lock (_stackProtocol)
                {
                    if (_stackProtocol.Count == 0)
                    {
                        return(null);
                    }
                    info = _stackProtocol.Pop();
                }

                var reader        = new StreamReader(context.Request.InputStream);
                var requestString = reader.ReadToEnd();
                if (!string.IsNullOrEmpty(requestString))
                {
                    return(null);
                }

                var bin = _serializer.WriteObject(info);
                response.OutputStream.Write(bin, 0, bin.Length);
                return(info);
            }
        }
Пример #2
0
        public MHEControl CreateMHEControl(IControllable assem, ProtocolInfo info)
        {
            sorterElement = assem as SorterElement;

            MHEControl protocolConfig = null;  //generic plc config object

            if (assem is SorterElement)
            {
                protocolConfig = CreateMHEControlGeneric <SorterATCInfo, MHEControl_Sorter>(assem, info);
            }
            else if (assem is CommunicationPoint)
            {
                protocolConfig = CreateMHEControlGeneric <MHEControl_CommPointInfo, MHEControl_CommPoint>(assem, info);
            }
            else
            {
                Experior.Core.Environment.Log.Write("Can't create MHE Control, object is not defined in the 'CreateMHEControl' of the controller", Color.Red);
                return(null);
            }
            //......other assemblies should be added here....do this with generics...correction better to do this with reflection...That is BaseController should use reflection
            //and not generics as we do not know the types at design time and it means that the above always has to be edited when adding a new MHE control object.
            protocolConfig.ParentAssembly = (Assembly)assem;
            controls.Add(protocolConfig);
            return(protocolConfig as MHEControl);
        }
 // NoLB parameter set
 public AzureEndPointConfigInfo(ParameterSet paramset,
     ProtocolInfo endpointProtocol,
     int endpointLocalPort,
     int endpointPublicPort,
     string endpointName,
     NetworkAclObject aclObj = null,
     bool directServerReturn = false,
     string internalLoadBalancer = null,
     string serviceName = null,
     string loadBalancerDistribution = null,
     string VirtualIPName = null)
 {
     this.Initialize(
         endpointProtocol,
         endpointLocalPort,
         endpointPublicPort,
         endpointName, 
         string.Empty, 
         0, 
         ProtocolInfo.tcp, 
         string.Empty, 
         null, 
         null,
         paramset,
         aclObj,
         directServerReturn,
         internalLoadBalancer,
         serviceName,
         loadBalancerDistribution,
         VirtualIPName);
 }
 /// <summary>
 /// 操作を見つけることが出来なかった場合の例外作成。
 /// </summary>
 /// <param name="info">操作情報。</param>
 /// <param name="findStartType">検索開始の型。</param>
 /// <param name="argTypes">型情報。</param>
 /// <param name="isObjectArrayArg">操作の引数がobject[]型であったか。</param>
 /// <param name="nameMatchCount">名前がマッチした数。</param>
 /// <param name="isAmbiguousArgs">あいまいな引数であるか。</param>
 /// <returns>例外。</returns>
 static InformationException MakeNotFoundException(ProtocolInfo info, Type findStartType, Type[] argTypes,
                                                   bool isObjectArrayArg, int nameMatchCount, bool isAmbiguousArgs)
 {
     if (isAmbiguousArgs)
     {
         throw new InformationException(string.Format(CultureInfo.CurrentCulture, ResourcesLocal.Instance.ErrorManyFoundInvokeFormat,
                                                      findStartType.Name, info.Operation, MakeErrorInvokeArgInfo(argTypes)));
     }
     else if (nameMatchCount == 0)
     {
         return(new InformationException(string.Format(CultureInfo.CurrentCulture, ResourcesLocal.Instance.ErrorNotFoundInvokeFormat,
                                                       findStartType.Name, info.Operation, MakeErrorInvokeArgInfo(argTypes))));
     }
     else
     {
         if (isObjectArrayArg)
         {
             return(new InformationException(string.Format(CultureInfo.CurrentCulture, ResourcesLocal.Instance.ErrorArgumentInvokeFormatForObjectArray,
                                                           findStartType.Name, info.Operation, MakeErrorInvokeArgInfo(argTypes))));
         }
         else
         {
             return(new InformationException(string.Format(CultureInfo.CurrentCulture, ResourcesLocal.Instance.ErrorArgumentInvokeFormat,
                                                           findStartType.Name, info.Operation, MakeErrorInvokeArgInfo(argTypes))));
         }
     }
 }
Пример #5
0
        /// <summary>Get the protocol version from protocol class.</summary>
        /// <remarks>
        /// Get the protocol version from protocol class.
        /// If the protocol class has a ProtocolAnnotation, then get the protocol
        /// name from the annotation; otherwise the class name is the protocol name.
        /// </remarks>
        public static long GetProtocolVersion(Type protocol)
        {
            if (protocol == null)
            {
                throw new ArgumentException("Null protocol");
            }
            long         version;
            ProtocolInfo anno = protocol.GetAnnotation <ProtocolInfo>();

            if (anno != null)
            {
                version = anno.ProtocolVersion();
                if (version != -1)
                {
                    return(version);
                }
            }
            try
            {
                FieldInfo versionField = protocol.GetField("versionID");
                return(versionField.GetLong(protocol));
            }
            catch (NoSuchFieldException ex)
            {
                throw new RuntimeException(ex);
            }
            catch (MemberAccessException ex)
            {
                throw new RuntimeException(ex);
            }
        }
Пример #6
0
        private IAnalysisSet MakeIterable(IAnalysisSet values)
        {
            var pi = new ProtocolInfo(DeclaringModule, Self.State);

            pi.AddProtocol(new IterableProtocol(pi, values));
            return(pi);
        }
Пример #7
0
 // NoLB parameter set
 public AzureEndPointConfigInfo(ParameterSet paramset,
                                ProtocolInfo endpointProtocol,
                                int endpointLocalPort,
                                int endpointPublicPort,
                                string endpointName,
                                NetworkAclObject aclObj         = null,
                                bool directServerReturn         = false,
                                string internalLoadBalancer     = null,
                                string serviceName              = null,
                                string loadBalancerDistribution = null,
                                string VirtualIPName            = null)
 {
     this.Initialize(
         endpointProtocol,
         endpointLocalPort,
         endpointPublicPort,
         endpointName,
         string.Empty,
         0,
         ProtocolInfo.tcp,
         string.Empty,
         null,
         null,
         paramset,
         aclObj,
         directServerReturn,
         internalLoadBalancer,
         serviceName,
         loadBalancerDistribution,
         VirtualIPName);
 }
Пример #8
0
        public override Protocol Clone(ProtocolInfo newSelf)
        {
            var np = new NamespaceProtocol(newSelf, _name);

            _values.CopyTo(np._values);
            return(np);
        }
Пример #9
0
        //BaseController should use reflection
        //and not generics as we do not know the types at design time
        public static MHEControl CreateMHEControlGeneric <T, U>(IControllable assem, ProtocolInfo info)
            where T : ProtocolInfo
            where U : MHEControl
        {
            MHEControl protocolConfig = null; //generic plc config object

            try
            {
                if (info == null)
                {
                    var          i            = (T)Activator.CreateInstance(typeof(T), null);
                    ProtocolInfo protocolInfo = i; //generic plc config object constructor argument type
                    protocolInfo.assem = assem.Name;
                    object[] args = { protocolInfo, assem };
                    var      ctr  = (U)Activator.CreateInstance(typeof(U), args);
                    protocolConfig = ctr;
                }
                else
                {
                    object[] args = { info, assem };
                    var      ctr  = (U)Activator.CreateInstance(typeof(U), args);
                    info.assem     = assem.Name;
                    protocolConfig = ctr;
                }
            }
            catch (Exception e)
            {
                Experior.Core.Environment.Log.Write("Can't create control!", Color.Red);
                Environment.Log.Write(e.Message, Color.Red);
            }
            return(protocolConfig);
        }
Пример #10
0
        protected AbstractHybridSession(UdpProtocol udp)
        {
            Udp       = udp;
            Udp.Data += HandleUdpData;

            Info = new ProtocolInfo(60);
        }
        /// <summary>
        /// 呼び出し対象の解決。
        /// </summary>
        /// <param name="varManager">変数管理。</param>
        /// <param name="typeFinder">タイプ検索。</param>
        /// <param name="info">呼び出し情報。</param>
        /// <param name="type">タイプ。</param>
        /// <param name="targetObj">オブジェクト。</param>
        /// <param name="args">引数。</param>
        /// <param name="argTypes">引数タイプ。</param>
        /// <param name="bind">バインディング。</param>
        static void ResolveInvokeTarget(VarPool varManager, TypeFinder typeFinder, ProtocolInfo info, out Type type, out object targetObj, out object[] args, out Type[] argTypes, out BindingFlags bind)
        {
            type      = null;
            targetObj = null;
            bind      = BindingFlags.Public | BindingFlags.NonPublic;

            //static呼び出し時
            if (info.VarAddress == null)
            {
                type = typeFinder.GetType(info.TypeFullName);
                if (type == null)
                {
                    throw new InformationException(string.Format(CultureInfo.CurrentCulture, ResourcesLocal.Instance.UnknownTypeInfoFormat, info.TypeFullName));
                }
                bind |= BindingFlags.Static;
            }
            //オブジェクトに対する呼び出し
            else
            {
                VarAndType varAndType = varManager.GetVarAndType(info.VarAddress);
                targetObj = varAndType.Core;
                if (targetObj == null)
                {
                    throw new InformationException(ResourcesLocal.Instance.NullObjectOperation);
                }
                type  = varAndType.Type;
                bind |= BindingFlags.Instance;
            }

            //引数の解決
            ResolveArgs(varManager, info.Arguments, out args, out argTypes);
        }
Пример #12
0
        internal ReturnInfo SendAndReceive(ProtocolInfo info)
        {
            var bin = _serializer.WriteObject(info);

            var request = (HttpWebRequest)WebRequest.Create(_uri);

            request.Method      = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            var requestStream = request.GetRequestStreamAsync();

            requestStream.Wait();
            using (var reqStream = requestStream.Result)
            {
                reqStream.Write(bin, 0, bin.Length);
            }

            var respons = request.GetResponseAsync();

            respons.Wait();

            using (var httpWebResponsex = (HttpWebResponse)respons.Result)
                using (var reader = new StreamReader(httpWebResponsex.GetResponseStream()))
                {
                    string requestString;
                    requestString = reader.ReadToEnd();
                    if (string.IsNullOrEmpty(requestString))
                    {
                        return(null);
                    }
                    return((ReturnInfo)_serializer.ReadObject(Encoding.UTF8.GetBytes(requestString)));
                }
        }
 public AzureEndPointConfigInfo(ProtocolInfo protocol, int internalPort,
     int externalPort, string endpointName)
 {
     this.InternalPort = internalPort;
     this.Protocol = protocol;
     this.ExternalPort = externalPort;
     this.EndpointName = endpointName;
 }
 public ReturnInfo SendAndReceive(ProtocolInfo info)
 {
     if (Sender == null)
     {
         return(null);
     }
     return(Converter.Convert(Sender.SendAndReceive(Converter.Convert(info))));
 }
        internal override IAnalysisSet Resolve(AnalysisUnit unit, ResolutionContext context)
        {
            VariableDef[] newTypes;
            if (context.CallSite == null)
            {
                // No ability to come back to this instance later, so resolve and return
                // imitation type
                var  union   = AnalysisSet.Empty;
                bool changed = false;
                if (Push())
                {
                    try {
                        union = UnionType.Resolve(unit, context, out changed);
                    } finally {
                        Pop();
                    }
                }

                var pi = new ProtocolInfo(DeclaringModule, ProjectState);
                pi.AddProtocol(new IterableProtocol(pi, union));
                if (ClassInfo.TypeId == BuiltinTypeId.Tuple)
                {
                    newTypes = VariableDef.Generator.Take(IndexTypes.Length).ToArray();
                    changed |= ResolveIndexTypes(unit, context, newTypes);
                    if (newTypes.Length == 1)
                    {
                        pi.AddProtocol(new GetItemProtocol(pi, unit.State.ClassInfos[BuiltinTypeId.Int], newTypes[0].Types));
                    }
                    else if (newTypes.Length > 1)
                    {
                        pi.AddProtocol(new TupleProtocol(pi, newTypes.Select(t => t.Types)));
                    }
                }

                return(changed ? (AnalysisValue)pi : this);
            }

            if (unit.InterpreterScope.TryGetNodeValue(context.CallSite, NodeValueKind.Sequence, out var newSeq))
            {
                newTypes = (newSeq as IterableValue)?.IndexTypes;
                if (newTypes != null)
                {
                    ResolveIndexTypes(unit, context, newTypes);
                }
                return(newSeq);
            }
            else
            {
                newTypes = VariableDef.Generator.Take(Math.Max(1, IndexTypes.Length)).ToArray();
                if (ResolveIndexTypes(unit, context, newTypes))
                {
                    return(unit.InterpreterScope.GetOrMakeNodeValue(context.CallSite, NodeValueKind.Sequence, n => CreateWithNewTypes(n, newTypes)));
                }
            }

            return(this);
        }
 /// <summary>
 /// 値取得処理呼び出し。
 /// </summary>
 /// <param name="varManager">変数管理。</param>
 /// <param name="info">呼び出し情報。</param>
 /// <returns>戻り値情報。</returns>
 static ReturnInfo GetValue(VarPool varManager, ProtocolInfo info)
 {
     //引数の数は0であること
     if (info.Arguments.Length != 0)
     {
         throw new InternalException();
     }
     return(new ReturnInfo(varManager.GetVarAndType(info.VarAddress).Core));
 }
        /// <summary>
        /// 非同期状態に関する通信。
        /// 非同期結果バッファの初期化と、完了の問い合わせ。
        /// 対象アプリケーション内でコントロールスレッドで実行される。
        /// </summary>
        /// <param name="info">呼び出し情報。</param>
        /// <param name="receiveWindow">受信ウィンドウ。</param>
        /// <returns>戻り値。</returns>
        private ReturnInfo AsyncState(ProtocolInfo info, ReceiveAfterSend receiveWindow)
        {
            ReturnInfo ret = CopyDataProtocolTalker.SendAndRecieve(_friendlyConnectorWindowInAppHandleAsync, info, receiveWindow) as ReturnInfo;

            if (ret == null)
            {
                throw new FriendlyOperationException(ResourcesLocal.Instance.ErrorAppCommunication);
            }
            return(ret);
        }
Пример #18
0
            /// <summary>
            /// 送受信。
            /// </summary>
            /// <param name="info">通信情報。</param>
            /// <returns>戻り値。</returns>
            public ReturnInfo SendAndReceive(ProtocolInfo info)
            {
                ReturnInfo ret = _app.SendAndReceive(info);

                if (ret != null && ((ret.ReturnValue as VarAddress) != null))
                {
                    _app.AppVarCreateCountUp();
                }
                return(ret);
            }
Пример #19
0
        /// <summary>Get the protocol name.</summary>
        /// <remarks>
        /// Get the protocol name.
        /// If the protocol class has a ProtocolAnnotation, then get the protocol
        /// name from the annotation; otherwise the class name is the protocol name.
        /// </remarks>
        public static string GetProtocolName(Type protocol)
        {
            if (protocol == null)
            {
                return(null);
            }
            ProtocolInfo anno = protocol.GetAnnotation <ProtocolInfo>();

            return((anno == null) ? protocol.FullName : anno.ProtocolName());
        }
 public ReturnInfo Execute(IAsyncInvoke async, ProtocolInfo info)
 {
     try
     {
         return(DotNetFriendlyExecutor.Execute(async, _pool, _typeFinder, info));
     }
     catch (Exception e)
     {
         return(new ReturnInfo(new ExceptionInfo(e)));
     }
 }
Пример #21
0
        private IAnalysisSet MakeView(IPythonType type, IAnalysisSet values)
        {
            var pi = new ProtocolInfo(DeclaringModule, Self.State);
            var np = new NameProtocol(pi, type);
            var ip = new IterableProtocol(pi, values);

            np.ExtendDescription(ip.GetRichDescription());
            pi.AddProtocol(np);
            pi.AddProtocol(ip);
            return(pi);
        }
 public AzureEndPointConfigInfo(ProtocolInfo protocol, int internalPort, 
     int externalPort, string endpointName, string lBSetName, int probePort,
     ProtocolInfo probeProtocol, string probePath)
 {
     this.InternalPort = internalPort;
     this.Protocol = protocol;
     this.ExternalPort = externalPort;
     this.EndpointName = endpointName;
     this.LBSetName = lBSetName;
     this.ProbePort = probePort;
     this.ProbeProtocol = probeProtocol;
     this.ProbePath = probePath;
 }
Пример #23
0
        /// <summary>
        /// 送受信
        /// </summary>
        /// <param name="info">通信情報</param>
        /// <returns>戻り値</returns>
        ReturnInfo SendAndReceive(ProtocolInfo info)
        {
            FriendlyConnectorCore connector = null;

            lock (_syncCurrentConnector)
            {
                if (_context == null)
                {
                    return(new ReturnInfo());
                }
                connector = _context.FriendlyConnector;
            }
            return(connector.SendAndReceive(info, null));
        }
 /// <summary>
 /// 実行。
 /// </summary>
 /// <param name="info">呼び出し情報。</param>
 /// <param name="receiveWindowFix">受信ウィンドウ。</param>
 /// <returns>戻り値。</returns>
 public ReturnInfo SendAndReceive(ProtocolInfo info, ReceiveAfterSend receiveWindowFix)
 {
     if (receiveWindowFix == null)
     {
         using (ReceiveAfterSend receiveWindowTmp = new ReceiveAfterSend())
         {
             return(SendAndReceiveCore(info, receiveWindowTmp));
         }
     }
     else
     {
         return(SendAndReceiveCore(info, receiveWindowFix));
     }
 }
Пример #25
0
            public override bool Equals(object o)
            {
                if (this == o)
                {
                    return(true);
                }
                if (o == null || this.GetType() != o.GetType())
                {
                    return(false);
                }
                ProtocolInfo that = ( ProtocolInfo )o;

                return(Version == that.Version && Objects.Equals(Orientation, that.Orientation) && Objects.Equals(Address, that.Address) && Objects.Equals(Protocol, that.Protocol) && Objects.Equals(Modifiers, that.Modifiers));
            }
Пример #26
0
        private void LoadHeaderFile(string path)
        {
            _saved = false;
            protocolsTree.Nodes.Clear();

            var backgroundWorker = new BackgroundWorker
            {
                WorkerReportsProgress = true
            };

            backgroundWorker.DoWork += (doWorkSender, doWorkEventArgs) =>
            {
                _protocolInfo = ProtocolInfoFactory.ParseFromHeader(path, (BackgroundWorker)doWorkSender);
            };

            backgroundWorker.ProgressChanged += (doWorkSender, doWorkEventArgs) =>
            {
                if (doWorkEventArgs.UserState == null)
                {
                    return;
                }

                var info = doWorkEventArgs.UserState as ProtocolInfo;
                if (info != null)
                {
                    tsslStatus.Text = $"Loading Protocol Info Version: {info.InfoVersion}";
                }
                else if (doWorkEventArgs.UserState is ProtocolGroup)
                {
                    var group = (ProtocolGroup)doWorkEventArgs.UserState;
                    tsslStatus.Text = $"Loading Protocol Group {group.Name}";
                }
                else if (doWorkEventArgs.UserState is Protocol)
                {
                    var protocol = (Protocol)doWorkEventArgs.UserState;
                    tsslStatus.Text = $"Loading Protocol {protocol.Name}";
                }
            };

            backgroundWorker.RunWorkerCompleted += (sender, args) =>
            {
                _loadWatch.Stop();
                DisplayProtocolInfo();
                tsslStatus.Text = $"Completed in {_loadWatch.ElapsedMilliseconds}ms";
            };

            _loadWatch.Restart();
            backgroundWorker.RunWorkerAsync();
        }
Пример #27
0
        private int server_BrowseDirectChildren(Action action, String object_id, String filter, Int32 starting_index, Int32 requested_count, String sort_criteria, HttpRequestContext context)
        {
            Console.WriteLine("BrowseDirectChildren: " + object_id);
            if (object_id != "0")
            {
                return(-1);
            }

            var item = new MediaItem();

            item.Title    = "Item";
            item.ObjectID = "1";
            item.ParentID = "0";
            item.Class    = new ObjectClass("object.item.audioItem.musicTrack", "");

            var resource = new MediaResource();

            resource.ProtoInfo = ProtocolInfo.GetProtocolInfoFromMimeType("audio/mp3", true, context);

            // get list of ips and make sure the ip the request came from is used for the first resource returned
            // this ensures that clients which look only at the first resource will be able to reach the item
            List <String> ips     = UPnP.GetIpAddresses(true);
            String        localIP = context.LocalAddress.ip;

            if (localIP != "0.0.0.0")
            {
                ips.Remove(localIP);
                ips.Insert(0, localIP);
            }

            // iterate through all ips and create a resource for each
            foreach (String ip in ips)
            {
                resource.URI = new Uri("http://" + ip + ":" + context.LocalAddress.port + "/test/test.mp3").ToString();
                item.AddResource(resource);
            }

            var didl = Didl.header + item.ToDidl(filter) + Didl.footer;

            action.SetArgumentValue("Result", didl);
            action.SetArgumentValue("NumberReturned", "1");
            action.SetArgumentValue("TotalMatches", "1");

            // update ID may be wrong here, it should be the one of the container?
            // TODO: We need to keep track of the overall updateID of the CDS
            action.SetArgumentValue("UpdateId", "1");

            return(0);
        }
        /// <summary>
        /// 変数初期化。
        /// </summary>
        /// <param name="varManager">変数管理。</param>
        /// <param name="info">呼び出し情報。</param>
        /// <returns>戻り値情報。</returns>
        static ReturnInfo VarInitialize(VarPool varManager, ProtocolInfo info)
        {
            //初期化は引数は1であること。
            if (info.Arguments.Length != 1)
            {
                throw new InternalException();
            }

            //引数の解決
            object[] args;
            ResolveArgs(varManager, info.Arguments, out args);

            //変数登録
            return(new ReturnInfo(varManager.Add(args[0])));
        }
Пример #29
0
        public void GetTcpProtocolAttributeTest()
        {
            //Arrange
            var moq = new Mock <IProtocolInfo>();

            moq.Setup(x => x.GetJsonAttribute <TcpProtocol>()).Returns("tcp/ip");
            var expectInfo = new ProtocolInfo().GetJsonAttribute <TcpProtocol>();

            //Act
            string result = moq.Object.GetJsonAttribute <TcpProtocol>();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(expectInfo, result);
        }
Пример #30
0
        public void ErrorWithOtherType()
        {
            //Arrange
            var moq = new Mock <IProtocolInfo>();

            moq.Setup(x => x.GetJsonAttribute <object>());
            var expectInfo = new ProtocolInfo().GetJsonAttribute <object>();

            //Act
            string result = moq.Object.GetJsonAttribute <object>();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(expectInfo, result);
        }
        /// <summary>
        /// データ受信時の処理。
        /// </summary>
        /// <param name="communicationNo">通信番号。</param>
        /// <param name="recieveData">受信データ。</param>
        /// <param name="senderWindow">送信元ウィンドウ。</param>
        protected override void OnRecieveData(int communicationNo, object recieveData, IntPtr senderWindow)
        {
            ContextOrderProtocolInfo contextOrder = recieveData as ContextOrderProtocolInfo;

            if (contextOrder != null)
            {
                FriendlyConnectorWindowInApp async = _manager.FromHandle(contextOrder.ExecuteWindowHandle);
                SendReturnData(communicationNo, senderWindow, _dotNetFriendlyControl.Execute(async, contextOrder.ProtocolInfo));
            }
            else
            {
                ProtocolInfo protocolInfo = recieveData as ProtocolInfo;
                SendReturnData(communicationNo, senderWindow, _dotNetFriendlyControl.Execute(this, protocolInfo));
            }
        }
Пример #32
0
        public MHEControl CreateMHEControl(IControllable assem, ProtocolInfo info)
        {
            MHEControl protocolConfig = null;  //generic plc config object
            //ProtocolInfo protocolInfo = null;  //generic plc config object constructor argument type
            Dictionary <string, Type> dt = new Dictionary <string, Type>();

            if (assem is CommunicationPoint)
            {
                protocolConfig = CreateMHEControlGeneric <CommPointDatcomInfo, MHEControl_CommPoint>(assem, info);
            }
            else if (assem is MergeDivertConveyor)
            {
                protocolConfig = CreateMHEControlGeneric <MergeDivertDatcomInfo, MHEControl_MergeDivert>(assem, info);
            }
            else if (assem is Transfer)
            {
                protocolConfig = CreateMHEControlGeneric <TransferDatcomInfo, MHEControl_Transfer>(assem, info);
            }
            else if (assem is StraightAccumulationConveyor)
            {
                protocolConfig = CreateMHEControlGeneric <ManualPickingDatcomInfo, MHEControl_ManualPicking>(assem, info);
            }
            else if (assem is BeltSorterDivert)
            {
                protocolConfig = CreateMHEControlGeneric <BeltSorterDivertDatcomInfo, MHEControl_BeltSorterDivert>(assem, info);
            }
            else if (assem is AngledDivert)
            {
                protocolConfig = CreateMHEControlGeneric <AngledDivertDatcomInfo, MHEControl_AngledDivert>(assem, info);
            }
            else if (assem is ThreeWaySwitch)
            {
                protocolConfig = CreateMHEControlGeneric <ThreeWaySwitchDatcomInfo, MHEControl_ThreeWaySwitch>(assem, info);
            }
            else if (assem is PickDoubleLift)
            {
                protocolConfig = CreateMHEControlGeneric <PickDoubleLiftDatcomInfo, MHEControl_PickDoubleLift>(assem, info);
            }
            else
            {
                Experior.Core.Environment.Log.Write("Can't create MHE Control, object is not defined in the 'CreateMHEControl' of the controller");
                return(null);
            }
            //......other assemblies should be added here....do this with generics...correction better to do this with reflection...That is BaseController should use reflection
            //and not generics as we do not know the types at design time and it means that the above always has to be edited when adding a new MHE control object.
            protocolConfig.ParentAssembly = (Assembly)assem;
            return(protocolConfig as MHEControl);
        }
Пример #33
0
        public static void Configure()
        {
            // Signature: MyChatProtocol.Pull.JoinMyChat.[].[]
            // Signature Digest: "84157E5C"
            PacketIndex.RegisterMetadata(new OperationInfo("84157E5C", true, null, CompressionTarget.None, Direction.Pull, null, null, null, null));

            // Signature: MyChatProtocol.Pull.SendMyChatMessage.[].[String]
            // Signature Digest: "BD7E2CA4"
            PacketIndex.RegisterMetadata(new OperationInfo("BD7E2CA4", true, null, CompressionTarget.Incoming, Direction.Pull, typeof(SendMyChatMessageRequest), SendMyChatMessageRequest.CreateInstance, null, null));

            // Signature: MyChatProtocol.Push.MyChatMessages.[ListOfByte.String].[]
            // Signature Digest: "F6F85E84"
            PacketIndex.RegisterMetadata(new OperationInfo("F6F85E84", true, null, CompressionTarget.Outgoing, Direction.Push, null, null, typeof(MyChatMessagesInform), MyChatMessagesInform.CreateInstance));

            ProtocolInfo.Register("MyChatProtocol", "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxQcm90b2NvbCBOYW1lPSJNeUNoYXRQcm90b2NvbCIgeG1sbnM9Imh0dHA6Ly93d3cuc3Bpa2UtZW5naW5lLmNvbS8yMDExL3NwbWwiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiPg0KICA8T3BlcmF0aW9ucz4NCg0KICAgIDwhLS0gU2ltcGxlIGpvaW4gY2hhdCBvcGVyYXRpb24gdGhhdCBwdXRzIHRoZSBjbGllbnQgdG8gdGhlIGNoYXQgcm9vbSAtLT4NCiAgICA8T3BlcmF0aW9uIE5hbWU9IkpvaW5NeUNoYXQiDQogICAgICAgICAgICAgICBTdXBwcmVzc1NlY3VyaXR5PSJ0cnVlIiAvPg0KDQogICAgPCEtLSBTaW1wbGUgc2VuZCBtZXNzYWdlIG9wZXJhdGlvbiB0aGF0IGJyb2FkY2FzdCB0aGUgbWVzc2FnZSB0byB0aGUgY2hhdCByb29tIC0tPg0KICAgIDxPcGVyYXRpb24gTmFtZT0iU2VuZE15Q2hhdE1lc3NhZ2UiDQogICAgICAgICAgICAgICBTdXBwcmVzc1NlY3VyaXR5PSJ0cnVlIg0KICAgICAgICAgICAgICAgQ29tcHJlc3Npb249IkluY29taW5nIj4NCiAgICAgIDxJbmNvbWluZz4NCiAgICAgICAgPE1lbWJlciBOYW1lPSJNZXNzYWdlIiBUeXBlPSJTdHJpbmciIC8+DQogICAgICA8L0luY29taW5nPg0KICAgIDwvT3BlcmF0aW9uPg0KDQogICAgPCEtLSBBIHB1c2ggb3BlcmF0aW9uIChzZXJ2ZXIgdG8gY2xpZW50KSB0aGF0IHNlbmRzIHRoZSBtZXNzYWdlcyB0byB0aGUgY2xpZW50cyAtLT4NCiAgICA8T3BlcmF0aW9uIE5hbWU9Ik15Q2hhdE1lc3NhZ2VzIg0KICAgICAgICAgICAgICAgU3VwcHJlc3NTZWN1cml0eT0idHJ1ZSINCiAgICAgICAgICAgICAgIENvbXByZXNzaW9uPSJPdXRnb2luZyINCiAgICAgICAgICAgICAgIERpcmVjdGlvbj0iUHVzaCI+DQogICAgICA8T3V0Z29pbmc+DQogICAgICAgIDxNZW1iZXIgTmFtZT0iQXZhdGFyIiBUeXBlPSJMaXN0T2ZCeXRlIiAvPg0KICAgICAgICA8TWVtYmVyIE5hbWU9Ik1lc3NhZ2UiIFR5cGU9IlN0cmluZyIgLz4NCiAgICAgIDwvT3V0Z29pbmc+DQogICAgPC9PcGVyYXRpb24+DQogICAgDQogIDwvT3BlcmF0aW9ucz4NCjwvUHJvdG9jb2w+");
        }
 public AzureEndPointConfigInfo(ProtocolInfo endpointProtocol, int endpointLocalPort,
     int endpointPublicPort, string endpointName, string lBSetName)
 {
     this.Initialize(
         endpointProtocol,
         endpointLocalPort,
         endpointPublicPort,
         endpointName,
         lBSetName,
         0,
         ProtocolInfo.tcp,
         string.Empty,
         null,
         null,
         ParameterSet.LoadBalanced);
 }
 public AzureEndPointConfigInfo(ProtocolInfo endpointProtocol, int endpointLocalPort, 
     int endpointPublicPort, string endpointName, string lBSetName, int probePort,
     ProtocolInfo probeProtocol, string probePath, int? probeInterval, int? probeTimeout)
 {
     this.Initialize(
         endpointProtocol,
         endpointLocalPort,
         endpointPublicPort,
         endpointName,
         lBSetName,
         probePort,
         probeProtocol,
         probePath,
         probeInterval,
         probeTimeout,
         ParameterSet.LoadBalancedProbe);
 }
 //NoLB
 public AzureEndPointConfigInfo(ParameterSet paramset, ProtocolInfo endpointProtocol, int endpointLocalPort,
     int endpointPublicPort, string endpointName, NetworkAclObject aclObj = null, bool directServerReturn = false)
 {
     this.Initialize(
         endpointProtocol, 
         endpointLocalPort, 
         endpointPublicPort, 
         endpointName, 
         string.Empty, 
         0, 
         ProtocolInfo.tcp, 
         string.Empty, 
         null, 
         null,
         paramset,
         aclObj,
         directServerReturn);
 }
 // CustoProbe
 public AzureEndPointConfigInfo(ParameterSet paramset, ProtocolInfo endpointProtocol, int endpointLocalPort, 
     int endpointPublicPort, string endpointName, string lBSetName, int probePort,
     ProtocolInfo probeProtocol, string probePath, int? probeInterval, int? probeTimeout, NetworkAclObject aclObj = null, bool directServerReturn = false)
 {
     this.Initialize(
             endpointProtocol,
             endpointLocalPort,
             endpointPublicPort,
             endpointName,
             lBSetName,
             probePort,
             probeProtocol,
             probePath,
             probeInterval,
             probeTimeout,
             paramset,
             aclObj,
             directServerReturn);
 }
 // ParameterSet.LoadBalancedNoProbe
 public AzureEndPointConfigInfo(ParameterSet paramset, ProtocolInfo endpointProtocol, int endpointLocalPort,
     int endpointPublicPort, string endpointName, string lBSetName, NetworkAclObject aclObj = null, bool directServerReturn = false)
 {
     if ( (paramset == ParameterSet.LoadBalancedNoProbe) || (paramset == ParameterSet.DefaultProbe) )
     {
         this.Initialize(
             endpointProtocol,
             endpointLocalPort,
             endpointPublicPort,
             endpointName,
             lBSetName,
             0,
             ProtocolInfo.tcp,
             string.Empty,
             null,
             null,
             paramset,
             aclObj,
             directServerReturn);
     }
 }
 private void Initialize(ProtocolInfo protocol, int internalPort,
     int? externalPort, string endpointName, string lBSetName, int probePort,
     ProtocolInfo probeProtocol, string probePath, 
     int? probeInterval, int? probeTimeout, ParameterSet paramSet, NetworkAclObject aclObj, bool directServerReturn,string internalLoadBalancer,string serviceName)
 {
     this.EndpointLocalPort = internalPort;
     this.EndpointProtocol = protocol;
     this.EndpointPublicPort = externalPort;
     this.EndpointName = endpointName;
     this.LBSetName = lBSetName;
     this.ProbePort = probePort;
     this.ProbeProtocol = probeProtocol;            
     this.ProbeInterval = probeInterval;
     this.ProbeTimeout = probeTimeout;
     this.ParamSet = paramSet;
     this.Acl = aclObj;
     this.DirectServerReturn = directServerReturn;
     if (this.ProbeProtocol.ToString().Equals("http"))
         this.ProbePath = probePath;
     this.InternalLoadBalancerName = internalLoadBalancer;
     this.ServiceName = serviceName;
 }
 private void Initialize(ProtocolInfo protocol, int internalPort,
     int? externalPort, string endpointName, string lBSetName, int probePort,
     ProtocolInfo probeProtocol, string probePath,
     int? probeInterval, int? probeTimeout, ParameterSet paramSet)
 {
     this.EndpointLocalPort = internalPort;
     this.EndpointProtocol = protocol;
     this.EndpointPublicPort = externalPort;
     this.EndpointName = endpointName;
     this.LBSetName = lBSetName;
     this.ProbePort = probePort;
     this.ProbeProtocol = probeProtocol;
     this.ProbePath = probePath;
     this.ProbeInterval = probeInterval;
     this.ProbeTimeout = probeTimeout;
     this.ParamSet = paramSet;
 }
 // CustomProbe parameter set
 public AzureEndPointConfigInfo(
     ParameterSet paramset,
     ProtocolInfo endpointProtocol,
     int endpointLocalPort,
     int endpointPublicPort,
     string endpointName,
     string lBSetName,
     int probePort,
     ProtocolInfo probeProtocol,
     string probePath,
     int? probeInterval,
     int? probeTimeout,
     NetworkAclObject aclObj = null,
     bool directServerReturn = false,
     string internalLoadBalancer= null,
     string serviceName = null,
     string loadBalancerDistribution = null,
     string VirtualIPName = null)
 {
         this.Initialize(
             endpointProtocol,
             endpointLocalPort,
             endpointPublicPort,
             endpointName,
             lBSetName,
             probePort,
             probeProtocol,
             probePath,
             probeInterval,
             probeTimeout,
             paramset,
             aclObj,
             directServerReturn,
             internalLoadBalancer,
             serviceName,
             loadBalancerDistribution,
             VirtualIPName);
 }