예제 #1
0
        /// <summary>
        /// Constructor for Language_Serialised taking seperate values.
        /// For creating Language_Serialised from CSV file.
        /// </summary>
        /// <param name="id">string holding Language ID</param>
        /// <param name="bLang">string holding BaseLanguage (ID)</param>
        /// <param name="dial">int holding language dialect code</param>
        public Language_Serialised(string id, string bLang, int dial)
        {
            // VALIDATION

            // ID
            // trim id and bLang
            id    = id.Trim();
            bLang = bLang.Trim();

            if (!id.Contains(bLang))
            {
                throw new InvalidDataException("Language_Serialised ID be based on its BaseLanguage ID");
            }

            else if (!Utility_Methods.ValidateLanguageID(id))
            {
                throw new InvalidDataException("Language_Serialised ID must have the format 'lang_' followed by 1-2 letters, ending in 1-2 numbers");
            }

            // BLANG
            if (!Utility_Methods.ValidateLanguageID(bLang, "baseLang"))
            {
                throw new InvalidDataException("Language_Serialised BaseLanguage ID must have the format 'lang_' followed by 1-2 letters");
            }

            // DIALECT
            if (dial < 1)
            {
                throw new InvalidDataException("Language dialect code must be an integer >= 0");
            }

            this.id           = id;
            this.baseLanguage = bLang;
            this.dialect      = dial;
        }
예제 #2
0
        /// <summary>
        /// Constructor for TitleName
        /// </summary>
        /// <param name="lang">string holding Language ID</param>
        /// <param name="nam">string holding title name associated with specific language</param>
        public TitleName(string lang, string nam)
        {
            // VALIDATION

            // LANG
            // trim
            lang = lang.Trim();

            if ((!Utility_Methods.ValidateLanguageID(lang)) && (!lang.Equals("generic")))
            {
                throw new InvalidDataException("TitleName langID must either be 'generic' or have the format 'lang_' followed by 1-2 letters, ending in 1-2 numbers");
            }

            // NAM
            // trim and ensure 1st is uppercase
            nam = Utility_Methods.FirstCharToUpper(nam.Trim());

            if (!Utility_Methods.ValidateName(nam))
            {
                throw new InvalidDataException("TitleName name must be 1-40 characters long and contain only valid characters (a-z and ') or spaces");
            }

            this.langID = lang;
            this.name   = nam;
        }
예제 #3
0
        /// <summary>
        /// Constructor for BaseLanguage
        /// </summary>
        /// <param name="id">String holding language ID</param>
        /// <param name="nam">String holding language name</param>
        public BaseLanguage(String id, String nam)
        {
            // VALIDATION

            // ID
            // trim
            id = id.Trim();

            if (!Utility_Methods.ValidateLanguageID(id, "baseLang"))
            {
                throw new InvalidDataException("BaseLanguage ID must have the format 'lang_' followed by 1-2 letters");
            }

            // NAM
            // trim and ensure 1st is uppercase
            nam = Utility_Methods.FirstCharToUpper(nam.Trim());

            if (!Utility_Methods.ValidateName(nam))
            {
                throw new InvalidDataException("BaseLanguage name must be 1-40 characters long and contain only valid characters (a-z and ') or spaces");
            }

            this.id   = id;
            this.name = nam;
        }