Skip to content
Snippets Groups Projects
Protocol.cs 1.2 KiB
Newer Older
  • Learn to ignore specific revisions
  • using System.Collections.ObjectModel;
    
    Frederik Carlier's avatar
    Frederik Carlier committed
    using System.Linq;
    
    
    namespace MasterDevs.ChromeDevTools.ProtocolGenerator
    {
    
    Frederik Carlier's avatar
    Frederik Carlier committed
        public class Protocol
    
            public Protocol()
            {
                this.Compatible = new Collection<string>();
                this.Domains = new Collection<Domain>();
            }
    
    
            public Collection<string> Compatible
            {
                get;
                set;
            }
    
            public Version Version
            {
                get;
                set;
            }
    
            public Collection<Domain> Domains
            {
                get;
                set;
            }
    
    
            public string SourceFile
            {
                get;
                set;
            }
    
            public string Alias
            {
                get;
                set;
            }
    
    Frederik Carlier's avatar
    Frederik Carlier committed
    
            public Domain GetDomain(string name)
            {
                return this.Domains.SingleOrDefault(d => string.Equals(d.Name, name, System.StringComparison.OrdinalIgnoreCase));
            }
    
            public override string ToString()
            {
                if(this.SourceFile != null)
                {
                    return $"{this.Alias} ({this.SourceFile})";
                }
                else
                {
                    return this.Alias;
                }
            }