public TECControllerType(TECControllerType typeSource) : this(typeSource.Manufacturer)
 {
     copyPropertiesFromHardware(typeSource);
     foreach (TECIO io in typeSource.IO)
     {
         TECIO ioToAdd = new TECIO(io);
         IO.Add(new TECIO(io));
     }
     foreach (TECIOModule module in typeSource.IOModules)
     {
         IOModules.Add(module);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Called when a scheme is being saved
 /// </summary>
 /// <param name="Compound">Use this to save data</param>
 public virtual void SaveAll(IO.ComponentData Compound)
 {
     Compound.SetType(GetType());
     Compound.Add("ID", ID);
     Compound.Add("Position", Graphics.Position);
     Compound.Add("Size", Graphics.Size);
     Compound.Add("Visible", Graphics.Visible);
     Compound.Add("Rotation", rotation.GetHashCode());
     Compound.Add("Removable", isRemovable);
 }
Beispiel #3
0
        //=============================================================ID==============================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            String s = "";
            for (int i = 0; i < ConnectedWires.Count; i++)
            {
                s += ConnectedWires[i].ID + ";";
            }
            if (s.Length > 0)
                s = s.Substring(0, s.Length - 1);
            Compound.Add("ConnectedWires", s);

            Compound.Add("CanGround", CanBeGround);
            Compound.Add("CanPower", CanProvidePower);
            Compound.Add("IsGround", isGround);
            Compound.Add("IsPower", isProvidingPower);

            Compound.Add("SendingVoltage", SendingVoltage);
            Compound.Add("SendingCurrent", SendingCurrent);

            /*
            s = "";
            for (int i = 0; i < ContainingComponents.Count; i++)
            {
                s += ContainingComponents[i].ID.ToString() + ";";
            }
            if (s.Length > 0)
                s = s.Substring(0, s.Length - 1);
            Compound.Add("ContainingComponents", s);//*/
        }
Beispiel #4
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);

            Compound.Add("Resistance", Resistance);

            if (connectedComponent == null)
            {
                Compound.Add("ConComp", -1);
                Compound.Add("Connector", -1);
            }
            else
            {
                Compound.Add("ConComp", connectedComponent.ID);
                Compound.Add("Connector", connector.ID);
            }
        }
Beispiel #5
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            for (int i = 0; i < Joints.Length; i++)
            {
                Compound.Add("J" + i.ToString(), Joints[i].ID);
            }

            for (int i = 0; i < Wires.Length; i++)
            {
                Compound.Add("W" + i.ToString(), Wires[i].ID);
            }

            Compound.Add("Left", connectedLeft);
            Compound.Add("Up", connectedUp);
            Compound.Add("Right", connectedRight);
            Compound.Add("Down", connectedDown);

            Compound.Add("LeftUp", leftUp);
            Compound.Add("LeftRight", leftRight);
            Compound.Add("LeftDown", leftDown);
            Compound.Add("UpRight", upRight);
            Compound.Add("UpDown", upDown);
            Compound.Add("RightDown", RightDown);

            Compound.Add("PortLeft", left.GetHashCode());
            Compound.Add("PortUp", up.GetHashCode());
            Compound.Add("PortRight", right.GetHashCode());
            Compound.Add("PortDown", down.GetHashCode());
        }
Beispiel #6
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("J3", Joints[3].ID);
            Compound.Add("J4", Joints[4].ID);
            Compound.Add("J5", Joints[5].ID);
            Compound.Add("W1", W1.ID);
            Compound.Add("W2", W2.ID);
            Compound.Add("W3", W3.ID);
        }
Beispiel #7
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("J3", Joints[3].ID);
            Compound.Add("W1", W1.ID);
            Compound.Add("W2", W2.ID);
            Compound.Add("W3", W3.ID);

            Compound.Add("Capacitance", (Logics as Logics.CapacitorLogics).Capacitance);
            Compound.Add("MaxVoltage", (Logics as Logics.CapacitorLogics).MaxOutputVoltage);
        }
Beispiel #8
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("W1", W1.ID);
            Compound.Add("W2", W2.ID);
            Compound.Add("Connection", connection.GetHashCode());
        }
Beispiel #9
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("J3", Joints[3].ID);
            Compound.Add("J4", Joints[4].ID);
            Compound.Add("J5", Joints[5].ID);
            Compound.Add("W1", W1.ID);
            Compound.Add("W2", W2.ID);
            Compound.Add("Period", (Logics as Logics.SignalSplitterLogics).Period);
        }
Beispiel #10
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);
            Compound.Add("Cycle", (Logics as Logics.PulseFormerLogics).cycle);
            String s = "";
            float[] t = (Logics as Logics.PulseFormerLogics).pulses;
            for (int i = 0; i < t.Length; i++)
            {
                s += t[i].ToString() + ";";
            }
            s = s.Substring(0, s.Length - 1);
            Compound.Add("Pulses", s);
            Compound.Add("MaxRes", MaxResistance);
        }
Beispiel #11
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);
            Compound.Add("RequiredLength", (Logics as Logics.PulseCoreLogics).RequiredActivity);
        }
Beispiel #12
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            for (int i = 0; i < Joints.Length; i++)
            {
                Compound.Add("J" + i.ToString(), Joints[i].ID);
            }

            for (int i = 0; i < W.Length; i++)
            {
                Compound.Add("W" + i.ToString(), W[i].ID);
            }
        }
Beispiel #13
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            W.IsConnected = false;

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);
        }
Beispiel #14
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("W1", W1.ID);
        }
