private void OnAddPermissionClick(string permission)
        {
            AMM_PropertyTemplate property = new AMM_PropertyTemplate("uses-permission");

            property.SetValue("android:name", permission);
            AMM_Manager.GetManifest().AddPermission(property);
        }
        private void SelectPermission(object data)
        {
            AMM_PropertyTemplate newPermission = new AMM_PropertyTemplate("uses-permission");

            newPermission.SetValue("android:name", data.ToString());
            AMM_Manager.GetManifest().AddPermission(newPermission);
        }
Esempio n. 3
0
 public void AddProperty(string tag, AMM_PropertyTemplate property)
 {
     if (!m_properties.ContainsKey(tag))
     {
         List <AMM_PropertyTemplate> list = new List <AMM_PropertyTemplate>();
         m_properties.Add(tag, list);
     }
     m_properties [tag].Add(property);
 }
Esempio n. 4
0
        public AMM_PropertyTemplate GetOrCreatePropertyWithTag(string tag)
        {
            AMM_PropertyTemplate p = GetPropertyWithTag(tag);

            if (p == null)
            {
                p = new AMM_PropertyTemplate(tag);
                AddProperty(p);
            }

            return(p);
        }
Esempio n. 5
0
        public string GetIntentFilterName(AMM_PropertyTemplate intent)
        {
            List <AMM_PropertyTemplate> actions = intent.GetPropertiesWithTag("action");

            if (actions.Count > 0)
            {
                return(actions[0].GetValue("android:name"));
            }
            else
            {
                return(string.Empty);
            }
        }
Esempio n. 6
0
        public AMM_PropertyTemplate GetOrCreatePropertyWithName(string tag, string name)
        {
            AMM_PropertyTemplate p = GetPropertyWithName(tag, name);

            if (p == null)
            {
                p = new AMM_PropertyTemplate(tag);
                p.SetValue("android:name", name);
                AddProperty(p);
            }

            return(p);
        }
Esempio n. 7
0
        public static AMM_PropertyTemplate GetLauncherPropertyTemplate()
        {
            AMM_PropertyTemplate launcher = new AMM_PropertyTemplate("intent-filter");

            AMM_PropertyTemplate prop = new AMM_PropertyTemplate("action");

            prop.SetValue("android:name", "android.intent.action.MAIN");
            launcher.AddProperty("action", prop);

            prop = new AMM_PropertyTemplate("category");
            prop.SetValue("android:name", "android.intent.category.LAUNCHER");
            launcher.AddProperty("category", prop);

            return(launcher);
        }
Esempio n. 8
0
        public AMM_PropertyTemplate AddPermission(string name)
        {
            if (!HasPermission(name))
            {
                AMM_PropertyTemplate uses_permission = new AMM_PropertyTemplate("uses-permission");
                uses_permission.Name = name;
                AddPermission(uses_permission);

                return(uses_permission);
            }
            else
            {
                return(GetPermission(name));
            }
        }
Esempio n. 9
0
        public AMM_PropertyTemplate GetOrCreateIntentFilterWithName(string name)
        {
            AMM_PropertyTemplate filter = GetIntentFilterWithName(name);

            if (filter == null)
            {
                filter = new AMM_PropertyTemplate("intent-filter");
                AMM_PropertyTemplate action = new AMM_PropertyTemplate("action");
                action.SetValue("android:name", name);
                filter.AddProperty(action);
                AddProperty(filter);
            }

            return(filter);
        }
Esempio n. 10
0
        public override void ToXmlElement(XmlDocument doc, XmlElement parent)
        {
            AddAttributesToXml(doc, parent, this);

            AMM_PropertyTemplate launcher = null;

            if (_isLauncher)
            {
                launcher = GetLauncherPropertyTemplate();
                AddProperty(launcher.Tag, launcher);
            }
            AddPropertiesToXml(doc, parent, this);
            if (_isLauncher)
            {
                m_properties["intent-filter"].Remove(launcher);
            }
        }
Esempio n. 11
0
        public static AMM_PropertyTemplate ParseProperty(XmlNode node)
        {
            AMM_PropertyTemplate property = new AMM_PropertyTemplate(node.Name);

            //Get Values
            foreach (XmlAttribute attr in node.Attributes)
            {
                property.SetValue(attr.Name, attr.Value);
            }
            //Get Properties
            foreach (XmlNode n in node.ChildNodes)
            {
                if (!n.Name.Equals("#comment"))
                {
                    property.AddProperty(n.Name, ParseProperty(n));
                }
            }

            return(property);
        }
