static SupcomLookups() { MapNameLookup = GameItem.MapNameLookup; Maps = new MultiVal<string, string>[MapNameLookup.Count + 1]; Maps[0] = new MultiVal<string, string>(Loc.Get("<LOC>All Maps"), ""); int index = 1; foreach (KeyValuePair<string, string> pair in MapNameLookup) { Maps[index] = new MultiVal<string, string>(pair.Value, pair.Key); index++; } }
private void gvChat_MouseMove(object sender, MouseEventArgs e) { try { GridHitInfo info = (sender as GridView).CalcHitInfo(e.X, e.Y); if (info.InRow && this.ChatRowPoints.ContainsKey(info.RowHandle)) { Rectangle rectangle = this.ChatRowPoints[info.RowHandle]; if (rectangle.Contains(e.X, e.Y)) { ChatLine row = (sender as GridView).GetRow(info.RowHandle) as ChatLine; if (row != null) { IText text = row.TextSegments[0]; if (text != null) { int index; Font textFont = text.TextFont; string str = text.Text; string str2 = null; Dictionary<int, ChatLink> dictionary = null; List<string> list = null; List<MultiVal<int, int>> list2 = null; SortedList<int, Emote> list3 = null; if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str)); } if (!(!Program.Settings.Chat.Emotes.ShowEmotes || (!row.ContainsEmotes.HasValue ? false : !row.ContainsEmotes.Value))) { list = new List<string>(); list2 = new List<MultiVal<int, int>>(); list3 = new SortedList<int, Emote>(); foreach (Emote emote in Emote.AllEmotes.Values) { index = str.IndexOf(emote.CharSequence); while (index >= 0) { bool flag = false; if (dictionary != null) { foreach (ChatLink link in dictionary.Values) { if ((index > link.StartIndex) && (index < link.EndIndex)) { flag = true; } } } if (!flag) { list2.Add(new MultiVal<int, int>(index, emote.CharSequence.Length)); list3.Add(index, emote); } index = str.IndexOf(emote.CharSequence, (int) (index + emote.CharSequence.Length)); if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { if (str2 == null) { str2 = str; } str2 = str2.Replace(emote.CharSequence, ""); } } } } using (Graphics graphics = this.gpgChatGrid.CreateGraphics()) { float num6; float x; float y; int num9; int num10; ChatLink link2; SolidBrush brush; string[] strArray; int num11; SizeF ef; Brush brush2; Font font2; RectangleF ef2; if ((list3 != null) && (list3.Count > 0)) { int num2; list2.Add(new MultiVal<int, int>(str.Length, 0)); list3.Add(str.Length, null); SortedList<int, MultiVal<int, int>> list4 = new SortedList<int, MultiVal<int, int>>(list2.Count); list4[-1] = new MultiVal<int, int>(0, 0); foreach (MultiVal<int, int> val in list2) { list4[val.Value1] = val; } for (num2 = 1; num2 < list4.Count; num2++) { int num3 = list4.Values[num2 - 1].Value1; index = list4.Values[num2].Value1; int num4 = list4.Values[num2 - 1].Value2; int num5 = list4.Values[num2].Value2; list.Add(str.Substring(num3 + num4, index - (num3 + num4))); } dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str2)); num6 = textFont.Height + 3; x = rectangle.X; y = rectangle.Y; num9 = (this.colText.VisibleWidth - 10) + rectangle.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { for (num2 = 0; num2 < list.Count; num2++) { if (list[num2].Length > 0) { strArray = DrawUtil.SplitString(list[num2], " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { using (font2 = new Font(textFont, FontStyle.Underline)) { ef = DrawUtil.MeasureString(graphics, link2.DisplayText + " ", font2); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } ef2 = new RectangleF(x, y, ef.Width, ef.Height); if (ef2.Contains((float) e.X, (float) e.Y)) { this.Cursor = Cursors.Hand; return; } } } } else { ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } if (list3.Values[num2] != null) { float num12 = ((float) textFont.Height) / ((float) list3.Values[num2].Image.Height); float num13 = list3.Values[num2].Image.Width * num12; if ((x + num13) > num9) { x = rectangle.X; y += num6; } x += num13; } } } } else { dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str)); if ((dictionary != null) && (dictionary.Count > 0)) { num6 = textFont.Height + 3; x = rectangle.X; y = rectangle.Y; num9 = (this.colText.VisibleWidth - 10) + rectangle.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { strArray = DrawUtil.SplitString(str, " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { using (font2 = new Font(textFont, FontStyle.Underline)) { ef = DrawUtil.MeasureString(graphics, link2.DisplayText + " ", font2); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } ef2 = new RectangleF(x, y, ef.Width, ef.Height); if (ef2.Contains((float) e.X, (float) e.Y)) { this.Cursor = Cursors.Hand; return; } } } } else { ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } } } } } } } } } catch (Exception exception) { ErrorLog.WriteLine(exception); this.Cursor = Cursors.Default; } this.Cursor = Cursors.Default; }
private void gvChat_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { try { if (this.mFirstChatDraw) { this.mFirstChatDraw = false; Program.Settings.StylePreferences.StyleControl(this.gvPrivateChat, EventArgs.Empty); } if ((e.Column.Name != this.colPlayer.Name) && (e.Column.Name != this.colText.Name)) { e.Handled = false; } else { this.ChatRowPoints[e.RowHandle] = e.Bounds; if (e.Column.AbsoluteIndex > 0) { ChatLine row = this.gvPrivateChat.GetRow(e.RowHandle) as ChatLine; if (row != null) { IText text = null; if ((e.Column.AbsoluteIndex == 1) && (row.PlayerSegments.Count > 0)) { text = row.PlayerSegments[0]; } else if ((e.Column.AbsoluteIndex == 2) && (row.TextSegments.Count > 0)) { text = row.TextSegments[0]; } if (text != null) { int num; int index; float num6; float x; float y; int num9; int num10; ChatLink link2; SolidBrush brush; string[] strArray; int num11; SizeF ef; Brush brush2; Font font2; Font textFont = text.TextFont; Rectangle bounds = e.Bounds; ChatLink[] linkArray = null; Dictionary<int, ChatLink> dictionary = null; SortedList<int, Emote> list = null; List<string> list2 = null; List<MultiVal<int, int>> list3 = null; string str = text.Text; string str2 = null; if (e.Column.AbsoluteIndex == 2) { if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { linkArray = ChatLink.FindLinks(text.Text, ChatLink.Emote); for (num = 0; num < linkArray.Length; num++) { if (Emote.AllEmotes.ContainsKey(linkArray[num].DisplayText)) { text.Text = text.Text.Replace(linkArray[num].FullUrl, linkArray[num].DisplayText); } } dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str)); row.ContainsLinks = new bool?((dictionary != null) && (dictionary.Count > 0)); } if (!(!Program.Settings.Chat.Emotes.ShowEmotes || (!row.ContainsEmotes.HasValue ? false : !row.ContainsEmotes.Value))) { list2 = new List<string>(); list3 = new List<MultiVal<int, int>>(); list = new SortedList<int, Emote>(); foreach (Emote emote in Emote.AllEmotes.Values) { index = str.IndexOf(emote.CharSequence); while (index >= 0) { bool flag = false; if (dictionary != null) { foreach (ChatLink link in dictionary.Values) { if ((index > link.StartIndex) && (index < link.EndIndex)) { flag = true; } } } if (!flag) { list3.Add(new MultiVal<int, int>(index, emote.CharSequence.Length)); list.Add(index, emote); } index = str.IndexOf(emote.CharSequence, (int) (index + emote.CharSequence.Length)); if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { if (str2 == null) { str2 = str; } str2 = str2.Replace(emote.CharSequence, ""); } } } row.ContainsEmotes = new bool?((list != null) && (list.Count > 0)); } } if ((list != null) && (list.Count > 0)) { list3.Add(new MultiVal<int, int>(str.Length, 0)); list.Add(str.Length, null); SortedList<int, MultiVal<int, int>> list4 = new SortedList<int, MultiVal<int, int>>(list3.Count); list4[-1] = new MultiVal<int, int>(0, 0); foreach (MultiVal<int, int> val in list3) { list4[val.Value1] = val; } for (num = 1; num < list4.Count; num++) { int num3 = list4.Values[num - 1].Value1; index = list4.Values[num].Value1; int num4 = list4.Values[num - 1].Value2; int num5 = list4.Values[num].Value2; list2.Add(str.Substring(num3 + num4, index - (num3 + num4))); } dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str2)); num6 = textFont.Height + 3; x = bounds.X; y = bounds.Y; num9 = (this.colText.VisibleWidth - 10) + bounds.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { for (num = 0; num < list2.Count; num++) { if (list2[num].Length > 0) { strArray = DrawUtil.SplitString(list2[num], " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { using (font2 = new Font(textFont, FontStyle.Underline)) { ef = DrawUtil.MeasureString(e.Graphics, link2.DisplayText + " ", font2); if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9)) { x = bounds.X; y += num6; } e.Graphics.DrawString(link2.DisplayText, font2, brush2, x, y); } } } else { ef = DrawUtil.MeasureString(e.Graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9)) { x = bounds.X; y += num6; } e.Graphics.DrawString(strArray[num11], textFont, brush, x, y); } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } if (list.Values[num] != null) { float num12 = ((float) textFont.Height) / ((float) list.Values[num].Image.Height); float width = list.Values[num].Image.Width * num12; if ((x + width) > num9) { x = bounds.X; y += num6; } e.Graphics.DrawImage(list.Values[num].Image, x, y, width, (float) textFont.Height); x += width; } } } } else if ((dictionary != null) && (dictionary.Count > 0)) { num6 = textFont.Height + 3; x = bounds.X; y = bounds.Y; num9 = (this.colText.VisibleWidth - 10) + bounds.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { strArray = DrawUtil.SplitString(str, " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { using (font2 = new Font(textFont, FontStyle.Underline)) { ef = DrawUtil.MeasureString(e.Graphics, link2.DisplayText + " ", font2); if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9)) { x = bounds.X; y += num6; } e.Graphics.DrawString(link2.DisplayText, font2, brush2, x, y); } } } else { ef = DrawUtil.MeasureString(e.Graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9)) { x = bounds.X; y += num6; } e.Graphics.DrawString(strArray[num11], textFont, brush, x, y); } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } } else { using (brush = new SolidBrush(text.TextColor)) { num6 = textFont.Height + 3; x = bounds.Left; y = bounds.Top; num9 = (this.colText.VisibleWidth - 10) + bounds.X; num10 = 0; strArray = DrawUtil.SplitString(str, " "); for (num11 = 0; num11 < strArray.Length; num11++) { ef = DrawUtil.MeasureString(e.Graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9)) { x = bounds.Left; y += num6; } e.Graphics.DrawString(strArray[num11], textFont, brush, x, y); num10 += strArray[num11].Length; x += ef.Width; } } } } e.Handled = true; } } } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
private void gvChat_CalcRowHeight(object sender, RowHeightEventArgs e) { try { if (this.ChatRowHeights.ContainsKey(e.RowHandle)) { e.RowHeight = this.ChatRowHeights[e.RowHandle]; } else { ChatLine row = this.gvPrivateChat.GetRow(e.RowHandle) as ChatLine; if (row != null) { IText text = row.TextSegments[0]; if (text != null) { int index; Font textFont = text.TextFont; string str = text.Text; string str2 = null; Dictionary<int, ChatLink> dictionary = null; List<string> list = null; List<MultiVal<int, int>> list2 = null; SortedList<int, Emote> list3 = null; if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str)); row.ContainsLinks = new bool?((dictionary != null) && (dictionary.Count > 0)); } if (!(!Program.Settings.Chat.Emotes.ShowEmotes || (!row.ContainsEmotes.HasValue ? false : !row.ContainsEmotes.Value))) { list = new List<string>(); list2 = new List<MultiVal<int, int>>(); list3 = new SortedList<int, Emote>(); foreach (Emote emote in Emote.AllEmotes.Values) { index = str.IndexOf(emote.CharSequence); while (index >= 0) { list2.Add(new MultiVal<int, int>(index, emote.CharSequence.Length)); list3.Add(index, emote); index = str.IndexOf(emote.CharSequence, (int) (index + emote.CharSequence.Length)); if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { if (str2 == null) { str2 = str; } str2 = str2.Replace(emote.CharSequence, ""); } } } row.ContainsEmotes = new bool?((list3 != null) && (list3.Count > 0)); } using (Graphics graphics = this.gpgChatGrid.CreateGraphics()) { float num6; float num7; float num8; int num9; int num10; ChatLink link; SolidBrush brush; string[] strArray; int num11; SizeF ef; Brush brush2; Font font2; if ((list3 != null) && (list3.Count > 0)) { int num2; list2.Add(new MultiVal<int, int>(str.Length, 0)); list3.Add(str.Length, null); SortedList<int, MultiVal<int, int>> list4 = new SortedList<int, MultiVal<int, int>>(list2.Count); list4[-1] = new MultiVal<int, int>(0, 0); foreach (MultiVal<int, int> val in list2) { list4[val.Value1] = val; } for (num2 = 1; num2 < list4.Count; num2++) { int num3 = list4.Values[num2 - 1].Value1; index = list4.Values[num2].Value1; int num4 = list4.Values[num2 - 1].Value2; int num5 = list4.Values[num2].Value2; list.Add(str.Substring(num3 + num4, index - (num3 + num4))); } dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str2)); num6 = textFont.Height + 3; num7 = 0f; num8 = num6; num9 = this.colText.VisibleWidth - 10; num10 = 0; link = null; using (brush = new SolidBrush(text.TextColor)) { for (num2 = 0; num2 < list.Count; num2++) { if (list[num2].Length > 0) { strArray = DrawUtil.SplitString(list[num2], " "); for (num11 = 0; num11 < strArray.Length; num11++) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link = dictionary[num10]; } if (link != null) { using (brush2 = new SolidBrush(link.LinkColor)) { using (font2 = new Font(textFont, FontStyle.Underline)) { ef = DrawUtil.MeasureString(graphics, strArray[num11], font2); if (((ef.Width <= num9) || (num7 != 0f)) && ((num7 + ef.Width) > num9)) { num7 = 0f; num8 += num6; } goto Label_05BC; } } } ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= num9) || (num7 != 0f)) && ((num7 + ef.Width) > num9)) { num7 = 0f; num8 += num6; } Label_05BC: num10 += strArray[num11].Length; num7 += ef.Width; if ((link != null) && (num10 >= link.EndIndex)) { link = null; } } } if (list3.Values[num2] != null) { float num12 = ((float) textFont.Height) / ((float) list3.Values[num2].Image.Height); float num13 = list3.Values[num2].Image.Width * num12; if ((num7 + num13) > num9) { num7 = 0f; num8 += num6; } num7 += num13; } } } e.RowHeight = Convert.ToInt32(Math.Round((double) num8, MidpointRounding.AwayFromZero)); } else if ((dictionary != null) && (dictionary.Count > 0)) { num6 = textFont.Height + 3; num7 = 0f; num8 = num6; num9 = this.colText.VisibleWidth - 10; num10 = 0; link = null; using (brush = new SolidBrush(text.TextColor)) { strArray = DrawUtil.SplitString(str, " "); num11 = 0; while (num11 < strArray.Length) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link = dictionary[num10]; } if (link != null) { using (brush2 = new SolidBrush(link.LinkColor)) { using (font2 = new Font(textFont, FontStyle.Underline)) { ef = DrawUtil.MeasureString(graphics, strArray[num11], font2); if (((ef.Width <= num9) || (num7 != 0f)) && ((num7 + ef.Width) > num9)) { num7 = 0f; num8 += num6; } goto Label_0890; } } } ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= num9) || (num7 != 0f)) && ((num7 + ef.Width) > num9)) { num7 = 0f; num8 += num6; } Label_0890: num10 += strArray[num11].Length; num7 += ef.Width; if ((link != null) && (num10 >= link.EndIndex)) { link = null; } num11++; } } e.RowHeight = Convert.ToInt32(Math.Round((double) num8, MidpointRounding.AwayFromZero)); } else { num6 = textFont.Height + 3; num7 = 0f; num8 = num6; num9 = this.colText.VisibleWidth - 10; num10 = 0; strArray = DrawUtil.SplitString(str, " "); for (num11 = 0; num11 < strArray.Length; num11++) { ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= num9) || (num7 != 0f)) && ((num7 + ef.Width) > num9)) { num7 = 0f; num8 += num6; } num10 += strArray[num11].Length; num7 += ef.Width; } e.RowHeight = Convert.ToInt32(Math.Round((double) num8, MidpointRounding.AwayFromZero)); } } } } this.ChatRowHeights[e.RowHandle] = e.RowHeight; } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
public void SetGridView(GridView view) { BoundGridView = view; view.Columns["Version"].Visible = false; view.Columns["VersionDate"].Visible = false; MultiVal<string, string, bool>[] valArray = new MultiVal<string, string, bool>[] { new MultiVal<string, string, bool>("<LOC>Quality", "QualityDisplay", true), new MultiVal<string, string, bool>("<LOC>Video Length", "LengthDisplay", true), new MultiVal<string, string, bool>("<LOC>Video Format", "VideoFormat", true) }; foreach (MultiVal<string, string, bool> val in valArray) { GridColumn column = new GridColumn(); column.Caption = Loc.Get(val.Value1); column.FieldName = val.Value2; column.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; column.AppearanceCell.Options.UseTextOptions = true; view.Columns.Add(column); column.Visible = val.Value3; } GridColumn column2 = new GridColumn(); column2.Caption = Loc.Get("<LOC>Preview"); column2.FieldName = "PreviewImage50"; column2.ColumnEdit = new RepositoryItemPictureEdit(); view.Columns.Add(column2); column2.Visible = true; view.Columns["Download"].VisibleIndex = 0; column2.VisibleIndex = 1; view.Columns["Name"].VisibleIndex = 2; view.Columns["QualityDisplay"].VisibleIndex = 3; view.Columns["LengthDisplay"].VisibleIndex = 4; view.Columns["VideoFormat"].VisibleIndex = 5; view.Columns["OwnerName"].VisibleIndex = 6; view.Columns["Downloads"].VisibleIndex = 7; view.Columns["RatingImageSmall"].VisibleIndex = 8; PreviewImageLoaded -= new EventHandler(this.Video_PreviewImageLoaded); PreviewImageLoaded += new EventHandler(this.Video_PreviewImageLoaded); }
private void gvChat_MouseUp(object sender, MouseEventArgs e) { try { int num2; if (this.ChatRowPoints.ContainsKey((sender as GridView).FocusedRowHandle)) { Rectangle rectangle = this.ChatRowPoints[(sender as GridView).FocusedRowHandle]; if (rectangle.Contains(e.X, e.Y)) { ChatLine row = (sender as GridView).GetRow((sender as GridView).FocusedRowHandle) as ChatLine; if (row != null) { IText text = row.TextSegments[0]; if (text != null) { int index; Font textFont = text.TextFont; string str = text.Text; string str2 = null; Dictionary<int, ChatLink> dictionary = null; List<string> list = null; List<MultiVal<int, int>> list2 = null; SortedList<int, Emote> list3 = null; if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str)); } if (!(!Program.Settings.Chat.Emotes.ShowEmotes || (!row.ContainsEmotes.HasValue ? false : !row.ContainsEmotes.Value))) { list = new List<string>(); list2 = new List<MultiVal<int, int>>(); list3 = new SortedList<int, Emote>(); SortedList<int, Emote> list4 = new SortedList<int, Emote>(new EmoteLengthComparer()); foreach (Emote emote in Emote.AllEmotes.Values) { list4.Add(emote.CharSequence.Length, emote); } foreach (Emote emote in list4.Values) { index = str.IndexOf(emote.CharSequence); while (index >= 0) { bool flag = false; if (dictionary != null) { foreach (ChatLink link in dictionary.Values) { if ((index >= link.StartIndex) && (index <= link.EndIndex)) { flag = true; } } } bool flag2 = false; foreach (KeyValuePair<int, Emote> pair in list3) { if ((index >= pair.Key) && (index < (pair.Key + pair.Value.CharSequence.Length))) { flag2 = true; break; } } if (!(flag || flag2)) { list2.Add(new MultiVal<int, int>(index, emote.CharSequence.Length)); list3.Add(index, emote); } index = str.IndexOf(emote.CharSequence, (int) (index + emote.CharSequence.Length)); if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value))) { if (str2 == null) { str2 = str; } str2 = str2.Replace(emote.CharSequence, ""); } } } } using (Graphics graphics = this.gpgChatGrid.CreateGraphics()) { float num6; float x; float y; int num9; int num10; ChatLink link2; SolidBrush brush; string[] strArray; int num11; SizeF ef; Brush brush2; Font linkFont; RectangleF ef2; if ((list3 != null) && (list3.Count > 0)) { list2.Add(new MultiVal<int, int>(str.Length, 0)); list3.Add(str.Length, null); SortedList<int, MultiVal<int, int>> list5 = new SortedList<int, MultiVal<int, int>>(list2.Count); list5[-1] = new MultiVal<int, int>(0, 0); foreach (MultiVal<int, int> val in list2) { list5[val.Value1] = val; } for (num2 = 1; num2 < list5.Count; num2++) { int num3 = list5.Values[num2 - 1].Value1; index = list5.Values[num2].Value1; int num4 = list5.Values[num2 - 1].Value2; int num5 = list5.Values[num2].Value2; list.Add(str.Substring(num3 + num4, index - (num3 + num4))); } dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str2)); num6 = textFont.Height + 3; x = rectangle.X; y = rectangle.Y; num9 = (this.colText.VisibleWidth - 10) + rectangle.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { num2 = 0; while (num2 < list.Count) { if (list[num2].Length > 0) { strArray = DrawUtil.SplitString(list[num2], " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { linkFont = link2.LinkFont; ef = DrawUtil.MeasureString(graphics, link2.DisplayText + " ", linkFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } ef2 = new RectangleF(x, y, ef.Width, ef.Height); if (ef2.Contains((float) e.X, (float) e.Y)) { link2.OnClick(); return; } } } else { ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } if (list3.Values[num2] != null) { float num12 = 1f; float num13 = list3.Values[num2].Image.Width * num12; if ((x + num13) > num9) { x = rectangle.X; y += num6; } if ((e.Button == MouseButtons.Right) && ConfigSettings.GetBool("Emotes", true)) { Rectangle rectangle2 = new Rectangle((int) x, (int) y, list3.Values[num2].Image.Width, list3.Values[num2].Image.Height); if (rectangle2.Contains(e.Location)) { this.ciEmote_Animate.Checked = Program.Settings.Chat.Emotes.AnimateEmotes; this.ciEmote_Share.Checked = Program.Settings.Chat.Emotes.AutoShareEmotes; this.SelectedEmote = list3.Values[num2]; this.gpgContextMenuEmote.Show(this.gpgChatGrid, e.Location); return; } } x += num13; } num2++; } } } else if ((dictionary != null) && (dictionary.Count > 0)) { num6 = textFont.Height + 3; x = rectangle.X; y = rectangle.Y; num9 = (this.colText.VisibleWidth - 10) + rectangle.X; num10 = 0; link2 = null; using (brush = new SolidBrush(text.TextColor)) { strArray = DrawUtil.SplitString(str, " "); for (num11 = 0; num11 < strArray.Length; num11++) { if (link2 == null) { if ((dictionary.Count > 0) && dictionary.ContainsKey(num10)) { link2 = dictionary[num10]; } if (link2 != null) { using (brush2 = new SolidBrush(link2.LinkColor)) { linkFont = link2.LinkFont; ef = DrawUtil.MeasureString(graphics, link2.DisplayText + " ", linkFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } ef2 = new RectangleF(x, y, ef.Width, ef.Height); if (ef2.Contains((float) e.X, (float) e.Y)) { if (e.Button == MouseButtons.Left) { link2.OnClick(); goto Label_0C82; } if (e.Button == MouseButtons.Right) { goto Label_0C82; } } } } else { ef = DrawUtil.MeasureString(graphics, strArray[num11], textFont); if (((ef.Width <= (num9 - rectangle.Left)) || (x != rectangle.Left)) && ((x + ef.Width) > num9)) { x = rectangle.X; y += num6; } } num10 += strArray[num11].Length; x += ef.Width; } else { num10 += strArray[num11].Length; } if ((link2 != null) && (num10 >= link2.EndIndex)) { link2 = null; } } } } } } } } } Label_0C82: if (e.Button == MouseButtons.Right) { if ((this.SelectedChatTextSender == null) || this.SelectedChatTextSender.IsSystem) { this.ciChatText_ShowEmotes.Visible = !Program.Settings.Chat.Emotes.ShowEmotes; this.ciChatText_ViewPlayer.Visible = false; this.ciChatText_ViewRank.Visible = false; this.ciChatText_PrivateMsg.Visible = false; this.ciChatText_ClanInvite.Visible = false; this.ciChatText_ClanRequest.Visible = false; this.ciChatText_ViewClan.Visible = false; this.ciChatText_Ignore.Visible = false; this.ciChatText_Unignore.Visible = false; this.ciChatText_WebStats.Visible = false; this.ciChatText_Replays.Visible = false; this.ciChatText_FriendInvite.Visible = false; this.ciChatText_FriendRemove.Visible = false; this.ciChatText_Promote.Visible = false; this.ciChatText_Demote.Visible = false; this.ciChatText_ClanRemove.Visible = false; this.ciChatText_LeaveClan.Visible = false; this.ciChatText_Ban.Visible = false; this.ciChatText_Kick.Visible = false; this.ciChatText_Solution.Visible = false; } else { User selectedChatTextSender = this.SelectedChatTextSender; this.ciChatText_ShowEmotes.Visible = !Program.Settings.Chat.Emotes.ShowEmotes; this.ciChatText_ViewPlayer.Visible = true; this.ciChatText_ViewRank.Visible = false; this.ciChatText_PrivateMsg.Visible = !selectedChatTextSender.IsCurrent && selectedChatTextSender.Online; this.ciChatText_ClanInvite.Visible = (User.Current.IsInClan && !selectedChatTextSender.IsInClan) && !selectedChatTextSender.IsCurrent; this.ciChatText_ClanRequest.Visible = (!User.Current.IsInClan && selectedChatTextSender.IsInClan) && !selectedChatTextSender.IsCurrent; this.ciChatText_ViewClan.Visible = selectedChatTextSender.IsInClan; this.ciChatText_Ignore.Visible = !selectedChatTextSender.IsCurrent && !selectedChatTextSender.IsIgnored; this.ciChatText_Unignore.Visible = !selectedChatTextSender.IsCurrent && selectedChatTextSender.IsIgnored; this.ciChatText_WebStats.Visible = ConfigSettings.GetBool("WebStatsEnabled", false); this.ciChatText_Replays.Visible = true; this.ciChatText_FriendInvite.Visible = !selectedChatTextSender.IsFriend && !selectedChatTextSender.IsCurrent; this.ciChatText_FriendRemove.Visible = selectedChatTextSender.IsFriend && !selectedChatTextSender.IsCurrent; this.ciChatText_Promote.Visible = selectedChatTextSender.IsClanMate && ClanMember.Current.CanTargetAbility(ClanAbility.Promote, selectedChatTextSender.Name); this.ciChatText_Demote.Visible = selectedChatTextSender.IsClanMate && ClanMember.Current.CanTargetAbility(ClanAbility.Demote, selectedChatTextSender.Name); this.ciChatText_ClanRemove.Visible = selectedChatTextSender.IsClanMate && ClanMember.Current.CanTargetAbility(ClanAbility.Remove, selectedChatTextSender.Name); this.ciChatText_LeaveClan.Visible = User.Current.Equals(selectedChatTextSender) && User.Current.IsInClan; if ((Chatroom.Current != null) && Chatroom.Current.IsClanRoom) { this.ciChatText_Ban.Visible = ((User.Current.IsAdmin || ClanMember.Current.CanTargetAbility(ClanAbility.Ban, selectedChatTextSender.Name)) && !selectedChatTextSender.IsCurrent) && !selectedChatTextSender.IsAdmin; this.ciChatText_Kick.Visible = ((User.Current.IsAdmin || ClanMember.Current.CanTargetAbility(ClanAbility.Kick, selectedChatTextSender.Name)) && !selectedChatTextSender.IsCurrent) && !selectedChatTextSender.IsAdmin; } else { this.ciChatText_Ban.Visible = (((Chatroom.InChatroom && Chatroom.GatheringParticipants.ContainsIndex("name", selectedChatTextSender.Name)) && (User.Current.IsAdmin || (!Chatroom.Current.IsPersistent && User.Current.IsChannelOperator))) && !selectedChatTextSender.IsCurrent) && !selectedChatTextSender.IsAdmin; this.ciChatText_Kick.Visible = this.ciChatText_Ban.Visible; } this.ciChatText_Solution.Visible = true; } int num14 = -1; for (num2 = 0; num2 < this.gpgContextMenuChatText.MenuItems.Count; num2++) { if (this.gpgContextMenuChatText.MenuItems[num2].Text == "-") { if ((num14 < 0) || (this.gpgContextMenuChatText.MenuItems[num14].Text == "-")) { this.gpgContextMenuChatText.MenuItems[num2].Visible = false; } else if (num2 == (this.gpgContextMenuChatText.MenuItems.Count - 1)) { this.gpgContextMenuChatText.MenuItems[num2].Visible = false; } else { this.gpgContextMenuChatText.MenuItems[num2].Visible = true; } } if (this.gpgContextMenuChatText.MenuItems[num2].Visible) { num14 = num2; } } if ((num14 >= 0) && (this.gpgContextMenuChatText.MenuItems[num14].Text == "-")) { this.gpgContextMenuChatText.MenuItems[num14].Visible = false; } this.gpgContextMenuChatText.Show(this.gvChat.GridControl, e.Location); } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
public void SetGridView(GridView view) { if (base.ContentType.CurrentUserCanDownload) { BoundGridView = view; GridColumn column = new GridColumn(); column.Caption = Loc.Get("<LOC>Preview"); column.FieldName = "PreviewImage50"; column.ColumnEdit = new RepositoryItemPictureEdit(); view.Columns.Add(column); column.Visible = true; GridColumn column2 = new GridColumn(); column2.Caption = Loc.Get("<LOC>UI Only"); column2.FieldName = "UIOnlyDisplay"; column2.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; column2.AppearanceCell.Options.UseTextOptions = true; view.Columns.Add(column2); column2.Visible = true; GridColumn column3 = new GridColumn(); column3.Caption = Loc.Get("<LOC>Developer"); column3.FieldName = "Developer"; column3.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; column3.AppearanceCell.Options.UseTextOptions = true; view.Columns.Add(column3); column3.Visible = true; view.Columns["Download"].VisibleIndex = 0; column.VisibleIndex = 1; view.Columns["Name"].VisibleIndex = 2; column2.VisibleIndex = 3; column3.VisibleIndex = 4; view.Columns["Version"].VisibleIndex = 5; view.Columns["OwnerName"].VisibleIndex = 6; view.Columns["Downloads"].VisibleIndex = 7; view.Columns["RatingImageSmall"].VisibleIndex = 8; MultiVal<string, string>[] valArray = new MultiVal<string, string>[] { new MultiVal<string, string>("<LOC>Number of Files", "NumberOfFiles"), new MultiVal<string, string>("<LOC>Website", this.Website), new MultiVal<string, string>("<LOC>Copyright", "Copyright"), new MultiVal<string, string>("<LOC>Unique ID", "Guid") }; foreach (MultiVal<string, string> val in valArray) { GridColumn column4 = new GridColumn(); column4.Caption = Loc.Get(val.Value1); column4.FieldName = val.Value2; column4.Visible = false; view.Columns.Add(column4); } PreviewImageLoaded -= new EventHandler(this.CustomMap_PreviewImageLoaded); PreviewImageLoaded += new EventHandler(this.CustomMap_PreviewImageLoaded); } }
public void SetGridView(GridView view) { if (base.ContentType.CurrentUserCanDownload) { BoundGridView = view; view.Columns["VersionDate"].Visible = false; view.PreviewFieldName = null; GridColumn column = new GridColumn(); column.Caption = Loc.Get("<LOC>Preview"); column.FieldName = "PreviewImage50"; column.ColumnEdit = new RepositoryItemPictureEdit(); view.Columns.Add(column); column.Visible = true; GridColumn column2 = new GridColumn(); column2.Caption = Loc.Get("<LOC>Players"); column2.FieldName = "MaxPlayers"; column2.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; column2.AppearanceCell.Options.UseTextOptions = true; view.Columns.Add(column2); column2.Visible = true; GridColumn column3 = new GridColumn(); column3.Caption = Loc.Get("<LOC>Size"); column3.FieldName = "SizeDisplay"; column3.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; column3.AppearanceCell.Options.UseTextOptions = true; view.Columns.Add(column3); column3.Visible = true; view.Columns["Download"].VisibleIndex = 0; column.VisibleIndex = 1; view.Columns["Name"].VisibleIndex = 2; column2.VisibleIndex = 3; column3.VisibleIndex = 4; view.Columns["Version"].VisibleIndex = 5; view.Columns["OwnerName"].VisibleIndex = 6; view.Columns["Downloads"].VisibleIndex = 7; view.Columns["RatingImageSmall"].VisibleIndex = 8; MultiVal<string, string>[] valArray = new MultiVal<string, string>[] { new MultiVal<string, string>("<LOC>Terrain Type", "TerrainType"), new MultiVal<string, string>("<LOC>Has Water", "HasWater"), new MultiVal<string, string>("<LOC>Separated", "IsSeparated"), new MultiVal<string, string>("<LOC>Rushing", "IsRushMap"), new MultiVal<string, string>("<LOC>Custom Rules", "HasCustomRuleset"), new MultiVal<string, string>("<LOC>Mission", "IsMission") }; foreach (MultiVal<string, string> val in valArray) { GridColumn column4 = new GridColumn(); column4.Caption = Loc.Get(val.Value1); column4.FieldName = val.Value2; column4.Visible = false; view.Columns.Add(column4); } view.CustomDrawCell -= new RowCellCustomDrawEventHandler(CustomMap.view_CustomDrawCell); view.MouseMove -= new MouseEventHandler(CustomMap.view_MouseMove); view.CustomDrawCell += new RowCellCustomDrawEventHandler(CustomMap.view_CustomDrawCell); view.MouseMove += new MouseEventHandler(CustomMap.view_MouseMove); PreviewImageLoaded -= new EventHandler(this.CustomMap_PreviewImageLoaded); PreviewImageLoaded += new EventHandler(this.CustomMap_PreviewImageLoaded); } }
public void SetGridView(GridView view) { MultiVal<string, string, bool>[] valArray = new MultiVal<string, string, bool>[] { new MultiVal<string, string, bool>("<LOC>Developer", "DeveloperName", true), new MultiVal<string, string, bool>("<LOC>Product Website", "Website", false), new MultiVal<string, string, bool>("<LOC>Quality", "QualityDisplay", true), new MultiVal<string, string, bool>("<LOC>Executable Name", "ExeName", false), new MultiVal<string, string, bool>("<LOC>Number of Files", "NumberOfFiles", false) }; foreach (MultiVal<string, string, bool> val in valArray) { GridColumn column = new GridColumn(); column.Caption = Loc.Get(val.Value1); column.FieldName = val.Value2; column.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near; column.AppearanceCell.Options.UseTextOptions = true; view.Columns.Add(column); column.Visible = val.Value3; } view.Columns["Download"].VisibleIndex = 0; view.Columns["Name"].VisibleIndex = 1; view.Columns["DeveloperName"].VisibleIndex = 2; view.Columns["QualityDisplay"].VisibleIndex = 3; view.Columns["Version"].VisibleIndex = 4; view.Columns["OwnerName"].VisibleIndex = 5; view.Columns["Downloads"].VisibleIndex = 6; view.Columns["RatingImageSmall"].VisibleIndex = 7; }