Exemplo n.º 1
0
        private void addConfigOption(Dictionary <string, string> options, PropertiesJson props, string prefix, string key)
        {
            var option = options.FirstOrDefault(o => o.Key == key).Value;

            if (option != null)
            {
                props.configurations[0].defines.Add(prefix + option);
            }
        }
Exemplo n.º 2
0
        private string generatePropertiesFile(Dictionary <string, string> options)
        {
            if (project.compilerPathError != null)
            {
                return(null);
            }

            var props = new PropertiesJson()
            {
                configurations = new List <Configuration>()
                {
                    new Configuration()
                    {
                        name             = "VisualTeensy",
                        compilerPath     = Path.Combine(project.compilerBase, "bin", "arm-none-eabi-gcc.exe").Replace('\\', '/'),
                        intelliSenseMode = "gcc-x64",
                        includePath      = new List <string>()
                        {
                            "src/**",
                            "lib/**",
                            project.coreBase?.Replace('\\', '/') + "/**",
                            setup.libBase?.Replace('\\', '/') + "/**"
                        },
                        defines = new List <string>()
                    }
                }
            };



            if (options.ContainsKey("build.flags.defs"))
            {
                foreach (var define in options["build.flags.defs"].Split(new string[] { "-D" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    props.configurations[0].defines.Add(define.Trim());
                }
            }
            addConfigOption(options, props, "F_CPU=", "build.fcpu");
            addConfigOption(options, props, "", "build.usbtype");
            addConfigOption(options, props, "LAYOUT_", "build.keylayout");
            props.configurations[0].defines.Add("ARDUINO");

            //props.configurations[0].defines.Add("F_CPU=" + options["build.fcpu"]);
            //props.configurations[0].defines.Add(options["build.usbtype"]);
            //props.configurations[0].defines.Add("LAYOUT_" + options["build.keylayout"]);

            return(FileHelpers.formatOutput(new JavaScriptSerializer().Serialize(props)));
        }