コード例 #1
0
        public ArduinoPlatform(string arduinoPath, string filename, string vendor, string arch)
        {
            cfg = ConfigParser.parseFile(filename);

            // overwrite platform dependend stuff
            Dictionary <string, string> deps = cfg.Where(kv => kv.Key.EndsWith("windows")).ToDictionary(kv => kv.Key.Replace(".windows", ""), kv => kv.Value);

            foreach (var kv in deps)
            {
                cfg[kv.Key] = kv.Value;
            }

            Dictionary <string, string> info = new Dictionary <string, string>();

            this.platform_path = Path.GetDirectoryName(filename);
            this.vendor        = vendor;
            this.arch          = arch.ToUpper().Trim();

            info.Add("runtime.ide.path", arduinoPath);
            info.Add("runtime.tools.avr-gcc.path", arduinoPath + @"\hardware\tools\avr");
            info.Add("runtime.ide.version", "10600");
            info.Add("build.arch", this.arch);
            info.Add("build.system.path", platform_path + @"\system");
            cfg = ConfigParser.parseDict(cfg, info);
        }
コード例 #2
0
ファイル: ArduinoBoard.cs プロジェクト: thefloe1/IDE4Arduino
        public ArduinoBoard(string boardShort, Dictionary <string, string> data, string path, ArduinoPlatform p)
        {
            cfg = new Dictionary <string, string>(p.cfg);

            Dictionary <string, string> bcfg = data.Where(kv => kv.Key.StartsWith(boardShort)).ToDictionary(kv => kv.Key.Replace(boardShort + ".", ""), kv => kv.Value);

            bcfg.ToList().ForEach(x => cfg[x.Key] = x.Value);

            if (cfg.ContainsKey("build.usb_manufacturer"))
            {
                cfg["build.usb_manufacturer"] = "\"\\\"" + cfg["build.usb_manufacturer"].Replace("\"", "") + "\\\"\"";
            }

            if (cfg.ContainsKey("build.usb_product"))
            {
                cfg["build.usb_product"] = "\"\\\"" + cfg["build.usb_product"].Replace("\"", "") + "\\\"\"";
            }

            cfg = ConfigParser.parseDict(cfg, cfg);
            cfg = ConfigParser.parseDict(cfg, cfg);

            id        = boardShort;
            name      = cfg["name"];
            this.path = path;

            corePath    = Path.Combine(path, @"cores\" + cfg["build.core"]);       //.Replace('\\','/');
            variantPath = Path.Combine(path, @"variants\" + cfg["build.variant"]); //.Replace('\\', '/');

            Dictionary <string, string> types = cfg.Where(kv => kv.Key.StartsWith("menu.cpu")).ToDictionary(x => x.Key.Remove(0, 9), x => x.Value);

            cpu_names = types.Keys.Select(key => key.Split('.')[0]).ToList().Distinct().ToArray();
        }