예제 #1
0
    public void GenerateChunks(string threadName, Vector2Int[] columns)
    {
        Loom.QueueAsyncTask(threadName, () =>
        {
            try
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();
                for (int i = 0; i < columns.Length; i++)
                {
                    _generating = true;
                    Columns[columns[i]].Generate(height);
                    chunksGenerated += height;
                }
                watch.Stop();
                Debug.Log("Finished generating chunks in: " + watch.Elapsed);

                if (!renderCompleteCalled)
                {
                    renderCompleteCalled = true;
                    //if (OnChunksGenerated != null)
                    //    Loom.QueueOnMainThread(() => { OnChunksGenerated(columns); });
                }
                _generating = false;
            }
            catch (Exception e)
            {
                SafeDebug.LogError(string.Format("{0}: {1}\n {2}", e.GetType().ToString(), e.Message, e.StackTrace));
            }
        });
    }
예제 #2
0
 public void GenerateChunks(string threadName, int index, IModule module, Vector3Int[] chunks)
 {
     Loom.QueueAsyncTask(threadName, () =>
     {
         try {
             for (int i = 0; i < chunks.Length; i++)
             {
                 _generating = true;
                 //SmoothChunk.CreateChunk(chunks[i], module, this); // TODO: use sampler
                 chunksGenerated++;
             }
             if (!renderCompleteCalled)
             {
                 for (int i = 0; i < chunks.Length; i++)
                 {
                     if (Vector3.Distance(new Vector3Int(), chunks[i]) > SmoothVoxelSettings.radius / 2)
                     {
                         renderCompleteCalled = true;
                         Loom.QueueOnMainThread(OnRenderComplete);
                     }
                 }
             }
             _generating = false;
         }
         catch (Exception e) {
             SafeDebug.LogError(string.Format("{0}: {1}\n {2}", e.GetType().ToString(), e.Message, e.StackTrace));
         }
     });
 }
예제 #3
0
    public void SpawnChunksAroundPoint(Vector3 point)
    {
        SpawnChunkFeild();
        Loom.QueueAsyncTask(WorldThreadName, () => {
            MazeGen module = new MazeGen(VoxelSettings.SuperSizeX / 2, 4, VoxelSettings.SuperSizeZ / 2, VoxelSettings.seed, 2, 1);
            for (int x = -1; x <= VoxelSettings.maxChunksX; x++)
            {
                for (int z = -1; z <= VoxelSettings.maxChunksZ; z++)
                {
                    Vector3Int location3D = new Vector3Int(x, 0, z);
                    Vector2Int location2D = new Vector2Int(location3D.x, location3D.z);
                    try
                    {
                        if (Chunks.ContainsKey(location3D) && !Chunks[location3D].Generated)
                        {
                            float[,] surface = Chunks[location3D].GenerateChunk(module);
                            Chunks[location3D].Render(false);
                        }
                    }
                    catch (Exception e)
                    {
                        SafeDebug.LogException(e);
                    }
                }
            }
            SafeDebug.Log("Finished rendering.");

            Loom.QueueOnMainThread(() =>
            {
                //MapTexture = module.GetTexture();
            });
        });
    }
예제 #4
0
        /// <summary>
        /// Accepts a field in the form "assemblyname#typename#fieldname" and returns the actual field
        /// </summary>
        /// <param name="Field"></param>
        /// <returns></returns>
        public static bool TryGetFieldFromPersistentStringForm(IPexComponent host, string fstr, out Field field)
        {
            field = null;

            var splitarr = fstr.Split(new char[] { PexMeConstants.PexMePersistenceFormSeparator });

            SafeDebug.Assume(splitarr.Length == 3, "Incorrect persistent store field name");

            var assemblyname = splitarr[0];
            var typename     = splitarr[1];
            var signature    = splitarr[2];

            FieldDefinition fdef;

            if (!TryGetFieldDefinition(host, assemblyname, typename, signature, out fdef))
            {
                return(false);
            }

            TypeDefinition tdef;

            if (!fdef.TryGetDeclaringType(out tdef))
            {
                return(false);
            }

            field = fdef.Instantiate(GetGenericTypeParameters(host, tdef));
            return(true);
        }
