コード例 #1
0
ファイル: ErrorTrap.cs プロジェクト: pepoluan/NRaas
        public void OnDelayedWorldLoadFinished()
        {
            sObjectsOfInterest.Clear();

            List <ICheck> checks = DerivativeSearch.Find <ICheck>();

            foreach (ICheck check in checks)
            {
                check.Finish();
            }

            EventTracker.sCurrentlyUpdatingDreamsAndPromisesManagers = false;

            new CheckRoleManager().Perform(RoleManager.sRoleManager, true);

            CheckRecovery();

            CheckOutfits();

            CheckLotObjects();

            Inventories.CheckInventories(LogCorrection, DebugLogCorrection, true);

            List <IDereferenceController> controllers = DerivativeSearch.Find <IDereferenceController>();

            foreach (IDereferenceController controller in controllers)
            {
                controller.Clear();

                foreach (KeyValuePair <Type, List <ObjectLookup.Item> > list in ObjectLookup.List)
                {
                    controller.Add(list.Key, list.Value);
                }

                controller.PreProcess();
            }

            if (ErrorTrapTuning3.kLogCounting)
            {
                using (TestSpan span = new TestSpan(ExternalTimeSpanLogger.sLogger, "Log Counts"))
                {
                    ObjectLookup.LogCounts();
                }
            }

            DereferenceManager.Logger.OnWorldQuit = false;

            try
            {
                DereferenceManager.Logger.sCollecting = true;

                using (Common.TestSpan totalSpan = new Common.TestSpan(TimeSpanLogger.Bin, "Dereferencing", DebugLevel.Stats))
                {
                    foreach (IDereferenceController controller in controllers)
                    {
                        controller.Perform();

                        if (DereferenceManager.Logger.OnWorldQuit)
                        {
                            break;
                        }
                    }
                }
            }
            finally
            {
                DereferenceManager.Logger.sCollecting = false;
            }

            using (Common.TestSpan totalSpan = new Common.TestSpan(TimeSpanLogger.Bin, "Dereferencing", DebugLevel.Stats))
            {
                foreach (IDereferenceController controller in controllers)
                {
                    controller.PostPerform();

                    if (DereferenceManager.Logger.OnWorldQuit)
                    {
                        break;
                    }
                }
            }

            // Possibly loaded by Dereference
            sResidents = null;

            ProcessToBeDeleted(sToBeDeleted, true);
            ProcessToBeDeleted(sSilentToBeDeleted, false);

            ObjectLookup.Clear();

            //sDelayLoading = false;

            RecordErrors();
        }
