示例#1
0
        public _IEXResult MountGroup()
        {
            PlatformContext  gatewayContext = GetGatewayContext();
            _Platform        GW             = gatewayContext.Platform;
            List <_Platform> Clients        = GetClientsList();

            _IEXResult res = null;

            if (DebugMode)
            {
                foreach (_Platform client in Clients)
                {
                    string temp;
                    client.IEX.IR.SendIR("MENU", out temp, 10000);
                }
                return(null);
            }

            int  Retries    = 0;
            bool HasFailure = false;

            do
            {
                HasFailure = false;
                lock (GatewayLocker)
                {
                    if (!gatewayContext.isMount && GW != null)
                    {
                        res = GW.EA.MountGw(_mountFlag);
                        if (!res.CommandSucceeded)
                        {
                            GW.IEX.LogComment("Failed to Mount Gateway: " + res.FailureReason, isBold: true, size: "12", colour: "Red");
                            return(res);
                        }
                    }
                    gatewayContext.isMount = true;
                }

                try
                {
                    Parallel.ForEach(Clients, CL =>
                    {
                        res = CL.EA.MountClient(_mountFlag, 1);
                        if (!res.CommandSucceeded && HasFailure == false)
                        {
                            CL.IEX.LogComment("Failed to Mount Client: " + res.FailureReason, isBold: true, size: "12", colour: "Red");
                            HasFailure = true;
                        }
                    });
                }
                catch (Exception)
                {
                    HasFailure = true;
                }

                Retries++;
            } while (HasFailure && Retries < 3);

            return(res);
        }
示例#2
0
        public _IEXResult MountSingle()
        {
            PlatformContext gatewayContext = GetGatewayIsClientContext();
            _Platform       GW             = gatewayContext.Platform;
            _IEXResult      res            = null;

            if (DebugMode)
            {
                string temp;
                GW.IEX.IR.SendIR("MENU", out temp, 10000);
                return(null);
            }

            lock (GatewayLocker)
            {
                if (!gatewayContext.isMount && GW != null)
                {
                    res = GW.EA.MountGw(_mountFlag);
                    if (!res.CommandSucceeded)
                    {
                        GW.IEX.LogComment("Failed to Mount Gateway: " + res.FailureReason, isBold: true, size: "12", colour: "Red");
                        return(res);
                    }
                }
                gatewayContext.isMount = true;
            }
            return(res);
        }