コード例 #1
0
ファイル: Corrections.cs プロジェクト: Robobeurre/NRaas
        public static bool CleanupOpportunities(SimDescription sim, bool clean, Logger log)
        {
            if (sim.OpportunityHistory == null) return false;

            if (sim.OpportunityHistory.mCurrentOpportunities == null) return false;

            OpportunityManager manager = null;
            if (sim.CreatedSim != null)
            {
                manager = sim.CreatedSim.OpportunityManager;
            }

            for (int i=0; i<sim.OpportunityHistory.mCurrentOpportunities.Length; i++)
            {
                OpportunityHistory.OpportunityExportInfo info = sim.OpportunityHistory.mCurrentOpportunities[i];
                if (info == null)
                {
                    if (manager != null)
                    {
                        info = new OpportunityHistory.OpportunityExportInfo();

                        sim.OpportunityHistory.mCurrentOpportunities[i] = info;

                        if (log != null)
                        {
                            log(" OpportunityExportInfo Created " + sim.FullName);
                        }
                    }
                }
                else if (clean)
                {
                    if (manager == null)
                    {
                        sim.OpportunityHistory.mCurrentOpportunities[i] = null;

                        if (log != null)
                        {
                            log(" OpportunityExportInfo Removed " + sim.FullName);
                        }
                    }
                }

                if (info == null) continue;

                if (info.ListenerStates == null)
                {
                    info.ListenerStates = new EventListenerExportInfo[3];

                    if (log != null)
                    {
                        log(" ListenerState Array Initialized " + sim.FullName);
                    }
                }

                for (int index = 0; index < 3; index++)
                {
                    if (info.ListenerStates[index] == null)
                    {
                        info.ListenerStates[index] = new EventListenerExportInfo();

                        if (log != null)
                        {
                            log(" ListenerState Element Initialized " + sim.FullName);
                        }
                    }
                }
            }

            return true;
        }
コード例 #2
0
ファイル: Corrections.cs プロジェクト: yakoder/NRaas
        public static bool CleanupOpportunities(SimDescription sim, bool clean, Logger log)
        {
            if (sim.OpportunityHistory == null)
            {
                return(false);
            }

            if (sim.OpportunityHistory.mCurrentOpportunities == null)
            {
                return(false);
            }

            OpportunityManager manager = null;

            if (sim.CreatedSim != null)
            {
                manager = sim.CreatedSim.OpportunityManager;
            }

            for (int i = 0; i < sim.OpportunityHistory.mCurrentOpportunities.Length; i++)
            {
                OpportunityHistory.OpportunityExportInfo info = sim.OpportunityHistory.mCurrentOpportunities[i];
                if (info == null)
                {
                    if (manager != null)
                    {
                        info = new OpportunityHistory.OpportunityExportInfo();

                        sim.OpportunityHistory.mCurrentOpportunities[i] = info;

                        if (log != null)
                        {
                            log(" OpportunityExportInfo Created " + sim.FullName);
                        }
                    }
                }
                else if (clean)
                {
                    if (manager == null)
                    {
                        sim.OpportunityHistory.mCurrentOpportunities[i] = null;

                        if (log != null)
                        {
                            log(" OpportunityExportInfo Removed " + sim.FullName);
                        }
                    }
                }

                if (info == null)
                {
                    continue;
                }

                if (info.ListenerStates == null)
                {
                    info.ListenerStates = new EventListenerExportInfo[3];

                    if (log != null)
                    {
                        log(" ListenerState Array Initialized " + sim.FullName);
                    }
                }

                for (int index = 0; index < 3; index++)
                {
                    if (info.ListenerStates[index] == null)
                    {
                        info.ListenerStates[index] = new EventListenerExportInfo();

                        if (log != null)
                        {
                            log(" ListenerState Element Initialized " + sim.FullName);
                        }
                    }
                }
            }

            return(true);
        }