コード例 #2
0
ファイル: Relativity.cs プロジェクト: yakoder/NRaas
            protected override bool OnPerform()
            {
                while ((SimClock.CurrentTicks - mPreviousTime) < (sOneMinute - 1))
                {
                    if (mExit)
                    {
                        break;
                    }
                    SpeedTrap.Sleep();
                }

                int overrideSpeed = 0;

                Sims3.Gameplay.Gameflow.ClockSpeedModel model = Sims3.UI.Responder.Instance.ClockSpeedModel as Sims3.Gameplay.Gameflow.ClockSpeedModel;
                if (model != null)
                {
                    if (Settings.mPausingOnCompletion)
                    {
                        if (Sim.ActiveActor != null)
                        {
                            if (Sim.ActiveActor.CurrentInteraction == null)
                            {
                                Settings.mPausingOnCompletion = false;
                                GameflowEx.Pause();
                            }
                        }
                    }

                    if (Settings.mSkipOnHumanSleep)
                    {
                        bool allSleeping = true;

                        if ((Sim.ActiveActor == null) || (!Sim.ActiveActor.IsHuman))
                        {
                            allSleeping = false;
                        }
                        else
                        {
                            foreach (Sim sim in Households.AllHumans(Household.ActiveHousehold))
                            {
                                if (!(sim.CurrentInteraction is ISleeping))
                                {
                                    allSleeping = false;
                                }
                            }
                        }

                        if (allSleeping)
                        {
                            if (model.CurrentGameSpeed != Sims3.SimIFace.Gameflow.GameSpeed.Triple)
                            {
                                Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Triple, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Automation);
                            }

                            Settings.mSkippingSleep = true;
                        }
                        else if (Settings.mSkippingSleep)
                        {
                            switch (model.CurrentGameSpeed)
                            {
                            case Sims3.SimIFace.Gameflow.GameSpeed.Triple:
                            case Sims3.SimIFace.Gameflow.GameSpeed.Skip:
                                Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Automation);
                                break;
                            }
                        }
                    }

                    Sims3.SimIFace.Gameflow.GameSpeed speed = model.CurrentGameSpeed;

                    switch (speed)
                    {
                    case Sims3.SimIFace.Gameflow.GameSpeed.Pause:
                        Settings.mPausingOnCompletion = false;
                        Settings.mSkippingSleep       = false;
                        break;

                    case Sims3.SimIFace.Gameflow.GameSpeed.Normal:
                        Settings.mSkippingSleep = false;
                        break;

                    case Sims3.SimIFace.Gameflow.GameSpeed.Double:
                        if (Settings.mSwitchSpeedOnFast > 0)
                        {
                            overrideSpeed = Settings.mSwitchSpeedOnFast;
                        }
                        Settings.mSkippingSleep       = false;
                        Settings.mPausingOnCompletion = false;
                        break;

                    case Sims3.SimIFace.Gameflow.GameSpeed.Triple:
                        if (Settings.mSwitchSpeedOnFast > 0)
                        {
                            overrideSpeed = Settings.mSwitchSpeedOnFast;
                        }

                        Settings.mPausingOnCompletion = false;
                        break;

                    case Sims3.SimIFace.Gameflow.GameSpeed.Skip:
                        if (Settings.mSwitchSpeedOnFast > 0)
                        {
                            overrideSpeed = Settings.mSwitchSpeedOnFast;
                        }

                        Settings.mPausingOnCompletion = false;
                        if (Settings.mPauseOnCompletion)
                        {
                            if (Sim.ActiveActor != null)
                            {
                                if (Sim.ActiveActor.CurrentInteraction != null)
                                {
                                    Settings.mPausingOnCompletion = true;
                                }
                            }
                        }
                        break;
                    }
                }

                using (TestSpan span = new TestSpan(Relativity.Logger.sLogger, "Simulate"))
                {
                    if (mExit)
                    {
                        return(false);
                    }

                    int speed = Settings.GetSpeed(SimClock.CurrentTime(), overrideSpeed);

                    PersistedSettings.sRelativeFactor = 0;
                    if (speed != 0)
                    {
                        PersistedSettings.sRelativeFactor = sOneMinute / (float)speed;
                    }

                    if (speed != mPriorValues.mPreviousSpeed)
                    {
                        PriorValues.sFactorChanged = true;
                    }

                    if (PriorValues.sFactorChanged)
                    {
                        PriorValues.sFactorChanged = false;

                        mPriorValues.RevertCommodityGains();

                        TuningAlterations.Revert();

                        TuningAlterations.Apply();
                    }

                    mPriorValues.ApplyCommodityGains();

                    mPriorValues.mPreviousSpeed = speed;

                    if (speed < 0)
                    {
                        speed = 0;
                    }

                    SimClock.TicksAdvanced += (speed - sOneMinute);

                    mPreviousTime = SimClock.CurrentTicks;
                }

                return(true);
            }