예제 #5
0
        public void AfterExecution(IPexComponent host, object data)
        {
            if (this.pmd.CurrentPUTMethod == null)
            {
                this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, "PUTExploration",
                                         "Return, not current PUT method is set");
                WriteStopStatus();
                return;
            }

            SafeDebug.AssertNotNull(this.pmd.CurrentPUTMethod, "CurrentPUTMethod should be set by this time");
            var currPUTSignature = MethodOrFieldAnalyzer.GetMethodSignature(this.pmd.CurrentPUTMethod);

            if (this.pmd.AllExploredMethods.Contains(currPUTSignature))
            {
                this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, "PUTExploration",
                                         "Ignoring the post processing of the PUT " + currPUTSignature + " since it is explored earlier!!!");
                WriteStopStatus();
                return;
            }

            //Add this to pending methods
            PexMePostProcessor ppp = new PexMePostProcessor(host);

            ppp.AfterExecution();
        }
예제 #6
0
        /// <summary>
        /// Retrieves the defined field
        /// </summary>
        /// <param name="method"></param>
        /// <param name="definedField"></param>
        /// <returns></returns>
        public static bool TryGetFieldOfSetter(Method method, out Field definedField)
        {
            SafeDebug.Assert(method.ShortName.StartsWith("set_"), "");
            definedField = null;
            MethodBodyEx body;

            if (!method.TryGetBody(out body) || !body.HasInstructions)
            {
                return(false);
            }

            int         offset = 0;
            Instruction instruction;
            OpCode      prevOpcode = OpCodes.Nop;

            while (body.TryGetInstruction(offset, out instruction))
            {
                SafeDebug.AssumeNotNull(instruction, "instruction");
                OpCode opCode = instruction.OpCode;
                if (opCode == OpCodes.Stfld || opCode == OpCodes.Stsfld)
                {
                    definedField = instruction.Field;
                    return(true);
                }
                offset = instruction.NextOffset;
            }

            return(false);
        }
예제 #7
0
        /// <summary>
        /// Creates a thread.
        /// </summary>
        /// <returns>ThreadId</returns>
        public int CreateThread()
        {
            int threadId;

            if (!this.DestroyedExecutionMonitorIds.TryDequeue(out threadId))
            {
                threadId = this.ThreadExecutionMonitors.Count;
                this.ThreadExecutionMonitors.Add(null);
            }

            SafeDebug.Assert(this.ThreadExecutionMonitors[threadId] == null,
                             "this.destroyedExecutionMonitorIds[threadId] == null");

            SafeList <IThreadExecutionMonitor> childExecutionMonitors =
                new SafeList <IThreadExecutionMonitor>(2); // all callbacks

            foreach (var monitorFactory in this.MonitorFactories)
            {
                IThreadExecutionMonitor monitor;
                if (monitorFactory.TryCreateThreadMonitor(threadId, out monitor))
                {
                    childExecutionMonitors.Add(monitor);
                }
            }

            this.ThreadExecutionMonitors[threadId] =
                new ThreadExecutionMonitorMultiplexer(childExecutionMonitors);

            return(threadId);
        }
