Example #1
0
        /// <summary>
        /// Deserializes an ABSave document into a whole object.
        /// </summary>
        /// <typeparam name="T">The type of the object to deserialize into.</typeparam>
        /// <param name="str">The string to deserialize from.</param>
        /// <param name="type">The type of the ABSave Document.</param>
        /// <param name="errorHandler">The way of handling errors through the process.</param>
        /// <returns></returns>
        public static T ABSaveToObject <T>(string str, ABSaveType type, ABSaveSettings errorHandler = null)
        {
            // Create a new parser.
            var parser = new ABSaveParser <T>(type, errorHandler);

            // Start the new parser.
            parser.Start(str);

            // Return the result.
            return(parser.Result);
        }
Example #2
0
        public void DebugParser()
        {
            var headerTest = new char[] { 'u', 'n', 'v', 'm' };

            for (int i = 0; i < headerTest.Length; i++)
            {
                var parser = new ABSaveParser <TestClass>(ABSaveType.WithNames, new ABSaveSettings(new ABSaveErrorHandler(ABSoftware.ABSave.Exceptions.Base.ABSaveError.InvalidValueInABSaveWhenParsing,
                                                                                                                          (e) => MessageBox.Show("ERROR: " + e.Message))));

                parser.Start(headerTest[i] + "\u0001str\u0001heyhey\u0001i\u00011617");

                Console.WriteLine("debug");
            }
        }