Пример #1
0
		public override void WriteGroupCodes()
		{
			int flags;

			WriteGroupCodeValue(10, X0.ToString().Trim());
			WriteGroupCodeValue(20, Y0.ToString().Trim());
			WriteGroupCodeValue(30, Z0.ToString().Trim());

			WriteGroupCodeValue(11, X1.ToString().Trim());
			WriteGroupCodeValue(21, Y1.ToString().Trim());
			WriteGroupCodeValue(31, Z1.ToString().Trim());

			WriteGroupCodeValue(12, X2.ToString().Trim());
			WriteGroupCodeValue(22, Y2.ToString().Trim());
			WriteGroupCodeValue(32, Z2.ToString().Trim());

			WriteGroupCodeValue(13, X3.ToString().Trim());
			WriteGroupCodeValue(23, Y3.ToString().Trim());
			WriteGroupCodeValue(33, Z3.ToString().Trim());

			flags = 0;

			if(Edge1Invisible) flags += 1;
			if(Edge2Invisible) flags += 2;
			if(Edge3Invisible) flags += 4;
			if(Edge4Invisible) flags += 8;

			WriteGroupCodeValue(70, flags.ToString().Trim());
		}
Пример #2
0
        public override void WriteGroupCodes()
        {
            WriteGroupCodeValue(10, X0.ToString().Trim());
            WriteGroupCodeValue(20, Y0.ToString().Trim());
            WriteGroupCodeValue(30, Z0.ToString().Trim());

            WriteGroupCodeValue(11, X1.ToString().Trim());
            WriteGroupCodeValue(21, Y1.ToString().Trim());
            WriteGroupCodeValue(31, Z1.ToString().Trim());
        }
Пример #3
0
        public void TestStupidBehaviourWithConfigurator()
        {
            var c1 = new Z1(); //disposed twice

            container.Configurator.ForAbstraction <C2>().Fail();
            container.Configurator.ForAbstraction <Z1>().UseInstances(c1);
            container.Configurator.ForAbstraction <I1>().UseInstances(c1);
            var foo = container.Get <I2>();

            container.Dispose();
            CollectionAssert.AreEquivalent(new[] { c1.GetHashCode().ToString(), foo.GetHashCode().ToString() }, log);
            Assert.AreEqual(3, z1Count);
        }
Пример #4
0
        public override void WriteGroupCodes()
        {
            WriteGroupCodeValue(10, X0.ToString().Trim());
            WriteGroupCodeValue(20, Y0.ToString().Trim());
            WriteGroupCodeValue(30, Z0.ToString().Trim());

            WriteGroupCodeValue(11, X1.ToString().Trim());
            WriteGroupCodeValue(21, Y1.ToString().Trim());
            WriteGroupCodeValue(31, Z1.ToString().Trim());

            WriteGroupCodeValue(12, X2.ToString().Trim());
            WriteGroupCodeValue(22, Y2.ToString().Trim());
            WriteGroupCodeValue(32, Z2.ToString().Trim());

            WriteGroupCodeValue(13, X3.ToString().Trim());
            WriteGroupCodeValue(23, Y3.ToString().Trim());
            WriteGroupCodeValue(33, Z3.ToString().Trim());
        }
Пример #5
0
        public bool Equals(Garage other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   State.Equals(other.State) &&
                   Field02h.Equals(other.Field02h) &&
                   ClosingWithoutTargetVehicle.Equals(other.ClosingWithoutTargetVehicle) &&
                   Deactivated.Equals(other.Deactivated) &&
                   ResprayHappened.Equals(other.ResprayHappened) &&
                   TargetModelIndex.Equals(other.TargetModelIndex) &&
                   Door1Pointer.Equals(other.Door1Pointer) &&
                   Door2Pointer.Equals(other.Door2Pointer) &&
                   Door1Handle.Equals(other.Door1Handle) &&
                   Door2Handle.Equals(other.Door2Handle) &&
                   IsDoor1Dummy.Equals(other.IsDoor1Dummy) &&
                   IsDoor2Dummy.Equals(other.IsDoor2Dummy) &&
                   RecreateDoorOnNextRefresh.Equals(other.RecreateDoorOnNextRefresh) &&
                   RotatingDoor.Equals(other.RotatingDoor) &&
                   CameraFollowsPlayer.Equals(other.CameraFollowsPlayer) &&
                   X1.Equals(other.X1) &&
                   X2.Equals(other.X2) &&
                   Y1.Equals(other.Y1) &&
                   Y2.Equals(other.Y2) &&
                   Z1.Equals(other.Z1) &&
                   Z2.Equals(other.Z2) &&
                   DoorOpenOffset.Equals(other.DoorOpenOffset) &&
                   DoorOpenMax.Equals(other.DoorOpenMax) &&
                   Door1X.Equals(other.Door1X) &&
                   Door1Y.Equals(other.Door1Y) &&
                   Door2X.Equals(other.Door2X) &&
                   Door2Y.Equals(other.Door2Y) &&
                   Door1Z.Equals(other.Door1Z) &&
                   Door2Z.Equals(other.Door2Z) &&
                   Timer.Equals(other.Timer) &&
                   CollectedCarsState.Equals(other.CollectedCarsState) &&
                   TargetCarPointer.Equals(other.TargetCarPointer) &&
                   Field96h.Equals(other.Field96h) &&
                   StoredCar.Equals(other.StoredCar));
        }
