Esempio n. 1
0
	    static MainForm()
        {
            using (Splash splash = new Splash("Refreshing wrappers list..."))
            {
                splash.Show();
                Application.DoEvents();
                myName = Path.GetFileNameWithoutExtension(Application.ExecutablePath);
                tempName = "s3pe-" + FNV64.GetHash(DateTime.UtcNow.ToString("O")).ToString("X16") + "-";
                foreach (string s in unwantedFields) fields.Remove(s);

                List<KeyValuePair<string, Type>> typeMap = new List<KeyValuePair<string, Type>>(WrapperDealer.TypeMap);
                WrapperDealer.Disabled.Clear();
                if (Properties.Settings.Default.DisabledWrappers != null)
                {
	                foreach (var v in Properties.Settings.Default.DisabledWrappers)
	                {
		                string[] kv = v.Trim().Split(new[] { ':' }, 2);
		                KeyValuePair<string, Type> kvp = typeMap.Find(x => x.Key == kv[0] && x.Value.FullName == kv[1]);
		                if (!kvp.Equals(default(KeyValuePair<string, Type>)))
		                {
			                WrapperDealer.Disabled.Add(kvp);
		                }
	                }
                }
            }
        }
Esempio n. 2
0
        public MainForm()
        {
            using (Splash splash = new Splash("Initialising form..."))
            {
                splash.Show();
                Application.DoEvents();
                InitializeComponent();

                this.Text = myName;

                this.lbProgress.Text = "";

                browserWidget1.Fields = new List<string>(fields.ToArray());
                browserWidget1.ContextMenuStrip = menuBarWidget.browserWidgetContextMenuStrip;

                List<string> filterFields = new List<string>(fields);
                foreach (string f in unwantedFilterFields)
                    filterFields.Remove(f);
                filterFields.Insert(0, "Tag");
                filterFields.Insert(0, "Name");
                resourceFilterWidget1.BrowserWidget = browserWidget1;
                resourceFilterWidget1.Fields = filterFields;
                resourceFilterWidget1.ContextMenuStrip = menuBarWidget.filterContextMenuStrip;
                menuBarWidget.CMFilter_Click += new MenuBarWidget.MBClickEventHandler(menuBarWidget1_CMFilter_Click);

                packageInfoWidget1.Fields = packageInfoFields1.Fields;
                this.PackageFilenameChanged += new EventHandler(MainForm_PackageFilenameChanged);
                this.PackageChanged += new EventHandler(MainForm_PackageChanged);

                this.SaveSettings += new EventHandler(MainForm_SaveSettings);
                this.SaveSettings += new EventHandler(browserWidget1.BrowserWidget_SaveSettings);
                this.SaveSettings += new EventHandler(controlPanel1.ControlPanel_SaveSettings);
                //this.SaveSettings += new EventHandler(hexWidget1.HexWidget_SaveSettings);

                MainForm_LoadFormSettings();
            }
        }
Esempio n. 3
0
        void UpdateList()
        {
            if (((MainForm)ParentForm).IsClosing) return;

            var cmp = listView1.ListViewItemSorter;
            IResourceIndexEntry sie = SelectedResource;

            bool vis = listView1.Visible;
            bool uwc = Application.UseWaitCursor;
            DateTime tick = DateTime.UtcNow.AddMilliseconds(tock);
            try
            {
                Application.UseWaitCursor = true;
                listView1.BeginUpdate();
                listView1.Visible = false;

                listView1.ListViewItemSorter = null;

                pbLabel.Text = "";
                SelectedResource = null;

                pbLabel.Text = "Clear resource list...";
                Application.DoEvents();
                using (Splash splash = new Splash("Clear resource list..."))
                {
                    splash.Show();
                    Application.DoEvents();
                    listView1.Items.Clear();// this can be slow and steals the main thread!
                }
                #region Old clear listView1...
                /*if (!pbLabel.Visible || listView1.Items.Count > 10000)
                {
                }
                else
                {
                    // this is slower but gives some feedback
                    pb.Maximum = listView1.Items.Count;
                    pb.Value = listView1.Items.Count;
                    try
                    {
                        int i = listView1.Items.Count;
                        while (i > 0)
                        {
                            i--;
                            try
                            {
                                listView1.Items.RemoveAt(i);
                            }
                            finally
                            {
                                if (tick < DateTime.UtcNow)
                                {
                                    tick = DateTime.UtcNow.AddMilliseconds(tock);
                                    if (pb != null) { pb.Value = i; Application.DoEvents(); }
                                }
                            }
                        }
                    }
                    finally { if (pb != null) pb.Value = 0; }
                }/**/
                #endregion

                lookup = new Dictionary<IResourceIndexEntry, ListViewItem>();
                if (resourceList == null) return;

                AddRange(resourceList);
            }
            finally
            {
                pbLabel.Text = "Restoring sorter...";
                Application.DoEvents();
                listView1.ListViewItemSorter = cmp;

                pbLabel.Text = "";
                Application.DoEvents();
                if (sie != null && lookup.ContainsKey(sie))
                    SelectedResource = sie;

                listView1.Visible = !this.Visible || !this.Created || vis;
                listView1.EndUpdate();
                Application.UseWaitCursor = uwc;
                Application.DoEvents();

                OnListUpdated(this, new EventArgs());
                if (this.Visible)
                    ForceFocus.Focus(Application.OpenForms[0]);
            }
        }
