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 List groups; public List users; public List locks; public List unlocks; public String [] pres; //public String pres; public uint status; public String script_path; public String comment; public bool service; public String comment_es; public String using_; public bool date; public bool modal; public bool enabled; public ConfigApplication(PropertyReader pr) { status = Core.S_CONF_NEEDED; service = true; enabled= true; prereq=new List(); groups=new List(); users=new List(); locks=new List(); unlocks=new List(); using_=""; date=false; if(pr.values.ContainsKey("Name"))name=pr.values["Name"]; else name="noname"; Console.WriteLine("Comment["+Core.getCore().locale+"]"); 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 if(pr.values.ContainsKey("Name[en]")) locale_name=pr.values["Name[en]"]; else locale_name=pr.values["Name"]; if(pr.values.ContainsKey("Comment["+Core.getCore().locale+"]")) comment=pr.values["Comment["+Core.getCore().locale+"]"]; else if(pr.values.ContainsKey("Comment["+Core.getCore().short_locale+"]")) comment=pr.values["Comment["+Core.getCore().short_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("Depends")) { pres=pr.values["Depends"].Split(';'); foreach (String n in pres) { // prereq.Add(n); // Console.WriteLine(n); prereq.Add(n); } } if(pr.values.ContainsKey("Using")) { using_=pr.values["Using"]; //Console.WriteLine(pr.values["Using"]); } 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; modal=true; } if(tmp=="False") { service=false; modal=false; } } else service=false; if(pr.values.ContainsKey("Groups")) { pres=pr.values["Groups"].Split(';'); foreach (String n in pres) { groups.Add(n); // Console.WriteLine("[Config Application] {0}",n); } } if(pr.values.ContainsKey("Users")) { pres=pr.values["Users"].Split(';'); foreach(String n in pres) { users.Add(n); } } if(pr.values.ContainsKey("Locks")) { pres=pr.values["Locks"].Split(';'); foreach(String n in pres) { Console.WriteLine("locks " + n); locks.Add(n); } } if(pr.values.ContainsKey("Unlocks")) { pres=pr.values["Unlocks"].Split(';'); foreach(String n in pres) { Console.WriteLine("locks " + n); unlocks.Add(n); } } if(pr.values.ContainsKey("Date")) { if (pr.values["Date"]=="1") { date=true; } } if(pr.values.ContainsKey("Modal")) { if(pr.values["Modal"]=="True") { modal=true; } if(pr.values["Modal"]=="False") { modal=false; } } if(pr.values.ContainsKey("Enabled")) { if(pr.values["Enabled"]=="False") enabled=false; } //Comment[es] } } } }