Ejemplo n.º 1
0
 private void OpenFold_Click(object sender, EventArgs e)
 {
     OpenRocket.Filter = "Rocket Permissions|" + Rocket.Core.Environment.PermissionFile;
     if (OpenRocket.ShowDialog() == DialogResult.OK)
     {
         _mem.Load(OpenRocket.FileName);
         Text          = "Editing: " + OpenRocket.FileName;
         DefGroup.Text = _mem._rp.DefaultGroup;
         GroupIDS.Items.Clear();
         _mem._rp.Groups.ForEach(k => GroupIDS.Items.Add(k.Id));
         GroupIDS.SelectedIndex = GroupIDS.Items.Count > 0 ? 0 : -1;
         RefreshGroupData();
     }
 }
Ejemplo n.º 2
0
        public PermissionsEditor(string FilePath, bool FileSystem = true)
        {
            InitializeComponent();

            if (!FileSystem)
            {
                OpenFold.Enabled = false;
                _fs           = FileSystem;
                _mem          = new PermissionsMemory();
                Text          = "Editing: Local GUI";
                _oldid        = _mem._rp.DefaultGroup;
                DefGroup.Text = _mem._rp.DefaultGroup;
                _mem._rp.Groups.ForEach(k => GroupIDS.Items.Add(k.Id));
                GroupIDS.SelectedIndex = GroupIDS.Items.Count > 0 ? 0 : -1;
                RefreshGroupData();
                return;
            }

            if (FilePath == "")
            {
                OpenRocket.Filter = "Rocket Permissions|" + Rocket.Core.Environment.PermissionFile;
                if (OpenRocket.ShowDialog() == DialogResult.OK)
                {
                    _mem          = new PermissionsMemory(OpenRocket.FileName);
                    Text          = "Editing: " + OpenRocket.FileName;
                    _oldid        = _mem._rp.DefaultGroup;
                    DefGroup.Text = _mem._rp.DefaultGroup;
                    _mem._rp.Groups.ForEach(k => GroupIDS.Items.Add(k.Id));
                    GroupIDS.SelectedIndex = GroupIDS.Items.Count > 0 ? 0 : -1;
                    RefreshGroupData();
                    return;
                }
                else
                {
                    Load += (s, e) => Close();
                    return;
                }
            }
            _mem          = new PermissionsMemory(FilePath);
            Text          = "Editing: " + FilePath;
            _oldid        = _mem._rp.DefaultGroup;
            DefGroup.Text = _mem._rp.DefaultGroup;
            _mem._rp.Groups.ForEach(k => GroupIDS.Items.Add(k.Id));
            GroupIDS.SelectedIndex = GroupIDS.Items.Count > 0 ? 0 : -1;
            RefreshGroupData();
        }