Esempio n. 4
0
        public void SelectAll()
        {
            if (((MainForm)ParentForm).IsClosing) return;

            string pbOldLabel = pbLabel.Text;
            int pbOldMaximum = -1;
            int pbOldValue = -1;
            if (pb != null)
            {
                pbOldMaximum = pb.Maximum;
                pbOldValue = pb.Value;
            }
            bool lvb = listView1.Visible;
            bool uwc = Application.UseWaitCursor;

            DateTime tick = DateTime.UtcNow.AddMilliseconds(tock);
            try
            {
                Application.UseWaitCursor = true;
                listView1.SuspendLayout();
                listView1.BeginUpdate();
                listView1.Visible = false;

                internalchg = true;

                SelectedResource = null;//not restored for SelectAll
                pbLabel.Text = "Selecting all resources...";
                Application.DoEvents();
                using (Splash splash = new Splash(pbLabel.Text))
                {
                    splash.Show();
                    Application.DoEvents();

                    if (pb != null)
                    {
                        pb.Value = 0;
                        pb.Maximum = listView1.Items.Count;
                    }

                    listView1.SelectedItems.Clear();

                    for (int i = 0; i < listView1.Items.Count; i++)
                    {
                        listView1.Items[i].Selected = true;
                        if (DateTime.UtcNow > tick)
                        {
                            if (((MainForm)ParentForm).IsClosing) return;

                            if (pb != null) { pb.Value = listView1.SelectedItems.Count; Application.DoEvents(); }
                            Application.DoEvents();
                            tick = DateTime.UtcNow.AddMilliseconds(tock);
                        }
                    }
                }
            }
            finally
            {
                pbLabel.Text = pbOldLabel;
                if (pb != null)
                {
                    pb.Value = 0;
                    pb.Maximum = pbOldMaximum;
                    pb.Value = pbOldValue;
                }
                listView1.Visible = lvb;
                listView1.EndUpdate();
                listView1.ResumeLayout();
                Application.UseWaitCursor = uwc;
                internalchg = false;
            }
            if (listView1.SelectedItems.Count == 1)
                listView1_SelectedIndexChanged(this, EventArgs.Empty);
        }
