Example #1
0
        public override void LoadAll(IO.ComponentData Compound)
        {
            base.LoadAll(Compound);

            j0 = Compound.GetInt("J0");
            j1 = Compound.GetInt("J1");
            w  = Compound.GetInt("W");
            (Logics as Logics.PulseFormerLogics).cycle = Compound.GetBool("Cycle");
            double td = Compound.GetDouble("MaxRes");

            if (Double.IsNaN(td))
            {
                td = MaxResistance;
            }
            MaxResistance = (float)td;

            String s = Compound.GetString("Pulses");
            var    a = s.Split(';');

            float[] t = new float[a.Length];
            for (int i = 0; i < a.Length; i++)
            {
                try
                {
                    t[i] = (float)Convert.ToDouble(a[i]);
                }
                catch
                {
                    t[i] = 0;
                }
            }
            (Logics as Logics.PulseFormerLogics).pulses = t;
        }
Example #2
0
        private String connectedWiresData;//, containingComponentsData;
        public override void LoadAll(IO.ComponentData Compound)
        {
            base.LoadAll(Compound);

            connectedWiresData = Compound.GetString("ConnectedWires");
            //containingComponentsData = Compound.GetString("ContainingComponents");

            CanBeGround      = Compound.GetBool("CanGround");
            CanProvidePower  = Compound.GetBool("CanPower");
            isGround         = Compound.GetBool("IsGround");
            isProvidingPower = Compound.GetBool("IsPower");

            SendingVoltage = Compound.GetDouble("SendingVoltage");
            SendingCurrent = Compound.GetDouble("SendingCurrent");
        }
Example #3
0
        public override void LoadAll(IO.ComponentData Compound)
        {
            base.LoadAll(Compound);

            j0 = Compound.GetInt("J0");
            j1 = Compound.GetInt("J1");
            w  = Compound.GetInt("W");
            String s = Compound.GetString("Target");

            (Logics as Logics.CoreLogics).Load(s);
            double acc = Compound.GetDouble("Accuracy");

            if (!Double.IsNaN(acc))
            {
                (Logics as Logics.CoreLogics).RequiredAccuracy = (float)acc;
            }
        }
Example #4
0
        public override void LoadAll(IO.ComponentData Compound)
        {
            base.LoadAll(Compound);

            if (ID == 45)
            {
            }

            j1 = Compound.GetInt("J1");
            j2 = Compound.GetInt("J2");

            Resistance  = Compound.GetDouble("Resistance");
            IsConnected = Compound.GetBool("IsConnected");
            direction   = (WireDirection)Compound.GetInt("Direction");

            if (Compound.Contains("SendingVoltage"))
            {
                sendingVoltage          = Compound.GetDouble("SendingVoltage");
                sendingCurrent          = Compound.GetDouble("SendingCurrent");
                CanSendVoltageOrCurrent = Compound.GetBool("CanSendVoltage");
            }

            dp = Compound.GetString("DrawPath");
        }
Example #5
0
        public override void LoadAll(IO.ComponentData Compound)
        {
            base.LoadAll(Compound);

            var o = Compound.GetVector2("OrigPos");

            if (o.X == -1 && o.Y == -1)
            {
                origPos = null;
            }
            else
            {
                origPos = o;
            }

            PushedPositions.Clear();

            int i = 0;

            while (true)
            {
                if (Compound.Contains("Component" + i.ToString()))
                {
                    if (Compound.GetString("Component" + i.ToString()) == "list")
                    {
                        int            j = 0;
                        List <Vector2> p = new List <Vector2>();
                        while (true)
                        {
                            if (Compound.Contains("Component" + i.ToString() + j.ToString()))
                            {
                                p.Add(Compound.GetVector2("Component" + i.ToString() + j.ToString()));
                            }
                            else
                            {
                                break;
                            }
                            j++;
                        }
                        PushedPositions.Add(p);
                    }
                    else
                    {
                        PushedPositions.Add(Compound.GetVector2("Component" + i.ToString()));
                    }
                }
                else
                {
                    break;
                }
                i++;
            }

            i = 0;
            contains.Clear();
            while (true)
            {
                if (Compound.Contains("Contains" + i.ToString()))
                {
                    contains.Add(Compound.GetInt("Contains" + i.ToString()));
                }
                else
                {
                    break;
                }
                i++;
            }

            if (origPos != null)
            {
                ignoreNextPosSave = true;
            }
        }