예제 #8
0
    public void Generate(int _seed, bool _enableCaves, float _amp, float _caveDensity, float _grassOffset)
    {
        try
        {
            /*seed = _seed;
             * enableCaves = _enableCaves;
             * amp = _amp;
             * caveDensity = _caveDensity;
             * grassOffset = _grassOffset;
             *
             * Vector2Int bottomLeft = new Vector2(location.x * ChunkSizeX, location.z * ChunkSizeZ);
             * Vector2Int topRight = new Vector2(location.x * ChunkSizeX + ChunkSizeX, location.z * ChunkSizeZ + ChunkSizeZ);
             *
             * MazeGen mountainTerrain = new MazeGen(ChunkSizeX / 2, 4, ChunkMeterSizeY / 2, seed, 2, 1);
             *
             * NoiseModule = mountainTerrain;*/

            //NoisePlane = new LibNoise.Models.Plane(NoiseModule);

            //SetSurfaceData(bottomLeft, topRight);
        }
        catch (Exception e)
        {
            SafeDebug.LogError(e.Message + "\nFunction: Generate, Chunk: " + location.ToString(), e);
        }
    }
예제 #9
0
    public float[,] Generate(int _seed, bool _enableCaves, float _amp, float _caveDensity, float _groundOffset, float _grassOffset)
    {
        try {
            seed         = _seed;
            enableCaves  = _enableCaves;
            amp          = _amp;
            caveDensity  = _caveDensity;
            groundOffset = _groundOffset;
            grassOffset  = _grassOffset;

            Vector2Int bottomLeft = new Vector2(Location.x * ChunkSizeX, Location.z * ChunkSizeZ);
            Vector2Int topRight   = new Vector2(Location.x * ChunkSizeX + ChunkSizeX, Location.z * ChunkSizeZ + ChunkSizeZ);

            MazeGen mountainTerrain = new MazeGen(ChunkSizeX / 2, 4, ChunkMeterSizeY / 2, seed, 2, 1);

            NoiseModule = mountainTerrain;

            //NoisePlane = new LibNoise.Models.Plane(NoiseModule);

            //SetSurfaceData(bottomLeft, topRight);
        }
        catch (Exception e) {
            SafeDebug.LogError(e.Message + "\nFunction: Generate, Chunk: " + Location.ToString(), e);
        }

        return(SurfaceData);
    }
예제 #10
0
 private void DoSend(byte[] data, Protocal type = Protocal.Tcp)
 {
     //SafeDebug.Log("Sending some shit 1");
     if (type == Protocal.Tcp || !udpStarted)
     {
         //SafeDebug.Log("Sending some shit 2");
         if (tcpClient != null && tcpSocket != null)
         {
             //if ((ServerCMD)data[0] != ServerCMD.Ping)
             //    SafeDebug.Log("SENDING: " + (ServerCMD)data[0]);
             data = BufferUtils.AddLength(data);
             //SafeDebug.Log("Sending some shit 3");
             tcpSocket.Send(data);
         }
         else
         {
             SafeDebug.LogError("Client TCP socket null!");
         }
     }
     else
     {
         if (udpClient != null)
         {
             byte[] udpIdBuff = BitConverter.GetBytes((UInt16)UdpID);
             byte[] buffer    = BufferUtils.Add(udpIdBuff, data);
             udpClient.Send(buffer, buffer.Length);
         }
         else
         {
             DoSend(data);
         }
     }
 }
예제 #11
0
    public float[,] Generate(IModule module, int _seed, bool _enableCaves, float _amp, float _caveDensity, float _groundOffset, float _grassOffset)
    {
        try
        {
            NoiseModule  = module;
            seed         = _seed;
            enableCaves  = _enableCaves;
            amp          = _amp;
            caveDensity  = _caveDensity;
            groundOffset = _groundOffset;
            grassOffset  = _grassOffset;

            RidgedMultifractal _caves = new RidgedMultifractal();
            _caves.Seed      = _seed;
            _caves.Frequency = 0.3;
            caveModule       = _caves;

            Vector2Int bottomLeft = new Vector2(Location.x * ChunkSizeX, Location.z * ChunkSizeZ);
            Vector2Int topRight   = new Vector2(Location.x * ChunkSizeX + ChunkSizeX, Location.z * ChunkSizeZ + ChunkSizeZ);

            SetSurfaceData(bottomLeft, topRight);
        }
        catch (Exception e)
        {
            SafeDebug.LogError(string.Format("{0}\nFunction: Generate\n Chunk: {1}", e.Message, Location.ToString()), e);
        }

        return(SurfaceData);
    }
