Exemplo n.º 1
0
        public async Task <ActionResult> SubmitForm(CockpitEntity entity, string keyValue)
        {
            try
            {
                await _service.SubmitForm(entity, keyValue);

                return(await Success("操作成功。", "", keyValue));
            }
            catch (Exception ex)
            {
                return(await Error(ex.Message, "", keyValue));
            }
        }
Exemplo n.º 2
0
        protected void InternalUpdateDampenersEnabled( )
        {
            foreach (CubeBlockEntity cubeBlock in m_parent.CubeBlocks)
            {
                if (cubeBlock is CockpitEntity)
                {
                    CockpitEntity cockpit = (CockpitEntity)cubeBlock;
                    if (cockpit.IsPassengerSeat)
                    {
                        continue;
                    }

                    cockpit.NetworkManager.BroadcastDampenersStatus(m_dampenersEnabled);
                    break;
                }
            }

            BaseObject.InvokeEntityMethod(BackingObject, CubeGridThrusterManagerSetEnabled, new object[] { m_dampenersEnabled });
            //BaseObject.InvokeEntityMethod(BackingObject, CubeGridThrusterManagerSetControlEnabled, new object[] { m_dampenersEnabled });
        }
Exemplo n.º 3
0
        protected bool RunCubeBlockReflectionTests()
        {
            bool result = true;

            if (!CubeBlockEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("CubeBlockEntity reflection validation failed!");
            }

            if (!TerminalBlockEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("TerminalBlockEntity reflection validation failed!");
            }

            if (!FunctionalBlockEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("FunctionalBlockEntity reflection validation failed!");
            }

            if (!ProductionBlockEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ProductionBlockEntity reflection validation failed!");
            }

            if (!LightEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("LightEntity reflection validation failed!");
            }

            if (!BatteryBlockEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("BatteryBlockEntity reflection validation failed!");
            }

            if (!BatteryBlockNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("BatteryBlockNetworkManager reflection validation failed!");
            }

            if (!DoorEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("DoorEntity reflection validation failed!");
            }

            if (!GravityBaseEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("GravityBaseEntity reflection validation failed!");
            }

            if (!GravityGeneratorEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("GravityGeneratorEntity reflection validation failed!");
            }

            if (!GravitySphereEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("GravitySphereEntity reflection validation failed!");
            }

            if (!BeaconEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("BeaconEntity reflection validation failed!");
            }

            if (!AntennaEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("AntennaEntity reflection validation failed!");
            }

            if (!ThrustEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ThrustEntity reflection validation failed!");
            }

            if (!ThrustNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ThrustNetworkManager reflection validation failed!");
            }

            if (!GyroEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("GyroEntity reflection validation failed!");
            }

            if (!GyroNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("GyroNetworkManager reflection validation failed!");
            }

            if (!CockpitEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("CockpitEntity reflection validation failed!");
            }

            if (!TurretBaseEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("TurretBaseEntity reflection validation failed!");
            }

            if (!TurretNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("TurretNetworkManager reflection validation failed!");
            }

            if (!LandingGearEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("LandingGearEntity reflection validation failed!");
            }

            if (!LandingGearNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("LandingGearNetworkManager reflection validation failed!");
            }

            if (!ReactorEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ReactorEntity reflection validation failed!");
            }

            if (!SolarPanelEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("SolarPanelEntity reflection validation failed!");
            }

            if (!SmallGatlingGunEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("SmallGatlingGunEntity reflection validation failed!");
            }

            if (!MergeBlockEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("MergeBlockEntity reflection validation failed!");
            }

            if (!PistonEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("PistonEntity reflection validation failed!");
            }

            if (!PistonNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("PistonNetworkManager reflection validation failed!");
            }

            if (!RotorEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("RotorEntity reflection validation failed!");
            }

            if (!VirtualMassEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("VirtualMassEntity reflection validation failed!");
            }

            if (!CameraBlockEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("CameraBlockEntity reflection validation failed!");
            }

            if (!OreDetectorEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("OreDetectorEntity reflection validation failed!");
            }

            if (!ButtonPanelEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ButtonPanelEntity reflection validation failed!");
            }

            if (!ShipControllerEntity.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ShipControllerEntity reflection validation failed!");
            }

            if (!ShipControllerNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ShipControllerNetworkManager reflection validation failed!");
            }

            if (result)
            {
                Console.WriteLine("All block types passed reflection unit tests!");
            }

            return(result);
        }
Exemplo n.º 4
0
        public async Task <ActionResult> SubmitForm2(CockpitEntity entity, string rowsdetail, string keyValue)
        {
            try
            {
                if (keyValue != null)
                {
                    JArray jarrayinfo = JArray.Parse(rowsdetail);
                    await _service.SubmitForm(entity, keyValue);

                    var    data    = _service.GetMaxIDList("");
                    string maxF_Id = data.Result.F_Id;
                    //
                    await _service2.DeleteForm(maxF_Id);

                    var excavaotr_F_Id = entity.excavatorID.Split(',');
                    List <Cockpit_excavator_relationEntity> carrierListinfo = new List <Cockpit_excavator_relationEntity>();
                    if (excavaotr_F_Id.Length == jarrayinfo.Count)
                    {
                        for (int ij = 0; ij < excavaotr_F_Id.Length; ij++)
                        {
                            Cockpit_excavator_relationEntity newData = new Cockpit_excavator_relationEntity();
                            var temp = await _excavatorService.GetForm(excavaotr_F_Id[ij]);

                            if (temp != null)
                            {
                                newData.DeviceNo   = temp.DeviceNo;
                                newData.DeviceName = temp.DeviceName;
                                newData.Brand      = temp.Brand;
                                newData.Model      = temp.model;
                            }
                            newData.cockpit_F_Id   = maxF_Id;
                            newData.excavaotr_F_Id = excavaotr_F_Id[ij];
                            if (((JObject)jarrayinfo[ij])["F_EnabledMark"] == null)
                            {
                                newData.F_EnabledMark = false;
                            }
                            else if (((JObject)jarrayinfo[ij])["F_EnabledMark"].ToString().ToLower() == "false")
                            {
                                newData.F_EnabledMark = false;
                            }
                            else
                            {
                                newData.F_EnabledMark = true;
                            }

                            await _service2.SubmitForm(newData, "");
                        }
                    }
                }
                else
                {
                    await _service.SubmitForm(entity, keyValue);

                    var    data    = _service.GetMaxIDList("");
                    string maxF_Id = data.Result.F_Id;
                    //
                    await _service2.DeleteForm(maxF_Id);

                    var excavaotr_F_Id = entity.excavatorID.Split(',');
                    List <Cockpit_excavator_relationEntity> carrierListinfo = new List <Cockpit_excavator_relationEntity>();
                    for (int ij = 0; ij < excavaotr_F_Id.Length; ij++)
                    {
                        Cockpit_excavator_relationEntity newData = new Cockpit_excavator_relationEntity();
                        var temp = await _excavatorService.GetForm(excavaotr_F_Id[ij]);

                        if (temp != null)
                        {
                            newData.DeviceNo   = temp.DeviceNo;
                            newData.DeviceName = temp.DeviceName;
                            newData.Brand      = temp.Brand;
                            newData.Model      = temp.model;
                        }
                        newData.cockpit_F_Id   = maxF_Id;
                        newData.excavaotr_F_Id = excavaotr_F_Id[ij];
                        newData.EnabledMark    = 2;

                        await _service2.SubmitForm(newData, "");
                    }
                }

                return(await Success("操作成功。", "", keyValue));
            }
            catch (Exception ex)
            {
                return(await Error(ex.Message, "", keyValue));
            }
        }