Ejemplo n.º 1
0
        public void mediatime()
        {
            string tc = "00:41:01.40";

            Console.WriteLine("source [" + tc + "]");

            MediaTime mt = new MediaTime(tc);

            Console.WriteLine("result [" + mt.hour + ":" + mt.minute + ":" + mt.second + "." + mt.millisecond + "]");
            double d1 = mt.ToSeconds();

            Console.WriteLine(d1);
        }
Ejemplo n.º 2
0
        public static MediaTime FromSeconds(double seconds)
        {
            MediaTime mt = new MediaTime();

            mt.hour        = (int)seconds / 3600;
            seconds       -= mt.hour * 3600;
            mt.minute      = (int)seconds / 60;
            seconds       -= mt.minute * 60;
            mt.second      = (int)seconds;
            mt.millisecond = (int)((seconds - mt.second) * 1000 + 0.5);

            return(mt);
        }
Ejemplo n.º 3
0
        public static MediaTime FromNorminalTime(string time)
        {
            int index = -1;

            time = time.Trim();
            MediaTime mt = null;
            int       hour = 0, minute = 0, sec = 0;
            bool      token_found = false;

            try {
                if ((index = time.IndexOf("h")) >= 0)
                {
                    string s = time.Substring(0, index).Trim();
                    hour        = Convert.ToInt32(s);
                    time        = time.Substring(index + 1);
                    token_found = true;
                }
                if ((index = time.IndexOf("mn")) >= 0)
                {
                    string s = time.Substring(0, index).Trim();
                    minute      = Convert.ToInt32(s);
                    time        = time.Substring(index + 2);
                    token_found = true;
                }
                if ((index = time.IndexOf("s")) >= 0)
                {
                    string s = time.Substring(0, index).Trim();
                    minute      = Convert.ToInt32(s);
                    time        = time.Substring(index + 1);
                    token_found = true;
                }
                if (token_found)
                {
                    mt             = new MediaTime();
                    mt.hour        = hour;
                    mt.minute      = minute;
                    mt.second      = sec;
                    mt.millisecond = 0;
                }
            }
            catch (Exception) {
            }
            return(mt);
        }
Ejemplo n.º 4
0
 static public double GetDuration(MediaTime start, MediaTime end)
 {
     return(end.ToSeconds() - start.ToSeconds());
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("== Start");

            TReg tr = new TReg();

            #region past
            tr.rSpace();
            tr.rComma();
            tr.rFind1();
            tr.rFind2();
            //tr.quotes();
            //tr.ends();
            tr.rMatch();
            tr.rMatchi();
            tr.colorCode();
            tr.spaces();
            tr.num();
            tr.searchccode();
            tr.mediatime();

            //tr.exchAra();

            //tr.timecheck();
            //tr.decimalcheck();
            //tr.deccheck();
            //tr.perccheck();
            //tr.curencycheck();
            //tr.Omitcheck();
            //tr.Sepacheck();
            //tr.kmcheck();

            //tr.pac2();
            //tr.pac2();
            //tr.sch();
            //tr.rev();
            //tr.ens();
            //tr.brackets();
            //tr.gops();

            //tr.joins();
            //tr.mtest();
            //Cap p = new Cap();
            //p.redo();
            //tr.decItalics();
            //tr.rall();
            //tr.eall();
            #endregion

            Console.ForegroundColor = ConsoleColor.Cyan;
            #region past 2
            //tr.eighth();
            //tr.smiml();
            //tr.ovrml();

            //Cap c = new Cap();
            //c.chu();

            MediaTime mt = new MediaTime();
            mt.vttTests();
            #endregion

            Npv npv = new Npv();
            npv.slashes();

            Vtt v = new Vtt();
            v.lines();

            genRegex gen = new genRegex();
            gen.align();

            Replace rep = new Replace();
            rep.Replaces();
            rep.cmp();

            Console.ResetColor();
            System.Console.WriteLine("== End");
        }