public void ReplaceSmartScript(SmartScript script)
        {
            SmartScriptListViewItem lvi = Items.Cast <SmartScriptListViewItem>().SingleOrDefault(p => p.Script == script);

            if (lvi == null)
            {
                return;
            }

            lvi.SubItems.Clear();
            lvi.Name = script.entryorguid.ToString();
            lvi.Text = script.entryorguid.ToString();

            foreach (PropertyInfo propInfo in _pinfo.Where(p => !p.Name.Equals("entryorguid")))
            {
                if (_excludedProperties.Contains(propInfo.Name))
                {
                    continue;
                }

                lvi.SubItems.Add(propInfo.GetValue(script).ToString());
            }

            _smartScripts[_smartScripts.IndexOf(lvi.Script)] = script;
            HandleHighlightItems();
        }
        public void AddSmartScripts(List <SmartScript> scripts, bool listViewOnly = false)
        {
            List <ListViewItem> items = new List <ListViewItem>();

            foreach (SmartScript script in scripts)
            {
                SmartScriptListViewItem lvi = new SmartScriptListViewItem(script.entryorguid.ToString());
                lvi.Script = script;
                lvi.Name   = script.entryorguid.ToString();

                foreach (PropertyInfo propInfo in _pinfo.Where(p => !p.Name.Equals("entryorguid")))
                {
                    if (_excludedProperties.Contains(propInfo.Name))
                    {
                        continue;
                    }

                    lvi.SubItems.Add(propInfo.GetValue(script).ToString());
                }

                if (!listViewOnly)
                {
                    _smartScripts.Add(script);
                }

                items.Add(lvi);
            }

            Items.AddRange(items.ToArray());
            HandleHighlightItems();
        }
        public int AddSmartScript(SmartScript script, bool listViewOnly = false)
        {
            SmartScriptListViewItem lvi = new SmartScriptListViewItem(script.entryorguid.ToString());

            lvi.Script = script;
            lvi.Name   = script.entryorguid.ToString();

            foreach (PropertyInfo propInfo in _pinfo.Where(p => !p.Name.Equals("entryorguid")))
            {
                if (_excludedProperties.Contains(propInfo.Name))
                {
                    continue;
                }

                lvi.SubItems.Add(propInfo.GetValue(script).ToString());
            }

            if (!listViewOnly)
            {
                _smartScripts.Add(script);
            }

            ListViewItem newItem = Items.Add(lvi);

            HandleHighlightItems();
            return(newItem.Index);
        }
Beispiel #4
0
        public void AddSmartScripts(List <SmartScript> scripts, bool listViewOnly = false)
        {
            List <ListViewItem> items = new List <ListViewItem>();

            foreach (SmartScript script in scripts)
            {
                SmartScriptListViewItem lvi = new SmartScriptListViewItem(script.entryorguid.ToString());
                lvi.Script = script;
                lvi.Name   = script.entryorguid.ToString();

                foreach (PropertyInfo propInfo in _pinfo.Where(p => !p.Name.Equals("entryorguid")))
                {
                    if (_excludedProperties.Contains(propInfo.Name))
                    {
                        continue;
                    }

                    lvi.SubItems.Add(propInfo.GetValue(script).ToString());
                }

                if (!listViewOnly)
                {
                    _smartScripts.Add(script);
                }

                if (Settings.Default.PhaseHighlighting && script.event_phase_mask != 0)
                {
                    if (!_phaseColors.ContainsKey(script.event_phase_mask))
                    {
                        if (_colors.Count == 0)
                        {
                            MessageBox.Show("There are not enough colors in the application because you are using too many different phasemasks.", "Not enough colors!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        _phaseColors.Add(script.event_phase_mask, _colors.Pop());
                        lvi.BackColor = _phaseColors[script.event_phase_mask];
                    }

                    lvi.BackColor = _phaseColors[script.event_phase_mask];
                }

                items.Add(lvi);
            }

            Items.AddRange(items.ToArray());
        }
Beispiel #5
0
        public void ReplaceSmartScript(SmartScript script)
        {
            SmartScriptListViewItem lvi = Items.Cast <SmartScriptListViewItem>().SingleOrDefault(p => p.Script == script);

            if (lvi == null)
            {
                return;
            }

            lvi.SubItems.Clear();
            lvi.Name = script.entryorguid.ToString();
            lvi.Text = script.entryorguid.ToString();

            foreach (PropertyInfo propInfo in _pinfo.Where(p => !p.Name.Equals("entryorguid")))
            {
                if (_excludedProperties.Contains(propInfo.Name))
                {
                    continue;
                }

                lvi.SubItems.Add(propInfo.GetValue(script).ToString());
            }

            _smartScripts[_smartScripts.IndexOf(lvi.Script)] = script;

            if (Settings.Default.PhaseHighlighting && script.event_phase_mask != 0)
            {
                if (!_phaseColors.ContainsKey(script.event_phase_mask))
                {
                    if (_colors.Count == 0)
                    {
                        MessageBox.Show("There are not enough colors in the application because you are using too many different phasemasks.", "Not enough colors!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    _phaseColors.Add(script.event_phase_mask, _colors.Pop());
                }

                lvi.BackColor = _phaseColors[script.event_phase_mask];
            }
        }
        public int AddSmartScript(SmartScript script, bool listViewOnly = false, bool selectNewItem = false)
        {
            SmartScriptListViewItem lvi = new SmartScriptListViewItem(script.entryorguid.ToString());
            lvi.Script = script;
            lvi.Name = script.entryorguid.ToString();

            foreach (PropertyInfo propInfo in _pinfo.Where(p => !p.Name.Equals("entryorguid")))
            {
                if (_excludedProperties.Contains(propInfo.Name))
                    continue;

                lvi.SubItems.Add(propInfo.GetValue(script).ToString());
            }

            if (!listViewOnly)
                _smartScripts.Add(script);

            ListViewItem newItem = Items.Add(lvi);

            if (Settings.Default.PhaseHighlighting && script.event_phase_mask != 0)
            {
                if (!_phaseColors.ContainsKey(script.event_phase_mask))
                {
                    if (_colors.Count == 0)
                    {
                        MessageBox.Show("There are not enough colors in the application because you are using too many different phasemasks.", "Not enough colors!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return -1;
                    }

                    _phaseColors.Add(script.event_phase_mask, _colors.Pop());
                }

                newItem.BackColor = _phaseColors[script.event_phase_mask];
            }

            newItem.Selected = selectNewItem;
            return newItem.Index;
        }