コード例 #3
0
ファイル: ErrorTrap.cs プロジェクト: pepoluan/NRaas
        public static void OnScriptError(ScriptCore.ScriptProxy proxy, Exception exception)
        {
            try
            {
                using (TestSpan span = new TestSpan(TimeSpanLogger.Bin, "OnScriptError", DebuggingLevel))
                {
                    bool fullReset = true;

                    bool record = !IgnoreList.IsIgnored(exception, out fullReset);

                    IScriptLogic target = null;
                    if (proxy != null)
                    {
                        target = proxy.Target;
                    }

                    StringBuilder noticeText = new StringBuilder();
                    StringBuilder logText    = new StringBuilder();

                    SimUpdate update = target as SimUpdate;
                    if (update != null)
                    {
                        target = update.mSim;
                    }
                    else
                    {
                        AutonomyManager autonomy = target as AutonomyManager;
                        if (autonomy != null)
                        {
                            target = SearchForAutonomy(exception.StackTrace);
                        }
                        else
                        {
                            Services services = target as Services;
                            if (services != null)
                            {
                                target = SearchForAssignedSim(exception.StackTrace);
                            }
                        }
                    }

                    SimDescription targetSim = SearchForSim(exception.StackTrace);
                    if (targetSim != null)
                    {
                        new FixInvisibleTask(targetSim).AddToSimulator();
                    }

                    IGameObject obj = null;

                    if (targetSim != null)
                    {
                        obj = ScriptCoreLogger.Convert(targetSim, noticeText, logText);
                    }
                    else
                    {
                        obj = ScriptCoreLogger.Convert(target, noticeText, logText);
                        if (obj == null)
                        {
                            obj = target as IGameObject;
                        }
                    }

                    ObjectGuid id       = ObjectGuid.InvalidObjectGuid;
                    bool       moonDial = false;
                    if (obj != null)
                    {
                        id = obj.ObjectId;

                        moonDial = obj.GetType() == typeof(Sims3.Gameplay.Objects.Decorations.MoonDial);

                        if (moonDial)
                        {
                            record = false;
                        }
                    }

                    if (record)
                    {
                        ScriptCoreLogger.Append(noticeText, logText, id, ObjectGuid.InvalidObjectGuid, exception, sAlreadyCaught);
                    }

                    /* do not use else if here */
                    if ((proxy != null) && (proxy.Target is RoleManagerTask))
                    {
                        new CheckRoleManagerTask().Perform(proxy.Target as RoleManagerTask, true);
                    }

                    Sim simObj = obj as Sim;
                    if (simObj != null)
                    {
                        try
                        {
                            if (simObj.Household == null)
                            {
                                fullReset = true;
                            }

                            if ((!fullReset) && (proxy != null))
                            {
                                proxy.OnReset();
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(proxy.Target, null, "PartialReset", e);
                            fullReset = true;
                        }

                        if (fullReset)
                        {
                            if (update != null)
                            {
                                try
                                {
                                    Simulator.DestroyObject(update.Proxy.ObjectId);
                                }
                                catch
                                { }
                            }

                            new ResetSimTask(simObj);
                            return;
                        }
                    }
                    else if (proxy != null && !moonDial)
                    {
                        proxy.OnReset();
                    }
                }
            }
            catch (Exception e)
            {
                Exception(proxy.Target, e);
            }
        }
コード例 #4
0
        private void UpdateTester(int rst)
        {
            /*result = 0 -> Ng
             * result = 1 -> Pass
             * result = 2 -> Timeout
             */
            switch (rst)
            {
            case 0:
                testStatus = TestStatus.Tested;
                testResult = TestResult.Ng;
                FailCount_Nomal++;
                break;

            case 1:
                testStatus = TestStatus.Tested;
                testResult = TestResult.Pass;
                PassCount_Nomal++;
                break;

            case 2:
                testStatus = TestStatus.Tested;
                testResult = TestResult.TimeOut;
                break;

            default:
                testStatus = TestStatus.Err;
                testResult = TestResult.TimeOut;
                break;
            }
            TestCount_Nomal++;
            Yield_Nomal = Math.Round((double)PassCount_Nomal / (PassCount_Nomal + FailCount_Nomal) * 100, 2);
            try
            {
                Inifile.INIWriteValue(iniTesterResutPath, "Tester" + Index.ToString(), "TestSpan", TestSpan.ToString());
                Inifile.INIWriteValue(iniTesterResutPath, "Tester" + Index.ToString(), "PassCount_Nomal", PassCount_Nomal.ToString());
                Inifile.INIWriteValue(iniTesterResutPath, "Tester" + Index.ToString(), "FailCount_Nomal", FailCount_Nomal.ToString());
                Inifile.INIWriteValue(iniTesterResutPath, "Tester" + Index.ToString(), "TestCount_Nomal", TestCount_Nomal.ToString());
                Inifile.INIWriteValue(iniTesterResutPath, "Tester" + Index.ToString(), "Yield_Nomal", Yield_Nomal.ToString());
            }
            catch
            {
            }
        }