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 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 ConfigApplication(PropertyReader pr) { status = Core.S_CONF_NEEDED; service = true; prereq=new List(); groups=new List(); users=new List(); 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["+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 = using_ + 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; } 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); } } //Comment[es] } } } }