예제 #12
0
        private void MultiStdDevMutation(ref ESSolution offspring)
        {
            SafeDebug.AssertNotNull(offspring, "offspring != null");

            base.modelBuilder = base.context.CreateArithmeticModelBuilder(offspring.currentModel);

            double globalLearningRate = (double)1 / Math.Sqrt((double)2 * (double)base.context.Variables.Count <IArithmeticVariable>());
            double localLearningRate  = (double)1 / Math.Sqrt((double)2 * Math.Sqrt((double)base.context.Variables.Count <IArithmeticVariable>()));
            double overallT           = globalLearningRate * Gaussian(0, 1);
            int    index = 0;

            foreach (var variable in base.context.Variables)
            {
                Term   sum         = null;
                double ni          = overallT + localLearningRate * Gaussian(0, 1);
                double scaleFactor = offspring.GetStdDev(index) * Math.Exp(ni);
                offspring.SetStdDev(index, scaleFactor);
                bool success = TryAddDoubleToTerm(variable.Term, scaleFactor * Gaussian(0, 1), out sum);
                if (success)
                {
                    base.modelBuilder.TryAssign(variable, offspring.currentModel.GetValue(sum));
                }
                index++;
            }

            offspring.UpdateModel(base.modelBuilder.ToArithmeticModel());
        }
예제 #13
0
        public static string GeneratePUTCommand(Method putmethod)
        {
            TypeEx classdef;
            bool   bresult = putmethod.TryGetDeclaringType(out classdef);

            SafeDebug.Assume(bresult, "Declaring type cannot be null");

            var assemblyEx   = classdef.Definition.Module.Assembly;
            var assemblyName = assemblyEx.Location;
            var namespacestr = classdef.Namespace;

            StringBuilder sb = new StringBuilder();

            sb.Append("pex.exe ");
            sb.Append(assemblyName);
            sb.Append(" /nf:");
            sb.Append(namespacestr);
            sb.Append(" /tf:");
            sb.Append(classdef.ShortName.ToString() + "!");
            sb.Append(" /mf:");
            sb.Append(putmethod.ShortName.ToString() + "!");
            sb.Append(" /nor");
            sb.Append(" /rn:");
            sb.Append(classdef.ShortName.ToString() + "_" + putmethod.ShortName.ToString());
            if (PexMeConstants.ENABLE_DEBUGGING_MODE)
            {
                sb.Append(" /bos");
            }
            sb.Append(" /fullmscorlib");
            return(sb.ToString());
        }
        public bool IsAssertMethod(MethodDefinition method, out int usefulParameters)
        {
            SafeDebug.AssumeNotNull(method, "method");
            TypeDefinition type;

            if (method.TryGetDeclaringType(out type))
            {
                if (type.SerializableName == MSTestv2TestFrameworkMetadata.AssertTypeDefinition)
                {
                    switch (method.ShortName)
                    {
                    case "IsFalse":
                    case "IsTrue":
                    case "IsNull":
                    case "IsNotNull":
                    case "IsInstanceOfType":
                    case "IsNotInstanceOfType":
                        usefulParameters = 1;
                        return(true);

                    case "AreEqual":
                    case "AreNotEqual":
                    case "AreSame":
                    case "AreNotSame":
                        usefulParameters = 2;
                        return(true);
                    }
                }
            }

            usefulParameters = -1;
            return(false);
        }
