예제 #1
0
 /// <inheritdoc />
 public Task <DebugEntry> CreateRequestDebugEntryAsync(string requestId, DebugEntry entry, string filename, CancellationToken cancellationToken)
 {
     return(RetryAsync(
                nameof(ISymbolServiceClient.CreateRequestDebugEntryAsync),
                (client, ct) => client.CreateRequestDebugEntryAsync(requestId, entry, filename, ct),
                cancellationToken));
 }
예제 #2
0
 public static void DestroyEntry(DebugEntry pEntry)
 {
     if (mEntries.Contains(pEntry))
     {
         mEntries.Remove(pEntry);
     }
 }
예제 #3
0
    public static DebugEntry GetEntry()
    {
        DebugEntry e = new DebugEntry();

        mEntries.Add(e);
        return(e);
    }
예제 #4
0
 private static void AddMessage(LogLevelFlags severity, string msg, int CallstackFrames, string[] parameters)
 {
     if (m_Saving || !DebugMode || ((severity & LogLevel) != severity)) return;
     if (m_DebugEntries.Count > 0)
     {
         DebugEntry prev = m_DebugEntries[m_DebugEntries.Count - 1];
         if ((prev.severity == severity) && (prev.msg == msg) && ParamsEqual(prev.parameters, parameters))
         {
             m_DebugEntries[m_DebugEntries.Count - 1].counter++;
             return;
         }
     }
     DebugEntry m = new DebugEntry();
     m.severity = severity;
     m.msg = msg;
     m.utc = DateTime.UtcNow;
     m.counter = 1;
     m.parameters = parameters;
     if (CallstackFrames != 0)
     {
         System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(true);
         for (int i = 0; i < st.FrameCount; i++)
         {
             if (m.sf.Count == CallstackFrames) break;
             System.Diagnostics.StackFrame sf = st.GetFrame(i);
             if (sf.GetMethod().DeclaringType.FullName != "PluginTools.PluginDebug")
                 m.sf.Add(sf);
         }
     }
     m_DebugEntries.Add(m);
     if (AutoSave) SaveDebugMessages();
 }
예제 #5
0
 private void Awake()
 {
     minigameAssetData = Resources.LoadAll <MinigameData> ("Data/Minigames");
     foreach (MinigameData data in minigameAssetData)
     {
         DebugEntry entry = Instantiate(panelPrefab, panel).GetComponent <DebugEntry> ();
         entry.gameName = data.typeOfGame;
     }
 }
예제 #6
0
    void DrawEntry(DebugEntry pEntry)
    {
        if ((pEntry.mState & EDebugEntryState.hidden) != 0)
        {
            return;
        }

        GUILayout.Label(pEntry.mText);
    }
예제 #7
0
        static DebugManager()
        {
            debugEntries = new ResourceHandler <DebugEntry>();

            fps = new DebugEntry("Relatus_FPS", "{0} FPS");
            RegisterDebugEntry(fps);

            scene = new DebugEntry("Relatus_Scene", "SCENE: {0}");
            RegisterDebugEntry(scene);

            entity = new DebugEntry("Relatus_Entities", "E: {0}");
            RegisterDebugEntry(entity);
        }
예제 #8
0
    void DebugText(string str, Color color)
    {
        Debug.Log(str);

        var entry = new DebugEntry();

        entry.text  = str;
        entry.color = color;

        entries.Add(entry);

        if (entries.Count > 50)
        {
            entries.RemoveAt(0);
        }

        scrollPosition.y = 1000000;
    }
예제 #9
0
 public void WriteLine(DebugEntry entry)
 {
     Count++;
 }
