public override int GetHashCode()
        {
            int result = 17;

            unchecked
            {
                if (FormatId != null)
                {
                    result = (result * 31) + FormatId.GetHashCode();
                }

                if (Arguments != null)
                {
                    foreach (var value_0 in Arguments)
                    {
                        result = result * 31;
                        if (value_0 != null)
                        {
                            result = (result * 31) + value_0.GetHashCode();
                        }
                    }
                }
            }

            return(result);
        }
Example #2
0
        public static Mime ToVideoMime(this FormatId formatId)
        {
            switch (formatId)
            {
            case _3GP: return(Mime._3GP);          // video/3gpp

            case _3GP2: return(Mime._3GP2);        // video/3gpp2

            case Aiff: return(Mime.Aiff);

            case Asf: return(Mime.Wmv);            // video/x-ms-asf | video/x-ms-wmv

            case Avi: return(Mime.Avi);

            case Matroska: return(Mime.Mkv);       // video/x-matroska

            case Mov: return(Mime.Mov);            // video/quicktime

            case Mp4: return(Mime.M4v);

            case Ogg: return(Mime.Ogv);            // video/ogg

            case Wave: return(Mime.Wav);           // audio/wav

            case WebM: return(Mime.WebM);          // video/webm
            }

            throw new ArgumentException($"{formatId} does not have a video only type");
        }
Example #3
0
        public static Mime ToAudioMime(this FormatId formatId)
        {
            switch (formatId)
            {
            case _3GP: return(Mime._3GP_A);          // audio/3gpp

            case _3GP2: return(Mime._3GP2_A);        // audio/3gpp2

            case Aiff: return(Mime.Aiff);            // audio/aiff

            case Asf: return(Mime.Wma);

            case Avi: return(Mime.Avi);

            case Mp3: return(Mime.Mp3);               // audio/mpeg

            case M4a: return(Mime.M4a);               // audio/mp4

            case Mp4: return(Mime.M4a);               // audio/mp4

            case Ogg: return(Mime.Oga);               // audio/ogg

            case Opus: return(Mime.Opus);

            case Mka: return(Mime.Mka);

            case Matroska: return(Mime.Mka);          // audio/x-matroska

            case Wave: return(Mime.Wav);              // audio/wav

            case WebM: return(Mime.WebM);             // video/webm
            }

            throw new ArgumentException($"{formatId} does not have an audio only type");
        }
Example #4
0
        public void Core(CodecId codecId, AVCodecID avCodecId, FormatId format)
        {
            // Assert.Equal((int)codecId, (int)format);

            Assert.Equal(codecId, avCodecId.ToCodecId());
            Assert.Equal(avCodecId, codecId.ToAVCodecID());
        }
Example #5
0
        public static Muxer Create(FormatId format, Stream stream)
        {
            var muxer = new Muxer(format);

            muxer.Open(stream);

            return(muxer);
        }
