Exemplo n.º 1
0
        public Module load()
        {
            Module module = null;

            try
            {
                globalSymbols = new Dictionary <string, Declaration>();
                localSymbols  = new Dictionary <string, Declaration>();

                oilcan = EnamlData.loadFromFile(filename);

                string oilVersion = oilcan.getStringValue("OILCan.version", "");
                string modname    = oilcan.getStringValue("module.name", "");

                module = new Module(modname);

                List <String> funcs = oilcan.getPathKeys("module.funcs");
                foreach (String funcname in funcs)
                {
                    FuncDefNode func = loadFuncDef("module.funcs." + funcname);
                    module.funcs.Add(func);
                    globalSymbols[funcname] = func;
                }
            }
            catch (ENAMLException e)
            {
                return(null);
            }

            return(module);
        }
Exemplo n.º 2
0
        public static WebFolder loadFolder(EnamlData silk, string path, string name, WebFolder parent)
        {
            WebFolder folder = new WebFolder(name, parent);

            string fullpath = (path.Length > 0) ? path + "." + name + "." : "";

            List <String> pagenames = silk.getPathKeys(fullpath + "pages");

            foreach (String pagename in pagenames)
            {
                WebPage page = WebPage.loadPage(silk, fullpath + "pages", pagename, folder);
                folder.pages.Add(page);
            }

            List <String> resourcenames = silk.getPathKeys(fullpath + "resources");

            foreach (String resname in resourcenames)
            {
                WebResource resource = WebResource.loadResource(silk, fullpath + "resources", resname, folder);
                folder.resources.Add(resource);
            }

            List <String> foldernames = silk.getPathKeys(fullpath + "folders");

            foreach (String foldername in foldernames)
            {
                WebFolder subfolder = WebFolder.loadFolder(silk, fullpath + "folders", foldername, folder);
                folder.folders.Add(subfolder);
            }

            return(folder);
        }
Exemplo n.º 3
0
        //- saving ------------------------------------------------------------

        public void saveToFile(String filename)
        {
            EnamlData rigData = new EnamlData();

            rigData.setStringValue("version", Settings.VERSION);

            Dictionary <VSTPanel, String> plugList = new Dictionary <VSTPanel, string>();
            int count = 1;

            foreach (VSTPanel panel in panels)
            {
                String plugName = "plugin-" + count.ToString().PadLeft(3, '0');
                rigData.setStringValue("plugin-list." + plugName + ".path", panel.plugPath);
                rigData.setStringValue("plugin-list." + plugName + ".audio-out", panel.audioOut);
                rigData.setStringValue("plugin-list." + plugName + ".midi-in",
                                       ((panel.midiInDevice != null) ? panel.midiInDevice.devName : "no input"));
                plugList[panel] = plugName;
                count++;
            }
            count = 1;
            foreach (Patch patch in patches)
            {
                String patname = "patch-" + count.ToString().PadLeft(3, '0');
                rigData.setStringValue("patch-list." + patname + ".name", patch.name);
                foreach (VSTPanel panel in patch.panels.Keys)
                {
                    rigData.setIntValue("patch-list." + patname + "." + plugList[panel], patch.panels[panel]);
                }
                count++;
            }
            rigData.saveToFile(filename);
            hasChanged = false;
        }
Exemplo n.º 4
0
        public static WebResource loadResource(EnamlData silk, string path, string name, WebFolder folder)
        {
            String respath = silk.getStringValue(path + "." + name + ".path", "");
            String resname = Path.GetFileName(respath);

            respath = Path.GetDirectoryName(respath);
            WebResource resource = new WebResource(resname, respath, folder);

            return(resource);
        }
Exemplo n.º 5
0
        public static WebPage loadPage(EnamlData silk, string path, string name, WebFolder folder)
        {
            String fullpath = path + "." + name;
            String html     = silk.getStringValue(fullpath + ".html", "");
            String template = silk.getStringValue(fullpath + ".template", "");
            String content  = silk.getStringValue(fullpath + ".content", "");

            WebPage page = new WebPage(html, folder, template, content);

            return(page);
        }
Exemplo n.º 6
0
        public Settings()
        {
            EnamlData data = EnamlData.loadFromFile("Audimat.cfg");

            string version = data.getStringValue("version", VERSION);

            rackHeight = data.getIntValue("global-settings.rack-window-height", VSTPanel.PANELHEIGHT);
            rackPosX   = data.getIntValue("global-settings.rack-window-pos.x", 100);
            rackPosY   = data.getIntValue("global-settings.rack-window-pos.y", 100);
            keyWndPosX = data.getIntValue("global-settings.keyboard-window-pos.x", 200);
            keyWndPosY = data.getIntValue("global-settings.keyboard-window-pos.y", 200);
        }
