示例#1
0
        /// <summary>
        /// Save the given string to a temporary file and returns the path
        /// </summary>
        /// <param name="text">File content</param>
        /// <param name="unicode">Save the file as unicode (true) or ANSI (false)</param>
        /// <param name="codepage">ANSI Codepage to use while reading the file</param>
        /// <param name="ext">The extension of the new temporary file</param>
        public static string SaveToTempFile(this string text, bool unicode = true, int codepage = 1252, string ext = "txt")
        {
            var path = FilePaths.CreateTempPath(ext);

            text.SaveToFile(path, false, unicode, codepage);
            return(path);
        }
示例#2
0
        /// <summary>
        /// Save the given string to a temporary file and returns the path
        /// </summary>
        /// <param name="xml">XML Document</param>
        /// <param name="unicode">Save the file as unicode (true) or ANSI (false)</param>
        /// <param name="codepage">ANSI Codepage to use while reading the file</param>
        /// <param name="ext">The extension of the new temporary file</param>
        public static string SaveToTempFile(this XmlDocument xml, bool unicode = true, int codepage = 1252, string ext = "xml")
        {
            var path = FilePaths.CreateTempPath(ext);

            xml.SaveToFile(path, false, unicode, codepage);
            return(path);
        }
示例#3
0
        /// <summary>
        /// Save the given byte array to a temporary file and returns the path
        /// </summary>
        /// <param name="buffer">File data</param>
        /// <param name="ext">The extension of the new temporary file</param>
        public static string SaveToTempFile(this byte[] buffer, string ext)
        {
            var path = FilePaths.CreateTempPath(ext);

            buffer.SaveToFile(path);
            return(path);
        }