Example #6
0
 public EncodeParameters(
     FormatId format,
     int?quality       = null,
     EncodeFlags flags = default)
 {
     Format  = format;
     Quality = quality;
     Flags   = flags;
 }
        private void printPage(object send, PrintPageEventArgs e)
        {
            Graphics graphics = e.Graphics;
            int      offset   = 105;

            //print header
            graphics.DrawString(empresa.razaoSocial, bold, Brushes.Black, 20, 0);
            graphics.DrawString(empresa.endereco.endereco + " Nº " + empresa.endereco.numero, regular, Brushes.Black, 100, 15);
            graphics.DrawLine(Pens.Black, 20, 30, 310, 30);
            graphics.DrawString("CUPOM NÃO FISCAL", bold, Brushes.Black, 80, 35);
            graphics.DrawLine(Pens.Black, 20, 50, 310, 50);
            graphics.DrawString("PEDIDO: " + FormatId.formatLong(venda.id), regular, Brushes.Black, 20, 60);
            graphics.DrawLine(Pens.Black, 20, 75, 310, 75);

            //itens header
            graphics.DrawString("PRODUTO", regular, Brushes.Black, 20, 80);
            graphics.DrawString("UNIT.", regular, Brushes.Black, 150, 80);
            graphics.DrawString("QTD.", regular, Brushes.Black, 200, 80);
            graphics.DrawString("TOTAL", regular, Brushes.Black, 245, 80);
            graphics.DrawLine(Pens.Black, 20, 95, 310, 95);

            //itens de venda
            foreach (ItemVenda iv in venda.items)
            {
                string produto = iv.produto.descricao;
                graphics.DrawString(produto.Length > 20 ? produto.Substring(0, 20) + "..." : produto, regularItens, Brushes.Black, 20, offset);
                graphics.DrawString(FormataMonetario.format(iv.valorUn), regularItens, Brushes.Black, 155, offset);
                graphics.DrawString(Convert.ToString(iv.quantidade), regularItens, Brushes.Black, 215, offset);
                graphics.DrawString(FormataMonetario.format(iv.total), regularItens, Brushes.Black, 250, offset);
                offset += 20;
            }
            //total
            graphics.DrawLine(Pens.Black, 20, offset, 310, offset);
            offset += 5;

            decimal total = 0;

            foreach (ItemVenda iv in venda.items)
            {
                total += iv.total;
            }
            graphics.DrawString("TOTAL R$: ", bold, Brushes.Black, 20, offset);
            graphics.DrawString(FormataMonetario.format(total), bold, Brushes.Black, 230, offset);
            offset += 15;

            graphics.DrawLine(Pens.Black, 20, offset, 310, offset);
            offset += 5;

            //bottom
            graphics.DrawString("Data: " + DateTime.Now.ToString("dd/MM/yyyy"), regularItens, Brushes.Black, 20, offset);
            graphics.DrawString("HORA: " + DateTime.Now.ToString("HH:mm:ss"), regularItens, Brushes.Black, 220, offset);

            e.HasMorePages = false;
        }
        public static Task CreateInvalidFormat()
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context = new BookOrganizer2DbContext(connectionString);
            var repository = new FormatRepository(context);
            var formatService = new FormatService(repository);

            var formatId = new FormatId(SequentialGuid.NewSequentialGuid());
            var command = new Commands.Create { Id = formatId };

            return formatService.Handle(command);
        }
Example #9
0
        public void A(string name, FormatId format, string mime)
        {
            var encode = EncodeParameters.Parse($"{name}::encode(quality:95)");

            Assert.Equal(95, encode.Quality);

            var e = EncodeParameters.Parse(encode.Canonicalize());

            Assert.Equal($"{e.Format.Canonicalize()}::encode(quality:95)", encode.Canonicalize());

            Assert.Equal(format, e.Format);

            Assert.Equal(mime, encode.Mime.ToString());
        }
        // DELETE
        public static Task RemoveFormat(FormatId id)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context = new BookOrganizer2DbContext(connectionString);
            var repository = new FormatRepository(context);

            var formatService = new FormatService(repository);
            var command = new Commands.Delete
            {
                Id = id,
            };

            return formatService.Handle(command);
        }
Example #11
0
        public Muxer(FormatId format)
            : base(format)
        {
            if (format == FormatId.M4a)
            {
                format = FormatId.Mp4;
            }

            AVOutputFormat *fmt = ffmpeg.av_guess_format(format.ToString().ToLower(), null, format.ToMime());

            if (fmt == null)
            {
                throw new Exception("Could not guess format:" + format.ToMime() + "|" + format.ToString().ToLower());
            }

            Context.Pointer->oformat = fmt;

            // Console.WriteLine("OUTPUT:" + Marshal.PtrToStringAnsi((IntPtr)fmt->long_name));
        }
Example #12
0
        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 11;

                hash = hash * 17 + FormatId?.GetHashCode() ?? 0;
                hash = hash * 17 + FontId?.GetHashCode() ?? 0;
                hash = hash * 17 + FillId?.GetHashCode() ?? 0;
                hash = hash * 17 + BorderId?.GetHashCode() ?? 0;
                hash = hash * 17 + NumberFormatId?.GetHashCode() ?? 0;
                hash = hash * 17 + HasPivotButton?.GetHashCode() ?? 0;
                hash = hash * 17 + HasQuotePrefix?.GetHashCode() ?? 0;
                hash = hash * 17 + Alignment?.GetHashCode() ?? 0;
                hash = hash * 17 + Protection?.GetHashCode() ?? 0;

                return(hash);
            }
        }
