示例#1
0
        public static void FlushConnectionAndUp(IntrinsicElectronicData Object)
        {
            Object.Data.CurrentInWire = 0;
            Object.Data.ActualVoltage = 0;
            Object.Data.ResistanceToConnectedDevices.Clear();
            //Object.connectedDevices.Clear();//#
            if (Object.Data.connections.Count > 0)
            {
                List <IntrinsicElectronicData> Backupconnections = new List <IntrinsicElectronicData>(Object.Data.connections);               //GC
                Object.Data.connections.Clear();

                foreach (IntrinsicElectronicData JumpTo in Backupconnections)
                {
                    JumpTo.FlushConnectionAndUp();
                }
            }
            foreach (KeyValuePair <ElectricalOIinheritance, ElectronicSupplyData> Supply in Object.Data.SupplyDependent)
            {
                Pool(Supply.Value.CurrentGoingTo);
                Pool(Supply.Value.CurrentComingFrom);
                Pool(Supply.Value.ResistanceGoingTo);
                Pool(Supply.Value.ResistanceComingFrom);
                Supply.Value.Upstream.Clear();
                Supply.Value.Downstream.Clear();
                Supply.Value.SourceVoltage = 0;
            }
        }
示例#2
0
        public static void FlushConnectionAndUp(ElectricalOIinheritance Object)
        {
            Object.Data.ResistanceComingFrom.Clear();
            Object.Data.ResistanceGoingTo.Clear();
            Object.Data.CurrentGoingTo.Clear();
            Object.Data.CurrentComingFrom.Clear();
            Object.Data.FirstPresent = 0;
            Object.Data.SourceVoltages.Clear();
            Object.Data.CurrentInWire = new float();
            Object.Data.ActualVoltage = new float();
            Object.Data.ResistanceToConnectedDevices.Clear();
            Object.connectedDevices.Clear();
            if (Object.Data.connections.Count > 0)
            {
                List <ElectricalOIinheritance> Backupconnections = new List <ElectricalOIinheritance>(Object.Data.connections);
                Object.Data.connections.Clear();

                foreach (ElectricalOIinheritance JumpTo in Backupconnections)
                {
                    JumpTo.FlushConnectionAndUp();
                }

                foreach (KeyValuePair <int, HashSet <ElectricalOIinheritance> > Supply in Object.Data.Downstream)
                {
                    foreach (ElectricalOIinheritance Device in Supply.Value)
                    {
                        Device.FlushConnectionAndUp();
                        //if (log)
                        //{
                        //	Logger.Log("Device1" + Device);
                        //}
                    }
                }
                foreach (KeyValuePair <int, HashSet <ElectricalOIinheritance> > Supply in Object.Data.Upstream)
                {
                    foreach (ElectricalOIinheritance Device in Supply.Value)
                    {
                        Device.FlushConnectionAndUp();
                        //if (log)
                        //{
                        //	Logger.Log("Device1" + Device);
                        //}
                    }
                }
                Object.Data.Upstream.Clear();
                Object.Data.Downstream.Clear();
            }
        }
        public static void FlushConnectionAndUp(ElectricalOIinheritance Object)
        {
            Object.Data.CurrentInWire = new float();
            Object.Data.ActualVoltage = new float();
            Object.Data.ResistanceToConnectedDevices.Clear();
            Object.connectedDevices.Clear();
            if (Object.Data.connections.Count > 0)
            {
                List <ElectricalOIinheritance> Backupconnections = new List <ElectricalOIinheritance>(Object.Data.connections);
                Object.Data.connections.Clear();

                foreach (ElectricalOIinheritance JumpTo in Backupconnections)
                {
                    JumpTo.FlushConnectionAndUp();
                }
                foreach (KeyValuePair <int, ElectronicSupplyData> Supply in Object.Data.SupplyDependent)
                {
                    foreach (ElectricalOIinheritance Device in Supply.Value.Downstream)
                    {
                        Device.FlushConnectionAndUp();
                    }
                    foreach (ElectricalOIinheritance Device in Supply.Value.Upstream)
                    {
                        Device.FlushConnectionAndUp();
                    }
                }
                foreach (KeyValuePair <int, ElectronicSupplyData> Supply in Object.Data.SupplyDependent)
                {
                    Supply.Value.CurrentComingFrom.Clear();
                    Supply.Value.CurrentGoingTo.Clear();
                    Supply.Value.ResistanceGoingTo.Clear();
                    Supply.Value.ResistanceComingFrom.Clear();
                    Supply.Value.Upstream.Clear();
                    Supply.Value.Downstream.Clear();
                    Supply.Value.SourceVoltages = 0;
                }
            }
        }
 public static void FlushConnectionAndUp(ElectricalOIinheritance Object)
 {
     if (Object.Data.connections.Count > 0)
     {
         List <ElectricalOIinheritance> Backupconnections = Object.Data.connections;
         Object.Data.connections.Clear();
         foreach (ElectricalOIinheritance JumpTo in Backupconnections)
         {
             JumpTo.FlushConnectionAndUp();
         }
         Object.Data.Upstream.Clear();
         Object.Data.Downstream.Clear();
         Object.Data.ResistanceComingFrom.Clear();
         Object.Data.ResistanceGoingTo.Clear();
         Object.Data.CurrentGoingTo.Clear();
         Object.Data.CurrentComingFrom.Clear();
         Object.Data.SourceVoltages = new Dictionary <int, float> ();
         Object.Data.CurrentInWire  = new float();
         Object.Data.ActualVoltage  = new float();
         Object.Data.ResistanceToConnectedDevices.Clear();
         Object.connectedDevices.Clear();
     }
 }
 public static void FlushConnectionAndUp(IElectricityIO Object)
 {
     if (Object.connections.Count > 0)
     {
         List <IElectricityIO> Backupconnections = Object.connections;
         Object.connections.Clear();
         foreach (IElectricityIO JumpTo in Backupconnections)
         {
             JumpTo.FlushConnectionAndUp();
         }
         //Needs prompt to regenerate connections
         Object.Upstream.Clear();
         Object.Downstream.Clear();
         Object.ResistanceComingFrom.Clear();
         Object.ResistanceGoingTo.Clear();
         Object.CurrentGoingTo.Clear();
         Object.CurrentComingFrom.Clear();
         Object.SourceVoltages = new Dictionary <int, float> ();
         Object.CurrentInWire  = new float();
         Object.ActualVoltage  = new float();
         Object.ResistanceToConnectedDevices.Clear();
         Object.connectedDevices.Clear();
     }
 }