Пример #6
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Point1/X", true, out subEle);
            subEle.Value = X1.ToString();

            ele.TryPathTo("Point1/Y", true, out subEle);
            subEle.Value = Y1.ToString();

            ele.TryPathTo("Point1/Z", true, out subEle);
            subEle.Value = Z1.ToString();

            ele.TryPathTo("Point2/X", true, out subEle);
            subEle.Value = X2.ToString();

            ele.TryPathTo("Point2/Y", true, out subEle);
            subEle.Value = Y2.ToString();

            ele.TryPathTo("Point2/Z", true, out subEle);
            subEle.Value = Z2.ToString();
        }
Пример #7
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            List <ValidationResult> errors = new List <ValidationResult>();

            #region machine parameters
            if (!((50 <= P12) && (P12 <= 2e5)))
            {
                errors.Add(new ValidationResult(errorP12));
            }
            if (!((48 <= U1) && (U1 <= 660)))
            {
                errors.Add(new ValidationResult(errorU1));
            }
            if (!((10 <= f1) && (f1 <= 400)))
            {
                errors.Add(new ValidationResult(errorf1));
            }
            //if (p < 0) errors.Add(new ValidationResult("Error p")); //such a state is unattainable. This is used for  Validator.TryValidateObject(..., true)
            if (!((0 <= Pмех) && (Pмех <= PмехBoundRight(P12))))
            {
                errors.Add(new ValidationResult($"Значение параметра Pмех должно принадлежать [0 : {PмехBoundRight(P12)}]."));
            }
            #endregion
            #region stator parameters
            if (!((50 < Di) && (Di <= 800)))
            {
                errors.Add(new ValidationResult(errorDi));
            }
            if ((!(0 <= ΔГ1) && (ΔГ1 <= 0)))
            {
                errors.Add(new ValidationResult(errorΔГ1));
            }
            if ((Z1 < 0) || !int.TryParse(Z1.ToString(), out _))
            {
                errors.Add(new ValidationResult(errorZ1));
            }
            if (!((Get_DaBounds(Di).left <= Da) && (Da < Get_DaBounds(Di).right)))
            {
                errors.Add(new ValidationResult($"Значение параметра Da должно принадлежать [{Math.Round(Get_DaBounds(Di).left, 2)} : {Math.Round(Get_DaBounds(Di).right, 2)})."));
            }
            if ((a1 < 0) || !int.TryParse(a1.ToString(), out _))
            {
                errors.Add(new ValidationResult(errora1));
            }
            if (!int.TryParse(a2.ToString(), out _))
            {
                errors.Add(new ValidationResult(errora2));
            }
            if (!((0 <= a2) && (a2 <= 30)))
            {
                errors.Add(new ValidationResult(errora2));
            }
            if ((W1 < 0) || !int.TryParse(W1.ToString(), out _))
            {
                errors.Add(new ValidationResult(errorW1));
            }
            if (W1 % 2 != 0)
            {
                errors.Add(new ValidationResult(errorW1parity));
            }
            if ((Wc < 0) || !int.TryParse(Wc.ToString(), out _))
            {
                errors.Add(new ValidationResult(errorWc));
            }
            if (!((3 <= Δкр) && (Δкр <= 40)))
            {
                errors.Add(new ValidationResult(errorΔкр));
            }
            if ((dиз < 0) || double.IsNaN(dиз))
            {
                errors.Add(new ValidationResult(errordиз));
            }
            if ((qГ < 0) || double.IsNaN(qГ))
            {
                errors.Add(new ValidationResult(errorqГ));
            }
            if (!((3.5 <= bz1) && (bz1 <= 15)))
            {
                errors.Add(new ValidationResult(errorbz1));
            }
            if (!((0 <= h8) && (h8 <= 20)))
            {
                errors.Add(new ValidationResult(errorh8));
            }
            if (!((0 <= h7) && (h7 <= 2)))
            {
                errors.Add(new ValidationResult(errorh7));
            }
            if (!((0 <= h6) && (h6 <= 20)))
            {
                errors.Add(new ValidationResult(errorh6));
            }
            if (!((0.1 <= h5) && (h5 <= 5)))
            {
                errors.Add(new ValidationResult(errorh5));
            }
            if (!((0 <= h3) && (h3 <= 5)))
            {
                errors.Add(new ValidationResult(errorh3));
            }
            if (!((5 <= h4) && (h4 <= 50)))
            {
                errors.Add(new ValidationResult(errorh4));
            }
            //if (!((dиз < ac) && (ac < 2 * dиз))) errors.Add(new ValidationResult($"Значение параметра расчета ac должно принадлежать ({dиз} : {2 * dиз})."));
            if (!(dиз < ac))
            {
                errors.Add(new ValidationResult($"Значение параметра ac должно быть > {dиз}."));
            }
            if (!((0 <= bПН) && (bПН <= bП1Calc(Di, h8, h7, h6, bz1, Z1))))
            {
                errors.Add(new ValidationResult($"Значение параметра bПН должно принадлежать [0 : {Math.Round(bП1Calc(Di, h8, h7, h6, bz1, Z1), 2)}]."));
            }
            if (h1 < 0 || double.IsNaN(h1))
            {
                errors.Add(new ValidationResult(errorh1));
            }
            if (h2 < 0 || double.IsNaN(h2))
            {
                errors.Add(new ValidationResult(errorh2));
            }
            if (!((0.5 <= li) && (li >= 3)))
            {
                errors.Add(new ValidationResult($"Значение параметра li должно принадлежать [{Get_liBounds(U1, I1(P12, U1), Di).left} : " +
                                                $"{Get_liBounds(U1, I1(P12, U1), Di).right}]."));
            }
            if (!((0 <= cз) && (cз <= 200)))
            {
                errors.Add(new ValidationResult(errorcз));
            }
            if (bП < 0 || double.IsNaN(bП))
            {
                errors.Add(new ValidationResult(errorbП));
            }
            if (bП1 < 0 || double.IsNaN(bП1))
            {
                errors.Add(new ValidationResult(errorbП1));
            }
            //if (!((0.36 <= Kзап) && (Kзап <= 0.76))) errors.Add(new ValidationResult(errorKзап));
            if (!((1 <= y1) && (y1 <= 0.5 * Z1 / Convert.ToDouble(p))))
            {
                errors.Add(new ValidationResult($"Значение параметра расчета y1 должно принадлежать [1 : {0.5 * Z1 / Convert.ToDouble(p)}]."));
            }
            if (!((0.5 <= β) && (β <= 0.95)))
            {
                errors.Add(new ValidationResult(errorβ));
            }
            if ((K2 < 0) || double.IsNaN(K2))
            {
                errors.Add(new ValidationResult(errorK2));
            }
            //if (string.IsNullOrEmpty(PR)) errors.Add(new ValidationResult("Error PR.")); //such a state is unattainable. This is used for  Validator.TryValidateObject(..., true)
            if (!((0 <= d1) && (d1 <= bП1Calc(Di, h8, h7, h6, bz1, Z1))))
            {
                errors.Add(
                    new ValidationResult($"Значение параметра расчета d1 должно принадлежать [0 : {Math.Round(bП1Calc(Di, h8, h7, h6, bz1, Z1), 2)}]."));
            }
            if (!((0.9 <= Kfe1) && (Kfe1 <= 1)))
            {
                errors.Add(new ValidationResult(errorKfe1));
            }
            if (!((0.002 <= ρ1x) && (ρ1x <= 0.05)))
            {
                errors.Add(new ValidationResult(errorρ1x));
            }
            if ((ρРУБ < 0) || double.IsNaN(ρРУБ))
            {
                errors.Add(new ValidationResult(errorρРУБ));
            }
            if (!((ρ1x <= ρ1Г) && (ρ1Г <= 0.1235)))
            {
                errors.Add(new ValidationResult($"Значение параметра расчета ρ1Г должно принадлежать [{ρ1x} : 0.1235]."));
            }
            if (!((0 <= B) && (B <= 20)))
            {
                errors.Add(new ValidationResult(errorB));
            }
            if ((p10_50 < 0) || double.IsNaN(p10_50))
            {
                errors.Add(new ValidationResult(errorp10_50));
            }
            #endregion
            #region rotor parameters
            if (!((0 <= ΔГ2) && (ΔГ2 <= 5)))
            {
                errors.Add(new ValidationResult(errorΔГ2));
            }
            //if (!((DpстBoundCalculation - 5 <= Dpст) && (Dpст < DpстBoundCalculation - 0.1)))
            //    errors.Add(new ValidationResult($"Значение параметра Dp.ст должно принадлежать [{ Math.Round(DpстBoundCalculation - 5, 2) } : { Math.Round(DpстBoundCalculation - 0.1, 2)})."));
            if (double.IsNaN(Dpст) || Dpст < 0)
            {
                errors.Add(new ValidationResult(errorDpст));
            }
            //if (string.IsNullOrEmpty(bСК)) errors.Add(new ValidationResult("Error bСК.")); //such a state is unattainable. This is used for  Validator.TryValidateObject(..., true)
            if ((Z2 < 0) || !int.TryParse(Z2.ToString(), out _))
            {
                errors.Add(new ValidationResult(errorZ2));
            }

            if (!((0.01 <= ρ2Г) && (ρ2Г <= 0.2)))
            {
                errors.Add(new ValidationResult(errorρ2Г));
            }
            if (!((0.9 <= Kfe2) && (Kfe2 <= 1)))
            {
                errors.Add(new ValidationResult(errorKfe2));
            }
            //if (!((0.125 * Get_Dp(Dpст, ΔГ2) <= hp) && (hp <= 0.375 * Get_Dp(Dpст, ΔГ2))))
            //    errors.Add(new ValidationResult($"Значение параметра hp должно принадлежать {Get_hpBounds(Dpст, ΔГ2)}."));
            if (hp < 0 || double.IsNaN(hp))
            {
                errors.Add(new ValidationResult(errorhp));
            }
            #endregion

            return(errors);
        }