Example #13
0
 public ValueTask <Format> GetFormatAsync(FormatId formatId)
 => Context.Formats.FindAsync(formatId);
Example #14
0
 public FormatInfo(FormatId id, Mime[] mimes)
 {
     Id    = id;
     Mimes = mimes ?? throw new ArgumentNullException(nameof(mimes));
 }
Example #15
0
 public FormatInfo(FormatId id, Mime mime)
 {
     Id    = id;
     Mimes = new[] { mime };
 }
Example #16
0
 public static string GetAudioFormat(this FormatId formatId) =>
 formatId.ToAudioMime().Format;
Example #17
0
 public Demuxer(FormatId format)
     : base(format)
 {
 }
Example #18
0
 public static string GetVideoFormat(this FormatId formatId) =>
 formatId.ToVideoMime().Format;
Example #19
0
 /// <summary>
 /// Override ToString() to provide a user friendly string representation.
 /// </summary>
 /// <returns>String representing the property key.</returns>
 public override string ToString()
 {
     return(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                          "PropertyKeyFormatString",
                          FormatId.ToString("B"), PropertyId));
 }
Example #20
0
 public static Mime ToMime(this FormatId value)
 {
     return(Mime.FromFormat(value));
 }
Example #21
0
        public void CanGetMime(FormatId format, string mediaType)
        {
            var mime = Mime.FromFormat(format);

            Assert.Equal(mediaType, mime.Name);
        }
Example #22
0
 public EncodingProfile(FormatId format, AudioProfile audio = null, VideoProfile video = null)
 {
     Format = format;
     Audio  = audio;
     Video  = video;
 }
Example #23
0
 public void VideoFormats(FormatId id, string extension)
 {
     Assert.Equal(extension, id.GetVideoFormat());
 }
Example #24
0
        public static string Canonicalize(this FormatId value)
        {
            switch (value)
            {
            // Applications
            case Json: return("JSON");

            // Audio
            case Aac: return("AAC");

            case Flac: return("FLAC");

            case M4a: return("M4A");

            case Mp3: return("MP3");

            case Opus: return("Opus");

            // Images
            case Bmp: return("BMP");

            case Bpg: return("BPG");

            case Gif: return("GIF");

            case Dng: return("DNG");

            case Heif: return("HEIF");

            case Ico: return("ICO");

            case Jpeg: return("JPEG");

            case Jp2: return("JP2");

            case Jxr: return("JXR");

            case Png: return("PNG");

            case Psd: return("PSD");

            case Svg: return("SVG");

            case Tiff: return("TIFF");

            case WebP: return("WebP");

            // Video
            case Mp4: return("MP4");

            case M4v: return("M4V");

            case WebM: return("WebM");

            // Fonts
            case Ttf: return("TTF");

            case Woff: return("WOFF");

            case Woff2: return("WOFF2");
            }

            return(value.ToString().ToUpper());
        }
Example #25
0
 public void FormatToName(FormatId container, string format)
 {
     Assert.Equal(format, container.GetAudioFormat());
 }
Example #26
0
 public bool Equals(PropertyKey other)
 {
     return(FormatId.Equals(other.FormatId) && (PropertyId == other.PropertyId));
 }
Example #27
0
 protected Format(FormatId id)
 {
     Id      = id;
     Context = new FormatContext();
 }
Example #28
0
 public override string ToString()
 {
     return($"{FormatId.ToString("B")}, {PropertyId}");
 }
Example #29
0
 /// <summary>
 /// Returns the hash code of the object. This is vital for performance of value types.
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(FormatId.GetHashCode() ^ PropertyId);
 }
Example #30
0
 /// <summary>
 /// override ToString()
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return("PKey: " + FormatId.ToString() + ":" + PropertyId.ToString(CultureInfo.InvariantCulture.NumberFormat));
 }