示例#1
0
        /**
         * Read all the mods
         * /etc/apache2/mods-available/
         * /etc/apache2/mods-enabled/
         **/
        public static ArrayList ReadMods()
        {
            ArrayList list = new ArrayList();

            string[] mods_available = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.load");
            string[] mods_config = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.conf");
            string[] mods_enabled = System.IO.Directory.GetFiles("/etc/apache2/mods-enabled/", "*.load");

            for (int i = 0; i < mods_available.Length; i++) {
                string tmpName = Utils.FileNameWithoutExt(mods_available[i]);

                bool tmpActive = false;
                for (int j = 0; j < mods_enabled.Length; j++)
                    if (Utils.FileName(mods_available[i]) == Utils.FileName(mods_enabled[j]))
                        tmpActive = true;

                System.IO.FileInfo tmpConfigFile = null;
                for (int k = 0; k < mods_config.Length; k++)
                    if (Utils.FileNameWithoutExt(mods_available[i]) == Utils.FileNameWithoutExt(mods_config[k]))
                        tmpConfigFile = new System.IO.FileInfo(mods_config[k]);

                ApacheMod apacheMod = new ApacheMod(tmpName, tmpActive, tmpConfigFile);
                list.Add(apacheMod);
            }

            return list;
        }
示例#2
0
        private void OnEditButtonClicked(object o, EventArgs args)
        {
            TreeIter iter; TreeModel model;

            if (treeView.Selection.GetSelected(out model, out iter))
            {
                ApacheMod mod = (ApacheMod)model.GetValue(iter, 0);
                mod.edit();
            }
        }
示例#3
0
        private void OnStatusButtonToggled(object o, EventArgs args)
        {
            TreeIter iter; TreeModel model;

            if (treeView.Selection.GetSelected(out model, out iter))
            {
                ApacheMod mod = (ApacheMod)model.GetValue(iter, 0);
                mod.changeStatus();
            }
        }
示例#4
0
        private void OnSelectionChanged(object o, EventArgs args)
        {
            TreeIter iter; TreeModel model;

            if (((TreeSelection)o).GetSelected(out model, out iter))
            {
                ApacheMod mod = (ApacheMod)model.GetValue(iter, 0);
                statusButton.Sensitive = true;
                changeStatusButton(mod.active);
                editButton.Sensitive = mod.hasConfigFile();
            }
        }
示例#5
0
        private void RenderModStatus(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            ApacheMod mod = (ApacheMod)model.GetValue(iter, 0);

            if (mod.active)
            {
                (cell as Gtk.CellRendererText).Foreground = "darkgreen";
                (cell as CellRendererText).Text           = "Active";
            }
            else
            {
                (cell as Gtk.CellRendererText).Foreground = "red";
                (cell as CellRendererText).Text           = "Inactive";
            }
        }
示例#6
0
        /**
         * Read all the mods
         * /etc/apache2/mods-available/
         * /etc/apache2/mods-enabled/
         **/
        public static ArrayList ReadMods()
        {
            ArrayList list = new ArrayList();

            string[] mods_available = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.load");
            string[] mods_config    = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.conf");
            string[] mods_enabled   = System.IO.Directory.GetFiles("/etc/apache2/mods-enabled/", "*.load");

            for (int i = 0; i < mods_available.Length; i++)
            {
                string tmpName = Utils.FileNameWithoutExt(mods_available[i]);

                bool tmpActive = false;
                for (int j = 0; j < mods_enabled.Length; j++)
                {
                    if (Utils.FileName(mods_available[i]) == Utils.FileName(mods_enabled[j]))
                    {
                        tmpActive = true;
                    }
                }

                System.IO.FileInfo tmpConfigFile = null;
                for (int k = 0; k < mods_config.Length; k++)
                {
                    if (Utils.FileNameWithoutExt(mods_available[i]) == Utils.FileNameWithoutExt(mods_config[k]))
                    {
                        tmpConfigFile = new System.IO.FileInfo(mods_config[k]);
                    }
                }

                ApacheMod apacheMod = new ApacheMod(tmpName, tmpActive, tmpConfigFile);
                list.Add(apacheMod);
            }

            return(list);
        }
示例#7
0
        private void RenderModConfig(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            ApacheMod mod = (ApacheMod)model.GetValue(iter, 0);

            (cell as CellRendererText).Text = mod.getConfigFullPath();
        }
示例#8
0
        private void RenderModName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            ApacheMod mod = (ApacheMod)model.GetValue(iter, 0);

            (cell as CellRendererText).Text = mod.name;
        }
示例#9
0
 private void initMods()
 {
     apacheModsList.setCollection(ApacheMod.ReadMods());
 }