예제 #15
0
 public void SpawnChunksLinear()
 {
     SpawnChunkFeild();
     Loom.QueueAsyncTask(WorldThreadName, () =>
     {
         TerrainModule module = new TerrainModule(VoxelSettings.seed);
         for (int x = 0; x < VoxelSettings.maxChunksX; x++)
         {
             for (int z = 0; z < VoxelSettings.maxChunksZ; z++)
             {
                 for (int y = 0; y < VoxelSettings.maxChunksY_M; y++)
                 {
                     Vector3Int location3D = new Vector3Int(x, y, z);
                     GenerateChunk(location3D, module);
                 }
             }
         }
         SafeDebug.Log("Finished rendering.");
         Loom.QueueOnMainThread(() =>
         {
             _generating = false;
             OnRenderComplete();
         });
     });
 }
        /// <summary>
        /// Just before returning from method body.
        /// </summary>
        /// <remarks>Only method allowed to pop from callstack.</remarks>
        public override void LeaveMethod()
        {
            try
            {
                if (callStack.Count == 0)
                {
                    SafeDebug.Fail("cannot leave empty method");    //should not happen with the fake frame.
                    return;
                }

                if (callStack.Count == 1)
                {
                    this.callMonitor.RunCompleted();
                    return;    //exit from Main, if we did not get Enter(Main).
                }

                CallFrame poppedFrame = callStack.First.Value;
                callStack.RemoveFirst();
                this.current = callStack.First.Value;

                if (poppedFrame.PreemptionsDisabled && !this.current.PreemptionsDisabled)
                {
                    this.PreemptionEnable();
                }

                if (poppedFrame.Prioritized && !this.current.Prioritized)
                {
                    MChessChess.UnprioritizePreemptions();
                }
            }
            catch (Exception e)
            {
                LogException(e);
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public ThreadExecutionMonitorDispatcher(IEventLog log, int threadIndex, IThreadMonitor callMonitor)
            : base(threadIndex)
        {
            SafeDebug.AssertNotNull(callMonitor, "callMonitor");

            this.log         = log;
            this.threadIndex = threadIndex;
            this.callMonitor = callMonitor;
            this.callStack   = new SafeLinkedList <CallFrame>();

            this.current = new CallFrame(default(ICallFrame), default(Method), 0); //fake caller.
            this.callStack.AddFirst(new SafeLinkedList <CallFrame> .Node(this.current));

            if (firstTime)
            {
                // get rid of all [T] from types and methods
                var env = MyEngine.EnvironmentVars;
                firstTime = false;
                foreach (var t in env.DontPreemptTypes)
                {
                    newDontPreemptTypes.Add(eliminateParameterizedTypes(t));
                }
                foreach (var m in env.DontPreemptMethods)
                {
                    newDontPreemptMethods.Add(eliminateParameterizedTypes(m));
                }
                foreach (var m in env.PrioritizeMethods)
                {
                    newPrioritizeMethods.Add(eliminateParameterizedTypes(m));
                }
            }
        }
예제 #18
0
            bool IPexAssumptionExceptionValidator.IsAssumption(Exception ex)
            {
                SafeDebug.AssumeNotNull(ex, "ex");

                // 1) must be a requires exception
                string trace;
                Type   exceptionType = ex.GetType();

                if (exceptionType == typeof(Cobra.Lang.RequireException) &&
                    ExceptionHelper.TryGetBestStackTrace(ex, out trace))
                {
                    StackTraceEx tx = host.Services.SymbolManager.ParseStackTrace(trace, true);

                    bool globalsFound = false;
                    for (int i = tx.Frames.Count - 1; i >= 0; i--)
                    {
                        StackFrameEx frame = tx.Frames[i];
                        if (frame.MethodName.StartsWith("require_"))
                        {
                            if (globalsFound) // already found? that's not good
                            {
                                return(false);
                            }
                            globalsFound = true;
                        }
                    }

                    return(globalsFound);
                }

                return(false);
            }
예제 #19
0
        private void MakeNumericMove(bool patternMove)
        {
            double delta = 0.0;
            short  dir   = this.direction;
            int    index = this.index;

            if (patternMove)
            {
                dir   = this.lastDirection;
                index = this.lastIndex;
            }

            SafeDebug.Assert(index < this.variableInfos.Count, "this.index < this.variableInfos.Count");

            var  variableInfo    = this.variableInfos[index];
            var  currentVariable = variableInfo.variable;
            Term newValue        = null;

            delta = (double)dir * Math.Pow(10, -variableInfo.precision) * Math.Pow(2, this.patternMoves);

            if (TryAddDoubleToTerm(currentVariable.Term, delta, out newValue))
            {
                base.modelBuilder.TryAssign(currentVariable, this.bestModel.GetValue(newValue));
            }
        }
예제 #20
0
    public void Generate(IModule module, int _seed, bool _enableCaves, float _amp, float _caveDensity, float _grassOffset)
    {
        try
        {
            Sampler = new TerrainSampler(module, _seed, _enableCaves, _amp, _caveDensity, _grassOffset);;
            Sampler.SetChunkSettings(VoxelsPerMeter,
                                     new Vector3Int(ChunkSizeX, ChunkSizeY, ChunkSizeZ),
                                     new Vector3Int(ChunkMeterSizeX, ChunkMeterSizeY, ChunkMeterSizeZ),
                                     skipDist,
                                     half, new Vector3(xSideLength, ySideLength, zSideLength));


            Vector2Int bottomLeft = new Vector2(location.x * ChunkSizeX, location.z * ChunkSizeZ);
            Vector2Int topRight   = new Vector2(location.x * ChunkSizeX + ChunkSizeX, location.z * ChunkSizeZ + ChunkSizeZ);
            watch.Start();
            Sampler.SetSurfaceData(bottomLeft, topRight);
            watch.Stop();
            noiseGenTime = watch.Elapsed.ToString();

            int bottom = VoxelConversions.ChunkToVoxel(location).y;
            empty = bottom > Sampler.GetMax();
        }
        catch (Exception e)
        {
            SafeDebug.LogError(string.Format("{0}\nFunction: Generate\n Chunk: {1}", e.Message, location.ToString()), e);
        }
    }
예제 #21
0
        /// <summary>
        /// Given a uncovered code location and the associated terms, this
        /// method infers factory method for that code location.
        ///
        /// Assumes that the uncovered branch is mainly due to an object creating issue
        /// </summary>
        /// <returns></returns>
        public bool TryInferFactoryMethod(UncoveredCodeLocationStore ucls, out SafeSet <Method> suggestedMethods)
        {
            SafeDebug.AssumeNotNull(ucls, "ucls");

            if (ucls.AllFields.Count == 0)
            {
                this.host.Log.LogError(WikiTopics.MissingWikiTopic, "factoryguesser",
                                       "No information about involving fields in the uncovered branch");
                suggestedMethods = null;
                return(false);
            }

            //Check whether the feature is currently supported
            FieldModificationType fmt = this.GetRequiredFieldModificationType(ucls);

            if (!(fmt == FieldModificationType.NON_NULL_SET ||
                  fmt == FieldModificationType.NULL_SET || fmt == FieldModificationType.INCREMENT || fmt == FieldModificationType.DECREMENT ||
                  fmt == FieldModificationType.FALSE_SET || fmt == FieldModificationType.TRUE_SET))
            {
                this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, "factoryguesser",
                                         "Format " + fmt.ToString() + " is not supported for suggesting factory methods");
                suggestedMethods = null;
                return(false);
            }

            //Step 1: Get the exact type whose factory method is required for covering this branch.
            //Decided based on where there is a subsequent field which can be directly handled rather than the top field.
            //This step is moved to the place where the uncovered location is initially stored

            //Step 2: Decide which methods of this type should be invoked. Use a bottomup approach
            //for inferrinfg the exact method
            if (!this.GetTargetMethod(ucls, ucls.TargetField, out suggestedMethods))
            {
                this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, "factoryguesser",
                                         "Failed to retrieve the target method of field " + ucls.TargetField.FullName + " in type " + ucls.ExplorableType.FullName);
                suggestedMethods = null;
                return(false);
            }

            var sb = new StringBuilder();

            foreach (var m in suggestedMethods)
            {
                sb.AppendLine(MethodOrFieldAnalyzer.GetMethodSignature(m));
            }
            ucls.SuggestedMethodsforFactory = sb.ToString();

            //Create a factory suggestion store. This is expected by the rest of the code.
            FactorySuggestionStore fss;

            if (!this.pmd.FactorySuggestionsDictionary.TryGetValue(ucls.ExplorableType.ToString(), out fss))
            {
                fss = new FactorySuggestionStore();
                fss.DeclaringType = ucls.ExplorableType.ToString();
                this.pmd.FactorySuggestionsDictionary[ucls.ExplorableType.ToString()] = fss;
            }

            return(true);
        }
