private void buildToolStripMenuItem1_Click(object sender, EventArgs e) { try { Builder b = Builder.getBuilder(); b.clear(); string bp = b.build_path; if (bp == "") { FolderBrowserDialog fb = new FolderBrowserDialog(); fb.SelectedPath = (docpath != "" ? docpath : Path.GetDirectoryName(Application.ExecutablePath)); if (fb.ShowDialog() != DialogResult.OK) { return; } bp = fb.SelectedPath; } b.setParams(tbAppName.Text, cbPackType.SelectedIndex, cbCompress.Checked, icon); b.setBrowser(cbInternal.Checked, cbSizeable.Checked, cbMaximized.Checked, int.Parse(tbWidth.Text), int.Parse(tbHeight.Text)); b.setFlags(cbDebug.Checked, cbConsole.Checked, cbLogfile.Checked); foreach (ListViewItem li in listView1.Items) { if ((string)li.Tag != INSTALL_CONF_TAG) { b.addFile(li.Text, (string)li.Tag); } } b.build(bp); } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.GetType().Name + "\r\n" + ex.Message); } }
static void buildAll(XmlDocument doc, string outpath) { Builder b = Builder.getBuilder(); b.clear(); foreach (XmlNode nd in doc.DocumentElement.ChildNodes) { if (nd.NodeType == XmlNodeType.Element) { if (nd.Name == "options") { string app = ""; string icon = ""; int pack = 0; bool comp = true; foreach (XmlNode n in nd.ChildNodes) { if (n.NodeType == XmlNodeType.Element) { switch (n.Name) { case "app": app = n.Attributes["name"].Value; if (n.Attributes["icon"] != null) { icon = n.Attributes["icon"].Value; } break; case "browser": bool inter = getcheck(n.Attributes["internal"], true); bool sz = false; bool mx = false; int w = 640; int h = 480; if (inter) { sz = getcheck(n.Attributes["sizeable"], false); mx = getcheck(n.Attributes["maximized"], false); if (!mx) { w = int.Parse(n.Attributes["width"].Value); h = int.Parse(n.Attributes["height"].Value); } } b.setBrowser(inter, sz, mx, w, h); break; case "pack": pack = int.Parse(n.Attributes["type"].Value); comp = getcheck(n.Attributes["compressed"], true); break; case "flags": bool dbg = getcheck(n.Attributes["debug"], false); b.setFlags(dbg, getcheck(n.Attributes["console"], dbg), getcheck(n.Attributes["logfile"], false)); break; } } } b.setParams(app, pack, comp, icon); } else if (nd.Name == "files") { foreach (XmlNode n in nd.ChildNodes) { if (n.NodeType == XmlNodeType.Element && n.Name == "file") { string s = n.Attributes["name"].Value; string a = (s == Builder.INST_API_TAG)?(Builder.INST_API_FILE):(Path.GetFileName(s)); if (n.Attributes["alias"] != null) { a = n.Attributes["alias"].Value; } b.addFile(a, s); } } } } } Console.WriteLine("building..."); b.build(outpath); }