Exemplo n.º 1
0
 public static void ProcessData(object omap)
 {
     StringEventHandler handler = null;
     VGen0 method = null;
     VGen1 gen2 = null;
     VGen2 gen3 = null;
     VGen1 gen4 = null;
     VGen1 gen5 = null;
     VGen1 gen6 = null;
     VGen1 gen7 = null;
     VGen1 gen8 = null;
     VGen1 gen9 = null;
     VGen1 gen10 = null;
     VGen0 gen11 = null;
     VGen1 gen12 = null;
     DlgWorldMap map = omap as DlgWorldMap;
     try
     {
         string[] strArray;
         uint num;
         float num2;
         float num3;
         MapLocation location;
         string str2;
         FileStream stream;
         int num4;
         int num5;
         DataList list2;
         byte[] buffer2;
         string str3;
         WebClient client;
         byte[] buffer3;
         int num7;
         string str4;
         bool flag2;
         string sourcePath = Application.StartupPath + @"\map\encoded.bin.gzip";
         if (handler == null)
         {
             handler = delegate (string text) {
                 map.SetStatus(Loc.Get("Decompressing map data: ") + text, new object[0]);
             };
         }
         Compression.OnDecompress += handler;
         map.mData = Compression.DecompressFile(sourcePath);
         map.SetStatus(Loc.Get("<LOC>Fetching locations."), new object[0]);
         if (method == null)
         {
             method = delegate {
                 map.SetCBColors();
             };
         }
         map.BeginInvoke(method);
         DataList queryDataSafe = DataAccess.GetQueryDataSafe("GetSelfIP", new object[0]);
         foreach (DataRecord record in queryDataSafe)
         {
             map.SetStatus(Loc.Get("<LOC>Loading Location: ") + record["player_name"].ToString(), new object[0]);
             strArray = record["ip_address"].ToString().Split(new char[] { '.' });
             if (strArray.Length == 4)
             {
                 try
                 {
                     num = ((Convert.ToUInt32(strArray[0]) * 0x100) * 0x100) * 0x100;
                     num += (Convert.ToUInt32(strArray[1]) * 0x100) * 0x100;
                     num += Convert.ToUInt32(strArray[2]) * 0x100;
                     num += Convert.ToUInt32(strArray[3]);
                 }
                 catch (Exception exception1)
                 {
                     ErrorLog.WriteLine(exception1);
                     continue;
                 }
                 num2 = 0f;
                 num3 = 0f;
                 map.FindLocation(num, out num2, out num3);
                 location = new MapLocation();
                 location.HideLocation = record["ip_opt_out"].ToString() == "1";
                 location.MapColor = Color.White;
                 location.Latitude = num2;
                 location.Longitude = num3;
                 location.DataType = "Self";
                 location.Classification = "Self";
                 location.LocationType = GPG.UI.LocationTypes.Image;
                 location.MapImage = Resources.TackSelf;
                 location.Information = record["player_name"];
                 if (gen2 == null)
                 {
                     gen2 = delegate (object objlocation) {
                         MapLocation mapLocation = objlocation as MapLocation;
                         if (mapLocation != null)
                         {
                             map.earthMap1.AddLocation(mapLocation);
                             map.earthMap1.Invalidate();
                         }
                     };
                 }
                 map.BeginInvoke(gen2, new object[] { location });
                 try
                 {
                     if (gen3 == null)
                     {
                         gen3 = delegate (object objopt, object objloc) {
                             try
                             {
                                 map.mSelfLocation = objloc as MapLocation;
                                 map.miHideLocation.Tag = Convert.ToInt32(objopt);
                                 if (((int) map.miHideLocation.Tag) == 1)
                                 {
                                     map.miHideLocation.Text = map.mOptInText;
                                 }
                                 else
                                 {
                                     map.miHideLocation.Text = map.mOptOutText;
                                 }
                                 map.miHideLocation.Enabled = true;
                             }
                             catch (Exception exception)
                             {
                                 ErrorLog.WriteLine(exception);
                             }
                         };
                     }
                     map.BeginInvoke(gen3, new object[] { record["ip_opt_out"], location });
                 }
                 catch (Exception exception2)
                 {
                     ErrorLog.WriteLine(exception2);
                 }
             }
         }
         if (User.Current.IsAdmin)
         {
             Hashtable hashtable = new Hashtable();
             str2 = Application.StartupPath + @"\map\data.bin";
             stream = new FileStream(str2, FileMode.Create);
             num4 = 0;
             num5 = 500;
             for (list2 = DataAccess.GetQueryDataSafe("GetIPAddresses", new object[] { num4, num5 }); list2.Count > 0; list2 = DataAccess.GetQueryDataSafe("GetIPAddresses", new object[] { num4, num5 }))
             {
                 map.SetStatus(Loc.Get("Loading Location (admins get realtime data and thus map takes longer for you than regular folks.)\r\n") + list2[0][0].ToString(), new object[0]);
                 foreach (DataRecord record in list2)
                 {
                     strArray = record[0].ToString().Split(new char[] { '.' });
                     if (strArray.Length == 4)
                     {
                         uint num6;
                         try
                         {
                             num = ((Convert.ToUInt32(strArray[0]) * 0x100) * 0x100) * 0x100;
                             num += (Convert.ToUInt32(strArray[1]) * 0x100) * 0x100;
                             num += Convert.ToUInt32(strArray[2]) * 0x100;
                             num += Convert.ToUInt32(strArray[3]);
                         }
                         catch (Exception exception5)
                         {
                             ErrorLog.WriteLine(exception5);
                             continue;
                         }
                         if (map.FindLocation(num, out num2, out num3, out num6) && ((num2 != 0f) && (num3 != 0f)))
                         {
                             byte[] bytes = BitConverter.GetBytes(num6);
                             if (hashtable.ContainsKey(bytes))
                             {
                                 if (((byte) hashtable[bytes]) < 0xff)
                                 {
                                     hashtable[bytes] = ((byte) hashtable[bytes]) + 1;
                                 }
                             }
                             else
                             {
                                 hashtable.Add(bytes, (byte) 1);
                             }
                             location = new MapLocation();
                             location.MapColor = Color.FromArgb(50, 0xff, 0xff, 0);
                             location.Classification = "Pop";
                             location.Latitude = num2;
                             location.Longitude = num3;
                             if (gen4 == null)
                             {
                                 gen4 = delegate (object objlocation) {
                                     MapLocation mapLocation = objlocation as MapLocation;
                                     if (mapLocation != null)
                                     {
                                         mapLocation.MapColor = Color.FromArgb(50, map.cbAllPlayers.ForeColor);
                                         map.earthMap1.AddLocation(mapLocation);
                                         map.earthMap1.Invalidate();
                                     }
                                 };
                             }
                             map.BeginInvoke(gen4, new object[] { location });
                         }
                     }
                 }
                 num4 += num5;
             }
             foreach (byte[] buffer in hashtable.Keys)
             {
                 stream.Write(buffer, 0, 4);
                 stream.WriteByte((byte) hashtable[buffer]);
             }
             stream.Close();
             buffer2 = Compression.CompressFile(str2);
         }
         else
         {
             try
             {
                 str3 = ConfigSettings.GetString("WorldMapData", "http://gpgnet.gaspowered.com/gpgnetdata/worldmap/worldmap.data.enc");
                 client = new WebClient();
                 buffer3 = Compression.DecompressData(client.DownloadData(str3));
                 for (num7 = 0; num7 < (buffer3.Length / 5); num7++)
                 {
                     num = BitConverter.ToUInt32(buffer3, num7 * 5);
                     byte num8 = buffer3[(num7 * 5) + 4];
                     if (map.FindLocation(num, out num2, out num3) && ((num2 != 0f) && (num3 != 0f)))
                     {
                         for (int i = 0; i < num8; i++)
                         {
                             location = new MapLocation();
                             location.MapColor = Color.FromArgb(50, 0xff, 0xff, 0);
                             location.Classification = "Pop";
                             location.Latitude = num2;
                             location.Longitude = num3;
                             if (gen5 == null)
                             {
                                 gen5 = delegate (object objlocation) {
                                     MapLocation mapLocation = objlocation as MapLocation;
                                     if (mapLocation != null)
                                     {
                                         mapLocation.MapColor = Color.FromArgb(50, map.cbAllPlayers.ForeColor);
                                         map.earthMap1.AddLocation(mapLocation);
                                         map.earthMap1.Invalidate();
                                     }
                                 };
                             }
                             map.BeginInvoke(gen5, new object[] { location });
                         }
                     }
                 }
             }
             catch (Exception exception6)
             {
                 ErrorLog.WriteLine(exception6);
             }
         }
         if (User.Current.IsAdmin)
         {
             str2 = Application.StartupPath + @"\map\onlinedata.bin";
             stream = new FileStream(str2, FileMode.Create);
             num4 = 0;
             num5 = 500;
             for (list2 = DataAccess.GetQueryDataSafe("GetOnlineIPAddresses", new object[] { num4, num5 }); list2.Count > 0; list2 = DataAccess.GetQueryDataSafe("GetOnlineIPAddresses", new object[] { num4, num5 }))
             {
                 map.SetStatus(Loc.Get("Loading Location (admins get realtime data and thus map takes longer for you than regular folks.)\r\n") + list2[0][0].ToString(), new object[0]);
                 foreach (DataRecord record in list2)
                 {
                     strArray = record[0].ToString().Split(new char[] { '.' });
                     if (strArray.Length == 4)
                     {
                         try
                         {
                             num = ((Convert.ToUInt32(strArray[0]) * 0x100) * 0x100) * 0x100;
                             num += (Convert.ToUInt32(strArray[1]) * 0x100) * 0x100;
                             num += Convert.ToUInt32(strArray[2]) * 0x100;
                             num += Convert.ToUInt32(strArray[3]);
                         }
                         catch (Exception exception7)
                         {
                             ErrorLog.WriteLine(exception7);
                             continue;
                         }
                         stream.Write(BitConverter.GetBytes(num), 0, 4);
                         if (map.FindLocation(num, out num2, out num3) && ((num2 != 0f) && (num3 != 0f)))
                         {
                             location = new MapLocation();
                             location.MapColor = Color.FromArgb(70, 0, 0xff, 0);
                             location.Classification = "Online";
                             location.Latitude = num2;
                             location.Longitude = num3;
                             if (gen6 == null)
                             {
                                 gen6 = delegate (object objlocation) {
                                     MapLocation mapLocation = objlocation as MapLocation;
                                     if (mapLocation != null)
                                     {
                                         mapLocation.MapColor = Color.FromArgb(0x7d, map.cbOnline.ForeColor);
                                         map.earthMap1.AddLocation(mapLocation);
                                         map.earthMap1.Invalidate();
                                     }
                                 };
                             }
                             map.BeginInvoke(gen6, new object[] { location });
                         }
                     }
                 }
                 num4 += num5;
             }
             stream.Close();
             buffer2 = Compression.CompressFile(str2);
         }
         else
         {
             try
             {
                 str3 = ConfigSettings.GetString("WorldMapOnlineData", "http://gpgnet.gaspowered.com/gpgnetdata/worldmap/worldmaponline.data.enc");
                 client = new WebClient();
                 buffer3 = Compression.DecompressData(client.DownloadData(str3));
                 for (num7 = 0; num7 < (buffer3.Length / 4); num7++)
                 {
                     num = BitConverter.ToUInt32(buffer3, num7 * 4);
                     if (map.FindLocation(num, out num2, out num3) && ((num2 != 0f) && (num3 != 0f)))
                     {
                         location = new MapLocation();
                         location.MapColor = Color.FromArgb(70, 0, 0xff, 0);
                         location.Classification = "Online";
                         location.Latitude = num2;
                         location.Longitude = num3;
                         if (gen7 == null)
                         {
                             gen7 = delegate (object objlocation) {
                                 MapLocation mapLocation = objlocation as MapLocation;
                                 if (mapLocation != null)
                                 {
                                     mapLocation.MapColor = Color.FromArgb(0x7d, map.cbOnline.ForeColor);
                                     map.earthMap1.AddLocation(mapLocation);
                                     map.earthMap1.Invalidate();
                                 }
                             };
                         }
                         map.BeginInvoke(gen7, new object[] { location });
                     }
                 }
             }
             catch (Exception exception8)
             {
                 ErrorLog.WriteLine(exception8);
             }
         }
         queryDataSafe = DataAccess.GetQueryDataSafe("GetFriendsIPAddresses", new object[0]);
         foreach (DataRecord record in queryDataSafe)
         {
             map.SetStatus(Loc.Get("<LOC>Loading Location: ") + record[0].ToString(), new object[0]);
             strArray = record["ip_address"].ToString().Split(new char[] { '.' });
             if (strArray.Length == 4)
             {
                 try
                 {
                     num = ((Convert.ToUInt32(strArray[0]) * 0x100) * 0x100) * 0x100;
                     num += (Convert.ToUInt32(strArray[1]) * 0x100) * 0x100;
                     num += Convert.ToUInt32(strArray[2]) * 0x100;
                     num += Convert.ToUInt32(strArray[3]);
                 }
                 catch (Exception exception9)
                 {
                     ErrorLog.WriteLine(exception9);
                     continue;
                 }
                 map.FindLocation(num, out num2, out num3);
                 location = new MapLocation();
                 str4 = Loc.Get("<LOC>Offline");
                 location.MapColor = Color.LightGreen;
                 if (record["connections"].ToString() != "0")
                 {
                     str4 = Loc.Get("<LOC>Online");
                 }
                 location.HideLocation = record["ip_opt_out"].ToString() == "1";
                 location.Latitude = num2;
                 location.Longitude = num3;
                 location.DataType = "Friend";
                 location.Classification = "Friend";
                 location.LocationType = GPG.UI.LocationTypes.Image;
                 location.MapImage = Resources.TackFriend;
                 location.Information = record["name"];
                 location.ExtendedInformation = location.Information + "\r\n" + str4;
                 if (gen8 == null)
                 {
                     gen8 = delegate (object objlocation) {
                         MapLocation mapLocation = objlocation as MapLocation;
                         if (mapLocation != null)
                         {
                             mapLocation.MapColor = map.cbFriends.ForeColor;
                             map.earthMap1.AddLocation(mapLocation);
                             map.earthMap1.Invalidate();
                         }
                     };
                 }
                 map.BeginInvoke(gen8, new object[] { location });
             }
         }
         queryDataSafe = DataAccess.GetQueryDataSafe("GetClanIPAddresses", new object[0]);
         foreach (DataRecord record in queryDataSafe)
         {
             map.SetStatus(Loc.Get("<LOC>Loading Location: ") + record[0].ToString(), new object[0]);
             strArray = record["ip_address"].ToString().Split(new char[] { '.' });
             if (strArray.Length == 4)
             {
                 try
                 {
                     num = ((Convert.ToUInt32(strArray[0]) * 0x100) * 0x100) * 0x100;
                     num += (Convert.ToUInt32(strArray[1]) * 0x100) * 0x100;
                     num += Convert.ToUInt32(strArray[2]) * 0x100;
                     num += Convert.ToUInt32(strArray[3]);
                 }
                 catch (Exception exception10)
                 {
                     ErrorLog.WriteLine(exception10);
                     continue;
                 }
                 map.FindLocation(num, out num2, out num3);
                 location = new MapLocation();
                 str4 = Loc.Get("<LOC>Offline");
                 location.MapColor = Color.FromArgb(0xff, 0xff, 0, 0);
                 if (record["connections"].ToString() != "0")
                 {
                     str4 = Loc.Get("<LOC>Online");
                 }
                 location.HideLocation = record["ip_opt_out"].ToString() == "1";
                 location.Latitude = num2;
                 location.Longitude = num3;
                 location.DataType = "Clan";
                 location.Classification = "Clan";
                 location.LocationType = GPG.UI.LocationTypes.Image;
                 location.MapImage = Resources.TackClan;
                 location.Information = record["name"];
                 location.ExtendedInformation = location.Information + "\r\n" + str4;
                 if (gen9 == null)
                 {
                     gen9 = delegate (object objlocation) {
                         MapLocation mapLocation = objlocation as MapLocation;
                         if (mapLocation != null)
                         {
                             mapLocation.MapColor = map.cbClanmates.ForeColor;
                             map.earthMap1.AddLocation(mapLocation);
                             map.earthMap1.Invalidate();
                         }
                     };
                 }
                 map.BeginInvoke(gen9, new object[] { location });
             }
         }
         map.SetCBColors();
         if (ConfigSettings.GetBool("DoOldGameList", false))
         {
             queryDataSafe = DataAccess.GetQueryDataSafe("GetTop10Addresses", new object[0]);
         }
         else
         {
             queryDataSafe = DataAccess.GetQueryDataSafe("GetTop10Addresses", new object[] { GameInformation.SelectedGame.GameID });
         }
         foreach (DataRecord record in queryDataSafe)
         {
             map.SetStatus(Loc.Get("<LOC>Loading Location: ") + record[0].ToString(), new object[0]);
             strArray = record["ip_address"].ToString().Split(new char[] { '.' });
             if (strArray.Length == 4)
             {
                 try
                 {
                     num = ((Convert.ToUInt32(strArray[0]) * 0x100) * 0x100) * 0x100;
                     num += (Convert.ToUInt32(strArray[1]) * 0x100) * 0x100;
                     num += Convert.ToUInt32(strArray[2]) * 0x100;
                     num += Convert.ToUInt32(strArray[3]);
                 }
                 catch (Exception exception11)
                 {
                     ErrorLog.WriteLine(exception11);
                     continue;
                 }
                 num2 = 0f;
                 num3 = 0f;
                 map.FindLocation(num, out num2, out num3);
                 location = new MapLocation();
                 if (record["connections"].ToString() == "0")
                 {
                     location.MapColor = Color.LightSkyBlue;
                 }
                 else
                 {
                     location.MapColor = Color.FromArgb(0x4b, Color.LightSkyBlue);
                 }
                 location.HideLocation = record["ip_opt_out"].ToString() == "1";
                 location.Latitude = num2;
                 location.Longitude = num3;
                 location.DataType = "Top10";
                 location.Classification = "Top10";
                 location.LocationType = GPG.UI.LocationTypes.Image;
                 location.MapImage = Resources.TackTop10;
                 location.Information = "#" + record["rank"] + " " + record["description"];
                 location.ExtendedInformation = location.Information + "\r\n" + Loc.Get("<LOC>Rating") + " " + record["rating"] + "\r\n" + Loc.Get("<LOC>Wins") + " " + record["wins"] + "\r\n" + Loc.Get("<LOC>Losses") + " " + record["losses"] + "\r\n" + Loc.Get("<LOC>Draws") + " " + record["draws"];
                 if (gen10 == null)
                 {
                     gen10 = delegate (object objlocation) {
                         MapLocation mapLocation = objlocation as MapLocation;
                         if (mapLocation != null)
                         {
                             mapLocation.MapColor = map.cbTop10.ForeColor;
                             map.earthMap1.AddLocation(mapLocation);
                             map.earthMap1.Invalidate();
                             mapLocation.Animate = true;
                         }
                     };
                 }
                 map.BeginInvoke(gen10, new object[] { location });
             }
         }
         if (gen11 == null)
         {
             gen11 = delegate {
                 map.earthMap1.Invalidate();
                 map.earthMap1.Refresh();
                 map.earthMap1.Focus();
                 map.refreshTimer.Interval = ConfigSettings.GetInt("MapDrawRate", 500);
                 map.refreshTimer.Stop();
             };
         }
         map.BeginInvoke(gen11);
         map.ShowCustomGames();
         int num10 = Convert.ToInt32(DataAccess.GetQueryDataSafe("GetMaxGameReportID", new object[0])[0][0]);
         goto Label_19A1;
     Label_1400:;
         queryDataSafe = DataAccess.GetQueryDataSafe("GatResultsWithIP", new object[] { num10 });
         int num11 = 0;
         MapLocation location2 = null;
         string str5 = "";
         string str6 = "";
         string str7 = "";
         foreach (DataRecord record in queryDataSafe)
         {
             string str8 = record["name"].ToString();
             string str9 = record["rank"].ToString();
             bool flag = record["won_game"].ToString() == "1";
             int num12 = Convert.ToInt32(record["game_id"]);
             string str10 = record["faction"].ToString();
             if (num10 < (num12 + 1))
             {
                 num10 = num12 + 1;
             }
             strArray = record["ip_address"].ToString().Split(new char[] { '.' });
             location = null;
             if (strArray.Length == 4)
             {
                 try
                 {
                     num = ((Convert.ToUInt32(strArray[0]) * 0x100) * 0x100) * 0x100;
                     num += (Convert.ToUInt32(strArray[1]) * 0x100) * 0x100;
                     num += Convert.ToUInt32(strArray[2]) * 0x100;
                     num += Convert.ToUInt32(strArray[3]);
                 }
                 catch (Exception exception12)
                 {
                     ErrorLog.WriteLine(exception12);
                     continue;
                 }
                 map.FindLocation(num, out num2, out num3);
                 location = new MapLocation();
                 location.HideLocation = record["ip_opt_out"].ToString() == "1";
                 location.MapColor = Color.FromArgb(0xff, 140, 140, 140);
                 location.Latitude = num2;
                 location.Longitude = num3;
                 location.DataType = "GameResult";
                 location.Classification = "GameResult";
                 location.LocationType = GPG.UI.LocationTypes.Image;
                 location.Information = str8;
                 if (flag)
                 {
                     if (str10.ToUpper() == "AEON")
                     {
                         location.MapImage = Resources.AeonVictory;
                         location.MapColor = Color.FromArgb(0xff, 0x19, 0xad, 0x5c);
                     }
                     else if (str10.ToUpper() == "CYBRAN")
                     {
                         location.MapImage = Resources.CybranVictory;
                         location.MapColor = Color.FromArgb(0xff, 220, 0x4d, 0x4e);
                     }
                     else
                     {
                         location.MapImage = Resources.UefVictory;
                         location.MapColor = Color.FromArgb(0xff, 0xae, 0xbc, 0xff);
                     }
                     str5 = str8;
                     str6 = str10;
                 }
                 else if (str10.ToUpper() == "AEON")
                 {
                     location.MapImage = Resources.AeonLoss;
                 }
                 else if (str10.ToUpper() == "CYBRAN")
                 {
                     location.MapImage = Resources.CybranLoss;
                 }
                 else
                 {
                     location.MapImage = Resources.UefLoss;
                 }
                 if (gen12 == null)
                 {
                     gen12 = delegate (object objlocation) {
                         MapLocation mapLocation = objlocation as MapLocation;
                         mapLocation.Visible = map.cbReports.Checked;
                         if (mapLocation != null)
                         {
                             map.earthMap1.AddLocation(mapLocation);
                             map.earthMap1.Invalidate();
                             mapLocation.Animate = true;
                         }
                     };
                 }
                 map.BeginInvoke(gen12, new object[] { location });
             }
             if (num11 == num12)
             {
                 string str11 = map.GenWittyText();
                 TickerItem item = new TickerItem();
                 item.Winner = str5;
                 item.Loser = "#" + str9 + " " + str8;
                 item.WinFaction = str6.ToLower();
                 item.LoseFaction = str10.ToLower();
                 item.Witty = str11;
                 map.mTickerItems.Add(item);
                 if (location != null)
                 {
                     location.ExtendedInformation = location.Information + "\r\n" + item.Loser + "\r\n" + item.Witty.Trim() + "\r\n" + item.Winner;
                 }
                 if (location2 != null)
                 {
                     location2.ExtendedInformation = location2.Information + "\r\n" + item.Loser + "\r\n" + item.Witty.Trim() + "\r\n" + item.Winner;
                 }
             }
             else
             {
                 str5 = "#" + str9 + " " + str8;
                 str6 = str10;
                 str7 = record["ip_address"].ToString();
                 num11 = num12;
                 location2 = location;
             }
         }
         if (User.Current.IsAdmin)
         {
             Thread.Sleep(ConfigSettings.GetInt("AdminMapRefreshRate", 0x2710));
         }
         else
         {
             Thread.Sleep(ConfigSettings.GetInt("MapRefreshRate", 0x1d4c0));
         }
         while (!map.Visible)
         {
             Thread.Sleep(0x2710);
         }
     Label_19A1:
         flag2 = true;
         goto Label_1400;
     }
     catch (Exception exception3)
     {
         ErrorLog.WriteLine(exception3);
     }
 }
