CSL.TorrentBuilder.ExtractPTPMovieInfo C# (CSharp) Method

ExtractPTPMovieInfo() public method

public ExtractPTPMovieInfo ( FileInfo file ) : string[]
file System.IO.FileInfo
return string[]
        public string[] ExtractPTPMovieInfo(FileInfo file)
        {
            string filename;
            string[] info;
            string[] result = new string[6];
            int counter = 5;
            int filecounter;

            /*string[] result:
             * 0: movie title
             * 1: year
             * 2: source media
             * 3: codec format
             * 4: file format
             * */

            filename = file.Name;
            if (filename.Contains(".torrent"))
                filename = filename.Remove(filename.IndexOf(".torrent"));

            info = filename.Split('.');
            filecounter = info.Length - 1;

            for (int a = 0; a < 4; a++)
            {
                counter--;
                filecounter--;
                try
                {
                    result[counter] = info[filecounter]; //Up until movie title, they will match up
                }
                catch { result[counter] = "ERROR"; }
            }

            filecounter--;
            //Worked way down complete, now work way up by piecing together the movie title if name includes space
            for (int a = 0; a <= filecounter; a++)
            {
                result[0] += " " + info[a];
            }
            result[0] = result[0].Remove(0, 1);

            return result;
        }