예제 #22
0
        /// <inheritdoc/>
        public override void EmitInconclusive(MethodBodyBuilder body, string message)
        {
            SafeDebug.AssumeNotNull(body, "body");

            body.Push(message);
            body.CallStatic(XunitTestFrameworkMetadata.Method_PexAssertInconclusive.Value);
            body.Statement();
        }
예제 #23
0
        public static void PrintNoFormat(object message)
        {
            SafeDebug.Log("[Server]: " + message);

            /*AddEntry(LogLevel.Print, message.ToString());
             * Action a = () => LogToFile(message.ToString());
             * QueueLog(a);*/
        }
예제 #24
0
        public static void Print(object message, params object[] args)
        {
            SafeDebug.Log("[Server]: " + string.Format(message.ToString(), args));

            /*AddEntry(LogLevel.Print, string.Format(message.ToString(), args));
             * Action a = () => LogToFile(string.Format(message.ToString(), args));
             * QueueLog(a);*/
        }
예제 #25
0
 public override bool TryMarkExpectedException(VisibilityContext visibility, MethodDefinitionBuilder method,
                                               Exception exception)
 {
     SafeDebug.AssumeNotNull(visibility, "visibility");
     SafeDebug.AssumeNotNull(method, "method");
     SafeDebug.AssumeNotNull(exception, "exception");
     return(false);
 }