Exemplo n.º 2
0
 private void PaintCanvas(Graphics canvas)
 {
     canvas.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
     int tickCount = Environment.TickCount;
     canvas.SmoothingMode = SmoothingMode.HighSpeed;
     Brush brush = new SolidBrush(Color.FromArgb(3, 6, 0x15));
     canvas.FillRectangle(brush, base.ClientRectangle);
     brush.Dispose();
     ZoomInfo zoomLevel = this.GetZoomLevel();
     float num2 = this.mSmootheMapScale / zoomLevel.ZoomThreshold;
     float num3 = zoomLevel.RelativeX(this.mSmootheX) * num2;
     float num4 = zoomLevel.RelativeY(this.mSmootheY) * num2;
     float num5 = num2 * zoomLevel.TileWidth;
     float num6 = num2 * zoomLevel.TileHeight;
     int num7 = (int) (num3 / num5);
     if (num7 < 0)
     {
         num7 = 0;
     }
     int horizontalTiles = (num7 + ((int) (((float) base.Width) / num5))) + 1;
     if (horizontalTiles > zoomLevel.HorizontalTiles)
     {
         horizontalTiles = zoomLevel.HorizontalTiles;
     }
     int num9 = (int) (num4 / num6);
     if (num9 < 0)
     {
         num9 = 0;
     }
     int verticleTiles = (num9 + ((int) (((float) base.Height) / num6))) + 1;
     if (verticleTiles > zoomLevel.VerticleTiles)
     {
         verticleTiles = zoomLevel.VerticleTiles;
     }
     RectangleF srcRect = new RectangleF(0f, 0f, (float) zoomLevel.TileWidth, (float) zoomLevel.TileHeight);
     float num11 = num2;
     for (int i = num7; i <= horizontalTiles; i++)
     {
         for (int j = num9; j <= verticleTiles; j++)
         {
             float x = (i * num5) - num3;
             float num15 = (j * num6) - num4;
             if (this.mHighRes)
             {
                 srcRect = new RectangleF(0f, 0f, 256f, 256f);
                 int index = 0;
                 int num17 = Convert.ToInt32(zoomLevel.Prefix);
                 for (index *= 11; index < (this.mHighResHeader.Length - 11); index += 11)
                 {
                     byte num18 = this.mHighResHeader[index];
                     if (num18 == num17)
                     {
                         num11 = 0f;
                         short num19 = BitConverter.ToInt16(this.mHighResHeader, index + 1);
                         short num20 = BitConverter.ToInt16(this.mHighResHeader, index + 3);
                         int offset = BitConverter.ToInt32(this.mHighResHeader, index + 5);
                         short count = BitConverter.ToInt16(this.mHighResHeader, index + 9);
                         if ((num19 == i) && (num20 == j))
                         {
                             if (count == 0)
                             {
                                 Brush brush2 = new SolidBrush(Color.FromArgb(3, 6, 0x15));
                                 RectangleF rect = new RectangleF(x, num15, num5 + num11, num6 + num11);
                                 canvas.FillRectangle(brush2, rect);
                                 brush2.Dispose();
                             }
                             else
                             {
                                 MemoryStream stream = new MemoryStream();
                                 stream.Write(this.mHighResData, offset, count);
                                 Image image = Image.FromStream(stream);
                                 RectangleF destRect = new RectangleF(x, num15, num5 + num11, num6 + num11);
                                 canvas.DrawImage(image, destRect, srcRect, GraphicsUnit.Pixel);
                             }
                         }
                     }
                 }
             }
             else
             {
                 string filename = zoomLevel.Prefix + "slice_" + i.ToString() + "_" + j.ToString() + ".jpg";
                 Image fileAsImage = this.mMapTiles.GetFileAsImage(filename);
                 RectangleF ef4 = new RectangleF(x, num15, num5 + num11, num6 + num11);
                 canvas.DrawImage(fileAsImage, ef4, srcRect, GraphicsUnit.Pixel);
             }
         }
     }
     MapLocation location = new MapLocation();
     location.Latitude = -58f;
     float y = (zoomLevel.RelativeY(location.MapY) * num2) - num4;
     if ((0f < y) && (y < base.Height))
     {
         Brush brush3 = new SolidBrush(Color.FromArgb(3, 6, 0x15));
         RectangleF ef5 = new RectangleF(0f, y, (float) base.Width, base.Height - y);
         canvas.FillRectangle(brush3, ef5);
         brush3.Dispose();
     }
     if (this.WatermarkLeft != null)
     {
         canvas.DrawImage(this.WatermarkLeft, 20, (base.Height - this.WatermarkLeft.Height) - 20);
     }
     if (this.WatermarkRight != null)
     {
         canvas.DrawImage(this.WatermarkRight, (int) ((base.Width - this.WatermarkRight.Width) - 20), (int) ((base.Height - this.WatermarkRight.Height) - 20));
     }
     if (this.ShowBorders)
     {
         float num24 = 0f;
         float num25 = 0f;
         float width = (50f * this.mSmootheMapScale) / 4f;
         if (width < 1f)
         {
             width = 1f;
         }
         else if (width > 3f)
         {
             width = 3f;
         }
         Pen pen = new Pen(Color.FromArgb(200, 0, 0, 0), width);
         for (int k = 0; k < (this.mCountryData.Length - 8); k += 8)
         {
             float num28 = BitConverter.ToSingle(this.mCountryData, k) + 10800f;
             float num29 = 5400f - BitConverter.ToSingle(this.mCountryData, k + 4);
             if ((num28 != 10802f) && (num24 != 10802f))
             {
                 PointF tf = new PointF((zoomLevel.RelativeX(num24) * num2) - num3, (zoomLevel.RelativeY(num25) * num2) - num4);
                 PointF tf2 = new PointF((zoomLevel.RelativeX(num28) * num2) - num3, (zoomLevel.RelativeY(num29) * num2) - num4);
                 canvas.DrawLine(pen, tf, tf2);
             }
             num24 = num28;
             num25 = num29;
         }
         pen.Dispose();
     }
     List<RectangleF> textBoxes = new List<RectangleF>();
     this.SetTextBoxes(textBoxes);
     float num30 = 500f;
     Bitmap bitmap = new Bitmap(base.Width, base.Height);
     Graphics textcanvas = Graphics.FromImage(bitmap);
     foreach (MapLocation location2 in this.mMapLocationList)
     {
         if (!location2.Visible)
         {
             continue;
         }
         float centerx = 0f;
         float centery = 0f;
         if ((location2.Latitude == 0f) && (location2.Longitude == 0f))
         {
             centerx = (zoomLevel.RelativeX(21600f) * num2) - num3;
             centery = (zoomLevel.RelativeY(num30) * num2) - num4;
             location2.UnknownLocYPos = centery;
             location2.UnknownLocXPos = centerx;
             num30 += 500f;
         }
         else
         {
             centerx = (zoomLevel.RelativeX(location2.MapX) * num2) - num3;
             centery = (zoomLevel.RelativeY(location2.MapY) * num2) - num4;
         }
         float radius = 50f * this.mSmootheMapScale;
         if (radius < 1f)
         {
             radius = 1f;
         }
         else if (radius > 50f)
         {
             radius = 50f;
         }
         if (location2.LocationType == LocationTypes.Flag)
         {
             if (radius < 4f)
             {
                 radius = 4f;
             }
             else if (radius > 15f)
             {
                 radius = 15f;
             }
             Brush brush4 = new SolidBrush(Color.Black);
             Brush brush5 = new SolidBrush(location2.MapColor);
             Brush brush6 = new SolidBrush(this.DimColor(0x42, location2.MapColor));
             Pen pen2 = new Pen(this.DimColor(0x21, location2.MapColor), 2f);
             PointF[] points = new PointF[3];
             points[0].X = centerx - radius;
             points[0].Y = centery - (radius * 2.75f);
             points[1].X = centerx;
             points[1].Y = centery + (radius * 0.25f);
             points[2].X = centerx + radius;
             points[2].Y = centery - (radius * 2.75f);
             canvas.FillPolygon(brush4, points);
             canvas.FillEllipse(brush4, (float) (centerx - (radius * 1.125f)), (float) (centery - (radius * 4.125f)), (float) (radius * 2.25f), (float) (radius * 2.25f));
             points = new PointF[3];
             points[0].X = centerx - radius;
             points[0].Y = centery - (radius * 3f);
             points[1].X = centerx;
             points[1].Y = centery;
             points[2].X = centerx + radius;
             points[2].Y = centery - (radius * 3f);
             canvas.FillPolygon(brush6, points);
             canvas.FillEllipse(brush5, (float) (centerx - radius), (float) (centery - (radius * 4f)), (float) (radius * 2f), (float) (radius * 2f));
             canvas.DrawEllipse(pen2, (float) (centerx - radius), (float) (centery - (radius * 4f)), (float) (radius * 2f), (float) (radius * 2f));
             if (location2.Information != null)
             {
                 this.DrawText(canvas, textcanvas, ref textBoxes, radius, centerx + (radius * 3f), centery - (radius * 4f), location2, centerx, centery);
             }
         }
         if (location2.LocationType == LocationTypes.Image)
         {
             if (radius < 4f)
             {
                 radius = 4f;
             }
             else if (radius > 15f)
             {
                 radius = 15f;
             }
             float num34 = 1.75f;
             RectangleF ef6 = new RectangleF(centerx - (radius * num34), centery - (radius * num34), (radius * num34) * 2f, (radius * num34) * 2f);
             if (location2.Information != null)
             {
                 this.DrawText(canvas, textcanvas, ref textBoxes, radius, centerx + (radius * 3f), centery - (radius * 1.5f), location2, centerx, centery);
             }
             if (location2 != this.SelectedLocation)
             {
                 canvas.DrawImage(location2.MapImage, ef6);
             }
             if (location2.DrawImageBorder)
             {
                 Pen pen3 = new Pen(location2.MapColor);
                 canvas.DrawRectangle(pen3, ef6.X, ef6.Y, ef6.Width, ef6.Height);
                 pen3.Dispose();
             }
         }
         if (location2.LocationType == LocationTypes.Dot)
         {
             radius *= location2.Strength;
             Brush brush7 = new SolidBrush(location2.MapColor);
             radius /= 8f;
             canvas.FillEllipse(brush7, (float) (centerx - radius), (float) (centery - radius), (float) (radius * 2f), (float) (radius * 2f));
         }
     }
     canvas.DrawImage(bitmap, 0, 0);
     textcanvas.Dispose();
     if (this.mMapSelectedLocation != null)
     {
         float unknownLocXPos = (zoomLevel.RelativeX(this.mMapSelectedLocation.MapX) * num2) - num3;
         float unknownLocYPos = (zoomLevel.RelativeY(this.mMapSelectedLocation.MapY) * num2) - num4;
         if ((this.mMapSelectedLocation.Latitude == 0f) && (this.mMapSelectedLocation.Longitude == 0f))
         {
             unknownLocXPos = this.mMapSelectedLocation.UnknownLocXPos;
             unknownLocYPos = this.mMapSelectedLocation.UnknownLocYPos;
         }
         float num37 = 50f * this.mSmootheMapScale;
         if (num37 < 1f)
         {
             num37 = 1f;
         }
         else if (num37 > 50f)
         {
             num37 = 50f;
         }
         if (this.mMapSelectedLocation.LocationType == LocationTypes.Flag)
         {
             if (num37 < 4f)
             {
                 num37 = 4f;
             }
             else if (num37 > 15f)
             {
                 num37 = 15f;
             }
             Brush brush8 = new SolidBrush(Color.FromArgb(0xff, this.mMapSelectedLocation.MapColor));
             Brush brush9 = new SolidBrush(this.DimColor(0x21, this.mMapSelectedLocation.MapColor));
             Pen pen4 = new Pen(Color.White, 2f);
             PointF[] tfArray2 = new PointF[3];
             tfArray2[0].X = unknownLocXPos - num37;
             tfArray2[0].Y = unknownLocYPos - (num37 * 3f);
             tfArray2[1].X = unknownLocXPos;
             tfArray2[1].Y = unknownLocYPos;
             tfArray2[2].X = unknownLocXPos + num37;
             tfArray2[2].Y = unknownLocYPos - (num37 * 3f);
             canvas.FillPolygon(brush9, tfArray2);
             canvas.DrawLine(pen4, tfArray2[0], tfArray2[1]);
             canvas.DrawLine(pen4, tfArray2[1], tfArray2[2]);
             canvas.FillEllipse(brush8, (float) (unknownLocXPos - num37), (float) (unknownLocYPos - (num37 * 4f)), (float) (num37 * 2f), (float) (num37 * 2f));
             canvas.DrawEllipse(pen4, (float) (unknownLocXPos - num37), (float) (unknownLocYPos - (num37 * 4f)), (float) (num37 * 2f), (float) (num37 * 2f));
             if (this.mMapSelectedLocation.Information != null)
             {
                 Brush brush10 = new SolidBrush(Color.FromArgb(0x7d, 0, 0, 0));
                 Pen pen5 = new Pen(Color.FromArgb(0xff, this.mMapSelectedLocation.MapColor));
                 canvas.FillRectangle(brush10, (unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset, (unknownLocYPos - (num37 * 4f)) + this.mMapSelectedLocation.StringYoffset, this.mMapSelectedLocation.StringWidth, this.mMapSelectedLocation.StringHeight);
                 canvas.DrawRectangle(pen5, (unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset, (unknownLocYPos - (num37 * 4f)) + this.mMapSelectedLocation.StringYoffset, this.mMapSelectedLocation.StringWidth, this.mMapSelectedLocation.StringHeight);
                 pen5.Dispose();
                 brush10.Dispose();
                 Brush brush11 = new SolidBrush(Color.Black);
                 Font font = new Font(this.Font.FontFamily, this.GetFontSize(num37));
                 canvas.DrawString(this.mMapSelectedLocation.Information, font, brush11, (float) (((unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset) + 1f), (float) (((unknownLocYPos - (num37 * 4f)) + this.mMapSelectedLocation.StringYoffset) + 1f));
                 canvas.DrawString(this.mMapSelectedLocation.Information, font, brush8, (float) ((unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset), (float) ((unknownLocYPos - (num37 * 4f)) + this.mMapSelectedLocation.StringYoffset));
             }
         }
         if (this.mMapSelectedLocation.LocationType == LocationTypes.Image)
         {
             if (num37 < 4f)
             {
                 num37 = 4f;
             }
             else if (num37 > 15f)
             {
                 num37 = 15f;
             }
             RectangleF ef7 = new RectangleF(unknownLocXPos - (num37 * 2f), unknownLocYPos - (num37 * 2f), num37 * 4f, num37 * 4f);
             canvas.DrawImage(this.mMapSelectedLocation.MapImage, ef7);
             if (this.mMapSelectedLocation.DrawImageBorder)
             {
                 Pen pen6 = new Pen(this.mMapSelectedLocation.MapColor);
                 canvas.DrawRectangle(pen6, ef7.X, ef7.Y, ef7.Width, ef7.Height);
                 pen6.Dispose();
             }
             if (this.mMapSelectedLocation.Information != null)
             {
                 Font font2 = new Font(this.Font.FontFamily, this.GetFontSize(num37));
                 string information = this.mMapSelectedLocation.Information;
                 if (this.mMapSelectedLocation.ExtendedInformation != "")
                 {
                     information = this.mMapSelectedLocation.ExtendedInformation;
                 }
                 SizeF ef8 = canvas.MeasureString(information, font2);
                 ef8.Width += 10f;
                 Brush brush12 = new SolidBrush(Color.FromArgb(200, this.mMapSelectedLocation.MapColor.R / 3, this.mMapSelectedLocation.MapColor.G / 3, this.mMapSelectedLocation.MapColor.B / 3));
                 Pen pen7 = new Pen(Color.FromArgb(0xff, this.mMapSelectedLocation.MapColor));
                 canvas.FillRectangle(brush12, (unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset, (unknownLocYPos - (num37 * 1.5f)) + this.mMapSelectedLocation.StringYoffset, ef8.Width, ef8.Height);
                 canvas.DrawRectangle(pen7, (unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset, (unknownLocYPos - (num37 * 1.5f)) + this.mMapSelectedLocation.StringYoffset, ef8.Width, ef8.Height);
                 pen7.Dispose();
                 brush12.Dispose();
                 Brush brush13 = new SolidBrush(Color.FromArgb(150, Color.Black));
                 Brush brush14 = new SolidBrush(Color.FromArgb(0xff, this.mMapSelectedLocation.MapColor));
                 canvas.DrawString(this.mMapSelectedLocation.Information, font2, brush13, (float) (((unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset) + 1f), (float) (((unknownLocYPos - (num37 * 1.5f)) + this.mMapSelectedLocation.StringYoffset) + 1f));
                 canvas.DrawString(this.mMapSelectedLocation.Information, font2, brush14, (float) ((unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset), (float) ((unknownLocYPos - (num37 * 1.5f)) + this.mMapSelectedLocation.StringYoffset));
                 if (information != this.mMapSelectedLocation.Information)
                 {
                     Font font3 = new Font(this.Font.FontFamily, this.GetFontSize(num37) * 0.75f);
                     information = information.Replace(this.mMapSelectedLocation.Information + "\r\n", "");
                     float num38 = (ef8.Width - canvas.MeasureString(information, font3).Width) / 2f;
                     float num39 = (ef8.Height - canvas.MeasureString(information, font3).Height) / 1.5f;
                     canvas.DrawString(information, font3, brush13, (float) ((((unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset) + 1f) + num38), (float) ((((unknownLocYPos - (num37 * 1.5f)) + this.mMapSelectedLocation.StringYoffset) + 1f) + num39));
                     canvas.DrawString(information, font3, brush14, (float) (((unknownLocXPos + (num37 * 3f)) + this.mMapSelectedLocation.StringXoffset) + num38), (float) (((unknownLocYPos - (num37 * 1.5f)) + this.mMapSelectedLocation.StringYoffset) + num39));
                     font3.Dispose();
                 }
             }
         }
     }
     bool flag = false;
     float num40 = (1f * (tickCount - this.mLastTick)) / this.mSmootheMapScale;
     if (this.mMapX > this.mSmootheX)
     {
         this.mSmootheX += num40;
         if (this.mMapX < this.mSmootheX)
         {
             this.mSmootheX = this.mMapX;
         }
         flag = true;
     }
     else if (this.mMapX < this.mSmootheX)
     {
         this.mSmootheX -= num40;
         if (this.mMapX > this.mSmootheX)
         {
             this.mSmootheX = this.mMapX;
         }
         flag = true;
     }
     if (this.mMapY > this.mSmootheY)
     {
         this.mSmootheY += num40;
         if (this.mMapY < this.mSmootheY)
         {
             this.mSmootheY = this.mMapY;
         }
         flag = true;
     }
     else if (this.mMapY < this.mSmootheY)
     {
         this.mSmootheY -= num40;
         if (this.mMapY > this.mSmootheY)
         {
             this.mSmootheY = this.mMapY;
         }
         flag = true;
     }
     if (this.mMapScale < this.mSmootheMapScale)
     {
         this.mSmootheMapScale -= (num40 * this.mSmootheMapScale) / 5000f;
         if (this.mMapScale > this.mSmootheMapScale)
         {
             this.mSmootheMapScale = this.mMapScale;
         }
         flag = true;
     }
     else if (this.mMapScale > this.mSmootheMapScale)
     {
         this.mSmootheMapScale += (num40 * this.mSmootheMapScale) / 5000f;
         if (this.mMapScale < this.mSmootheMapScale)
         {
             this.mSmootheMapScale = this.mMapScale;
         }
         flag = true;
     }
     this.mapMoved = false;
     this.mLastTick = tickCount;
     if (flag)
     {
         base.Invalidate();
     }
 }
Exemplo n.º 3
0
 private void ShowCustomGames()
 {
     this.miRefreshGamesList.Enabled = false;
     this.earthMap1.ClearLocations("CustomGame");
     ThreadPool.QueueUserWorkItem(delegate (object o) {
         MappedObjectList<GameItem> objects = null;
         Exception exception;
         VGen1 method = null;
         VGen0 gen2 = null;
         if (ConfigSettings.GetBool("DoOldGameList", false))
         {
             objects = DataAccess.GetObjects<GameItem>("GetGamesWithIP", new object[0]);
         }
         else
         {
             objects = DataAccess.GetObjects<GameItem>("GetGamesWithIP2", new object[] { GameInformation.SelectedGame.GameID });
         }
         foreach (GameItem item in objects)
         {
             if (item.Description.IndexOf("AUTOMATCH") == 0)
             {
                 continue;
             }
             string str = item.MapName.Split(" ".ToCharArray(), 2)[0];
             string[] strArray = item.URL.Split("=;".ToCharArray());
             if (strArray.Length > 2)
             {
                 string[] strArray2 = strArray[1].Split(new char[] { '.' });
                 if (strArray2.Length == 4)
                 {
                     uint num;
                     try
                     {
                         num = ((Convert.ToUInt32(strArray2[0]) * 0x100) * 0x100) * 0x100;
                         num += (Convert.ToUInt32(strArray2[1]) * 0x100) * 0x100;
                         num += Convert.ToUInt32(strArray2[2]) * 0x100;
                         num += Convert.ToUInt32(strArray2[3]);
                     }
                     catch (Exception exception1)
                     {
                         exception = exception1;
                         ErrorLog.WriteLine(exception);
                         continue;
                     }
                     float latitide = 0f;
                     float longitude = 0f;
                     this.FindLocation(num, out latitide, out longitude);
                     MapLocation location = new MapLocation {
                         HideLocation = item.IPOptOut == 1,
                         MapColor = Color.FromArgb(0xff, 0xe4, 0xc3, 130),
                         Latitude = latitide,
                         Longitude = longitude,
                         DataType = "CustomGame",
                         Classification = "CustomGame",
                         LocationType = GPG.UI.LocationTypes.Image,
                         Information = item.Description,
                         ExtendedInformation = item.Description + "\r\n" + item.MapName + "\r\n" + item.PlayerName + "\r\n" + item.NumPlayers,
                         Tag = item
                     };
                     Image image = item.MapImage;
                     if (image != null)
                     {
                         try
                         {
                             Graphics graphics = Graphics.FromImage(image);
                             if (item.HasPassword)
                             {
                                 graphics.DrawImage(DrawUtil.GetTransparentImage(0.8f, DrawUtil.AdjustColors(0.2f, 0.2f, 0.2f, Resources.key)), new Rectangle(60, 90, 150, 80));
                             }
                             graphics.Dispose();
                             location.DrawImageBorder = true;
                             location.MapImage = image;
                             if (method == null)
                             {
                                 method = delegate (object objlocation) {
                                     MapLocation mapLocation = objlocation as MapLocation;
                                     if (mapLocation != null)
                                     {
                                         mapLocation.MapColor = this.cbGames.ForeColor;
                                         this.earthMap1.AddLocation(mapLocation);
                                         this.earthMap1.Invalidate();
                                         mapLocation.Animate = true;
                                     }
                                 };
                             }
                             base.BeginInvoke(method, new object[] { location });
                         }
                         catch (Exception exception2)
                         {
                             exception = exception2;
                             ErrorLog.WriteLine(exception);
                         }
                     }
                 }
             }
         }
         try
         {
             if (gen2 == null)
             {
                 gen2 = delegate {
                     base.SetStatus("", new object[0]);
                     this.miRefreshGamesList.Enabled = true;
                 };
             }
             base.BeginInvoke(gen2);
         }
         catch (Exception exception3)
         {
             exception = exception3;
             ErrorLog.WriteLine(exception);
         }
     });
 }
Exemplo n.º 4
0
 protected override void OnMouseWheel(MouseEventArgs e)
 {
     base.OnMouseWheel(e);
     this.mMapSelectedLocation = this.CheckMapHit((float) this.mLastMouseX, (float) this.mLastMouseY);
     float mapScale = this.MapScale;
     float num2 = this.MapScale / 3f;
     if (e.Delta < 0)
     {
         num2 = 0f - num2;
         this.mMapScale += num2;
     }
     else
     {
         this.mMapScale += num2;
     }
     this.CheckBounds();
     if (mapScale != this.MapScale)
     {
         this.mMapX -= (((float) base.Width) / 2f) / this.mMapScale;
         this.mMapY -= (((float) base.Height) / 2f) / this.mMapScale;
         this.mMapX += (((float) base.Width) / 2f) / mapScale;
         this.mMapY += (((float) base.Height) / 2f) / mapScale;
         if (e.Delta > 0)
         {
             this.mMapX -= (e.X - (((float) base.Width) / 2f)) / this.mMapScale;
             this.mMapY -= (e.Y - (((float) base.Height) / 2f)) / this.mMapScale;
             this.mMapX += (e.X - (((float) base.Width) / 2f)) / mapScale;
             this.mMapY += (e.Y - (((float) base.Height) / 2f)) / mapScale;
         }
         this.CheckBounds();
         this.mapMoved = true;
     }
     this.mSmootheX = this.mMapX;
     this.mSmootheY = this.mMapY;
     this.mSmootheMapScale = this.mMapScale;
     base.Update();
     base.Invalidate();
 }
Exemplo n.º 5
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (e.Button == MouseButtons.Left)
     {
         int num = e.X - this.mLastMouseX;
         int num2 = e.Y - this.mLastMouseY;
         float num3 = ((float) num) / this.mSmootheMapScale;
         float num4 = ((float) num2) / this.mSmootheMapScale;
         float mapX = this.MapX;
         float mapY = this.MapY;
         this.MapX -= num3;
         this.MapY -= num4;
     }
     this.mLastMouseX = e.X;
     this.mLastMouseY = e.Y;
     MapLocation location = this.CheckMapHit((float) this.mLastMouseX, (float) this.mLastMouseY);
     if ((this.mMapSelectedLocation != location) && (location != null))
     {
         this.mMapSelectedLocation = location;
         base.Invalidate();
     }
     else if ((this.mMapSelectedLocation != null) && (location == null))
     {
         this.mMapSelectedLocation = null;
         base.Invalidate();
     }
 }
Exemplo n.º 6
0
 private void DrawText(Graphics canvas, Graphics textcanvas, ref List<RectangleF> textBoxes, float radius, float x, float y, MapLocation mapLocation, float centerx, float centery)
 {
     Brush brush = new SolidBrush(Color.FromArgb(0xff, Color.Black));
     Brush brush2 = new SolidBrush(Color.FromArgb(200, mapLocation.MapColor));
     Font font = new Font(this.Font.FontFamily, this.GetFontSize(radius));
     SizeF size = canvas.MeasureString(mapLocation.Information, font);
     float num = x;
     float num2 = y;
     float num3 = 0f;
     float num4 = 0f;
     float num5 = 0f;
     if (!this.mapMoved)
     {
         goto Label_01F2;
     }
     RectangleF target = new RectangleF(new PointF(num, num2), size);
     int num6 = -1;
     bool flag = textBoxes.Count > 0;
 Label_01AB:
     while (flag)
     {
         num = x + num3;
         num2 = y + num4;
         target = new RectangleF(new PointF(num, num2), size);
         flag = false;
         foreach (RectangleF ef3 in textBoxes)
         {
             if (!this.CheckHit(ef3, target))
             {
                 continue;
             }
             num6++;
             if (num6 >= 8)
             {
                 num6 = 0;
             }
             if (num6 == 0)
             {
                 num5 += 2f;
                 num3 = num5;
                 num4 = 0f;
             }
             else if (num6 == 1)
             {
                 num4 = num3;
                 num3 = 0f;
             }
             else if (num6 == 2)
             {
                 num3 = 0f - num4;
                 num4 = 0f;
             }
             else if (num6 == 3)
             {
                 num4 = num3;
                 num3 = 0f;
             }
             else if (num6 == 4)
             {
                 num3 = num4;
             }
             else if (num6 == 5)
             {
                 num3 = 0f - num3;
             }
             else if (num6 == 6)
             {
                 num4 = 0f - num4;
             }
             else if (num6 == 7)
             {
                 num3 = 0f - num3;
             }
             flag = true;
             goto Label_01AB;
         }
     }
     mapLocation.StringXoffset = num3;
     mapLocation.StringYoffset = num4;
     mapLocation.StringWidth = target.Width;
     mapLocation.StringHeight = target.Height;
     textBoxes.Add(target);
     mapLocation.StringRect = target;
 Label_01F2:
     num = x + mapLocation.StringXoffset;
     num2 = y + mapLocation.StringYoffset;
     mapLocation.StringRect.X = num;
     mapLocation.StringRect.Y = num2;
     Brush brush3 = new SolidBrush(Color.FromArgb(0x7d, 0, 0, 0));
     Pen pen = new Pen(Color.FromArgb(0x7d, mapLocation.MapColor));
     textcanvas.FillRectangle(brush3, num, num2, mapLocation.StringWidth, mapLocation.StringHeight);
     textcanvas.DrawRectangle(pen, num, num2, mapLocation.StringWidth, mapLocation.StringHeight);
     pen.Dispose();
     brush3.Dispose();
     textcanvas.DrawString(mapLocation.Information, font, brush2, num, num2);
     float num7 = num + (mapLocation.StringWidth / 2f);
     float num8 = num2 + (mapLocation.StringHeight / 2f);
     if ((num7 > num) && (centerx < num))
     {
         num7 = num;
     }
     if ((num7 < (num + mapLocation.StringWidth)) && (centerx > (num + mapLocation.StringWidth)))
     {
         num7 = num + mapLocation.StringWidth;
     }
     if ((num8 > num2) && (centery < num2))
     {
         num8 = num2;
     }
     if ((num8 < (num2 + mapLocation.StringHeight)) && (centery > (num2 + mapLocation.StringHeight)))
     {
         num8 = num2 + mapLocation.StringHeight;
     }
     Pen pen2 = new Pen(Color.FromArgb(150, mapLocation.MapColor), 2f);
     canvas.DrawLine(pen2, centerx, centery, num7, num8);
     pen2.Dispose();
     brush.Dispose();
     brush2.Dispose();
 }
Exemplo n.º 7
0
 public void AddLocation(MapLocation mapLocation)
 {
     if (mapLocation.LocationType != LocationTypes.Dot)
     {
         this.mapMoved = true;
         this.mNonDots.Add(mapLocation);
         if (mapLocation.Classification == "GameResult")
         {
             this.mGameReports.Add(mapLocation);
             while (this.mGameReports.Count > 20)
             {
                 MapLocation item = this.mGameReports[0];
                 this.mGameReports.Remove(item);
                 this.mNonDots.Remove(item);
                 this.mMapLocationList.Remove(item);
             }
         }
         base.Invalidate();
     }
     else if (mapLocation.LocationType == LocationTypes.Dot)
     {
         for (int i = this.mMapLocationList.Count - 1; i >= 0; i--)
         {
             MapLocation location2 = this.mMapLocationList[i] as MapLocation;
             if (((location2 != null) && (location2.Latitude == mapLocation.Latitude)) && ((location2.Longitude == mapLocation.Longitude) && (location2.Classification == mapLocation.Classification)))
             {
                 location2.Strength += 0.05f * ((10f - location2.Strength) / 10f);
                 return;
             }
         }
     }
     mapLocation.Visible = !this.mFilters.Contains(mapLocation.Classification);
     this.mMapLocationList.Add(mapLocation);
 }
Exemplo n.º 8
0
 public MapLocation RandomLocation(Bitmap bitmap)
 {
     if (this.mRenderInfo == null)
     {
         return null;
     }
     Color black = Color.Black;
     int x = 0;
     int y = 0;
     for (int i = 0; (((black.G < 50) || (black.R > 150)) || (black.B > 150)) && (i < 200); i++)
     {
         x = this.mRandom.Next(base.Width);
         y = this.mRandom.Next(base.Height);
         black = bitmap.GetPixel(x, y);
     }
     float num4 = this.mSmootheMapScale / this.mRenderInfo.ZoomThreshold;
     float num5 = this.mRenderInfo.RelativeX(this.mSmootheX) * num4;
     float num6 = this.mRenderInfo.RelativeY(this.mSmootheY) * num4;
     float num7 = (x + num5) / this.mSmootheMapScale;
     float num8 = (y + num6) / this.mSmootheMapScale;
     MapLocation location = new MapLocation();
     location.MapX = num7;
     location.MapY = num8;
     return location;
 }