corrade-vassal – Diff between revs 8 and 12

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 8 Rev 12
Line 4... Line 4...
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
Line 6... Line 6...
6   6  
7 using System; 7 using System;
-   8 using System.Collections.Generic;
8 using System.Collections.Generic; 9 using System.Diagnostics;
9 using System.Drawing; 10 using System.Drawing;
10 using System.Drawing.Imaging; 11 using System.Drawing.Imaging;
11 using System.IO; 12 using System.IO;
12 using System.Linq; 13 using System.Linq;
Line 497... Line 498...
497 vassalForm.RegionTeleportGroup.Enabled = false; 498 vassalForm.RegionTeleportGroup.Enabled = false;
498 vassalForm.StatusProgress.Value = 0; 499 vassalForm.StatusProgress.Value = 0;
499 vassalForm.StatusText.Text = @"Teleporting to " + selectedRegionName; 500 vassalForm.StatusText.Text = @"Teleporting to " + selectedRegionName;
500 })); 501 }));
Line -... Line 502...
-   502  
-   503 // Pause for teleport (10 teleports / 15s allowed).
-   504 Thread.Sleep(700);
501   505  
502 int elapsedSeconds = 0; 506 int elapsedSeconds = 0;
503 Timer teleportTimer = new Timer(TimeSpan.FromSeconds(1).TotalMilliseconds); 507 Timer teleportTimer = new Timer(TimeSpan.FromSeconds(1).TotalMilliseconds);
504 teleportTimer.Elapsed += (o, p) => 508 teleportTimer.Elapsed += (o, p) =>
505 { 509 {
Line 617... Line 621...
617 PhysicsFPS.Enabled = false; 621 PhysicsFPS.Enabled = false;
618 ActiveScripts.Text = string.Empty; 622 ActiveScripts.Text = string.Empty;
619 ActiveScripts.Enabled = false; 623 ActiveScripts.Enabled = false;
620 ScriptTime.Text = string.Empty; 624 ScriptTime.Text = string.Empty;
621 ScriptTime.Enabled = false; 625 ScriptTime.Enabled = false;
-   626 FrameTime.Text = string.Empty;
-   627 FrameTime.Enabled = false;
-   628 ScriptedObjects.Text = string.Empty;
-   629 ScriptedObjects.Enabled = false;
-   630 PhysicsTime.Text = string.Empty;
-   631 PhysicsTime.Enabled = false;
-   632 NetTime.Text = string.Empty;
-   633 NetTime.Enabled = false;
622 Objects.Text = string.Empty; 634 Objects.Text = string.Empty;
623 Objects.Enabled = false; 635 Objects.Enabled = false;
624 })); 636 }));
Line 625... Line 637...
625   637  
Line 651... Line 663...
651   663  
652 // Disable estate manager tabs since we will enable these dynamically. 664 // Disable estate manager tabs since we will enable these dynamically.
653 EstateTopTab.Enabled = false; 665 EstateTopTab.Enabled = false;
654 EstateListsTab.Enabled = false; 666 EstateListsTab.Enabled = false;
-   667 ResidentListBanGroup.Enabled = false;
655 ResidentListBanGroup.Enabled = false; 668 ResidentListTeleportHomeGroup.Enabled = false;
-   669 EstateTerrainDownloadUploadGroup.Enabled = false;
656 EstateTerrainDownloadUploadGroup.Enabled = false; 670 EstateVariablesGroup.Enabled = false;
657 // Estate textures 671 // Estate textures
658 RegionTexturesLowUUIDApplyBox.Enabled = false; 672 RegionTexturesLowUUIDApplyBox.Enabled = false;
659 RegionTexturesLowUUIDApplyButton.Enabled = false; 673 RegionTexturesLowUUIDApplyButton.Enabled = false;
660 RegionTexturesMiddleLowUUIDApplyBox.Enabled = false; 674 RegionTexturesMiddleLowUUIDApplyBox.Enabled = false;
Line 732... Line 746...
732 ConnectionStatusPictureBox.Refresh(); 746 ConnectionStatusPictureBox.Refresh();
733 })); 747 }));
734 break; 748 break;
735 } 749 }
736 Tabs.Enabled = true; 750 Tabs.Enabled = true;
-   751 RegionTeleportGroup.Enabled = true;
737 })); 752 }));
738 } 753 }
739 catch (Exception) 754 catch (Exception)
740 { 755 {
741 // port closed 756 // port closed
Line 755... Line 770...
755 ConnectionStatusPictureBox.Refresh(); 770 ConnectionStatusPictureBox.Refresh();
756 })); 771 }));
757 break; 772 break;
758 } 773 }
759 Tabs.Enabled = false; 774 Tabs.Enabled = false;
-   775 RegionTeleportGroup.Enabled = false;
760 })); 776 }));
761 } 777 }
Line 762... Line 778...
762   778  
763 try 779 try
Line 797... Line 813...
797 { 813 {
798 case true: // we are an estate manager 814 case true: // we are an estate manager
799 EstateTopTab.Enabled = true; 815 EstateTopTab.Enabled = true;
800 EstateListsTab.Enabled = true; 816 EstateListsTab.Enabled = true;
801 ResidentListBanGroup.Enabled = true; 817 ResidentListBanGroup.Enabled = true;
-   818 ResidentListTeleportHomeGroup.Enabled = true;
802 EstateTerrainDownloadUploadGroup.Enabled = true; 819 EstateTerrainDownloadUploadGroup.Enabled = true;
-   820 EstateVariablesGroup.Enabled = true;
803 RegionToolsRegionDebugGroup.Enabled = true; 821 RegionToolsRegionDebugGroup.Enabled = true;
804 RegionToolsRegionInfoGroup.Enabled = true; 822 RegionToolsRegionInfoGroup.Enabled = true;
805 // Estate textures 823 // Estate textures
806 RegionTexturesLowUUIDApplyBox.Enabled = true; 824 RegionTexturesLowUUIDApplyBox.Enabled = true;
807 RegionTexturesLowUUIDApplyButton.Enabled = true; 825 RegionTexturesLowUUIDApplyButton.Enabled = true;
Line 814... Line 832...
814 break; 832 break;
815 default: 833 default:
816 EstateTopTab.Enabled = false; 834 EstateTopTab.Enabled = false;
817 EstateListsTab.Enabled = false; 835 EstateListsTab.Enabled = false;
818 ResidentListBanGroup.Enabled = false; 836 ResidentListBanGroup.Enabled = false;
-   837 ResidentListTeleportHomeGroup.Enabled = false;
819 EstateTerrainDownloadUploadGroup.Enabled = false; 838 EstateTerrainDownloadUploadGroup.Enabled = false;
-   839 EstateVariablesGroup.Enabled = false;
820 RegionToolsRegionDebugGroup.Enabled = false; 840 RegionToolsRegionDebugGroup.Enabled = false;
821 RegionToolsRegionInfoGroup.Enabled = false; 841 RegionToolsRegionInfoGroup.Enabled = false;
822 // Estate textures 842 // Estate textures
823 RegionTexturesLowUUIDApplyBox.Enabled = false; 843 RegionTexturesLowUUIDApplyBox.Enabled = false;
824 RegionTexturesLowUUIDApplyButton.Enabled = false; 844 RegionTexturesLowUUIDApplyButton.Enabled = false;
Line 860... Line 880...
860   880  
Line 861... Line 881...
861 overviewTabTimer.Stop(); 881 overviewTabTimer.Stop();
862   882  
-   883 try
-   884 {
-   885 // Start measuring the lag to Corrade.
863 try 886 Stopwatch stopWatch = new Stopwatch();
864 { 887 stopWatch.Start();
865 // Get the statistics. 888 // Get the statistics.
866 string result = wasPOST(vassalConfiguration.HTTPServerURL, 889 string result = wasPOST(vassalConfiguration.HTTPServerURL,
867 wasKeyValueEscape(new Dictionary<string, string> 890 wasKeyValueEscape(new Dictionary<string, string>
Line 878... Line 901...
878 "FPS", 901 "FPS",
879 "PhysicsFPS", 902 "PhysicsFPS",
880 "ActiveScripts", 903 "ActiveScripts",
881 "ScriptTime", 904 "ScriptTime",
882 "Objects", 905 "Objects",
-   906 "FrameTime",
-   907 "ScriptedObjects",
-   908 "PhysicsTime",
-   909 "NetTime",
883 "AvatarPositions" 910 "AvatarPositions"
884 }) 911 })
885 } 912 }
886 }), vassalConfiguration.DataTimeout); 913 }), vassalConfiguration.DataTimeout);
-   914 stopWatch.Stop();
Line 887... Line 915...
887   915  
888 bool success; 916 bool success;
889 if (string.IsNullOrEmpty(result) || 917 if (string.IsNullOrEmpty(result) ||
890 !bool.TryParse(wasInput(wasKeyValueGet("success", result)), out success)) 918 !bool.TryParse(wasInput(wasKeyValueGet("success", result)), out success))
Line 909... Line 937...
909 PhysicsFPS.Enabled = true; 937 PhysicsFPS.Enabled = true;
910 ActiveScripts.Text = data[data.IndexOf("ActiveScripts") + 1]; 938 ActiveScripts.Text = data[data.IndexOf("ActiveScripts") + 1];
911 ActiveScripts.Enabled = true; 939 ActiveScripts.Enabled = true;
912 ScriptTime.Text = data[data.IndexOf("ScriptTime") + 1]; 940 ScriptTime.Text = data[data.IndexOf("ScriptTime") + 1];
913 ScriptTime.Enabled = true; 941 ScriptTime.Enabled = true;
-   942 FrameTime.Text = data[data.IndexOf("FrameTime") + 1];
-   943 FrameTime.Enabled = true;
-   944 ScriptedObjects.Text = data[data.IndexOf("ScriptedObjects") + 1];
-   945 ScriptedObjects.Enabled = true;
-   946 PhysicsTime.Text = data[data.IndexOf("PhysicsTime") + 1];
-   947 PhysicsTime.Enabled = true;
-   948 NetTime.Text = data[data.IndexOf("NetTime") + 1];
-   949 NetTime.Enabled = true;
914 Objects.Text = data[data.IndexOf("Objects") + 1]; 950 Objects.Text = data[data.IndexOf("Objects") + 1];
915 Objects.Enabled = true; 951 Objects.Enabled = true;
-   952  
-   953 // Show the overview lag time.
-   954 CorradePollTimeDial.Value =
-   955 (float) Math.Min(TimeSpan.FromMilliseconds(stopWatch.ElapsedMilliseconds).TotalSeconds,
-   956 CorradePollTimeDial.MaxValue);
916 })); 957 }));
Line 917... Line 958...
917   958  
918 // Get avatar positions. 959 // Get avatar positions.
919 // Pattern: [...], X, 10, Y, 63, Z, 200, [...], X, 52, Y, 73, Z, 55, [...[...]] 960 // Pattern: [...], X, 10, Y, 63, Z, 200, [...], X, 52, Y, 73, Z, 55, [...[...]]
Line 2035... Line 2076...
2035 { 2076 {
2036 case true: 2077 case true:
2037 vassalForm.Invoke( 2078 vassalForm.Invoke(
2038 (MethodInvoker) 2079 (MethodInvoker)
2039 (() => { vassalForm.StatusText.Text = @"Teleport succeeded."; })); 2080 (() => { vassalForm.StatusText.Text = @"Teleport succeeded."; }));
2040 Thread.Sleep(TimeSpan.FromSeconds(1).Milliseconds); -  
2041 break; 2081 break;
2042 default: 2082 default:
2043 // In case the destination is to close (Corrade status code 37559), 2083 // In case the destination is to close (Corrade status code 37559),
2044 // then we are on the same region so no need to retry. 2084 // then we are on the same region so no need to retry.
2045 uint status; //37559 2085 uint status; //37559
Line 2052... Line 2092...
2052 break; 2092 break;
2053 default: 2093 default:
2054 vassalForm.Invoke( 2094 vassalForm.Invoke(
2055 (MethodInvoker) 2095 (MethodInvoker)
2056 (() => { vassalForm.StatusText.Text = @"Teleport failed."; })); 2096 (() => { vassalForm.StatusText.Text = @"Teleport failed."; }));
2057 Thread.Sleep(10000); -  
2058 break; 2097 break;
2059 } 2098 }
2060 break; 2099 break;
2061 } 2100 }
-   2101  
-   2102 // Pause for teleport (10 teleports / 15s allowed).
-   2103 Thread.Sleep(700);
2062 } while (!success && !(--teleportRetries).Equals(0)); 2104 } while (!success && !(--teleportRetries).Equals(0));
Line 2063... Line 2105...
2063   2105  
2064 if (!success) 2106 if (!success)
Line 2144... Line 2186...
2144 { 2186 {
2145 cell.ToolTipText = ex.Message; 2187 cell.ToolTipText = ex.Message;
2146 } 2188 }
2147 })); 2189 }));
2148 } 2190 }
-   2191 finally
-   2192 {
-   2193 // Pause for teleport (10 teleports / 15s allowed).
-   2194 Thread.Sleep(700);
-   2195 }
2149 } while (!restartRegionQueue.Count.Equals(0)); 2196 } while (!restartRegionQueue.Count.Equals(0));
2150 } 2197 }
2151 catch (Exception) 2198 catch (Exception)
2152 { 2199 {
2153 } 2200 }
Line 2194... Line 2241...
2194 private void RequestBanAgents(object sender, EventArgs e) 2241 private void RequestBanAgents(object sender, EventArgs e)
2195 { 2242 {
2196 // Block teleports and disable button. 2243 // Block teleports and disable button.
2197 vassalForm.Invoke((MethodInvoker) (() => 2244 vassalForm.Invoke((MethodInvoker) (() =>
2198 { 2245 {
-   2246 ResidentListTeleportHomeGroup.Enabled = false;
2199 ResidentListBanGroup.Enabled = false; 2247 ResidentListBanGroup.Enabled = false;
2200 RegionTeleportGroup.Enabled = false; 2248 RegionTeleportGroup.Enabled = false;
2201 })); 2249 }));
Line 2202... Line 2250...
2202   2250  
2203 // Enqueue all the regions to restart. 2251 // Enqueue all the agents to ban.
2204 Queue<UUID> agentsQueue = new Queue<UUID>(); 2252 Queue<UUID> agentsQueue = new Queue<UUID>();
2205 vassalForm.Invoke((MethodInvoker) (() => 2253 vassalForm.Invoke((MethodInvoker) (() =>
2206 { 2254 {
2207 foreach ( 2255 foreach (
Line 2254... Line 2302...
2254 { 2302 {
2255 bool alsoBan = false; 2303 bool alsoBan = false;
2256 vassalForm.Invoke( 2304 vassalForm.Invoke(
2257 (MethodInvoker) (() => { alsoBan = vassalForm.ResidentBanAllEstatesBox.Checked; })); 2305 (MethodInvoker) (() => { alsoBan = vassalForm.ResidentBanAllEstatesBox.Checked; }));
Line 2258... Line 2306...
2258   2306  
2259 // Teleport to the region. 2307 // Ban the resident.
2260 string result = wasPOST(vassalConfiguration.HTTPServerURL, 2308 string result = wasPOST(vassalConfiguration.HTTPServerURL,
2261 wasKeyValueEscape(new Dictionary<string, string> 2309 wasKeyValueEscape(new Dictionary<string, string>
2262 { 2310 {
2263 {"command", "setestatelist"}, 2311 {"command", "setestatelist"},
Line 2320... Line 2368...
2320 { 2368 {
2321 Monitor.Exit(ClientInstanceTeleportLock); 2369 Monitor.Exit(ClientInstanceTeleportLock);
2322 // Allow teleports and enable button. 2370 // Allow teleports and enable button.
2323 vassalForm.BeginInvoke((MethodInvoker) (() => 2371 vassalForm.BeginInvoke((MethodInvoker) (() =>
2324 { 2372 {
-   2373 ResidentListTeleportHomeGroup.Enabled = true;
2325 ResidentListBanGroup.Enabled = true; 2374 ResidentListBanGroup.Enabled = true;
2326 RegionTeleportGroup.Enabled = true; 2375 RegionTeleportGroup.Enabled = true;
2327 })); 2376 }));
2328 } 2377 }
2329 }) 2378 })
Line 3997... Line 4046...
3997 break; 4046 break;
3998 } 4047 }
3999 })); 4048 }));
4000 } 4049 }
Line -... Line 4050...
-   4050  
-   4051 private void RequestTeleportHome(object sender, EventArgs e)
-   4052 {
-   4053 // Block teleports and disable button.
-   4054 vassalForm.Invoke((MethodInvoker) (() =>
-   4055 {
-   4056 ResidentListTeleportHomeGroup.Enabled = false;
-   4057 ResidentListBanGroup.Enabled = false;
-   4058 RegionTeleportGroup.Enabled = false;
-   4059 }));
-   4060  
-   4061 // Enqueue all the agents to teleport home.
-   4062 Queue<UUID> agentsQueue = new Queue<UUID>();
-   4063 vassalForm.Invoke((MethodInvoker) (() =>
-   4064 {
-   4065 foreach (
-   4066 DataGridViewRow residentListRow in
-   4067 ResidentListGridView.Rows.AsParallel()
-   4068 .Cast<DataGridViewRow>()
-   4069 .Where(o => o.Selected || o.Cells.Cast<DataGridViewCell>().Any(p => p.Selected)))
-   4070 {
-   4071 UUID agentUUID;
-   4072 if (!UUID.TryParse(residentListRow.Cells["ResidentListUUID"].Value.ToString(), out agentUUID))
-   4073 continue;
-   4074 agentsQueue.Enqueue(agentUUID);
-   4075 }
-   4076 }));
-   4077  
-   4078 // If no rows were selected, enable teleports, the return button and return.
-   4079 if (agentsQueue.Count.Equals(0))
-   4080 {
-   4081 vassalForm.Invoke((MethodInvoker) (() =>
-   4082 {
-   4083 ResidentListBanGroup.Enabled = true;
-   4084 RegionTeleportGroup.Enabled = true;
-   4085 }));
-   4086 return;
-   4087 }
-   4088  
-   4089 new Thread(() =>
-   4090 {
-   4091 Monitor.Enter(ClientInstanceTeleportLock);
-   4092 try
-   4093 {
-   4094 do
-   4095 {
-   4096 // Dequeue the first object.
-   4097 UUID agentUUID = agentsQueue.Dequeue();
-   4098 DataGridViewRow currentDataGridViewRow = null;
-   4099 vassalForm.Invoke((MethodInvoker) (() =>
-   4100 {
-   4101 currentDataGridViewRow = vassalForm.ResidentListGridView.Rows.AsParallel()
-   4102 .Cast<DataGridViewRow>()
-   4103 .FirstOrDefault(
-   4104 o =>
-   4105 o.Cells["ResidentListUUID"].Value.ToString()
-   4106 .Equals(agentUUID.ToString(), StringComparison.OrdinalIgnoreCase));
-   4107 }));
-   4108  
-   4109 if (currentDataGridViewRow == null) continue;
-   4110  
-   4111 try
-   4112 {
-   4113 // Teleport the user home.
-   4114 string result = wasPOST(vassalConfiguration.HTTPServerURL,
-   4115 wasKeyValueEscape(new Dictionary<string, string>
-   4116 {
-   4117 {"command", "estateteleportusershome"},
-   4118 {"group", vassalConfiguration.Group},
-   4119 {"password", vassalConfiguration.Password},
-   4120 {"avatars", agentUUID.ToString()}
-   4121 }), vassalConfiguration.DataTimeout);
-   4122  
-   4123 if (string.IsNullOrEmpty(result))
-   4124 throw new Exception("Error communicating with Corrade.");
-   4125  
-   4126 bool success;
-   4127 if (!bool.TryParse(wasInput(wasKeyValueGet("success", result)), out success))
-   4128 throw new Exception("No success status could be retrieved.");
-   4129  
-   4130 switch (success)
-   4131 {
-   4132 case true:
-   4133 vassalForm.Invoke((MethodInvoker) (() =>
-   4134 {
-   4135 vassalForm.StatusText.Text = @"Resident teleported home.";
-   4136 currentDataGridViewRow.Selected = false;
-   4137 currentDataGridViewRow.DefaultCellStyle.BackColor = Color.LightGreen;
-   4138 foreach (
-   4139 DataGridViewCell cell in
-   4140 currentDataGridViewRow.Cells.AsParallel().Cast<DataGridViewCell>())
-   4141 {
-   4142 cell.ToolTipText = @"Resident teleported home.";
-   4143 }
-   4144 }));
-   4145 break;
-   4146 default:
-   4147 throw new Exception("Unable to teleport resident home.");
-   4148 }
-   4149 }
-   4150 catch (Exception ex)
-   4151 {
-   4152 vassalForm.Invoke((MethodInvoker) (() =>
-   4153 {
-   4154 vassalForm.StatusText.Text = ex.Message;
-   4155 currentDataGridViewRow.Selected = false;
-   4156 currentDataGridViewRow.DefaultCellStyle.BackColor = Color.LightPink;
-   4157 foreach (
-   4158 DataGridViewCell cell in
-   4159 currentDataGridViewRow.Cells.AsParallel().Cast<DataGridViewCell>())
-   4160 {
-   4161 cell.ToolTipText = ex.Message;
-   4162 }
-   4163 }));
-   4164 }
-   4165 } while (agentsQueue.Count.Equals(0));
-   4166 }
-   4167 catch (Exception)
-   4168 {
-   4169 }
-   4170 finally
-   4171 {
-   4172 Monitor.Exit(ClientInstanceTeleportLock);
-   4173 // Allow teleports and enable button.
-   4174 vassalForm.BeginInvoke((MethodInvoker) (() =>
-   4175 {
-   4176 ResidentListTeleportHomeGroup.Enabled = true;
-   4177 ResidentListBanGroup.Enabled = true;
-   4178 RegionTeleportGroup.Enabled = true;
-   4179 }));
-   4180 }
-   4181 })
-   4182 {IsBackground = true}.Start();
-   4183 }
-   4184  
-   4185 private void RequestSetVariables(object sender, EventArgs e)
-   4186 {
-   4187 // Block teleports and disable button.
-   4188 vassalForm.Invoke((MethodInvoker) (() =>
-   4189 {
-   4190 RegionTeleportGroup.Enabled = false;
-   4191 SetTerrainVariablesButton.Enabled = false;
-   4192 }));
-   4193  
-   4194 new Thread(() =>
-   4195 {
-   4196 try
-   4197 {
-   4198 Monitor.Enter(ClientInstanceTeleportLock);
-   4199  
-   4200 int waterHeight = 10;
-   4201 int terrainRaiseLimit = 100;
-   4202 int terrainLowerLimit = -100;
-   4203 bool useEstateSun = true;
-   4204 bool fixedSun = false;
-   4205 int sunPosition = 18;
-   4206  
-   4207 bool run = false;
-   4208  
-   4209 vassalForm.Invoke((MethodInvoker) (() =>
-   4210 {
-   4211 useEstateSun = TerrainToolsUseEstateSunBox.Checked;
-   4212 fixedSun = TerrainToolsFixedSunBox.Checked;
-   4213 switch (!int.TryParse(TerrainToolsWaterHeightBox.Text, out waterHeight))
-   4214 {
-   4215 case true:
-   4216 TerrainToolsWaterHeightBox.BackColor = Color.MistyRose;
-   4217 return;
-   4218 default:
-   4219 TerrainToolsWaterHeightBox.BackColor = Color.Empty;
-   4220 break;
-   4221 }
-   4222 switch (!int.TryParse(TerrainToolsTerrainRaiseLimitBox.Text, out terrainRaiseLimit))
-   4223 {
-   4224 case true:
-   4225 TerrainToolsTerrainRaiseLimitBox.BackColor = Color.MistyRose;
-   4226 return;
-   4227 default:
-   4228 TerrainToolsTerrainRaiseLimitBox.BackColor = Color.Empty;
-   4229 break;
-   4230 }
-   4231 switch (!int.TryParse(TerrainToolsTerrainLowerLimitBox.Text, out terrainLowerLimit))
-   4232 {
-   4233 case true:
-   4234 TerrainToolsTerrainLowerLimitBox.BackColor = Color.MistyRose;
-   4235 return;
-   4236 default:
-   4237 TerrainToolsTerrainLowerLimitBox.BackColor = Color.Empty;
-   4238 break;
-   4239 }
-   4240 switch (!int.TryParse(TerrainToolsSunPositionBox.Text, out sunPosition))
-   4241 {
-   4242 case true:
-   4243 TerrainToolsSunPositionBox.BackColor = Color.MistyRose;
-   4244 return;
-   4245 default:
-   4246 TerrainToolsSunPositionBox.BackColor = Color.Empty;
-   4247 break;
-   4248 }
-   4249  
-   4250 run = true;
-   4251 }));
-   4252  
-   4253 if (!run) return;
-   4254  
-   4255 // Set the terrain variables.
-   4256 string result = wasPOST(vassalConfiguration.HTTPServerURL,
-   4257 wasKeyValueEscape(new Dictionary<string, string>
-   4258 {
-   4259 {"command", "setregionterrainvariables"},
-   4260 {"group", vassalConfiguration.Group},
-   4261 {"password", vassalConfiguration.Password},
-   4262 {"waterheight", waterHeight.ToString()},
-   4263 {"terrainraiselimit", terrainRaiseLimit.ToString()},
-   4264 {"terrainlowerlimit", terrainLowerLimit.ToString()},
-   4265 {"useestatesun", useEstateSun.ToString()},
-   4266 {"fixedsun", fixedSun.ToString()},
-   4267 {"sunposition", sunPosition.ToString()}
-   4268 }), vassalConfiguration.DataTimeout);
-   4269  
-   4270 if (string.IsNullOrEmpty(result))
-   4271 throw new Exception("Error communicating with Corrade");
-   4272  
-   4273 bool success;
-   4274 if (!bool.TryParse(wasInput(wasKeyValueGet("success", result)), out success))
-   4275 throw new Exception("No success status could be retrieved");
-   4276  
-   4277 if (!success)
-   4278 throw new Exception("Unable to set region variables");
-   4279 }
-   4280 catch (Exception ex)
-   4281 {
-   4282 vassalForm.Invoke((MethodInvoker) (() => { StatusText.Text = ex.Message; }));
-   4283 }
-   4284 finally
-   4285 {
-   4286 Monitor.Exit(ClientInstanceTeleportLock);
-   4287 }
-   4288  
-   4289 // Block teleports and disable button.
-   4290 vassalForm.Invoke((MethodInvoker) (() =>
-   4291 {
-   4292 RegionTeleportGroup.Enabled = true;
-   4293 SetTerrainVariablesButton.Enabled = true;
-   4294 }));
-   4295 })
-   4296 {IsBackground = true}.Start();
-   4297 }
-   4298  
-   4299 private void ReconnectRequested(object sender, EventArgs e)
-   4300 {
-   4301 // Spawn a thread to check Corrade's connection status.
-   4302 new Thread(() =>
-   4303 {
-   4304 TcpClient tcpClient = new TcpClient();
-   4305 try
-   4306 {
-   4307 Uri uri = new Uri(vassalConfiguration.HTTPServerURL);
-   4308 tcpClient.Connect(uri.Host, uri.Port);
-   4309 // port open
-   4310 vassalForm.BeginInvoke((MethodInvoker) (() => { vassalForm.Tabs.Enabled = true; }));
-   4311 // set the loading spinner
-   4312 if (vassalForm.RegionAvatarsMap.Image == null)
-   4313 {
-   4314 Assembly thisAssembly = Assembly.GetExecutingAssembly();
-   4315 Stream file =
-   4316 thisAssembly.GetManifestResourceStream("Vassal.img.loading.gif");
-   4317 switch (file != null)
-   4318 {
-   4319 case true:
-   4320 vassalForm.BeginInvoke((MethodInvoker) (() =>
-   4321 {
-   4322 vassalForm.RegionAvatarsMap.SizeMode = PictureBoxSizeMode.CenterImage;
-   4323 vassalForm.RegionAvatarsMap.Image = Image.FromStream(file);
-   4324 vassalForm.RegionAvatarsMap.Refresh();
-   4325 }));
-   4326 break;
-   4327 }
-   4328 }
-   4329 }
-   4330 catch (Exception)
-   4331 {
-   4332 // port closed
-   4333 vassalForm.BeginInvoke((MethodInvoker) (() => { vassalForm.Tabs.Enabled = false; }));
-   4334 }
-   4335 })
-   4336 {IsBackground = true}.Start();
-   4337 }
4001   4338  
4002 /// <summary> 4339 /// <summary>
4003 /// Linden constants. 4340 /// Linden constants.
4004 /// </summary> 4341 /// </summary>
4005 public struct LINDEN_CONSTANTS 4342 public struct LINDEN_CONSTANTS