Exemplo n.º 7
0
        public void save()
        {
            EnamlData data = new EnamlData();

            data.setStringValue("version", VERSION);
            data.setIntValue("global-settings.rack-window-height", rackHeight);
            data.setIntValue("global-settings.rack-window-pos.x", rackPosX);
            data.setIntValue("global-settings.rack-window-pos.y", rackPosY);
            data.setIntValue("global-settings.keyboard-window-pos.x", keyWndPosX);
            data.setIntValue("global-settings.keyboard-window-pos.y", keyWndPosY);

            data.saveToFile("Audimat.cfg");
        }
Exemplo n.º 8
0
        public static WebSite loadSilkFile(string filename)
        {
            WebSite site = new WebSite();

            site.silkroot = Path.GetDirectoryName(filename);
            EnamlData silk = EnamlData.loadFromFile(filename);

            site.version  = silk.getStringValue("Silk.version", "");
            site.devroot  = silk.getStringValue("Silk.devroot", "");
            site.prodroot = silk.getStringValue("Silk.prodroot", "");

            site.root = WebFolder.loadFolder(silk, "", "root", null);

            return(site);
        }
Exemplo n.º 9
0
        //---------------------------------------------------------------------
        // WRITING OUT
        //---------------------------------------------------------------------

        //these should mirror the loading methods above

        public void save(Module module)
        {
            nodenum = 0;
            generateOILNames(module);

            oilcan = new EnamlData();
            oilcan.setStringValue("OILCan.version", OILCANVERSION);
            oilcan.setStringValue("module.name", module.name);

            int fnum = 0;

            foreach (FuncDefNode func in module.funcs)
            {
                saveFuncDef(fnum++, func);
            }

            oilcan.saveToFile(filename);
        }
Exemplo n.º 10
0
        //---------------------------------------------------------------------

        public static VSTRig loadFromFile(String path, ControlPanel controlPanel)
        {
            VSTRig rig = null;

            EnamlData rigData = EnamlData.loadFromFile(path);      //load data from file

            if (rigData != null)
            {
                rig = new VSTRig(controlPanel);

                //load plugins
                List <String> plugs = rigData.getPathKeys("plugin-list");
                Dictionary <String, VSTPanel> plugList = new Dictionary <string, VSTPanel>();      //temp dict for matching plugins to patches
                foreach (String plug in plugs)
                {
                    String plugPath     = rigData.getStringValue("plugin-list." + plug + ".path", "");
                    String plugAudioOut = rigData.getStringValue("plugin-list." + plug + ".audio-out", "");
                    String plugMidiIn   = rigData.getStringValue("plugin-list." + plug + ".midi-in", "");

                    VSTPanel panel = rig.addPanel(plugPath);
                    //panel.plugin.setAudioOut(plugAudioOut);
                    panel.setMidiIn(plugMidiIn);

                    plugList[plug] = panel;
                }

                //load patches
                List <String> pats = rigData.getPathKeys("patch-list");
                foreach (String pat in pats)
                {
                    String patchName = rigData.getStringValue("patch-list." + pat + ".name", "");
                    Patch  patch     = new Patch(patchName);
                    foreach (String plug in plugs)
                    {
                        int patnum = rigData.getIntValue("patch-list." + pat + "." + plug, 0);
                        patch.addPanel(plugList[plug], patnum);
                    }
                    rig.patches.Add(patch);
                }
                rig.setCurrentPatch(0);
            }

            return(rig);
        }
Exemplo n.º 11
0
        //use hard coded fields for now
        public static Format loadFormatFile(string filepath)
        {
            Format format = new Format();

            EnamlData gosling = EnamlData.loadFromFile(filepath);

            string gosVersion = gosling.getStringValue("Gosling.version", "");

            //read in structure data
            List <String> structs = gosling.getPathKeys("structs");

            foreach (String structname in structs)
            {
                FStruct       fs        = new FStruct(format, structname);
                List <String> fields    = gosling.getPathKeys("structs." + structname);
                String        fieldpath = "structs." + structname + ".";
                foreach (String fieldname in fields)
                {
                    String        fline = gosling.getStringValue(fieldpath + fieldname, "");
                    List <String> parms = getParams(fline);
                    FField        f     = loadField(fs, fieldname, parms);
                    fs.fields.Add(f);
                    fs.symTable.addEntry(fieldname, f);
                }
                format.structs.addEntry(structname, fs);
            }

            //read in file structure data
            format.fyle = new FStruct(format, "file");
            List <String> ffields = gosling.getPathKeys("file");

            foreach (String fieldname in ffields)
            {
                String        fline = gosling.getStringValue("file." + fieldname, "").Trim();
                List <String> parms = getParams(fline);
                FField        f     = loadField(format.fyle, fieldname, parms);
                format.fyle.fields.Add(f);
                format.fyle.symTable.addEntry(fieldname, f);
            }

            return(format);
        }
Exemplo n.º 12
0
 public OILCan(String _filename)
 {
     filename = _filename;
     oilcan   = null;
     nodenum  = 0;
 }