Пример #8
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            try
            {
                FN1 = Filename1.Text; FN2 = Filename2.Text; FN3 = Filename3.Text; FN4 = Filename4.Text; FN5 = Filename5.Text;
                if ((FN1.Length < 2) && (FN2.Length < 2) && (FN3.Length < 2) && (FN4.Length < 2) && (FN5.Length < 2))
                {
                    throw new FormatException();
                }
                m_SS = SS.Text; if ((m_SS.Length < 1) || (m_SS.Length > 1))
                {
                    throw new FormatException();
                }
                m_PN = int.Parse(PN.Text); if (m_PN <= 0)
                {
                    throw new FormatException();
                }
                if (X1.Text.Length < 1)
                {
                    throw new FormatException();
                }
                if (X2.Text.Length < 1)
                {
                    throw new FormatException();
                }
                if (Y1.Text.Length < 1)
                {
                    throw new FormatException();
                }
                if (Y2.Text.Length < 1)
                {
                    throw new FormatException();
                }
                if (Z1.Text.Length < 1)
                {
                    throw new FormatException();
                }
                if (Z2.Text.Length < 1)
                {
                    throw new FormatException();
                }
                minX = int.Parse(X1.Text);
                maxX = int.Parse(X2.Text);
                minY = int.Parse(Y1.Text);
                maxY = int.Parse(Y2.Text);
                minZ = int.Parse(Z1.Text);
                maxZ = int.Parse(Z2.Text);

                if (minX > maxX)
                {
                    int buff = minX; minX = maxX; maxX = buff;
                }
                if (minY > maxY)
                {
                    int buff = minY; minY = maxY; maxY = buff;
                }
                if (minZ > maxZ)
                {
                    int buff = minZ; minZ = maxZ; maxZ = buff;
                }

                DialogResult = DialogResult.OK;
            }
            catch (FormatException)
            {
                if (FN1.Length < 2)
                {
                    MessageBox.Show("FileName1 = ?");
                    Filename1.Text = "";
                    Filename1.Focus();
                }
                if ((m_SS.Length < 1) || (m_SS.Length > 1))
                {
                    MessageBox.Show("Separation Character = ?");
                    SS.Text = "";
                    SS.Focus();
                }
                if (m_PN <= 0)
                {
                    MessageBox.Show("Draw a Point for Every = ?");
                    PN.Text = "";
                    PN.Focus();
                }
                if (X1.Text.Length < 1)
                {
                    MessageBox.Show("Limit1 - X = ?");
                    X1.Text = "";
                    X1.Focus();
                }
                if (X2.Text.Length < 1)
                {
                    MessageBox.Show("Limit2 - X = ?");
                    X2.Text = "";
                    X2.Focus();
                }
                if (Y1.Text.Length < 1)
                {
                    MessageBox.Show("Limit1 - Y = ?");
                    Y1.Text = "";
                    Y1.Focus();
                }
                if (Y2.Text.Length < 1)
                {
                    MessageBox.Show("Limit2 - Y = ?");
                    Y2.Text = "";
                    Y2.Focus();
                }
                if (Z1.Text.Length < 1)
                {
                    MessageBox.Show("Limit1 - Z = ?");
                    Z1.Text = "";
                    Z1.Focus();
                }
                if (Z2.Text.Length < 1)
                {
                    MessageBox.Show("Limit2 - Z = ?");
                    Z2.Text = "";
                    Z2.Focus();
                }
            }
        }