diff --git a/src/Eryph.ComputeClient.Commands/Catlets/CatletConfigCmdlet.cs b/src/Eryph.ComputeClient.Commands/Catlets/CatletConfigCmdlet.cs index 58c99cd..6dc05eb 100644 --- a/src/Eryph.ComputeClient.Commands/Catlets/CatletConfigCmdlet.cs +++ b/src/Eryph.ComputeClient.Commands/Catlets/CatletConfigCmdlet.cs @@ -23,17 +23,10 @@ protected static CatletConfig DeserializeConfigString(string configString) configString = configString.Replace("\r\n", "\n"); if (configString.StartsWith("{") && configString.EndsWith("}")) - return CatletConfigDictionaryConverter.Convert(ConfigModelJsonSerializer.DeserializeToDictionary(configString)); + return CatletConfigJsonSerializer.Deserialize(configString); - //YAML - try - { - return CatletConfigYamlSerializer.Deserialize(configString); - } - catch (YamlException ex) - { - throw ex; - } + + return CatletConfigYamlSerializer.Deserialize(configString); } diff --git a/src/Eryph.ComputeClient.Commands/Catlets/GetCatletCommand.cs b/src/Eryph.ComputeClient.Commands/Catlets/GetCatletCommand.cs index 4a7bbe3..2dad3b7 100644 --- a/src/Eryph.ComputeClient.Commands/Catlets/GetCatletCommand.cs +++ b/src/Eryph.ComputeClient.Commands/Catlets/GetCatletCommand.cs @@ -76,8 +76,8 @@ protected override void ProcessRecord() private void WriteConfig(CatletConfiguration config) { - var catletConfig = CatletConfigDictionaryConverter.Convert( - ConfigModelJsonSerializer.DeserializeToDictionary(config.Configuration)); + var catletConfig = CatletConfigJsonSerializer.Deserialize( + config.Configuration); var yaml = CatletConfigYamlSerializer.Serialize(catletConfig); WriteObject(yaml); diff --git a/src/Eryph.ComputeClient.Commands/Catlets/NewCatletCommand.cs b/src/Eryph.ComputeClient.Commands/Catlets/NewCatletCommand.cs index 0b2eb8f..96d6a50 100644 --- a/src/Eryph.ComputeClient.Commands/Catlets/NewCatletCommand.cs +++ b/src/Eryph.ComputeClient.Commands/Catlets/NewCatletCommand.cs @@ -2,8 +2,6 @@ using System.Collections; using System.Management.Automation; using System.Text; -using System.Text.Json; -using System.Text.RegularExpressions; using Eryph.ComputeClient.Models; using Eryph.ConfigModel.Catlets; using Eryph.ConfigModel.Json; @@ -105,7 +103,7 @@ protected override void EndProcessing() if (!PopulateVariables(config, Variables, SkipVariablesPrompt)) return; - var serializedConfig = JsonSerializer.SerializeToElement(config, ConfigModelJsonSerializer.DefaultOptions); + var serializedConfig = CatletConfigJsonSerializer.SerializeToElement(config); WaitForOperation( Factory.CreateCatletsClient().Create( diff --git a/src/Eryph.ComputeClient.Commands/Eryph.ComputeClient.Commands.csproj b/src/Eryph.ComputeClient.Commands/Eryph.ComputeClient.Commands.csproj index e2c573d..95f62b2 100644 --- a/src/Eryph.ComputeClient.Commands/Eryph.ComputeClient.Commands.csproj +++ b/src/Eryph.ComputeClient.Commands/Eryph.ComputeClient.Commands.csproj @@ -9,9 +9,10 @@ - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Eryph.ComputeClient.Commands/Networks/GetVNetworksCommand.cs b/src/Eryph.ComputeClient.Commands/Networks/GetVNetworksCommand.cs index 347150c..9186df5 100644 --- a/src/Eryph.ComputeClient.Commands/Networks/GetVNetworksCommand.cs +++ b/src/Eryph.ComputeClient.Commands/Networks/GetVNetworksCommand.cs @@ -64,13 +64,11 @@ protected override void ProcessRecord() private void WriteConfig(VirtualNetworkConfiguration config) { + var networkConfig = ProjectNetworksConfigJsonSerializer.Deserialize( + config.Configuration); - var catletConfig = ProjectNetworksConfigDictionaryConverter.Convert( - ConfigModelJsonSerializer.DeserializeToDictionary(config.Configuration)); - - var yaml = ProjectNetworkConfigYamlSerializer.Serialize(catletConfig); + var yaml = ProjectNetworksConfigYamlSerializer.Serialize(networkConfig); WriteObject(yaml); - } } diff --git a/src/Eryph.ComputeClient.Commands/Networks/NetworkConfigCmdlet.cs b/src/Eryph.ComputeClient.Commands/Networks/NetworkConfigCmdlet.cs index 98245e3..4c2b180 100644 --- a/src/Eryph.ComputeClient.Commands/Networks/NetworkConfigCmdlet.cs +++ b/src/Eryph.ComputeClient.Commands/Networks/NetworkConfigCmdlet.cs @@ -5,32 +5,20 @@ using Eryph.ConfigModel.Yaml; using YamlDotNet.Core; -namespace Eryph.ComputeClient.Commands.Networks -{ - public class NetworkConfigCmdlet : NetworkCmdLet - { +namespace Eryph.ComputeClient.Commands.Networks; - protected static ProjectNetworksConfig DeserializeConfigString(string configString) - { - configString = configString.Trim(); - configString = configString.Replace("\r\n", "\n"); +public class NetworkConfigCmdlet : NetworkCmdLet +{ - if (configString.StartsWith("{") && configString.EndsWith("}")) - return ProjectNetworksConfigDictionaryConverter.Convert( - ConfigModelJsonSerializer.DeserializeToDictionary(configString)); + protected static ProjectNetworksConfig DeserializeConfigString(string configString) + { + configString = configString.Trim(); + configString = configString.Replace("\r\n", "\n"); - - //YAML - try - { - return ProjectNetworkConfigYamlSerializer.Deserialize(configString); - } - catch (YamlException ex) - { - throw ex; - } + if (configString.StartsWith("{") && configString.EndsWith("}")) + return ProjectNetworksConfigJsonSerializer.Deserialize(configString); - } + return ProjectNetworksConfigYamlSerializer.Deserialize(configString); } -} \ No newline at end of file +} diff --git a/src/Eryph.ComputeClient.Commands/Networks/SetVNetworkCommand.cs b/src/Eryph.ComputeClient.Commands/Networks/SetVNetworkCommand.cs index e4174f5..9bbe3c6 100644 --- a/src/Eryph.ComputeClient.Commands/Networks/SetVNetworkCommand.cs +++ b/src/Eryph.ComputeClient.Commands/Networks/SetVNetworkCommand.cs @@ -1,10 +1,8 @@ using System; using System.Management.Automation; using System.Text; -using System.Text.Json; using Eryph.ComputeClient.Models; using Eryph.ConfigModel.Json; -using Eryph.ConfigModel.Networks; using JetBrains.Annotations; namespace Eryph.ComputeClient.Commands.Networks @@ -77,7 +75,7 @@ protected override void EndProcessing() } config.Project = ProjectName; - var configJson = JsonSerializer.SerializeToElement(config, ConfigModelJsonSerializer.DefaultOptions); + var configJson = ProjectNetworksConfigJsonSerializer.SerializeToElement(config); WaitForOperation( Factory.CreateVirtualNetworksClient().UpdateConfig(