Пример #1
0
        /// <summary>
        /// Return the type of the file (and obviously, also the "name" of the reader to use
        /// </summary>
        /// <param name="path">Path to the file</param>
        /// <returns>Null if type is unknown or a string with the type</returns>
        public static string getFileType(string path)
        {
            Reader r = new CsvReader(path);

            try
            {
                r.Read();
            }
            catch
            {
                r = new KismetCsvReader(path);

                try
                {
                    r.Read();
                }
                catch
                {
                    r = new NetXMLReader(path);

                    try
                    {
                        r.Read();
                    }
                    catch { }
                }
            }

            if (!r.ParseSuccess)
            {
                return(null);
            }

            return(r.ReaderType);
        }
Пример #2
0
        /// <summary>
        /// Return the type of the file (and obviously, also the "name" of the reader to use
        /// </summary>
        /// <param name="path">Path to the file</param>
        /// <returns>Null if type is unknown or a string with the type</returns>
        public static string getFileType(string path)
        {
            Reader r = new CsvReader(path);

            try
            {
                r.Read();
            }
            catch 
            {
                r = new KismetCsvReader(path);

                try
                {
                    r.Read();
                }
                catch 
                {
                    r = new NetXMLReader(path);

                    try
                    {
                        r.Read();
                    }
                    catch { }
                }
            }

            if (!r.ParseSuccess)
            {
                return null;
            }

            return r.ReaderType;
        }