Start a new topic

Use consistent xml element order on save to make version control easier

I've struggled to version control a RoyalTS config file because the xml elements change order randomly. This makes it very difficult to see the actual change when using a tool like git and sharing the config with others.


My idea is to simply order the xml elements under each root note by name ascending. This way a lot of the configuration wouldn’t change in the way it currently does. It should be a case of running an OrderBy() as part of the save.

 

For example, under a connection element:

 

<RoyalRDSConnection>

  <ID>b3fa4e7c-436b-4925-bf35-08234e03c485</ID>

  <Name>Server1</Name>

  <Modified>06/29/2023 23:14:19.798</Modified>

  <Created>06/29/2023 23:14:19.798</Created>

  <ModifiedBy>James</ModifiedBy>

  <CreatedBy>James</CreatedBy>

  <PositionNr>2</PositionNr>

  <IsConnectionTemplate>False</IsConnectionTemplate>

  <AutomaticallyCalculateScaleFactor>True</AutomaticallyCalculateScaleFactor>

  <ColorDepth>24</ColorDepth>

  <ColorFromParent>False</ColorFromParent>

  <ConnectToAdministerOrConsole>False</ConnectToAdministerOrConsole>

  <CredentialFromParent>True</CredentialFromParent>

  <CredentialId>00000000-0000-0000-0000-000000000000</CredentialId>

  <CredentialOmitDomain>False</CredentialOmitDomain>

  <CustomImageList>{}</CustomImageList>

  <DesktopHeight>0</DesktopHeight>

  <DesktopWidth>0</DesktopWidth>

  <Favorite>False</Favorite>

  <LocalZoom>False</LocalZoom>

   <ParentID>b276350b-ff70-407c-adb8-a15fe74effe4</ParentID>

  <RDPPort>3389</RDPPort>

  <ScaleFactor>100</ScaleFactor>

  <SmartReconnect>False</SmartReconnect>

  <SmartSizing>False</SmartSizing>

  <URI>Server1.local</URI>

  <UseGlobalPlugInWin>True</UseGlobalPlugInWin>

  </RoyalRDSConnection>

 

Order the child elements by their element name:

 

<RoyalRDSConnection>

  <AutomaticallyCalculateScaleFactor>True</AutomaticallyCalculateScaleFactor>

  <ColorDepth>24</ColorDepth>

  <ColorFromParent>False</ColorFromParent>

  <ConnectToAdministerOrConsole>False</ConnectToAdministerOrConsole>

  <Created>06/29/2023 23:14:19.798</Created>

  <CreatedBy>James</CreatedBy>

  <CredentialFromParent>True</CredentialFromParent>

  <CredentialId>00000000-0000-0000-0000-000000000000</CredentialId>

  <CredentialOmitDomain>False</CredentialOmitDomain>

  <CustomImageList>{}</CustomImageList>

  <DesktopHeight>0</DesktopHeight>

  <DesktopWidth>0</DesktopWidth>

  <Favorite>False</Favorite>

  <ID>b3fa4e7c-436b-4925-bf35-08234e03c485</ID>

  <IsConnectionTemplate>False</IsConnectionTemplate>

  <LocalZoom>False</LocalZoom>

  <Modified>06/29/2023 23:14:19.798</Modified>

  <ModifiedBy>James</ModifiedBy>

  <Name>Server1</Name>

  <ParentID>b276350b-ff70-407c-adb8-a15fe74effe4</ParentID>

  <PositionNr>2</PositionNr>

  <RDPPort>3389</RDPPort>

  <ScaleFactor>100</ScaleFactor>

  <SmartReconnect>False</SmartReconnect>

  <SmartSizing>False</SmartSizing>

  <URI>Server1.local</URI>

  <UseGlobalPlugInWin>True</UseGlobalPlugInWin>

</RoyalRDSConnection>

 

This doesn’t break the schema, but keeps things more consistent between saves.


Thanks and keep up the good work on this excellent tool


James

Login or Signup to post a comment