Writing plugins for CodeSite viewers

Home Forums CodeSite Writing plugins for CodeSite viewers

Viewing 3 reply threads
  • Author
    Posts
    • #2356
      NIKOLAY NIKITIN
      Participant

        Is it possible to write my own plugin for CodeSite File Viewer and CodeSite Live Viewer?

        Thank you.

      • #2358
        Ray Konopka
        Keymaster

          Hi,

          Yes, it is technically possible to write a custom plug-in for the CodeSite Viewers. The Compare Objects and Compare MemStatus plug-ins are built as separate packages that are loaded into the Viewers on startup.

          What type of plug-in are you looking to create?

          Ray

        • #2359
          NIKOLAY NIKITIN
          Participant

            I wrote several helpers for using CodeSite, which allow to send a list of any parameters to CodeSite in a convenient (for me) tabular form.

            For illustration, it might look like this:

            CodeSite.Send(‘CreateFile’, LogParams.
            Str ( ‘lpFileName’, AFileName).
            Int ( ‘dwDesiredAccess’, ADesiredAccess).
            Int ( ‘dwShareMode’, AShareMode).
            Ptr ( ‘lpSecurityAttributes’, ASecAttrs)

            );

            The implementation of this syntax became possible thanks to the overload Send method, which accepts the ICodeSiteCustomData interface. But when I wanted to use the same my LogParams helper to log the input parameters when calling CodeSite.EnterMethod (and to log the output parameters by calling CodeSite.ExitMethod), I ran into the lack of overloads I needed.

            Simply put, I can write:

            function TMyClass.MyMethod(const APar1: Integer; var APar2: string): Boolean;
            begin
            CodeSite.EnterMethod(Self, ‘MyMethod’);
            try
            CodeSite.Send(‘MyMethod’, LogParams.
            Int (‘APar1’ , APar1));



            finally
            CodeSite.Send(‘MyMethod’, LogParams.
            Str    (‘APar2’ , APar1).
            Bool (‘Result’ , Result));
            CodeSite.ExitMethod(Self, ‘MyMethod’, Result);
            end;
            end;

             

            But I can not write:

            function TMyClass.MyMethod(const APar1: Integer; var APar2: string): Boolean;
            begin
            CodeSite.EnterMethod(Self, ‘MyMethod’, LogParams.
            Int (‘APar1’ , APar1));
            try


            finally
            CodeSite.ExitMethod(Self, ‘MyMethod’, LogParams.
            Str (‘APar2’ , APar1).
            Bool (‘Result’ , Result));
            end;
            end;

            I began to understand the reasons for the limitations of the EnterMethod ExitMethod methods. I saw that CodeSiteLogger, when sending a message to the dispatcher, does not send the inspection type TCodeSiteInspectorType separately, everything is transferred through the integer MsgType. The viewer, having received the data written by the dispatcher, does not even try to display the data that came along with the csmEnterMethod, because it does not know TCodeSiteInspectorType and cannot figure it out from the neutral constant csmEnterMethod.

            I planned, when logging incoming and outgoing parameters, to transfer my constants (csmEnterMethodParamString, csmEnterMethodParamTable, csmEnterMethodParamProps, csmEnterMethodParamTree and csmExitMethodParamString, csmExitMethodParamTable,
            csmExitMethodParamProps, csmExitMethodParamTree) and support them in the viewer.

            Sorry for my awful English, I used a machine translator.

            If, to illustrate my thoughts, it is necessary to demonstrate examples of some sources, then I suggest writing off by e-mail

          • #2380
            Ray Konopka
            Keymaster

              Hi,

              Thanks for the additional information. In short, you would like an easier way to log the parameters to a method call. A plug-in will not really help you capture the information you want. Instead, you need an overloaded EnterMethod method to allow your LogParams technique to work, or some other technique. I’ll have to give this some more thought.
              What does the output look like in the Viewer after calling CodeSite.Send using your LogParams object?

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.