예제 #1
0
        /// <summary>
        /// serialises a Language object
        /// </summary>
        /// <returns>Language_Serialised object</returns>
        /// <param name="l">Language to be converted</param>
        public static Language_Serialised Language_serialise(Language l)
        {
            Language_Serialised langSerialisedOut = null;

            langSerialisedOut = new Language_Serialised(l);
            return(langSerialisedOut);
        }
예제 #2
0
 /// <summary>
 /// Constructor for Language using Language_Serialised.
 /// For use when de-serialising.
 /// </summary>
 /// <param name="ls">Language_Serialised object to use as source</param>
 public Language(Language_Serialised ls)
 {
     this.id      = ls.id;
     this.dialect = ls.dialect;
     // baseLanguage to be inserted later
     this.baseLanguage = null;
 }
예제 #3
0
        /// <summary>
        /// Writes a Language or Language_Serialised object to the database
        /// </summary>
        /// <returns>bool indicating success</returns>
        /// <param name="gameID">Game (bucket) to write to</param>
        /// <param name="l">Language to write</param>
        /// <param name="ls">Language_Serialised to write</param>
        public static bool DatabaseWrite_Language(string gameID, Language l = null, Language_Serialised ls = null)
        {
            if (l != null)
            {
                // convert Language into Language_Serialised
                ls = DatabaseWrite.Language_serialise(l);
            }

            // write Language_Serialised to database
            var rLanguage         = new RiakObject(gameID, ls.id, ls);
            var putLanguageResult = Globals_Server.rClient.Put(rLanguage);

            if (!putLanguageResult.IsSuccess)
            {
                Globals_Server.logError("Write failed: Language " + rLanguage.Key + " to bucket " + rLanguage.Bucket);
            }

            return(putLanguageResult.IsSuccess);
        }