<commit_before>﻿using RelhaxModpack.DatabaseComponents;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;

namespace RelhaxModpack
{
    /// <summary>
    /// A database component is the base class for all other packages
    /// </summary>
    public class DatabasePackage : IDatabaseComponent, IXmlSerializable
    {
        #region Xml serialization
        /// <summary>
        /// Defines a list of properties in the class to be serialized into xml attributes
        /// </summary>
        /// <returns>A list of string property names</returns>
        /// <remarks>Xml attributes will always be written, xml elements are optional</remarks>
        public virtual string[] PropertiesForSerializationAttributes()
        {
            return PackagePropertiesToXmlParseAttributes.ToArray();
        }

        /// <summary>
        /// Defines a list of properties in the class to be serialized into xml elements
        /// </summary>
        /// <returns>A list of string property names</returns>
        /// <remarks>Xml attributes will always be written, xml elements are optional</remarks>
        public virtual string[] PropertiesForSerializationElements()
        {
            return PackagePropertiesToXmlParseElements.ToArray();
        }

        private static readonly List<string> PackagePropertiesToXmlParseAttributes = new List<string>()
        {
            nameof(PackageName),
            nameof(Enabled),
            nameof(InstallGroup),
            nameof(PatchGroup),
            nameof(UID)
        };

        private static readonly List<string> PackagePropertiesToXmlParseElements = new List<string>()
        {
            nameof(Size),
            nameof(Version),
            nameof(ZipFile),
            nameof(CRC),
            nameof(Timestamp),
            nameof(LogAtInstall),
            nameof(StartAddress),
            nameof(EndAddress),
            nameof(Triggers),
            nameof(DevURL),
            nameof(InternalNotes),
            nameof(Author),
            nameof(Maintainers)
        };
        #endregion

        #region Selection file processing
        private static readonly List<string> PackagePropertiesToSaveForSelectionFile = new List<string>()
        {
            nameof(PackageName),
            nameof(UID),
            nameof(ZipFile),
            nameof(Timestamp),
            nameof(CRC),
            nameof(Version)
        };

        /// <summary>
        /// Gets a list of property names that are used for saving/loading the selection V3 file format
        /// </summary>
        /// <returns></returns>
        public virtual string[] AttributesToXmlParseSelectionFiles()
        { return PackagePropertiesToSaveForSelectionFile.ToArray(); }
        #endregion
<commit_msg>add saving and loading of enabled property<commit_after>﻿using RelhaxModpack.DatabaseComponents;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;

namespace RelhaxModpack
{
    /// <summary>
    /// A database component is the base class for all other packages
    /// </summary>
    public class DatabasePackage : IDatabaseComponent, IXmlSerializable
    {
        #region Xml serialization
        /// <summary>
        /// Defines a list of properties in the class to be serialized into xml attributes
        /// </summary>
        /// <returns>A list of string property names</returns>
        /// <remarks>Xml attributes will always be written, xml elements are optional</remarks>
        public virtual string[] PropertiesForSerializationAttributes()
        {
            return PackagePropertiesToXmlParseAttributes.ToArray();
        }

        /// <summary>
        /// Defines a list of properties in the class to be serialized into xml elements
        /// </summary>
        /// <returns>A list of string property names</returns>
        /// <remarks>Xml attributes will always be written, xml elements are optional</remarks>
        public virtual string[] PropertiesForSerializationElements()
        {
            return PackagePropertiesToXmlParseElements.ToArray();
        }

        private static readonly List<string> PackagePropertiesToXmlParseAttributes = new List<string>()
        {
            nameof(PackageName),
            nameof(Enabled),
            nameof(InstallGroup),
            nameof(PatchGroup),
            nameof(UID)
        };

        private static readonly List<string> PackagePropertiesToXmlParseElements = new List<string>()
        {
            nameof(Size),
            nameof(Version),
            nameof(ZipFile),
            nameof(CRC),
            nameof(Timestamp),
            nameof(LogAtInstall),
            nameof(StartAddress),
            nameof(EndAddress),
            nameof(Triggers),
            nameof(DevURL),
            nameof(InternalNotes),
            nameof(Author),
            nameof(Maintainers)
        };
        #endregion

        #region Selection file processing
        private static readonly List<string> PackagePropertiesToSaveForSelectionFile = new List<string>()
        {
            nameof(PackageName),
            nameof(UID),
            nameof(ZipFile),
            nameof(Timestamp),
            nameof(CRC),
            nameof(Version),
            nameof(Enabled)
        };

        /// <summary>
        /// Gets a list of property names that are used for saving/loading the selection V3 file format
        /// </summary>
        /// <returns></returns>
        public virtual string[] AttributesToXmlParseSelectionFiles()
        { return PackagePropertiesToSaveForSelectionFile.ToArray(); }
        #endregion

{'fraction_non_alphanumeric': 0.08893976752377598, 'fraction_numerical': 0.0003522367030644593, 'mean_word_length': 2.093137254901961, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4441185', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1333, 'n_words': 377}