Nanook.TheGhost.ProjectSong.AutoImportSongIni C# (CSharp) Method

AutoImportSongIni() public method

Reads Artis and Title from song ini file
public AutoImportSongIni ( string fileName ) : int
fileName string
return int
        public int AutoImportSongIni(string fileName)
        {
            if (!File.Exists(fileName))
                return 0;

            string[] l = File.ReadAllLines(fileName, Encoding.Default);

            bool found = false;

            string n = "name = ";
            string a = "artist = ";
            string y = "year = ";
            string d = "delay = ";
            int delay = 0;

            foreach (string s in l)
            {
                if (s.ToLower() == "[song]")
                {
                    this.Artist = string.Empty;
                    this.Title = string.Empty;
                    this.Year = string.Empty; // string.Empty;
                    if (this.Notes.BaseFile != null)
                        this.Notes.BaseFile.NonNoteSyncOffset = 0;
                    this.GuitarVolume = 0;
                    this.SongVolume = 0;
                    found = true;
                }
                else if (found)
                {
                    if (s.Length > n.Length && s.ToLower().StartsWith(n))
                        this.Title = s.Substring(n.Length);
                    else if (s.Length > a.Length && s.ToLower().StartsWith(a))
                        this.Artist = s.Substring(a.Length);
                    else if (s.Length > y.Length && s.ToLower().StartsWith(y))
                        this.Year = s.Substring(y.Length);
                    else if (s.Length > d.Length && s.ToLower().StartsWith(d))
                        delay = int.Parse(s.Substring(d.Length));
                }

            }
            return delay;
        }