예제 #10
0
        public void CheckEntry(CachedSNOEntry entry)
        {
            var d = new DebugEntry(entry);

            if (entry.Gizmotype.HasValue)
            {
                if (entry.Gizmotype.Value == GizmoType.Door)
                {
                    if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Doors))
                    {
                        return;
                    }

                    if (Doors.Entries.Contains(d))
                    {
                        return;
                    }
                    Doors.Entries.Add(d);
                    DebugData_Doors.SerializeToXML(Doors);
                }
                else if (entry.Gizmotype.Value == GizmoType.Chest)
                {
                    if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Containers))
                    {
                        return;
                    }

                    if (Containers.Entries.Contains(d))
                    {
                        return;
                    }
                    Containers.Entries.Add(d);
                    DebugData_Containers.SerializeToXML(Containers);
                }
                else if (entry.Gizmotype.Value == GizmoType.BreakableChest || entry.Gizmotype.Value == GizmoType.DestroyableObject)
                {
                    if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Destructibles))
                    {
                        return;
                    }

                    if (Destructibles.Entries.Contains(d))
                    {
                        return;
                    }
                    Destructibles.Entries.Add(d);
                    DebugData_Destructibles.SerializeToXML(Destructibles);
                }
                else if (entry.Gizmotype.Value == GizmoType.BreakableDoor)
                {
                    if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Barricades))
                    {
                        return;
                    }

                    if (Barricades.Entries.Contains(d))
                    {
                        return;
                    }
                    Barricades.Entries.Add(d);
                    DebugData_Barricades.SerializeToXML(Barricades);
                }
            }
            else if (d.ActorType == PluginActorType.Item || d.TargetType == TargetType.Item)
            {
                if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Items))
                {
                    return;
                }

                if (Items.Entries.Contains(d))
                {
                    return;
                }
                Items.Entries.Add(d);
                DebugData_DroppedItems.SerializeToXML(Items);
            }
        }
