Beispiel #1
0
        /// <summary>
        /// Writes whole object to file. Very Untested and should only be used with care.
        /// </summary>
        /// <param name="path">Path to file.</param>
        /// <param name="obj">Object to pass through.</param>
        /// <typeparam name="T">The 1st type parameter.</typeparam>
        public static void WriteToFile <T> (string path, T obj)
        {
            EiBuffer buffer = new EiBuffer(true);

            buffer.WriteReflection <T> (obj);
            buffer.WriteToFile(path);
        }
Beispiel #2
0
        /// <summary>
        /// Reads from file to object. Very Untested and should only be used with care.
        /// </summary>
        /// <param name="path">Path to file.</param>
        /// <param name="obj">Object to read to.</param>
        /// <typeparam name="T">The 1st type parameter.</typeparam>
        public static T ReadFromFile <T> (string path, T obj)
        {
            EiBuffer buffer = new EiBuffer(System.IO.File.ReadAllBytes(path));

            return((T)buffer.ReadReflection(obj));
        }