using System; namespace zero { namespace netboot { [System.ComponentModel.ToolboxItem(true)] public partial class IsoManagerWidget : Gtk.Bin { public Gtk.TreeViewColumn namecol; public Gtk.TreeViewColumn idcol; public Gtk.CellRendererText cell; public Gtk.CellRendererText id_cell; public Gtk.TreeViewColumn versioncol; public Gtk.CellRendererText cell_ver; public Gtk.ListStore isos; public string save_path="/net/isos/"; public string base_tcos="/var/lib/tcos/tftp/"; public bool do_it_anyway=false; public bool iso_found=false; public bool only_installer=false; public string manifest_line; public string model_type=""; private string extractedModel; public zero.netboot.IsoInfo iso; public System.Collections.Generic.List isos_center; public IsoManagerWidget () { this.Build (); this.build_tree(); isos_center=new System.Collections.Generic.List(); vbox4.Sensitive=false; populateTreeView(); } public void build_tree() { //treeview1=new Gtk.TreeView(); id_cell=new Gtk.CellRendererText(); idcol=new Gtk.TreeViewColumn(); idcol.PackStart(id_cell,true); idcol.AddAttribute(id_cell,"text",0); idcol.Title=Mono.Unix.Catalog.GetString("ID"); idcol.Resizable=false; treeview1.AppendColumn(idcol); idcol.Visible=false; namecol=new Gtk.TreeViewColumn(); namecol.Title=Mono.Unix.Catalog.GetString("Adaptation"); cell=new Gtk.CellRendererText(); namecol.PackStart(cell,true); namecol.AddAttribute(cell,"text",1); treeview1.AppendColumn(namecol); versioncol=new Gtk.TreeViewColumn(); versioncol.Title=Mono.Unix.Catalog.GetString("Version"); cell_ver=new Gtk.CellRendererText(); versioncol.PackStart(cell_ver,true); treeview1.AppendColumn(versioncol); versioncol.AddAttribute(cell_ver,"text",2); isos=new Gtk.ListStore(typeof(string),typeof(string),typeof(string)); treeview1.Model=isos; treeview1.ShowAll(); } public void populateTreeView() { isos=new Gtk.ListStore(typeof(string),typeof(string),typeof(string)); treeview1.Model=isos; treeview1.ShowAll(); // this.build_tree(); clearEntries(); foreach(zero.netboot.IsoInfo info in zero.netboot.Core.getCore().isoList) { try { extractedModel = info.version.Split(' ')[0].Replace("modelo-",""); isos.AppendValues(Convert.ToString(info.id),zero.netboot.Core.getCore().lliurexlist[extractedModel], info.version.Split(' ')[1]); } catch { } } if (isos.IterNChildren()>0) { Gtk.TreeIter iter; isos.GetIterFirst(out iter); treeview1.Selection.SelectIter(iter); treeview1.Sensitive=true; } else treeview1.Sensitive=false; } public void clearEntries() { idEntry.Text=""; fileNameEntry.Text=""; dateEntry.Text=""; versionEntry.Text=""; } protected virtual void OnTreeview1CursorChanged (object sender, System.EventArgs e) { Gtk.TreeModel model; Gtk.TreeIter iter; treeview1.Selection.GetSelected(out model,out iter); zero.netboot.IsoInfo info=null; if(iter.Stamp!=0) info=zero.netboot.IsoInfo.getInfo(Convert.ToString(model.GetValue(iter,0))); if(info!=null ) { //Console.WriteLine(info.fileName); idEntry.Text=Convert.ToString(info.id); string name=info.fileName; //int index=name.LastIndexOf("/"); idEntry.Text=Convert.ToString(info.id); //Console.WriteLine(info.id); fileNameEntry.Text=name; versionEntry.Text=info.version; dateEntry.Text=info.date; } vbox4.Sensitive=true; } protected virtual void OnAddIsoButtonClicked (object sender, System.EventArgs e) { Gtk.FileChooserDialog fdialog= new Gtk.FileChooserDialog(Mono.Unix.Catalog.GetString("Choose an ISO file..."),null,Gtk.FileChooserAction.Open); fdialog.AddButton(Mono.Unix.Catalog.GetString("Cancel"),Gtk.ResponseType.Cancel); fdialog.AddButton(Mono.Unix.Catalog.GetString("Accept"),Gtk.ResponseType.Ok); Gtk.FileFilter filter=new Gtk.FileFilter(); filter.AddPattern("*.iso"); fdialog.Filter=filter; fdialog.SetCurrentFolder(zero.netboot.Core.getCore().confman.options["default_save_path"]); Gtk.ResponseType result = (Gtk.ResponseType)fdialog.Run(); string file=fdialog.Filename.Replace(" ","\\ "); if (result==Gtk.ResponseType.Ok) { //Console.WriteLine(file); fdialog.Destroy(); try { string std_out=""; string std_error=""; lliurex.utils.Commands.run(zero.netboot.Core.getCore().mount_script,"mount "+file,out std_out,out std_error); string[] list_values=std_out.Split('\n'); foreach(string line in list_values ) { if (line.Contains("=")) { // Console.WriteLine(line); string[] tmp=line.Split('='); zero.netboot.Core.getCore().mnt_config[tmp[0]]=tmp[1]; } } foreach(System.Collections.Generic.KeyValuePair pair in zero.netboot.Core.getCore().mnt_config) { Console.WriteLine(pair.Key + "=" + pair.Value); } model_type=""; manifest_line=""; if(System.IO.File.Exists(zero.netboot.Core.getCore().mnt_config["MANIFEST"]) || zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("centro.manifest") || zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("biblioteca.manifest")) { if(zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("centro.manifest")) { model_type="modelo-centro"; zero.netboot.Core.getCore().dprint(model_type); } else { if(zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("server.manifest")) { model_type="modelo-server"; zero.netboot.Core.getCore().dprint(model_type); } else { if (zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("biblioteca.manifest")) { model_type="modelo-biblio"; zero.netboot.Core.getCore().dprint(model_type); } else { if(zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("client.manifest")) { model_type="modelo-client"; zero.netboot.Core.getCore().dprint(model_type); } else { System.IO.StreamReader sr=new System.IO.StreamReader(zero.netboot.Core.getCore().mnt_config["MANIFEST"]); while((manifest_line=sr.ReadLine())!=null) { switch(manifest_line) { case "lliurex-cdd-edu-biblio-gserver": model_type="modelo-biblio"; break; case "lliurex-cdd-edu-class-gserver": model_type="modelo-server"; break; case "lliurex-cdd-edu-class-gclient": model_type="modelo-client"; break; case "lliurex-cdd-edu-lxdesktop": model_type="modelo-lite"; break; case "lliurex-cdd-lxdesktop": model_type="modelo-lite"; break; case "lliurex-cdd-edu-infantil-gdesktop": model_type="modelo-infantil"; break; case "lliurex-cdd-edu-music-gdesktop": model_type="modelo-music"; break; case "lliurex-cdd-edu-gdesktop": model_type="modelo-desktop"; break; case "lliurex-cdd-gdesktop-pime": model_type="modelo-pime"; break; default: break; } } sr.Close(); } } } } } // save to database //CDD_VERSION System.Collections.Generic.List tmp_list=new System.Collections.Generic.List(); zero.netboot.Core.getCore().sqlman.select_query("SELECT * FROM isos",out tmp_list); if (model_type.Equals("modelo-centro")) { foreach(zero.netboot.IsoInfo info in tmp_list) { if (info.version.Contains("modelo-client") || info.version.Contains("modelo-server")) { zero.netboot.Core.getCore().isooptdialog=new zero.netboot.IsoOptionDialog(); iso_found=true; isos_center.Add(info); } } if(!iso_found) CopyISOFileCenter(); } else { foreach(zero.netboot.IsoInfo info in tmp_list) { if (info.version.Contains(model_type)) { zero.netboot.Core.getCore().versionwin=new zero.netboot.VersionDialog(info.version,model_type + " " + zero.netboot.Core.getCore().mnt_config["CDD_VERSION"]); iso_found=true; iso=info; } } if(!iso_found) CopyISOFile(); } } catch { Console.WriteLine("Wrong ISO"); zero.netboot.Core.getCore().close_me=false; zero.netboot.WarningDialog warning=new zero.netboot.WarningDialog(); warning.msg=Mono.Unix.Catalog.GetString(Mono.Unix.Catalog.GetString("Wrong Iso selected.")); } } else{ if(result==Gtk.ResponseType.Cancel || result==Gtk.ResponseType.DeleteEvent) fdialog.Destroy(); } } public void CopyISOFile() { isos.Clear(); System.Threading.ThreadStart progressTStart = delegate { if(iso_found && do_it_anyway) zero.netboot.Core.getCore().sqlman.delete_iso(iso.id); if (!iso_found || do_it_anyway) { Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin=new zero.netboot.ProgressWindow(Mono.Unix.Catalog.GetString("Copying ISO and Checking files..."), false);}); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) 0.0, Mono.Unix.Catalog.GetString("Copying files...").ToString());}); zero.netboot.Core.getCore().sqlman.insert_iso(base_tcos+model_type,model_type + " " + zero.netboot.Core.getCore().mnt_config["CDD_VERSION"], 1); zero.netboot.Core.getCore().sqlman.select_query("SELECT * FROM isos",out zero.netboot.Core.getCore().isoList); populateTreeView(); // COPY BASE FILES lliurex.utils.Commands.run(zero.netboot.Core.getCore().copy_script,"base-files " + base_tcos + model_type + " " + model_type.Replace("modelo-","") + " " + only_installer + " " + zero.netboot.Core.getCore().debug); if (!only_installer) { // EXTRACT SQUASHFS System.Diagnostics.Process process=new System.Diagnostics.Process(); process.EnableRaisingEvents=false; process.StartInfo.FileName=zero.netboot.Core.getCore().copy_script; process.StartInfo.Arguments="unsquashfs " + base_tcos + model_type + " " + model_type.Replace("modelo-","") + " " + only_installer + " " + zero.netboot.Core.getCore().debug; process.StartInfo.UseShellExecute=false; process.StartInfo.RedirectStandardOutput=true; process.StartInfo.RedirectStandardError=true; process.StartInfo.CreateNoWindow=true; process.Start(); string line; while (!process.StandardOutput.EndOfStream) { line = process.StandardOutput.ReadLine(); if (zero.netboot.Core.getCore().debug) Console.WriteLine(line); string[] line_split = line.Split(' '); line=line_split[line_split.Length-1].ToString().Replace("\n", ""); if (!line.Contains("%")) continue; int number; double percent; if (!System.Int32.TryParse(line.Replace("%", ""), out number)) continue; string line_from_int=Convert.ToString(number)+"% " + Mono.Unix.Catalog.GetString("of uncompressed files"); percent = Convert.ToDouble(number)/100; if (percent > 1.0) percent = (double) 0.0; Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) percent, line_from_int.ToString());}); } process.WaitForExit(); process.Close(); } // UPDATE Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) 1.0, Mono.Unix.Catalog.GetString("Optimizing ISO... (It can take a few minutes)").ToString());}); lliurex.utils.Commands.run(zero.netboot.Core.getCore().chroot_script, "update_hacks " + base_tcos + model_type + " " + model_type.Replace("modelo-","") + " " + zero.netboot.Core.getCore().confman.options["language_enabled"] + " " + zero.netboot.Core.getCore().confman.options["isos-sources-list"] + " " + zero.netboot.Core.getCore().debug + " " + zero.netboot.Core.getCore().confman.options["liveuser"] + " " + zero.netboot.Core.getCore().confman.options["livepasswd"]); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) 1.0, Mono.Unix.Catalog.GetString("Updating Net Boot...").ToString());}); lliurex.utils.Commands.run(zero.netboot.Core.getCore().copy_script,"finalize " + base_tcos + model_type + " " + model_type.Replace("modelo-","") + " False " + zero.netboot.Core.getCore().debug); lliurex.utils.Variables.SetVar("ZNB_" + model_type.Replace("modelo-","").ToUpper() + "_ENABLE", "Y"); lliurex.utils.Commands.run(zero.netboot.Core.getCore().mount_script,"umount"); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.Hide();}); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.Destroy();}); do_it_anyway=false; iso_found=false; isos_center.Clear(); only_installer=false; Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().isomanwidget.populateTreeView();}); zero.netboot.Core.getCore().isomanwidget.clearEntries(); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().isoopswidget.populateTreeView();}); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().tcoswidget.populateTreeView();}); } }; zero.netboot.Core.getCore().progressThread= new System.Threading.Thread(progressTStart); zero.netboot.Core.getCore().progressThread.Start(); } public void CopyISOFileCenter() { if(iso_found && do_it_anyway) { foreach(zero.netboot.IsoInfo info in isos_center) { zero.netboot.Core.getCore().sqlman.delete_iso(info.id); } } if (!iso_found || do_it_anyway) { isos.Clear(); System.Threading.ThreadStart progressTStart = delegate { Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin=new zero.netboot.ProgressWindow(Mono.Unix.Catalog.GetString("Copying ISO and Checking files..."), false);}); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) 0.0, Mono.Unix.Catalog.GetString("Copying files...").ToString());}); zero.netboot.Core.getCore().sqlman.insert_iso(base_tcos+"modelo-server","modelo-server" + " " + zero.netboot.Core.getCore().mnt_config["CDD_VERSION"], 1); zero.netboot.Core.getCore().sqlman.insert_iso(base_tcos+"modelo-client","modelo-client" + " " + zero.netboot.Core.getCore().mnt_config["CDD_VERSION"], 1); zero.netboot.Core.getCore().sqlman.select_query("SELECT * FROM isos",out zero.netboot.Core.getCore().isoList); populateTreeView(); // COPY BASE FILES lliurex.utils.Commands.run(zero.netboot.Core.getCore().copy_script,"base-files " + base_tcos + " centro " + only_installer + " " + zero.netboot.Core.getCore().debug); if (!only_installer) { // EXTRACT SQUASHFS System.Diagnostics.Process process=new System.Diagnostics.Process(); process.EnableRaisingEvents=false; process.StartInfo.FileName=zero.netboot.Core.getCore().copy_script; process.StartInfo.Arguments="unsquashfs " + base_tcos + " centro " + only_installer + " " + zero.netboot.Core.getCore().debug; process.StartInfo.UseShellExecute=false; process.StartInfo.RedirectStandardOutput=true; process.StartInfo.RedirectStandardError=true; process.StartInfo.CreateNoWindow=true; process.Start(); string line; while (!process.StandardOutput.EndOfStream) { line = process.StandardOutput.ReadLine(); if (zero.netboot.Core.getCore().debug) Console.WriteLine(line); string[] line_split = line.Split(' '); line=line_split[line_split.Length-1].ToString().Replace("\n", ""); if (!line.Contains("%")) continue; int number; double percent; if (!System.Int32.TryParse(line.Replace("%", ""), out number)) continue; string line_from_int=Convert.ToString(number)+"% " + Mono.Unix.Catalog.GetString("of uncompressed files"); percent = Convert.ToDouble(number)/100; if (percent > 1.0) percent = (double) 0.0; Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) percent, line_from_int.ToString());}); } process.WaitForExit(); process.Close(); } // UPDATE Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) 1.0, Mono.Unix.Catalog.GetString("Optimizing ISO... (It can take a few minutes)").ToString());}); lliurex.utils.Commands.run(zero.netboot.Core.getCore().chroot_script,"update_hacks " + base_tcos + "modelo-client" + " client " + zero.netboot.Core.getCore().confman.options["language_enabled"] + " " + zero.netboot.Core.getCore().confman.options["isos-sources-list"] + " " + zero.netboot.Core.getCore().debug + " " + zero.netboot.Core.getCore().confman.options["liveuser"] + " " + zero.netboot.Core.getCore().confman.options["livepasswd"]); lliurex.utils.Commands.run(zero.netboot.Core.getCore().chroot_script,"update_hacks " + base_tcos + "modelo-server" + " server " + zero.netboot.Core.getCore().confman.options["language_enabled"] + " " + zero.netboot.Core.getCore().confman.options["isos-sources-list"] + " " + zero.netboot.Core.getCore().debug + " " + zero.netboot.Core.getCore().confman.options["liveuser"] + " " + zero.netboot.Core.getCore().confman.options["livepasswd"]); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.set_fraction((double) 1.0, Mono.Unix.Catalog.GetString("Updating Net Boot...").ToString());}); lliurex.utils.Commands.run(zero.netboot.Core.getCore().copy_script,"finalize " + base_tcos + " centro False " + zero.netboot.Core.getCore().debug); lliurex.utils.Variables.SetVar("ZNB_CLIENT_ENABLE", "Y"); lliurex.utils.Variables.SetVar("ZNB_SERVER_ENABLE", "Y"); lliurex.utils.Commands.run(zero.netboot.Core.getCore().mount_script,"umount"); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.Hide();}); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().progresswin.Destroy();}); do_it_anyway=false; iso_found=false; isos_center.Clear(); only_installer=false; Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().isomanwidget.populateTreeView();}); zero.netboot.Core.getCore().isomanwidget.clearEntries(); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().isoopswidget.populateTreeView();}); Gtk.Application.Invoke(delegate {zero.netboot.Core.getCore().tcoswidget.populateTreeView();}); }; zero.netboot.Core.getCore().progressThread= new System.Threading.Thread(progressTStart); zero.netboot.Core.getCore().progressThread.Start(); } } protected virtual void OnAddPathButtonClicked (object sender, System.EventArgs e) { Gtk.FileChooserDialog fdialog= new Gtk.FileChooserDialog(Mono.Unix.Catalog.GetString("Choose an existing path..."),null,Gtk.FileChooserAction.SelectFolder); fdialog.AddButton(Mono.Unix.Catalog.GetString("Cancel"),Gtk.ResponseType.Cancel); fdialog.AddButton(Mono.Unix.Catalog.GetString("Accept"),Gtk.ResponseType.Ok); Gtk.ResponseType result = (Gtk.ResponseType)fdialog.Run(); string file=fdialog.Filename; if (result==Gtk.ResponseType.Ok) { Console.WriteLine(file); fdialog.Destroy(); string manifest_default="/casper/filesystem.manifest"; string manifest_server="/casper/server.manifest"; string manifest_client="/casper/client.manifest"; string manifest_centro="/casper/centro.manifest"; string manifest_biblio="/casper/biblioteca.manifest"; string packages_file="/casper/packages.txt"; if (System.IO.File.Exists(file + manifest_server) && System.IO.File.Exists(file + manifest_client)) zero.netboot.Core.getCore().mnt_config["MANIFEST"]=file+manifest_centro; else if (System.IO.File.Exists(file + manifest_server)) { zero.netboot.Core.getCore().mnt_config["MANIFEST"]=file+manifest_server; System.IO.StreamReader bibliosr=new System.IO.StreamReader(file + packages_file); string biblio=""; bool biblio_found=false; while((biblio=bibliosr.ReadLine())!=null) { if (biblio.Contains("llxcfg-biblioteca")) { zero.netboot.Core.getCore().mnt_config["MANIFEST"]=file+manifest_biblio; biblio_found=true; } if(biblio_found) break; } bibliosr.Close(); } else if (System.IO.File.Exists(file + manifest_client)) zero.netboot.Core.getCore().mnt_config["MANIFEST"]=file+manifest_client; else zero.netboot.Core.getCore().mnt_config["MANIFEST"]=file+manifest_default; zero.netboot.Core.getCore().dprint("MANIFEST = " + zero.netboot.Core.getCore().mnt_config["MANIFEST"]); try{ System.IO.StreamReader sr=new System.IO.StreamReader(file + packages_file); string line=""; bool found=false; while((line=sr.ReadLine())!=null) { if (line.Contains("lliurex-cdd")) { //zero.netboot.Core.getCore().dprint(line); string[] tmp=line.Split(' '); bool version_found=false; foreach(string line2 in tmp) { if(line2.Contains("10.09") || line2.Contains("11.09")) { zero.netboot.Core.getCore().dprint("CDD_VERSION = " + line2); zero.netboot.Core.getCore().mnt_config["CDD_VERSION"]=line2; version_found=true; } if(version_found) break; } found=true; } if(found) break; } manifest_line=""; model_type=""; if(System.IO.File.Exists(zero.netboot.Core.getCore().mnt_config["MANIFEST"]) || zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("centro.manifest") || zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("biblioteca.manifest")) { if(zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("centro.manifest")) { model_type="modelo-centro"; zero.netboot.Core.getCore().dprint(model_type); } else { if(zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("server.manifest")) { model_type="modelo-server"; zero.netboot.Core.getCore().dprint(model_type); } else { if (zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("biblioteca.manifest")) { model_type="modelo-biblio"; zero.netboot.Core.getCore().dprint(model_type); } else { if(zero.netboot.Core.getCore().mnt_config["MANIFEST"].Contains("client.manifest")) { model_type="modelo-client"; zero.netboot.Core.getCore().dprint(model_type); } else { sr=new System.IO.StreamReader(zero.netboot.Core.getCore().mnt_config["MANIFEST"]); while((manifest_line=sr.ReadLine())!=null) { switch(manifest_line) { case "lliurex-cdd-edu-biblio-gserver": model_type="modelo-biblio"; break; case "lliurex-cdd-edu-class-gserver": model_type="modelo-server"; break; case "lliurex-cdd-edu-class-gclient": model_type="modelo-client"; break; case "lliurex-cdd-edu-lxdesktop": model_type="modelo-lite"; break; case "lliurex-cdd-lxdesktop": model_type="modelo-lite"; break; case "lliurex-cdd-edu-infantil-gdesktop": model_type="modelo-infantil"; break; case "lliurex-cdd-edu-music-gdesktop": model_type="modelo-music"; break; case "lliurex-cdd-edu-gdesktop": model_type="modelo-desktop"; break; case "lliurex-cdd-gdesktop-pime": model_type="modelo-pime"; break; default: break; } } sr.Close(); } } } } } System.Collections.Generic.List tmp_list=new System.Collections.Generic.List(); zero.netboot.Core.getCore().sqlman.select_query("SELECT * FROM isos",out tmp_list); if (model_type.Equals("modelo-centro")) { foreach(zero.netboot.IsoInfo info in tmp_list) { if (info.version.Contains("modelo-client") || info.version.Contains("modelo-server")) { zero.netboot.Core.getCore().isooptdialog=new zero.netboot.IsoOptionDialog(); iso_found=true; iso=info; } } if(!iso_found) CopyISOFileCenter(); } else { foreach(zero.netboot.IsoInfo info in tmp_list) { if (info.version.Contains(model_type)) { zero.netboot.Core.getCore().versionwin=new zero.netboot.VersionDialog(info.version,model_type + " " + zero.netboot.Core.getCore().mnt_config["CDD_VERSION"]); iso_found=true; iso=info; } } if(!iso_found) CopyISOFile(); } } catch { Console.WriteLine("Error!, wrong path."); zero.netboot.Core.getCore().close_me=false; zero.netboot.WarningDialog warning=new zero.netboot.WarningDialog(); warning.msg=Mono.Unix.Catalog.GetString(Mono.Unix.Catalog.GetString("Wrong Path selected.")); } } else if(result==Gtk.ResponseType.Cancel || result==Gtk.ResponseType.DeleteEvent) fdialog.Destroy(); } protected virtual void OnAddLinkButtonClicked (object sender, System.EventArgs e) { Gtk.FileChooserDialog fdialog= new Gtk.FileChooserDialog("asd",null,Gtk.FileChooserAction.SelectFolder); fdialog.AddButton("Cancel",Gtk.ResponseType.Cancel); fdialog.AddButton("Accept",Gtk.ResponseType.Ok); Gtk.ResponseType result = (Gtk.ResponseType)fdialog.Run(); string file=fdialog.Filename; if (result==Gtk.ResponseType.Ok) { Console.WriteLine(file); fdialog.Destroy(); // extract iso information somehow //zero.netboot.Core.getCore().sqlman.insert_iso(file,"Liurex 1060 Servidor Mundial"); isos.AppendValues("Lliurex 9009 Servidor Sistema Solar [Link]"); //zero.netboot.IsoInfo info=zero.netboot.Core.getCore().sqlman.get_last_iso_entry(); //zero.netboot.Core.getCore().isoList.Add() // move iso somewhere ? } else if(result==Gtk.ResponseType.Cancel || result==Gtk.ResponseType.DeleteEvent) fdialog.Destroy(); } protected virtual void OnDelButtonClicked (object sender, System.EventArgs e) { Gtk.TreeModel model; Gtk.TreeIter iter; treeview1.Selection.GetSelected(out model,out iter); zero.netboot.IsoInfo info=zero.netboot.IsoInfo.getInfo((string)model.GetValue(iter,0)); if (info!=null && !zero.netboot.Core.getCore().iso_options_running) { zero.netboot.Core core = zero.netboot.Core.getCore(); core.deldialog=new zero.netboot.DeleteDialog(info); core.deldialog.msg=Mono.Unix.Catalog.GetString("You are going to delete ISO") +" '" + info.version + "'. " + Mono.Unix.Catalog.GetString("Are you sure?"); } } protected virtual void OnMountButtonClicked (object sender, System.EventArgs e) { Console.WriteLine("MOUNT"); // do whatever i have to here // string std_out=""; // string err_out=""; Gtk.TreeModel model; Gtk.TreeIter iter; treeview1.Selection.GetSelected(out model,out iter); zero.netboot.IsoInfo info=zero.netboot.IsoInfo.getInfo((string)model.GetValue(iter,0)); Console.WriteLine(zero.netboot.Core.getCore().mount_script + " " + info.fileName); //lliurex.utils.Commands.run(mount_script,"",out std_out,out err_out); } /*protected virtual void OnEnabledApplyClicked (object sender, System.EventArgs e) { try { Convert.ToInt16(idEntry.Text); if(enabledCheck.Active) { Console.WriteLine("[IsoManagerWidget] Enabling iso id={0}",idEntry.Text); } else { Console.WriteLine("[IsoManagerWidget] Disabling iso id={0}",idEntry.Text); } } catch { } }*/ } } }