Esempio n. 5
0
        void UpdateList()
        {
            if (((MainForm)ParentForm).IsClosing)
            {
                return;
            }

            var cmp = listView1.ListViewItemSorter;
            IResourceIndexEntry sie = SelectedResource;

            bool     vis  = listView1.Visible;
            bool     uwc  = Application.UseWaitCursor;
            DateTime tick = DateTime.UtcNow.AddMilliseconds(tock);

            try
            {
                Application.UseWaitCursor = true;
                listView1.BeginUpdate();
                listView1.Visible = false;

                listView1.ListViewItemSorter = null;

                pbLabel.Text     = "";
                SelectedResource = null;

                pbLabel.Text = "Clear resource list...";
                Application.DoEvents();
                using (Splash splash = new Splash("Clear resource list..."))
                {
                    splash.Show();
                    Application.DoEvents();
                    listView1.Items.Clear();// this can be slow and steals the main thread!
                }
                #region Old clear listView1...

                /*if (!pbLabel.Visible || listView1.Items.Count > 10000)
                 * {
                 * }
                 * else
                 * {
                 *  // this is slower but gives some feedback
                 *  pb.Maximum = listView1.Items.Count;
                 *  pb.Value = listView1.Items.Count;
                 *  try
                 *  {
                 *      int i = listView1.Items.Count;
                 *      while (i > 0)
                 *      {
                 *          i--;
                 *          try
                 *          {
                 *              listView1.Items.RemoveAt(i);
                 *          }
                 *          finally
                 *          {
                 *              if (tick < DateTime.UtcNow)
                 *              {
                 *                  tick = DateTime.UtcNow.AddMilliseconds(tock);
                 *                  if (pb != null) { pb.Value = i; Application.DoEvents(); }
                 *              }
                 *          }
                 *      }
                 *  }
                 *  finally { if (pb != null) pb.Value = 0; }
                 * }/**/
                #endregion

                lookup = new Dictionary <IResourceIndexEntry, ListViewItem>();
                if (resourceList == null)
                {
                    return;
                }

                AddRange(resourceList);
            }
            finally
            {
                pbLabel.Text = "Restoring sorter...";
                Application.DoEvents();
                listView1.ListViewItemSorter = cmp;

                pbLabel.Text = "";
                Application.DoEvents();
                if (sie != null && lookup.ContainsKey(sie))
                {
                    SelectedResource = sie;
                }

                listView1.Visible = !this.Visible || !this.Created || vis;
                listView1.EndUpdate();
                Application.UseWaitCursor = uwc;
                Application.DoEvents();

                OnListUpdated(this, new EventArgs());
                if (this.Visible)
                {
                    ForceFocus.Focus(Application.OpenForms[0]);
                }
            }
        }
Esempio n. 6
0
        public void SelectAll()
        {
            if (((MainForm)ParentForm).IsClosing)
            {
                return;
            }

            string pbOldLabel   = pbLabel.Text;
            int    pbOldMaximum = -1;
            int    pbOldValue   = -1;

            if (pb != null)
            {
                pbOldMaximum = pb.Maximum;
                pbOldValue   = pb.Value;
            }
            bool lvb = listView1.Visible;
            bool uwc = Application.UseWaitCursor;

            DateTime tick = DateTime.UtcNow.AddMilliseconds(tock);

            try
            {
                Application.UseWaitCursor = true;
                listView1.SuspendLayout();
                listView1.BeginUpdate();
                listView1.Visible = false;

                internalchg = true;

                SelectedResource = null;//not restored for SelectAll
                pbLabel.Text     = "Selecting all resources...";
                Application.DoEvents();
                using (Splash splash = new Splash(pbLabel.Text))
                {
                    splash.Show();
                    Application.DoEvents();

                    if (pb != null)
                    {
                        pb.Value   = 0;
                        pb.Maximum = listView1.Items.Count;
                    }

                    listView1.SelectedItems.Clear();

                    for (int i = 0; i < listView1.Items.Count; i++)
                    {
                        listView1.Items[i].Selected = true;
                        if (DateTime.UtcNow > tick)
                        {
                            if (((MainForm)ParentForm).IsClosing)
                            {
                                return;
                            }

                            if (pb != null)
                            {
                                pb.Value = listView1.SelectedItems.Count; Application.DoEvents();
                            }
                            Application.DoEvents();
                            tick = DateTime.UtcNow.AddMilliseconds(tock);
                        }
                    }
                }
            }
            finally
            {
                pbLabel.Text = pbOldLabel;
                if (pb != null)
                {
                    pb.Value   = 0;
                    pb.Maximum = pbOldMaximum;
                    pb.Value   = pbOldValue;
                }
                listView1.Visible = lvb;
                listView1.EndUpdate();
                listView1.ResumeLayout();
                Application.UseWaitCursor = uwc;
                internalchg = false;
            }
            if (listView1.SelectedItems.Count == 1)
            {
                listView1_SelectedIndexChanged(this, EventArgs.Empty);
            }
        }