Author Topic: plugin file  (Read 7192 times)

jane

  • Newbie
  • *
  • Posts: 49
plugin file
« on: July 15, 2021, 01:08:17 AM »
hello.
I try to use suggested 6 (7) init functions but seemes thats something missing regarding vaProxy variable.
I also get a warning regarding prosessor arc.
I changed Guid code.(donnoif that code should be official.
Code: [Select]
using System;
using Microsoft.FlightSimulator.SimConnect;
using System.Runtime.InteropServices;


namespace instrumenter
{

    public class VoiceAttackPlugin

    {
        public static Guid VA_Id()
        {
            return new Guid("{B7E765E0-8C2C-44A7-8C72-8Dxxxx5E0692}"); //this id must be generated by YOU... it must be unique so VoiceAttack can identify and use the plugin
        }

        public static string VA_DisplayName()
        {
            return "VoiceAttack Plugin - v1";  //this is what you will want displayed in dropdowns as well as in the log file to indicate the name of your plugin
        }

        public static string VA_DisplayInfo()
        {
            return "My VoiceAttack Plugin\r\n\r\nThis is just a sample.\r\n\r\n2021 VoiceAttack";  //this is just extended info that you might want to give to the user.  note that you should format this up properly.
        }


        //The fourth function is VA_Init1 (UPDATED IN VERSION 4)
        public static void VA_Init1(dynamic vaProxy)
        { 
        }

        //The fifth function is VA_Exit1(UPDATED IN VERSION 4
        public static void VA_exit1(dynamic vaProxy)
        {
        }

        //The sixth required static function is VA_StopCommand(NEW IN VERSION 4).
        public static void VA_StopCommand()
        {
        }

        //The seventh required function is VA_Invoke1(UPDATED IN VERSION 4)
        public static void VA_Invoke(dynamic vaProxy)
        {
        }
    }



7

Severity   Code   Description   Project   File   Line   Suppression State
Message   IDE0060   Remove unused parameter 'vaProxy' if it is not part of a shipped public API   ClassLibrary1   C:\Users\jeike\source\repos\ClassLibrary1\ClassLibrary1\Class1.cs   44   Active
Message   IDE0060   Remove unused parameter 'vaProxy' if it is not part of a shipped public API   ClassLibrary1   C:\Users\jeike\source\repos\ClassLibrary1\ClassLibrary1\Class1.cs   34   Active
Message   IDE0060   Remove unused parameter 'vaProxy' if it is not part of a shipped public API   ClassLibrary1   C:\Users\jeike\source\repos\ClassLibrary1\ClassLibrary1\Class1.cs   29   Active

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4757
  • RTFM
Re: plugin file
« Reply #1 on: July 15, 2021, 01:22:21 AM »
Aside from a missing closing curly brace, and the Flight Simulator-specific reference, that compiles on my machine.

As denoted by"Message" in the "Severity" column, those are merely suggestions, not issues that would keep your plugin from working.


Do note that learning how to program in C#, especially using external libraries and interfacing directly with other applications, would probably be considered outside the scope of VoiceAttack itself.
There are resources available online, and courses you can take, both on C# and programming in general, if you want to dive deeper into that.

jane

  • Newbie
  • *
  • Posts: 49
Re: plugin file
« Reply #2 on: July 15, 2021, 02:44:19 AM »
Sri, the missing curl is in original file. Suppose the vaProxy is defined in VA source. I dont know regarding the processor warning, so have to figure that outl. The reference was added using command in subwindow of Visual studio. I might have written a comment in source file about that. I did some c# on ucontrollersand win 3 programming, but thats many years ago, so Ill follow your suggestion looking into lib/dll topics. CPU Changed using manager in submenu of Build.

Aside from a missing closing curly brace, and the Flight Simulator-specific reference, that compiles on my machine.

As denoted by"Message" in the "Severity" column, those are merely suggestions, not issues that would keep your plugin from working.


Do note that learning how to program in C#, especially using external libraries and interfacing directly with other applications, would probably be considered outside the scope of VoiceAttack itself.
There are resources available online, and courses you can take, both on C# and programming in general, if you want to dive deeper into that.
« Last Edit: July 15, 2021, 04:19:22 AM by jane »

jane

  • Newbie
  • *
  • Posts: 49
Re: plugin file
« Reply #3 on: July 16, 2021, 12:37:51 PM »
What could be the reason for this plugin not showing up in VA plugin manager: ClassLibrary1.dll
It copied to a sub directory of Apps.
regards

Code: [Select]
using System;
using Microsoft.FlightSimulator.SimConnect;
using System.Runtime.InteropServices;


namespace setter
{

    public class Contsetter
    {


     
        public static Guid VA_Id()
        {
            return new Guid("{531E4EA1-11AF-4095-89F7-B834270A0116}"); //this id must be generated by YOU... it must be unique so VoiceAttack can identify and use the plugin
        }

        public static string VA_DisplayName()
        {
            return "VoiceAttack Plugin - v1";  //this is what you will want displayed in dropdowns as well as in the log file to indicate the name of your plugin
        }

        public static string VA_DisplayInfo()
        {
            return "My VoiceAttack Plugin\r\n\r\nThis is just a sample.\r\n\r\n2021 VoiceAttack";  //this is just extended info that you might want to give to the user.  note that you should format this up properly.
        }


        //The fourth function is VA_Init1 (UPDATED IN VERSION 4)
        public static void VA_Init1(dynamic vaProxy)
        {
        }

        //The fifth function is VA_Exit1(UPDATED IN VERSION 4
        public static void VA_exit1(dynamic vaProxy)
        {
        }

        //The sixth required static function is VA_StopCommand(NEW IN VERSION 4).
        public static void VA_StopCommand()
        {
        }

        //The seventh required function is VA_Invoke1(UPDATED IN VERSION 4)
        public static void VA_Invoke(dynamic vaProxy)
        {
        }


        // public static void Set_radio1_frequency(decimal FREQUENCY)
        // {
        //    set value in var FREQUENCY to COM 1 (Radio 1).
        // return errorcode if implemented. If so change return type for function to correct type.
        //



    } // end class
}

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2826
Re: plugin file
« Reply #4 on: July 16, 2021, 12:45:17 PM »
A cursory run through and I see that VA_Exit1 is not capitalized properly.  The interface is case-sensitive and when the plugins are checked for validity, it will fail on that point (no warning given, as a warning would need to be given for every file that does not conform to the plugin requirements).

Hope that helps!

jane

  • Newbie
  • *
  • Posts: 49
Re: plugin file
« Reply #5 on: July 16, 2021, 08:50:55 PM »
A cursory run through and I see that VA_Exit1 is not capitalized properly.  The interface is case-sensitive and when the plugins are checked for validity, it will fail on that point (no warning given, as a warning would need to be given for every file that does not conform to the plugin requirements).

Hope that helps!

Thank You, but not working. I changed the cap. of VA_exit1, looked through the examplefile but cant see anything more that have to be changed.
I suppose Messages from build doesnt stop VA to register plugin?
I suppose VA trigger itself to look for new plugins? regards



Code: [Select]
using System;
using Microsoft.FlightSimulator.SimConnect;
using System.Runtime.InteropServices;

namespace Setter
{

    public class Contsetter
    {



        public static Guid VA_Id()
        {
            return new Guid("{531E4EA1-11AF-4095-89F7-B834270A0116}"); //this id must be generated by YOU... it must be unique so VoiceAttack can identify and use the plugin
        }

        public static string VA_DisplayName()
        {
            return "VoiceAttack Plugin - v1";  //this is what you will want displayed in dropdowns as well as in the log file to indicate the name of your plugin
        }

        public static string VA_DisplayInfo()
        {
            return "My VoiceAttack Plugin\r\n\r\nThis is just a sample.\r\n\r\n2021 VoiceAttack";  //this is just extended info that you might want to give to the user.  note that you should format this up properly.
        }


        //The fourth function is VA_Init1 (UPDATED IN VERSION 4)
        public static void VA_Init1(dynamic vaProxy)
        {
        }

        //The fifth function is VA_Exit1(UPDATED IN VERSION 4
        public static void VA_Exit1(dynamic vaProxy)
        {
            //this function gets called when VoiceAttack is closing (normally).  You would put your cleanup code in here, but be aware that your code must be robust enough to not absolutely depend on this function being called
           
        }


        //The sixth required static function is VA_StopCommand(NEW IN VERSION 4).
        public static void VA_StopCommand()
        {
        }

        //The seventh required function is VA_Invoke1(UPDATED IN VERSION 4)
        public static void VA_Invoke(dynamic vaProxy)
        {
        }


        // public static void Set_radio1_frequency(decimal FREQUENCY)
        // {
        //    set value in var FREQUENCY to COM 1 (Radio 1).
        // return errorcode if implemented. If so change return type for function to correct type.
        //



    } // end class
}

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4757
  • RTFM
Re: plugin file
« Reply #6 on: July 16, 2021, 09:09:33 PM »
You're missing the "VA_Invoke1()" method, as you named it "VA_Invoke()" instead.

There is an example project in the installation directory under \Plugin Samples\C#\PluginSampleC#.zip that you could could use as a starting point, rather than attempting to start from scratch.

As mentioned, those messages don't prevent a plugin (or application) from working.

VoiceAttack will check for/load plugins when it starts. It needs to be restarted to load new plugins.

jane

  • Newbie
  • *
  • Posts: 49
Re: plugin file
« Reply #7 on: July 17, 2021, 08:53:27 AM »
You're missing the "VA_Invoke1()" method, as you named it "VA_Invoke()" instead.

There is an example project in the installation directory under \Plugin Samples\C#\PluginSampleC#.zip that you could could use as a starting point, rather than attempting to start from scratch.

As mentioned, those messages don't prevent a plugin (or application) from working.

VoiceAttack will check for/load plugins when it starts. It needs to be restarted to load new plugins.

Thank You. A sloppy misstake regarding typo. I did instead copy functionheaders,and for some of them, also the content, directly from example source to avoid typos.
Still no showup in the plugin manager.

Im starting wondering if it has something to do with the build of project/directory structure from the Apps in VA?
As I understand from reading, VA will find the needed dll provided its stored in a subdirectory of Apps.(?).
I also understand thes no restriction in number of subdirectories?

Another thing regarding build. I build dll for 64b cpu.

Is there any restrictions how many plugins you can use with VA?  regards

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4757
  • RTFM
Re: plugin file
« Reply #8 on: July 17, 2021, 09:08:14 AM »
Have you tried building the example plugin, and seeing whether that gets loaded correctly? That project is configured in a manner known to produce a working plugin.

The plugin should indeed be placed in a subfolder of the "Apps" directory, as mentioned in the documentation.
Not sure what type of restriction you're referring to. Plugins can be placed several folders deep, as long as those folders are inside the "Apps" directly, if that's what you mean.

The example plugin is built as AnyCPU, in order to work with both 64bit and 32bit version of VoiceAttack (this is also mentioned in the documentation), however building for a specific platform should work, as long as it matches the bitness of your VoiceAttack installation.


There is no artificial restriction on the total amount of plugins, as far as I'm aware.

jane

  • Newbie
  • *
  • Posts: 49
Re: plugin file
« Reply #9 on: July 17, 2021, 09:12:41 AM »
Have you tried building the example plugin, and seeing whether that gets loaded correctly? That project is configured in a manner known to produce a working plugin.

The plugin should indeed be placed in a subfolder of the "Apps" directory, as mentioned in the documentation.
Not sure what type of restriction you're referring to. Plugins can be placed several folders deep, as long as those folders are inside the "Apps" directly, if that's what you mean.

The example plugin is built as AnyCPU, in order to work with both 64bit and 32bit version of VoiceAttack (this is also mentioned in the documentation), however building for a specific platform should work, as long as it matches the bitness of your VoiceAttack installation.


There is no artificial restriction on the total amount of plugins, as far as I'm aware.

Thanks, Ill do the example test then :)

jane

  • Newbie
  • *
  • Posts: 49
Re: plugin file
« Reply #10 on: July 17, 2021, 09:50:14 AM »
Have you tried building the example plugin, and seeing whether that gets loaded correctly? That project is configured in a manner known to produce a working plugin.

The plugin should indeed be placed in a subfolder of the "Apps" directory, as mentioned in the documentation.
Not sure what type of restriction you're referring to. Plugins can be placed several folders deep, as long as those folders are inside the "Apps" directly, if that's what you mean.

The example plugin is built as AnyCPU, in order to work with both 64bit and 32bit version of VoiceAttack (this is also mentioned in the documentation), however building for a specific platform should work, as long as it matches the bitness of your VoiceAttack installation.


There is no artificial restriction on the total amount of plugins, as far as I'm aware.

hi.and thanks for answer.  Both 32 and 64b worked.(showed up in plugin manager) Last q before i dive into examples: Is there any restrictions in naming plugin, class witin it? regards

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4757
  • RTFM
Re: plugin file
« Reply #11 on: July 17, 2021, 09:54:15 AM »
Quote from: VoiceAttackHelp.pdf
You can call your classes anything you want.
VoiceAttack will find all the classes in your .dll that meet the criteria and reference each
class as a separate plugin (this way if you have multiple plugins per assembly (.dll))