Exemplo n.º 1
0
        public static string IduceVrijeme(FirePlaySong song)
        {
            string default_end = "Z";

            int min = 0, sec = 0, millis = 0;

            //int index = -1;
            if (song.Trajanje.Contains("."))
            {
                int index = song.Trajanje.IndexOf(".");
                if (!(int.TryParse(new String(song.Trajanje.ToCharArray(), 0, index), out sec)))
                {
                    throw new IndexingErrorExeption("Index for dot missaligned");
                }
                if (!(int.TryParse(new String(song.Trajanje.ToCharArray(), index + 1, song.Trajanje.Length), out millis)))
                {
                    throw new IndexingErrorExeption("Index for dot missaligned");
                }

                if (sec > 59)
                {
                    min  = (int)(sec / 60);
                    sec -= (min * 60);
                    while (millis > 1000)
                    {
                        millis /= 10;
                    }
                    return(FPTime.Sum(new FPTime(song.Vrijeme), new FPTime(0, 0, 0, 0, min, sec, millis, default_end)).GetTimeString());
                }
            }
            else
            {
                if (!(int.TryParse(new String(song.Trajanje.ToCharArray(), 0, song.Trajanje.Length), out sec)))
                {
                    throw new IndexingErrorExeption("Index for dot missaligned");
                }
                if (sec > 59)
                {
                    min  = (int)(sec / 60);
                    sec -= (min * 60);
                    while (millis > 1000)
                    {
                        millis /= 10;
                    }
                    return(FPTime.Sum(new FPTime(song.Vrijeme), new FPTime(0, 0, 0, 0, min, sec, millis, default_end)).GetTimeString());
                }
            }


            return(string.Empty);
        }
Exemplo n.º 2
0
 public void Add(FirePlaySong song)
 {
     Songs.Add(song);
     _counter++;
 }