v1.3.0 Restructure Saxonite workspace and upgrade to .NET 10 (#1)
Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes. - Relocate application and library projects while retaining Git rename history. - Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests. - Update Common integration, application version, and repository documentation. Application version: 1.3.0 Reviewed-on: #1 Co-authored-by: andy <andy@sarand.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using static Saxonite.Net.Standard.Base.Bus.SaxUserConfig;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Data
|
||||
{
|
||||
//==========================================================================
|
||||
public class SaxConfigData
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
private static readonly String ElementName_Config = "Config";
|
||||
private static readonly String ElementName_Profile = "Profile";
|
||||
private static readonly String ElementName_Eligibility = "Eligibility";
|
||||
private static readonly String ElementName_HideInfo = "HideInfo";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Profile settings.</summary>
|
||||
public class ProfileData
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
/// <summary>Eligibility settings.</summary>
|
||||
public class EligibilityData
|
||||
{
|
||||
/// <summary>Hide the eligbiility information tip.</summary>
|
||||
public bool HideInfo { get; set; }
|
||||
}
|
||||
public EligibilityData Eligibility { get; set; } = new EligibilityData();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
/// <summary>Serialise to XML.</summary>
|
||||
public static String ToXml(ProfileData profile)
|
||||
{
|
||||
String fn = typeof(ProfileData).FullName + ".GetConfigData";
|
||||
try
|
||||
{
|
||||
XDocument doc = new XDocument();
|
||||
XElement configElement = doc.AppendElement(ElementName_Config);
|
||||
// Profile.
|
||||
XElement profileElement = configElement.AppendElement(ElementName_Profile);
|
||||
// Profile - Eligibility.
|
||||
XElement eligibilityElement = profileElement.AppendElement(ElementName_Eligibility);
|
||||
if (profile.Eligibility.HideInfo)
|
||||
eligibilityElement.AppendElement(ElementName_HideInfo, "1");
|
||||
return doc.GetXml();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
/// <summary>Deserialise from XML.</summary>
|
||||
public static ProfileData FromXml(String configData)
|
||||
{
|
||||
String fn = typeof(ProfileData).FullName + ".ExtractConfig";
|
||||
ProfileData profile = new ProfileData();
|
||||
if (StringUtil.IsEmpty(configData)) return profile;
|
||||
try
|
||||
{
|
||||
// Load XML data.
|
||||
// NB Serialised data has 'Config' as root element
|
||||
XDocument doc = XDocument.Parse(configData);
|
||||
XElement rootElement = doc.Root;
|
||||
foreach (XElement rootChildElement in rootElement.GetChildElements())
|
||||
{
|
||||
String rootChildElementName = rootChildElement.GetLocalName();
|
||||
if (rootChildElementName.EqualsCI(ElementName_Profile))
|
||||
{
|
||||
// Profile.
|
||||
XElement profileElement = rootChildElement;
|
||||
foreach (XElement profileChildElement in profileElement.GetChildElements())
|
||||
{
|
||||
String profileChildElementName = profileChildElement.GetLocalName();
|
||||
if (profileChildElementName.EqualsCI(ElementName_Eligibility))
|
||||
{
|
||||
// Profile - Eligibility.
|
||||
XElement eligibilityElement = profileChildElement;
|
||||
String hideInfo = eligibilityElement.GetChildText(ElementName_HideInfo);
|
||||
profile.Eligibility.HideInfo = StringUtil.ToBool(hideInfo);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Profile' child element: " + profileChildElementName);
|
||||
}
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user