Esempio n. 12
0
        public bool IsLauncherProperty(AMM_PropertyTemplate property)
        {
            if (property.Tag.Equals("intent-filter"))
            {
                if (property.Properties.ContainsKey("category"))
                {
                    foreach (AMM_PropertyTemplate p in property.Properties["category"])
                    {
                        if (p.Values.ContainsKey("android:name"))
                        {
                            if (p.Values ["android:name"].Equals("android.intent.category.LAUNCHER"))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }
Esempio n. 13
0
        private void ReadManifest(string manifestPath)
        {
            m_template = new AMM_Template();


            if (!SA_AssetDatabase.IsFileExists(manifestPath))
            {
                return;
            }

#if !(UNITY_WP8 || UNITY_METRO)
            //Read XML file
            XmlDocument doc = new XmlDocument();
            doc.Load(SA_PathUtil.ConvertRelativeToAbsolutePath(manifestPath));
            XmlNode rootNode = doc.DocumentElement;

            foreach (XmlAttribute attr in rootNode.Attributes)
            {
                m_template.SetValue(attr.Name, attr.Value);
            }

            foreach (XmlNode childNode in rootNode.ChildNodes)
            {
                if (!childNode.Name.Equals("application") &&
                    !childNode.Name.Equals("uses-permission") &&
                    !childNode.Name.Equals("#comment"))
                {
                    m_template.AddProperty(childNode.Name, AMM_Manager.ParseProperty(childNode));
                }
            }

            XmlNode applicationNode = null;
            foreach (XmlNode childNode in rootNode.ChildNodes)
            {
                if (childNode.Name.Equals("application"))
                {
                    applicationNode = childNode;
                    break;
                }
            }

            foreach (XmlAttribute attr in applicationNode.Attributes)
            {
                m_template.ApplicationTemplate.SetValue(attr.Name, attr.Value);
            }
            foreach (XmlNode childNode in applicationNode.ChildNodes)
            {
                if (!childNode.Name.Equals("#comment") &&
                    !childNode.Name.Equals("activity"))
                {
                    m_template.ApplicationTemplate.AddProperty(childNode.Name, AMM_Manager.ParseProperty(childNode));
                }
            }

            foreach (XmlNode childNode in applicationNode.ChildNodes)
            {
                if (childNode.Name.Equals("activity") &&
                    !childNode.Name.Equals("#comment"))
                {
                    string activityName = "";
                    if (childNode.Attributes["android:name"] != null)
                    {
                        activityName = childNode.Attributes["android:name"].Value;
                    }
                    else
                    {
                        Debug.LogWarning("Android Manifest contains activity tag without android:name attribute.");
                    }

                    XmlNode launcher   = null;
                    bool    isLauncher = false;
                    foreach (XmlNode actNode in childNode.ChildNodes)
                    {
                        if (actNode.Name.Equals("intent-filter"))
                        {
                            foreach (XmlNode intentNode in actNode.ChildNodes)
                            {
                                if (intentNode.Name.Equals("category"))
                                {
                                    if (intentNode.Attributes["android:name"].Value.Equals("android.intent.category.LAUNCHER"))
                                    {
                                        isLauncher = true;
                                        launcher   = actNode;
                                    }
                                }
                            }
                        }
                    }

                    AMM_ActivityTemplate activity = new AMM_ActivityTemplate(isLauncher, activityName);
                    foreach (XmlAttribute attr in childNode.Attributes)
                    {
                        activity.SetValue(attr.Name, attr.Value);
                    }

                    foreach (XmlNode actNode in childNode.ChildNodes)
                    {
                        if (!actNode.Name.Equals("#comment"))
                        {
                            if (actNode != launcher)
                            {
                                activity.AddProperty(actNode.Name, AMM_Manager.ParseProperty(actNode));
                            }
                        }
                    }

                    m_template.ApplicationTemplate.AddActivity(activity);
                }
            }

            //Load Manifest Permissions
            foreach (XmlNode node in rootNode.ChildNodes)
            {
                if (node.Name.Equals("uses-permission"))
                {
                    AMM_PropertyTemplate permission = new AMM_PropertyTemplate("uses-permission");
                    permission.SetValue("android:name", node.Attributes["android:name"].Value);
                    m_template.AddPermission(permission);
                }
            }
#endif
        }
Esempio n. 14
0
 public void RemoveProperty(AMM_PropertyTemplate property)
 {
     m_properties [property.Tag].Remove(property);
 }
Esempio n. 15
0
 public void AddProperty(AMM_PropertyTemplate property)
 {
     AddProperty(property.Tag, property);
 }
Esempio n. 16
0
 public void AddPermission(AMM_PropertyTemplate permission)
 {
     _permissions.Add(permission);
 }
Esempio n. 17
0
        private static void OnAddPropertyClick(string tag)
        {
            AMM_PropertyTemplate property = new AMM_PropertyTemplate(tag);

            m_parentTemplate.AddProperty(tag, property);
        }
Esempio n. 18
0
 public void RemovePermission(AMM_PropertyTemplate permission)
 {
     _permissions.Remove(permission);
 }