using System; using System.Collections.Generic; using Gtk; using Gdk; namespace lliurex { namespace controlcenter { public class ConfigApplication { //public const String path_icons = "/usr/share/zero-center/icons/"; public const String path_zmds = "/usr/share/zero-center/zmds/"; public const String path_apps= "/usr/share/zero-center/apps"; public const String status_path = "/usr/share/zero-center/applications"; public String name; public String locale_name; public String category; public Gdk.Pixbuf icon; public List prereq; public String [] pres; public uint status; public String script_path; public String comment; public bool service; public ConfigApplication(PropertyReader pr) { status = Core.S_CONF_NEEDED; service = true; if(pr.values.ContainsKey("Name"))name=pr.values["Name"]; else name="noname"; if(pr.values.ContainsKey("Name["+Core.getCore().locale+"]"))locale_name=pr.values["Name["+Core.getCore().locale+"]"]; else if(pr.values.ContainsKey("Name["+Core.getCore().short_locale+"]"))locale_name=pr.values["Name["+Core.getCore().short_locale+"]"]; else locale_name=""; if(pr.values.ContainsKey("Comment["+Core.getCore().locale+"]"))comment=pr.values["Comment["+Core.getCore().locale+"]"]; else if(pr.values.ContainsKey("Comment"))comment=pr.values["Comment"]; if(Core.getCore().IsGUI) { if(pr.values.ContainsKey("Icon")) { if(Gtk.IconTheme.Default.HasIcon(pr.values["Icon"])) { icon=Gtk.IconTheme.Default.LoadIcon(pr.values["Icon"],48,IconLookupFlags.ForceSvg); } else icon=Core.getCore().pixdefault; } else icon=Core.getCore().pixdefault; } else if (!Core.getCore().IsVerbosed) { Console.WriteLine("No GUI detected, Icons doesn't need to be loaded"); } if(pr.values.ContainsKey("Prereq")) { pres = pr.values["Prereq"].Split(';'); } if(pr.values.ContainsKey("ScriptPath")) { //temp = str.IndexOf("def"); string temp=pr.values["ScriptPath"]; int index= temp.IndexOf(".zmd"); // Console.WriteLine(index); if (index==-1) { script_path=temp; } else { script_path = path_zmds + temp; } // Console.WriteLine(script_path); } if(pr.values.ContainsKey("Category"))category=pr.values["Category"]; else category="Other"; if(pr.values.ContainsKey("Service")) { String tmp = pr.values["Service"]; if(tmp=="True")service=true; if(tmp=="False")service=false; } } } } }