Example #1
0
        public List <Target> GetTargets(bool loadIncs)
        {
            List <Target> results = new List <Target>();
            XmlNodeList   targets = root.GetElementsByTagName("target");

            foreach (XmlElement node in targets)
            {
                Target t = new Target(node.GetAttribute("name"), node.GetAttribute("file"), null);
                t.Debug         = "True".Equals(node.GetAttribute("debug"));
                t.Shorthand     = "True".Equals(node.GetAttribute("shorthand"));
                t.ShorthandList = node.GetAttribute("shorthand-list");
                if (loadIncs)
                {
                    XmlNodeList incs = node.GetElementsByTagName("include");
                    foreach (XmlNode inc in incs)
                    {
                        string iname = inc.Attributes.GetNamedItem("name").Value;
                        if (IsSelected(iname) && FileExists(iname))
                        {
                            t.Add(iname);
                        }
                    }
                }
                results.Add(t);
            }
            return(results);
        }
Example #2
0
        private void okButton_Click(object sender, EventArgs e)
        {
            Project p = Project.GetInstance();

            if (txtName.Text.Trim().Length < 1)
            {
                MessageBox.Show("A target name is required.",
                                "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtName.Focus();
                return;
            }
            if (txtFile.Text.Trim().Length < 1)
            {
                MessageBox.Show("A file name is required.",
                                "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtFile.Focus();
                return;
            }
            if (incs.Items.Count < 1)
            {
                MessageBox.Show("You must select at least one file to include.",
                                "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                files.Focus();
                return;
            }
            if (originalName.Length == 0)
            {
                List <Target> targets = p.GetTargets(false);
                foreach (Target t in targets)
                {
                    if (t.Name.Trim().ToLower() == txtName.Text.Trim().ToLower())
                    {
                        MessageBox.Show("The target name '" + txtName.Text.Trim() + "' already exists.  Please choose a new name.",
                                        "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }
            }
            target.Includes = new List <string>(incs.Items.Count);
            foreach (ListViewItem li in incs.Items)
            {
                target.Add(li.Name);
            }

            p.AddTarget(target, originalName);

            this.Close();
        }
Example #3
0
        public Target GetTarget(string name)
        {
            XmlElement node = (XmlElement)root.SelectSingleNode("target[@name='" + name + "']");

            if (node != null)
            {
                Target t = new Target(node.GetAttribute("name"), node.GetAttribute("file"), null);
                t.Debug         = "True".Equals(node.GetAttribute("debug"));
                t.Shorthand     = "True".Equals(node.GetAttribute("shorthand"));
                t.ShorthandList = node.GetAttribute("shorthand-list");
                XmlNodeList incs = node.GetElementsByTagName("include");
                foreach (XmlNode inc in incs)
                {
                    string iname = inc.Attributes.GetNamedItem("name").Value;
                    if (IsSelected(iname))
                    {
                        t.Add(iname);
                    }
                }
                return(t);
            }
            return(null);
        }
Example #4
0
 public List<Target> GetTargets(bool loadIncs)
 {
     List<Target> results = new List<Target>();
     XmlNodeList targets = root.GetElementsByTagName("target");
     foreach(XmlElement node in targets)
     {
         Target t = new Target(node.GetAttribute("name"), node.GetAttribute("file"), null);
         t.Debug = "True".Equals(node.GetAttribute("debug"));
         t.Shorthand = "True".Equals(node.GetAttribute("shorthand"));
         t.ShorthandList = node.GetAttribute("shorthand-list");
         if(loadIncs)
         {
             XmlNodeList incs = node.GetElementsByTagName("include");
             foreach(XmlNode inc in incs)
             {
                 string iname = inc.Attributes.GetNamedItem("name").Value;
                 if(IsSelected(iname) && FileExists(iname))
                 {
                     t.Add(iname);
                 }
             }
         }
         results.Add(t);
     }
     return results;
 }
Example #5
0
 public Target GetTarget(string name)
 {
     XmlElement node = (XmlElement)root.SelectSingleNode("target[@name='" + name + "']");
     if(node != null)
     {
         Target t = new Target(node.GetAttribute("name"), node.GetAttribute("file"), null);
         t.Debug = "True".Equals(node.GetAttribute("debug"));
         t.Shorthand = "True".Equals(node.GetAttribute("shorthand"));
         t.ShorthandList = node.GetAttribute("shorthand-list");
         XmlNodeList incs = node.GetElementsByTagName("include");
         foreach(XmlNode inc in incs)
         {
             string iname = inc.Attributes.GetNamedItem("name").Value;
             if(IsSelected(iname))
             {
                 t.Add(iname);
             }
         }
         return t;
     }
     return null;
 }