예제 #1
0
        private IEnumerable <dynamic> GetLabels(JsonBuildingContext context)
        {
            var labels = context.Labels;

            if (labels.IsNullOrWhiteSpace())
            {
                return(default);
예제 #2
0
 private Layouts GetLayouts(JsonBuildingContext context)
 {
     return(new Layouts
     {
         Labels = this.GetLabels(context),
         Keymap = this.GetKeymap(context),
     });
 }
예제 #3
0
        private Lighting GetLighting(JsonBuildingContext context)
        {
            if (Enum.TryParse <Lighting>(context.Lighting, out var lighting))
            {
                return(lighting);
            }

            return(Lighting.none);
        }
예제 #4
0
        public string Build(JsonBuildingContext context)
        {
            var qcLayout       = this.GetQcLayout(context.QmkConfJson);
            var physicalLayout = this.GetPhysicalLayout(context.Raw);
            var logicalLayout  = this.GetLogicalLayout(context.Raw);
            var injected       = this.InjectDesign(physicalLayout, qcLayout);
            var kles           = this.ConvertToKleLayout(injected, logicalLayout);
            var json           = this.FormatToJson(kles);

            return(json);
        }
예제 #5
0
        private ViaModel GetViaModel(JsonBuildingContext context)
        {
            var name      = context.Name;
            var vendorId  = context.VendorId;
            var productId = context.ProductId;

            return(new ViaModel
            {
                Name = name,
                VenderId = vendorId,
                ProductId = productId,
                Lighting = this.GetLighting(context),
                Matrix = this.GetMatrix(context),
                Layouts = this.GetLayouts(context),
            });
        }
예제 #6
0
        public string Build(JsonBuildingContext context)
        {
            var model = this.GetViaModel(context);

            return(JsonSerializer.ToJsonString(model));
        }