예제 #26
0
        /// <summary>
        /// Tries the get categories.
        /// </summary>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <param name="names">
        /// The names.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        protected override bool TryGetCategories(ICustomAttributeProviderEx element, out IEnumerable <string> names)
        {
            SafeDebug.AssumeNotNull(element, "element");

            // TODO
            names = null;
            return(false);
        }
예제 #27
0
        protected override object BeforeExploration <TAbstractValue>(IPexExplorationComponent <TAbstractValue> host)
        {
            SafeDebug.AssumeNotNull(host, "host");

            host.ExplorationServices.ExceptionManager.AddAssumptionExceptionValidator(
                new Validator <TAbstractValue>(host)
                );
            return(null);
        }
예제 #28
0
 public override void Shutdown(int code)
 {
     // finalizers
     IsInitialized = false;
     syncVarManager.ReleaseGCAddresses();
     this.ExitCode = (ChessExitCode)code;
     SafeDebug.Assert(this.exitCallback != null, "this.exitCallBack != null");
     this.exitCallback((ChessExitCode)code, null);
 }
예제 #29
0
        public static void LogError(object message, params object[] args)
        {
            SafeDebug.LogError("[Server]: " + string.Format(message.ToString(), args));

            /*string messageStr = string.Format(message.ToString(), args);
             * AddEntry(LogLevel.Error, string.Format("[{0}]: {1}", GetTime(), messageStr));
             * Action a = () => LogToFile(string.Format("[{0} E]: {1}", GetTime(), messageStr));
             * QueueLog(a);*/
        }
예제 #30
0
        public void DestroyThread(int index)
        {
            SafeDebug.Assert(this.executionMonitors[index] != null, "this.executionMonitors[index] != null");
            IThreadExecutionMonitor m = this.executionMonitors[index];

            m.Destroy();
            this.destroyedExecutionMonitorIds.Enqueue(index);
            this.executionMonitors[index] = null;
        }