Table of Contents

Legacy Plugin Configuration

Configuration when using PluginBase instead of PluginBase2 uses XML.

Basic example

<!-- For PluginBase -->
<root>
  <logging>
    <logLevel>Trace</logLevel>
  </logging>
</root>
<!-- When using PluginBase2 you can configure the trace configuration in either the secure or unsecure configuration. Secure config will take precedence if specified in both. See https://docs.hitachisolutions.com/hslxrmsdk/articles/getting-started-plugins.html#trace-configuration -->
{ "TraceConfiguration": { "LogLevel": "Warn", "Indent": "  ", "LogContext": false } }

LogLevel values:
  None = 0,
  Critical = 1,
  Error = 2,
  Warning = 3,
  Info = 4,
  Debug = 5,
  Trace = 6

-->

Every possible option

<root>
  <logging>
    <logLevel>Warning</logLevel>
    <indent>  </indent>
    <logContext>false</logContext>
  </logging>
  <settings mycustomstring="Hello World!" mycustombool="true" mycustomint="1" />
  <SpecialConfiguration>
    <MyString>Hello World!</MyString>
    <MyInt>2147483647</MyInt>
    <MyDouble>3.14159</MyDouble>
    <MyBool>false</MyBool>
  </SpecialConfiguration>
</root>

All options explained

<root>
  <logging>
    <!--logLevel: controls which messages appear in the trace
        Options from most to least restrictive: 
          None, Critical, Error, Warning, Info, Debug, Trace
        Default: Info-->
    <logLevel>Error</logLevel>
    
    <!--indent: sets indent string | Default: \t-->
    <indent>    </indent>
    
    <!--logContext: whether to trace the context of the message | Default: false-->
    <logContext>false</logContext>
  </logging>
  
  <!--        
  Custom Configuration Settings: settings node
  
  Custom configuration settings can be specified in the unsecure and secure 
  configuration by adding a <settings> node to the XML it contains. Any attributes 
  of the <settings> node will be deserialized along with their values and they can 
  be accessed from the configuration manager by using the SecureConfig or 
  UnsecureConfig properties of the PluginConfigurationManager object.  The 
  <settings> node must be a direct child of the document's root node as the XPath 
  used to find the element is "/*/settings".
  
  Example of accessing custom settings using the XML in the example:
                  
  string mystring = pluginEventContext.ConfigManager.UnsecureConfig.GetItemConvertedAs(
    "mycustomstring", "default string");
  int myint = pluginEventContext.ConfigManager.UnsecureConfig.GetItemConvertedAs(
    "mycustomint", 0);
  bool mybool = pluginEventContext.ConfigManager.UnsecureConfig.GetItemConvertedAs(
    "mycustombool", false);
  -->
  <settings mycustomstring="Hello World!" mycustombool="true" mycustomint="1" />
  
  <!--
  Custom Configuration Settings: custom node
  
  Custom configuration settings can also be pulled from a custom Xml node which can be 
  used to initialize a dynamic object. 
  
  var specialConfigXel = configManager.UnsecureConfigXml?.Element("SpecialConfiguration");
  var myConfig = new 
  {
      MyString = (string)specialConfigXel?.Element("MyString") ?? "default string value",
      MyInt = (int?)specialConfigXel?.Element("MyInt") ?? 2,
      MyDouble = (double?)specialConfigXel?.Element("MyDouble") ?? 2.3,
      MyBool = (bool?)specialConfigXel?.Element("MyBool") ?? false
  };
  -->
  <SpecialConfiguration>
    <MyString>Hello World!</MyString>
    <MyInt>2147483647</MyInt>
    <MyDouble>3.14159</MyDouble>
    <MyBool>false</MyBool>
  </SpecialConfiguration>
</root>