Exemplo n.º 1
0
        public static bool TryParse(FFprobeObject rawValue, out FFprobeFraction value)
        {
            try
            {
                if (rawValue == null)
                {
                    value = null;
                    return(false);
                }

                var splitValues = rawValue.Value.ToString().Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

                var numerator   = 0;
                var denominator = 0;
                if (!int.TryParse(splitValues[0], out numerator))
                {
                    value = null;
                    return(false);
                }
                if (!int.TryParse(splitValues[1], out denominator))
                {
                    value = null;
                    return(false);
                }

                value = new FFprobeFraction(numerator, denominator);

                return(true);
            }
            catch (Exception err)
            {
                value = null;
                return(false);
            }
        }
Exemplo n.º 2
0
        public static bool TryParse(FFprobeObject rawValue, out FFprobeFraction value)
        {
            try
            {
                if (rawValue == null)
                {
                    value = null;
                    return false;
                }

                var splitValues = rawValue.Value.ToString().Split(new string[] {"/"}, StringSplitOptions.RemoveEmptyEntries);

                var numerator = 0;
                var denominator = 0;
                if (!int.TryParse(splitValues[0], out numerator))
                {
                    value = null;
                    return false;
                }
                if (!int.TryParse(splitValues[1], out denominator))
                {
                    value = null;
                    return false;
                }

                value = new FFprobeFraction(numerator, denominator);

                return true;
            }
            catch (Exception err)
            {
                value = null;
                return false;
            }
        }
Exemplo n.º 3
0
        internal static FFmpegFraction Create(FFprobeFraction ffprobeFraction)
        {
            if (ffprobeFraction == null)
            {
                return null;
            }

            return new FFmpegFraction(ffprobeFraction.Numerator, ffprobeFraction.Denominator);
        }