public static bool OnFrameBoundary(double time, double frameRate, double epsilon)
        {
            TimeUtility.ValidateFrameRate(frameRate);
            double num  = TimeUtility.ToExactFrames(time, frameRate);
            double num2 = Math.Round(num);

            return(Math.Abs(num - num2) < epsilon);
        }
        public static string TimeAsFrames(double timeValue, double frameRate, string format = "F2")
        {
            string result;

            if (TimeUtility.OnFrameBoundary(timeValue, frameRate))
            {
                result = TimeUtility.ToFrames(timeValue, frameRate).ToString();
            }
            else
            {
                result = TimeUtility.ToExactFrames(timeValue, frameRate).ToString(format);
            }
            return(result);
        }
        public static string TimeAsTimeCode(double timeValue, double frameRate, string format = "F2")
        {
            TimeUtility.ValidateFrameRate(frameRate);
            int    num  = (int)Math.Abs(timeValue);
            int    num2 = num / 3600;
            int    num3 = num % 3600 / 60;
            int    num4 = num % 60;
            string str  = (timeValue >= 0.0) ? string.Empty : "-";
            string str2;

            if (num2 > 0)
            {
                str2 = string.Concat(new object[]
                {
                    num2,
                    ":",
                    num3.ToString("D2"),
                    ":",
                    num4.ToString("D2")
                });
            }
            else if (num3 > 0)
            {
                str2 = num3 + ":" + num4.ToString("D2");
            }
            else
            {
                str2 = num4.ToString();
            }
            int    totalWidth = (int)Math.Floor(Math.Log10(frameRate) + 1.0);
            string text       = (TimeUtility.ToFrames(timeValue, frameRate) - TimeUtility.ToFrames((double)num, frameRate)).ToString().PadLeft(totalWidth, '0');

            if (!TimeUtility.OnFrameBoundary(timeValue, frameRate))
            {
                string text2 = TimeUtility.ToExactFrames(timeValue, frameRate).ToString(format);
                int    num5  = text2.IndexOf('.');
                if (num5 >= 0)
                {
                    text = text + " [" + text2.Substring(num5) + "]";
                }
            }
            return(str + str2 + ":" + text);
        }