Beispiel #15
0
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("OrigPos", Settings.GameState == Settings.GameStates.Stopped ? new Vector2(-1, -1) : origPos.Value);
            for (int i = 0; i < PushedPositions.Count; i++)
            {
                if (PushedPositions[i] is Vector2)
                {
                    Compound.Add("Component" + i.ToString(), (Vector2)PushedPositions[i]);
                }
                if (PushedPositions[i] is List<Vector2>)
                {
                    Compound.Add("Component" + i.ToString(), "list");
                    List<Vector2> t = (List<Vector2>)PushedPositions[i];
                    for (int j = 0; j < t.Count; j++)
                    {
                        Compound.Add("Component" + i.ToString() + j.ToString(), (Vector2)t[j]);
                    }
                }
            }

            for (int i = 0; i < components.Count; i++)
            {
                Compound.Add("Contains" + i.ToString(), components[i].ID);
            }
        }
Beispiel #16
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);
            Compound.Add("Min", (Logics as Logics.VoltageGraphLogics).min);
            Compound.Add("Max", (Logics as Logics.VoltageGraphLogics).max);
            Compound.Add("Frequency", (Logics as Logics.VoltageGraphLogics).frequency);
        }
Beispiel #17
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            for (int i = 0; i < Joints.Length; i++)
            {
                Compound.Add("J" + i.ToString(), Joints[i].ID);
            }

            for (int i = 0; i < Wires.Length; i++)
            {
                Compound.Add("W" + i.ToString(), Wires[i].ID);
            }

            Compound.Add("Left", left.GetHashCode());
            Compound.Add("Up", up.GetHashCode());
            Compound.Add("Right", right.GetHashCode());
            Compound.Add("Down", down.GetHashCode());

            Compound.Add("Range", Range);
        }
Beispiel #18
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);

            Compound.Add("Voltage", (Logics as Logics.PowerACLogics).voltage);
            Compound.Add("Period", (Logics as Logics.PowerACLogics).period);
        }
Beispiel #19
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("J3", Joints[3].ID);
            Compound.Add("W1", W1.ID);
            Compound.Add("W2", W2.ID);
            Compound.Add("Delay", (Logics as Logics.DelayerLogics).Delay);
        }
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("C1", ConnectedComponent1.ID);
            Compound.Add("C2", ConnectedComponent2.ID);
        }
Beispiel #21
0
        //================================================================IO===========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J1", J1.ID);
            Compound.Add("J2", J2.ID);

            Compound.Add("Resistance", Resistance);
            Compound.Add("IsConnected", IsConnected);
            Compound.Add("Direction", direction.GetHashCode());

            Compound.Add("SendingVoltage", sendingVoltage);
            Compound.Add("SendingCurrent", sendingCurrent);
            Compound.Add("CanSendVoltage", CanSendVoltageOrCurrent);

            if (Graphics.Visible)
            {
                String d = "";
                var g = Graphics as Graphics.WireGraphics;
                for (int i = 0; i < g.DrawPath.Count; i++)
                {
                    d += g.DrawPath[i].X.ToString() + ";" + g.DrawPath[i].Y.ToString() + ";";
                }
                d = d.Substring(0, d.Length - 1);
                Compound.Add("DrawPath", d);
            }
        }
Beispiel #22
0
        //============================================================LOGICS========================================================


        //==============================================================IO==========================================================


        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("J3", Joints[3].ID);
            Compound.Add("Current", MaxCurrent);
            Compound.Add("Potential", MaxVoltage);
            Compound.Add("Force", MaxMagnetForce);
        }
Beispiel #23
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("J2", Joints[2].ID);
            Compound.Add("J3", Joints[3].ID);
            Compound.Add("W1", W1.ID);
            Compound.Add("W2", W2.ID);
            Compound.Add("Charge", (Logics as Logics.AccumulatorLogics).Charge);
            Compound.Add("StartCharge", (Logics as Logics.AccumulatorLogics).StartCharge);
            Compound.Add("MaxCharge", (Logics as Logics.AccumulatorLogics).MaxCharge);
        }
Beispiel #24
0
        //==============================================================IO==========================================================


        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);
            Compound.Add("Field", fieldRadius);
        }
Beispiel #25
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("Field", fieldRadius);
            Compound.Add("Pole", pole.GetHashCode());

            if (connectedComponent == null)
            {
                Compound.Add("ConComp", -1);
                Compound.Add("Connector", -1);
            }
            else
            {
                Compound.Add("ConComp", connectedComponent.ID);
                Compound.Add("Connector", connector.ID);
            }
        }
Beispiel #26
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);
            Compound.Add("Luminosity", Luminosity);
        }
Beispiel #27
0
        //============================================================LOGICS========================================================
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);

            Compound.Add("Resistance", Resistance);
        }
Beispiel #28
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            for (int i = 0; i < Joints.Length; i++)
            {
                Compound.Add("J" + i.ToString(), Joints[i].ID);
            }

            for (int i = 0; i < Wires.Length; i++)
            {
                Compound.Add("W" + i.ToString(), Wires[i].ID);
            }

            Compound.Add("Swapped", Swapped);
            Compound.Add("OrigSwapped", OrigSwapped);
        }
Beispiel #29
0
        //==============================================================IO==========================================================
        public override void SaveAll(IO.ComponentData Compound)
        {
            base.SaveAll(Compound);

            Compound.Add("J0", Joints[0].ID);
            Compound.Add("J1", Joints[1].ID);
            Compound.Add("W", W.ID);
            String s = "";
            var l = Logics as Logics.CoreLogics;
            for (int i = 0; i < l.target.Length; i++)
            {
                s += l.target[i] ? "1" : "0";
            }
            Compound.Add("Target", s);
            Compound.Add("Accuracy", (Logics as Logics.CoreLogics).RequiredAccuracy);
        }