diff --git a/AApp/TheUser.cs b/AApp/TheUser.cs index 7ab61c8..d0210e8 100644 --- a/AApp/TheUser.cs +++ b/AApp/TheUser.cs @@ -87,6 +87,18 @@ namespace SCJMapper_V2 return Path.Combine( UserDir, mapName + ".xml" ); } + /// + /// Returns the Layout Groups Json file name + path into our user dir + /// + /// A fully qualified filename + static public string LayoutJsonFileName( ) + { + log.Debug( "LayoutJsonFileName - Entry" ); + + return Path.Combine( UserDir, "LayoutGroups.json" ); + } + + /// /// Returns the mapping file name + path into our user dir /// diff --git a/Layout/ActionGroups.cs b/Layout/ActionGroups.cs index ca7f539..4c62268 100644 --- a/Layout/ActionGroups.cs +++ b/Layout/ActionGroups.cs @@ -11,6 +11,9 @@ namespace SCJMapper_V2.Layout /// class ActionGroups { + // logger + private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType ); + /// /// All actionmap groups /// @@ -24,7 +27,7 @@ namespace SCJMapper_V2.Layout Player, EVA, Vehicle, - VehicleWeapons, + //VehicleWeapons, // removed in 3.10.0 Lights, Interaction, Spectator, @@ -39,33 +42,57 @@ namespace SCJMapper_V2.Layout static ActionGroups() { m_actionDict = new Dictionary>( ); - // Define which maps belongs to which group - var x = new List( ) { "spaceship_general", "spaceship_view", "spaceship_movement", "spaceship_docking", "spaceship_power", "IFCS_controls" }; - m_actionDict.Add( EGroup.SpaceFlight, x ); - x = new List( ) { "spaceship_targeting", "spaceship_target_hailing", "spaceship_scanning", "spaceship_ping", "spaceship_radar" }; - m_actionDict.Add( EGroup.SpaceTargeting, x ); - x = new List( ) { "spaceship_mining" }; - m_actionDict.Add( EGroup.SpaceMining, x ); - x = new List( ) { "spaceship_turret", "spaceship_weapons", "spaceship_missiles", "spaceship_auto_weapons" }; - m_actionDict.Add( EGroup.SpaceWeapons, x ); - x = new List( ) { "spaceship_defensive" }; - m_actionDict.Add( EGroup.SpaceDefensive, x ); - x = new List( ) { "lights_controller" }; - m_actionDict.Add( EGroup.Lights, x ); - x = new List( ) { "default", "prone", "player", "player_choice", "player_emotes", "player_input_optical_tracking" }; - m_actionDict.Add( EGroup.Player, x ); - x = new List( ) { "zero_gravity_eva" }; - m_actionDict.Add( EGroup.EVA, x ); - x = new List( ) { "vehicle_general", "vehicle_driver" }; - m_actionDict.Add( EGroup.Vehicle, x ); - x = new List( ) { "vehicle_gunner" }; - m_actionDict.Add( EGroup.VehicleWeapons, x ); - x = new List( ) { "spaceship_hud", "ui_textfield", "ui_notification" }; - m_actionDict.Add( EGroup.Interaction, x ); - x = new List( ) { "spectator", "flycam", "view_director_mode" }; - m_actionDict.Add( EGroup.Spectator, x ); - x = new List( ) { }; - m_actionDict.Add( EGroup.Others, x ); + + // Try to read the user file + var lg = LayoutGroupsJson.FromJson( TheUser.LayoutJsonFileName( ) ); + if ( lg != null ) { + log.Info( "Layout-ActionGroups: use user provided file" ); + // read from the user file + m_actionDict.Add( EGroup.SpaceFlight, lg.SpaceFlight ); + m_actionDict.Add( EGroup.SpaceTargeting, lg.SpaceTargeting ); + m_actionDict.Add( EGroup.SpaceMining, lg.SpaceMining ); + m_actionDict.Add( EGroup.SpaceWeapons, lg.SpaceWeapons ); + m_actionDict.Add( EGroup.SpaceDefensive, lg.SpaceDefensive ); + m_actionDict.Add( EGroup.Lights, lg.Lights ); + m_actionDict.Add( EGroup.Player, lg.Player ); + m_actionDict.Add( EGroup.EVA, lg.EVA ); + m_actionDict.Add( EGroup.Vehicle, lg.Vehicle ); + //m_actionDict.Add( EGroup.VehicleWeapons, lg.VehicleWeapons ); // removed in 3.10.0 + m_actionDict.Add( EGroup.Interaction, lg.Interaction ); + m_actionDict.Add( EGroup.Spectator, lg.Spectator ); + m_actionDict.Add( EGroup.Others, lg.Others ); + } + else { + log.Info( "Layout-ActionGroups: user provided file not available, use internal backup mapping" ); + // use the built in backup assignment (as of 3.10.0/1 + // Define which maps belongs to which group + var x = new List( ) { "spaceship_general", "spaceship_view", "spaceship_movement", "spaceship_docking", "spaceship_power", "IFCS_controls" }; + m_actionDict.Add( EGroup.SpaceFlight, x ); + x = new List( ) { "spaceship_targeting", "spaceship_target_hailing", "spaceship_scanning", "spaceship_ping", "spaceship_radar", "spaceship_targeting_advanced" }; + m_actionDict.Add( EGroup.SpaceTargeting, x ); + x = new List( ) { "spaceship_mining" }; + m_actionDict.Add( EGroup.SpaceMining, x ); + x = new List( ) { "turret_main", "spaceship_weapons", "spaceship_missiles", "spaceship_auto_weapons" }; + m_actionDict.Add( EGroup.SpaceWeapons, x ); + x = new List( ) { "spaceship_defensive" }; + m_actionDict.Add( EGroup.SpaceDefensive, x ); + x = new List( ) { "lights_controller" }; + m_actionDict.Add( EGroup.Lights, x ); + x = new List( ) { "default", "prone", "player", "player_choice", "player_emotes", "player_input_optical_tracking" }; + m_actionDict.Add( EGroup.Player, x ); + x = new List( ) { "zero_gravity_eva" }; + m_actionDict.Add( EGroup.EVA, x ); + x = new List( ) { "vehicle_general", "vehicle_driver" }; + m_actionDict.Add( EGroup.Vehicle, x ); + //x = new List( ) { "vehicle_gunner" }; // removed in 3.10.0 + //m_actionDict.Add( EGroup.VehicleWeapons, x ); // removed in 3.10.0 + x = new List( ) { "spaceship_hud", "ui_textfield", "ui_notification" }; + m_actionDict.Add( EGroup.Interaction, x ); + x = new List( ) { "spectator", "flycam", "view_director_mode" }; + m_actionDict.Add( EGroup.Spectator, x ); + x = new List( ) { "server_renderer" }; + m_actionDict.Add( EGroup.Others, x ); + } } /// diff --git a/Layout/LayoutGroups.cs b/Layout/LayoutGroups.cs new file mode 100644 index 0000000..81d2f0d --- /dev/null +++ b/Layout/LayoutGroups.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.Serialization; + +namespace SCJMapper_V2.Layout +{ + // The Json file for LayoutGroups + + /* + { + "_comment" : "Layout Groups File (leave group names alone, change only the contained groups)", + "SpaceFlight" :[ "spaceship_general", "spaceship_view", "spaceship_movement", "spaceship_docking", "spaceship_power", "IFCS_controls"], + "SpaceDefensive" :[ "spaceship_defensive" ], + "SpaceTargeting" :[ "spaceship_targeting", "spaceship_target_hailing", "spaceship_scanning", "spaceship_ping", "spaceship_radar", "spaceship_targeting_advanced" ], + "SpaceWeapons" :[ "turret_main", "spaceship_weapons", "spaceship_missiles", "spaceship_auto_weapons" ], + "SpaceMining" :[ "spaceship_mining" ], + "Player" :[ "default", "prone", "player", "player_choice", "player_emotes", "player_input_optical_tracking" ], + "EVA" :[ "zero_gravity_eva" ], + "Vehicle" :[ "vehicle_general", "vehicle_driver" ], + "Lights" :[ "lights_controller" ], + "Interaction" :[ "spaceship_hud", "ui_textfield", "ui_notification" ], + "Spectator" :[ "spectator", "flycam", "view_director_mode" ], + "Others" :[ "server_renderer" ] + } + + */ + + /// + /// The LaoutGroups File + /// + [DataContract] + class LayoutGroups + { + [DataMember( IsRequired = false )] + public string _comment { get; set; } + [DataMember( IsRequired = true )] + public List SpaceFlight { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List SpaceDefensive { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List SpaceTargeting { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List SpaceWeapons { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List SpaceMining { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List Player { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List EVA { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List Vehicle { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List Lights { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List Interaction { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List Spectator { get; set; } = new List( ); + [DataMember( IsRequired = true )] + public List Others { get; set; } = new List( ); + + // non Json + + } +} diff --git a/Layout/LayoutGroupsJson.cs b/Layout/LayoutGroupsJson.cs new file mode 100644 index 0000000..cc71ea3 --- /dev/null +++ b/Layout/LayoutGroupsJson.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.Serialization.Json; +using System.Text; +using System.Threading.Tasks; + +namespace SCJMapper_V2.Layout +{ + class LayoutGroupsJson + { + // logger + private static readonly log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType ); + + /// + /// Reads from a LayoutGroups file + /// + /// The Json Filename + /// A LayoutGroups obj or null for errors + public static LayoutGroups FromJson( string jFilename ) + { + LayoutGroups c = null; + if ( File.Exists( jFilename ) ) { + using ( var ts = File.OpenRead( jFilename ) ) { + c = FromJson( ts ); + } + } + else { + log.Debug( $"LayoutGroups.FromJson: Userfile does not exist ({jFilename})" ); + } + return c; + } + + + /// + /// Reads from a LayoutGroups stream + /// + /// An open stream at position + /// A LayoutGroups obj or null for errors + public static LayoutGroups FromJson( Stream jStream ) + { + try { + var jsonSerializer = new DataContractJsonSerializer( typeof( LayoutGroups ) ); + object objResponse = jsonSerializer.ReadObject( jStream ); + var jsonResults = objResponse as LayoutGroups; + return jsonResults; + } + catch ( Exception e ) { + log.Debug( $"LayoutGroups.FromJson: Serializer Exception ({e.Message})" ); + return null; + } + } + + + } +} diff --git a/Layout/MapProps.cs b/Layout/MapProps.cs index f2dfb1a..aa3f5d6 100644 --- a/Layout/MapProps.cs +++ b/Layout/MapProps.cs @@ -122,7 +122,7 @@ namespace SCJMapper_V2.Layout { EGroup.Player, ConvertFromString(AppSettings.Instance.GroupColor_05) }, { EGroup.EVA, ConvertFromString(AppSettings.Instance.GroupColor_06) }, { EGroup.Vehicle, ConvertFromString(AppSettings.Instance.GroupColor_07) }, - { EGroup.VehicleWeapons, ConvertFromString(AppSettings.Instance.GroupColor_08) }, + // { EGroup.VehicleWeapons, ConvertFromString(AppSettings.Instance.GroupColor_08) }, // removed in 3.10.0 { EGroup.Lights, ConvertFromString(AppSettings.Instance.GroupColor_09) }, { EGroup.Interaction, ConvertFromString(AppSettings.Instance.GroupColor_10) }, { EGroup.Spectator, ConvertFromString(AppSettings.Instance.GroupColor_11) }, @@ -145,7 +145,7 @@ namespace SCJMapper_V2.Layout AppSettings.Instance.GroupColor_05 = ConvertToString( m_amColors[EGroup.Player] ); AppSettings.Instance.GroupColor_06 = ConvertToString( m_amColors[EGroup.EVA] ); AppSettings.Instance.GroupColor_07 = ConvertToString( m_amColors[EGroup.Vehicle] ); - AppSettings.Instance.GroupColor_08 = ConvertToString( m_amColors[EGroup.VehicleWeapons] ); + // AppSettings.Instance.GroupColor_08 = ConvertToString( m_amColors[EGroup.VehicleWeapons] );// removed in 3.10.0 AppSettings.Instance.GroupColor_09 = ConvertToString( m_amColors[EGroup.Lights] ); AppSettings.Instance.GroupColor_10 = ConvertToString( m_amColors[EGroup.Interaction] ); AppSettings.Instance.GroupColor_11 = ConvertToString( m_amColors[EGroup.Spectator] ); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index a2cc65d..4ad62dd 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion( "2.47.0.82" )] -[assembly: AssemblyFileVersion( "2.47.0.82" )] +[assembly: AssemblyVersion( "2.48.0.83" )] +[assembly: AssemblyFileVersion( "2.48.0.83" )] diff --git a/ReadMe.txt b/ReadMe.txt index 419f391..1f68fce 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,12 +1,12 @@ -SC Joystick Mapper V 2.47 - Build 82 BETA -(c) Cassini, StandardToaster - 12-Apr-2020 +SC Joystick Mapper V 2.48 - Build 83 BETA +(c) Cassini, StandardToaster - 18-Aug-2020 Contains 14 files + graphics: -SCJMapper.exe The program (V2.46) +SCJMapper.exe The program (V2.48) - The following files and folders MUST be in the same folder as the Exe file -SCJMapper.exe.config Program config (V2.47) +SCJMapper.exe.config Program config (V2.48) de\SCJMapper.resources.dll German language (V2.45) fr\SCJMapper.resources.dll French language (V2.45) Storage\*.scj Folder for collected assets (V2.35) @@ -20,9 +20,9 @@ x64\libzstd.dll Native dll for ZstdNet (v2.33) x86\libzstd.dll Native dll for ZstdNet (v2.33) log4net.dll Managed Logging Assembly log4net.config.OFF Config file for logging - then look for trace.log in the same folder + rename without .OFF, restart and then look for trace.log in the same folder -SCJMapper_QGuide V2.35beta.pdf Quick Guide (v2.35) +SCJMapper_QGuide V2.47beta.pdf Quick Guide (v2.47) ReadMe.txt This file graphics folder Skybox Images (V2.32) - graphics folder MUST be in the same folder as the Exe file @@ -50,6 +50,8 @@ Scanned for viruses before packing... cassini@burri-web.org Changelog: +V 2.48 - BETA Build 83 +- updated Actionmap Groups for Layout Dialog taken from LayoutGroups.json from Documents\SCJMapper\[PTU] folder V 2.47 - BETA Build 82 - add Mode to create SCJoyServer Command items from action tree - add Saving ActionTree to a json file in \Documents\SCJM\file.scjn.json for other tools (easier than XML) diff --git a/SCJMapper-V2.csproj b/SCJMapper-V2.csproj index 6575020..0570c13 100644 --- a/SCJMapper-V2.csproj +++ b/SCJMapper-V2.csproj @@ -27,8 +27,8 @@ false false true - 82 - 2.47.0.82 + 83 + 2.48.0.83 false true @@ -168,6 +168,8 @@ + + diff --git a/graphics/layouts/LayoutGroups.json b/graphics/layouts/LayoutGroups.json new file mode 100644 index 0000000..2502f67 --- /dev/null +++ b/graphics/layouts/LayoutGroups.json @@ -0,0 +1,62 @@ +{ + "_comment": "Layout Groups File as of Alpha 3.10.0 (leave group names alone, change only the contained groups)", + "SpaceFlight": [ + "spaceship_general", + "spaceship_view", + "spaceship_movement", + "spaceship_docking", + "spaceship_power", + "IFCS_controls" + ], + "SpaceDefensive": [ + "spaceship_defensive" + ], + "SpaceTargeting": [ + "spaceship_targeting", + "spaceship_target_hailing", + "spaceship_scanning", + "spaceship_ping", + "spaceship_radar", + "spaceship_targeting_advanced" + ], + "SpaceWeapons": [ + "turret_main", + "spaceship_weapons", + "spaceship_missiles", + "spaceship_auto_weapons" + ], + "SpaceMining": [ + "spaceship_mining" + ], + "Player": [ + "default", + "prone", + "player", + "player_choice", + "player_emotes", + "player_input_optical_tracking" + ], + "EVA": [ + "zero_gravity_eva" + ], + "Vehicle": [ + "vehicle_general", + "vehicle_driver" + ], + "Lights": [ + "lights_controller" + ], + "Interaction": [ + "spaceship_hud", + "ui_textfield", + "ui_notification" + ], + "Spectator": [ + "spectator", + "flycam", + "view_director_mode" + ], + "Others": [ + "server_renderer" + ] +} \ No newline at end of file