예제 #11
0
        public string Execute(string input = null)
        {
            // Clear the debug data
            DebugData.Clear();

            // Add a pass-through command at the end just to hold a label called "end".
            if (commands.Any(c => c.Label == FINAL_COMMAND_LABEL))
            {
                commands.Remove(commands.First(c => c.Label == FINAL_COMMAND_LABEL));
            }
            commands.Add(
                new PipelineCommand()
            {
                CommandName = LABEL_COMMAND,
                Label       = FINAL_COMMAND_LABEL,
                CommandArgs = new Dictionary <object, string>()
                {
                    { 0, FINAL_COMMAND_LABEL }
                }
            }
                );

            // We set the global variable to the incoming string. It will be modified and eventually returned from this variable slot.
            SetVariable(GLOBAL_VARIABLE_NAME, input);

            // We're going to set up a linked list of commands. Each command holds a reference to the next command in its SendToLabel property. The last command is NULL.
            var commandQueue = new Dictionary <string, PipelineCommand>();

            for (var index = 0; index < commands.Count; index++)
            {
                var thisCommand = commands[index];

                // If this is a "Label" command, then we need to get the label "out" to a property
                if (thisCommand.NormalizedCommandName == LABEL_COMMAND)
                {
                    thisCommand.Label = thisCommand.DefaultArgument;
                }

                // If (1) this command doesn't already have a SendToLabel (it...shouldn't...I don't think), and (2) we're not on the last command, then set the SendToLabel of this command to the Label of the next command
                if (thisCommand.SendToLabel == null && index < commands.Count - 1)
                {
                    thisCommand.SendToLabel = commands[index + 1].Label;
                }

                // Add this command to the queue, keyed to its Label
                commandQueue.Add(thisCommand.Label.ToLower(), thisCommand);
            }

            // We're going to stay in this loop, resetting "command" each iteration, until SendToLabel is NULL
            NextCommandLabel = commandQueue.First().Value.Label;
            while (true)
            {
                // Do we have a next command?
                if (NextCommandLabel == null)
                {
                    // Stick a fork in us, we're done
                    break;
                }

                // Does the specified next command exist?
                if (!commandQueue.ContainsKey(NextCommandLabel.ToLower()))
                {
                    throw new Exception(string.Format("Specified command label \"{0}\" does not exist in the command queue.", NextCommandLabel));
                }

                // Get the next command
                var command = commandQueue[NextCommandLabel.ToLower()];

                // Create the debug entry
                var debugData = new DebugEntry(command);

                // Are we writing to a variable?
                if (command.NormalizedCommandName == WRITE_TO_VARIABLE_COMMAND)
                {
                    // Get the active text and copy it to a different variable
                    SetVariable(command.OutputVariable, GetVariable(GLOBAL_VARIABLE_NAME));
                    NextCommandLabel = command.SendToLabel;
                    continue;
                }

                // Are we reading from a variable?
                if (command.NormalizedCommandName == READ_FROM_VARIABLE_COMMAND)
                {
                    // Get the variable and copy it into the active text
                    SetVariable(GLOBAL_VARIABLE_NAME, GetVariable(command.InputVariable));
                    NextCommandLabel = command.SendToLabel;
                    continue;
                }

                // Is this a label?
                if (command.NormalizedCommandName == LABEL_COMMAND)
                {
                    NextCommandLabel = command.SendToLabel;
                    continue;
                }

                // Note that the above commands will never actually execute. This is why their methods are just empty shells...

                // Do we a method for this command?
                if (!CommandMethods.ContainsKey(command.NormalizedCommandName))
                {
                    // This command doesn't exist. We're going to try to be helpful and let the user know if it's becaue of a missing dependency.
                    var errorString = hiddenCommandMethods.ContainsKey(command.NormalizedCommandName)
                        ? string.Format(hiddenCommandMethods[command.NormalizedCommandName])  // This should be the reason the command is hidden
                        : string.Format(@"No command loaded for ""{0}""", command.CommandName);

                    throw new DeninaException(errorString);
                }

                // Set a pipeline reference which can be accessed inside the filter method
                command.Pipeline = this;

                // Resolve any arguments that are actually variable names
                command.ResolveArguments();

                // Execute
                var method = CommandMethods[command.NormalizedCommandName];
                try
                {
                    timer.Reset();
                    timer.Start();

                    // This is where we make the actual method call. We get the text out of the InputVariable slot, and we put it back into the OutputVariable slot. (These are usually the same slot...)
                    // We're going to "SafeSet" this, so they can't pipe output to a read-only variable
                    debugData.InputValue = GetVariable(command.InputVariable).ToString();
                    var output = method.Invoke(null, new[] { GetVariable(command.InputVariable), command });
                    debugData.OutputValue = output.ToString();

                    // If we're appending, tack this onto what was passed in (really, prepend was was passed in)
                    if (command.AppendToLast)
                    {
                        output = string.Concat(GetVariable(command.InputVariable), output);
                    }

                    SafeSetVariable(command.OutputVariable, output);

                    command.ElapsedTime = timer.ElapsedMilliseconds;
                }
                catch (Exception e)
                {
                    if (e.InnerException is DeninaException)
                    {
                        // Since this was reflected, the "outer" exception is "an exception was thrown by the target of an invocation"
                        // Hence, the "real" exception is the inner exception
                        var exception = (DeninaException)e.InnerException;

                        exception.CurrentCommandText = command.OriginalText;
                        exception.CurrentCommandName = command.NormalizedCommandName;
                        throw exception;
                    }
                    else
                    {
                        throw;
                    }
                }

                // Set the pointer to the next command
                NextCommandLabel = command.SendToLabel;

                DebugData.Add(debugData);
            }

            var finalOutput = GetVariable(GLOBAL_VARIABLE_NAME).ToString();

            // Raise the PipelineCompleted event
            var eventArgs = new PipelineEventArgs(this, finalOutput);

            OnPipelineComplete(eventArgs);
            finalOutput = eventArgs.Value;

            return(finalOutput);
        }
예제 #12
0
 /// <summary>
 /// Register a <see cref="DebugEntry"/> to be managed by Morro.
 /// </summary>
 /// <param name="debugEntry">The debug entry you want to register.</param>
 public static void RegisterDebugEntry(DebugEntry debugEntry)
 {
     debugEntries.Register(debugEntry.Name, debugEntry);
 }