本文整理汇总了C#中RegionInfo类的典型用法代码示例。如果您正苦于以下问题:C# RegionInfo类的具体用法?C# RegionInfo怎么用?C# RegionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegionInfo类属于命名空间,在下文中一共展示了RegionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryFetchRegion
public BackendResponse TryFetchRegion(UUID id, out RegionInfo region)
{
List<RegionInfo> regions;
BackendResponse response = TryFetchRegionsFromGridService(out regions);
if (response == BackendResponse.Success)
{
for (int i = 0; i < regions.Count; i++)
{
if (regions[i].ID == id)
{
region = regions[i];
return BackendResponse.Success;
}
}
}
else
{
region = default(RegionInfo);
return response;
}
region = default(RegionInfo);
return response;
}
示例2: BindCountries
/// <summary>
/// Binds the country dropdown list with countries retrieved
/// from the .NET Framework.
/// </summary>
public void BindCountries()
{
StringDictionary dic = new StringDictionary();
List<string> col = new List<string>();
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
RegionInfo ri = new RegionInfo(ci.Name);
if (!dic.ContainsKey(ri.EnglishName))
dic.Add(ri.EnglishName, ri.TwoLetterISORegionName.ToLowerInvariant());
if (!col.Contains(ri.EnglishName))
col.Add(ri.EnglishName);
}
// Add custom cultures
if (!dic.ContainsValue("bd"))
{
dic.Add("Bangladesh", "bd");
col.Add("Bangladesh");
}
col.Sort();
ddlCountry.Items.Add(new ListItem("[Not specified]", ""));
foreach (string key in col)
{
ddlCountry.Items.Add(new ListItem(key, dic[key]));
}
SetDefaultCountry();
}
示例3: GetRegionInfos
public RegionInfo[] GetRegionInfos(bool nonDisabledOnly)
{
List<RegionInfo> Infos = new List<RegionInfo>();
List<string> RetVal = nonDisabledOnly ?
GD.Query("Disabled", 0, "simulator", "RegionInfo") :
GD.Query("", "", "simulator", "RegionInfo");
if (RetVal.Count == 0)
return Infos.ToArray();
RegionInfo replyData = new RegionInfo();
for (int i = 0; i < RetVal.Count; i++)
{
replyData.UnpackRegionInfoData((OSDMap)OSDParser.DeserializeJson(RetVal[i]));
if (replyData.ExternalHostName == "DEFAULT" || replyData.FindExternalAutomatically)
{
replyData.ExternalHostName = Aurora.Framework.Utilities.GetExternalIp();
}
else
replyData.ExternalHostName = Util.ResolveEndPoint(replyData.ExternalHostName, replyData.InternalEndPoint.Port).Address.ToString();
Infos.Add(replyData);
replyData = new RegionInfo();
}
//Sort by startup number
Infos.Sort(RegionInfoStartupSorter);
return Infos.ToArray();
}
示例4: PosTest1
public bool PosTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest1:Get the hash code of the RegionInfo object 1");
try
{
RegionInfo regionInfo = new RegionInfo("zh-CN");
int hashCode = regionInfo.GetHashCode();
if (hashCode != regionInfo.Name.GetHashCode())
{
TestLibrary.TestFramework.LogError("001", "the ExpectResult is" + regionInfo.Name.GetHashCode() +"but the ActualResult is " + hashCode);
retVal = false;
}
}
catch (ArgumentException)
{
TestLibrary.TestFramework.LogInformation("The East Asian Languages are not installed. Skipping test(s)");
retVal = true;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例5: CreateNewRegion
private void CreateNewRegion(object sender, EventArgs e)
{
if (RName.Text == "")
{
MessageBox.Show("You must enter a region name!");
return;
}
RegionInfo region = new RegionInfo();
region.RegionName = RName.Text;
region.RegionID = UUID.Random();
region.RegionLocX = int.Parse(LocX.Text) * Constants.RegionSize;
region.RegionLocY = int.Parse(LocY.Text) * Constants.RegionSize;
IPAddress address = IPAddress.Parse("0.0.0.0");
int port = port = Convert.ToInt32(Port.Text);
region.InternalEndPoint = new IPEndPoint(address, port);
string externalName = ExternalIP.Text;
if (externalName == "DEFAULT")
{
externalName = Aurora.Framework.Utilities.GetExternalIp();
region.FindExternalAutomatically = true;
}
else
region.FindExternalAutomatically = false;
region.ExternalHostName = externalName;
region.RegionType = Type.Text;
region.ObjectCapacity = int.Parse(ObjectCount.Text);
int maturityLevel = 0;
if (!int.TryParse(Maturity.Text, out maturityLevel))
{
if (Maturity.Text == "Adult")
maturityLevel = 2;
else if (Maturity.Text == "Mature")
maturityLevel = 1;
else //Leave it as PG by default if they do not select a valid option
maturityLevel = 0;
}
region.RegionSettings.Maturity = maturityLevel;
region.Disabled = DisabledEdit.Checked;
region.RegionSizeX = int.Parse(CRegionSizeX.Text);
region.RegionSizeY = int.Parse(CRegionSizeY.Text);
region.NumberStartup = int.Parse(CStartNum.Text);
m_connector.UpdateRegionInfo(region);
if (KillAfterRegionCreation)
{
System.Windows.Forms.Application.Exit();
return;
}
else
{
IScene scene;
m_log.Info("[LOADREGIONS]: Creating Region: " + region.RegionName + ")");
SceneManager manager = m_OpenSimBase.ApplicationRegistry.RequestModuleInterface<SceneManager>();
manager.CreateRegion(region, out scene);
}
RefreshCurrentRegions();
}
示例6: UpdateRegionInfo
public void UpdateRegionInfo(RegionInfo region, bool Disable)
{
List<object> Values = new List<object>();
if (GetRegionInfo(region.RegionID) != null)
{
Values.Add(region.RegionName);
Values.Add(region.RegionLocX);
Values.Add(region.RegionLocY);
Values.Add(region.InternalEndPoint.Address);
Values.Add(region.InternalEndPoint.Port);
if (region.FindExternalAutomatically)
{
Values.Add("DEFAULT");
}
else
{
Values.Add(region.ExternalHostName);
}
Values.Add(region.RegionType);
Values.Add(region.ObjectCapacity);
Values.Add(region.AccessLevel);
Values.Add(Disable ? 1 : 0);
Values.Add(region.AllowScriptCrossing ? 1 : 0);
Values.Add(region.TrustBinariesFromForeignSims ? 1 : 0);
Values.Add(region.SeeIntoThisSimFromNeighbor ? 1 : 0);
Values.Add(region.AllowPhysicalPrims ? 1 : 0);
GD.Update("simulator", Values.ToArray(), new string[]{"RegionName","RegionLocX",
"RegionLocY","InternalIP","Port","ExternalIP","RegionType","MaxPrims","AccessLevel","Disabled"},
new string[] { "RegionID" }, new object[] { region.RegionID });
}
else
{
Values.Add(region.RegionID);
Values.Add(region.RegionName);
Values.Add(region.RegionLocX);
Values.Add(region.RegionLocY);
Values.Add(region.InternalEndPoint.Address);
Values.Add(region.InternalEndPoint.Port);
if (region.FindExternalAutomatically)
{
Values.Add("DEFAULT");
}
else
{
Values.Add(region.ExternalHostName);
}
Values.Add(region.RegionType);
Values.Add(region.ObjectCapacity);
Values.Add(0);
Values.Add(0);
Values.Add(0);
Values.Add(region.AccessLevel);
Values.Add(Disable ? 1 : 0);
Values.Add(region.AllowScriptCrossing ? 1 : 0);
Values.Add(region.TrustBinariesFromForeignSims ? 1 : 0);
Values.Add(region.SeeIntoThisSimFromNeighbor ? 1 : 0);
Values.Add(region.AllowPhysicalPrims ? 1 : 0);
GD.Insert("simulator", Values.ToArray());
}
}
示例7: PosTest2
public bool PosTest2()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest2:Return the property IsMetric in RegionInfo object 2");
try
{
RegionInfo regionInfo = new RegionInfo("zh-CN");
bool boolVal = regionInfo.IsMetric;
if (!boolVal)
{
TestLibrary.TestFramework.LogError("003", "the ExpectResult is false but the ActualResult is " + boolVal.ToString());
retVal = false;
}
}
catch (ArgumentException)
{
TestLibrary.TestFramework.LogInformation("The East Asian Languages are not installed. Skipping test(s)");
retVal = true;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例8: PosTest1
public bool PosTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest1:Invoke the method ToString in RegionInfo object 1");
try
{
RegionInfo regionInfo = new RegionInfo("zh-CN");
string strVal = regionInfo.ToString();
if (strVal != regionInfo.Name)
{
TestLibrary.TestFramework.LogError("001", "the ExpectResult is" + regionInfo.Name + "but the ActualResult is" + strVal);
retVal = false;
}
}
catch (ArgumentException)
{
TestLibrary.TestFramework.LogInformation("The East Asian Languages are not installed. Skipping test(s)");
retVal = true;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例9: PosTest2
public bool PosTest2()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest2:Return the CurrencySymbol property in RegionInfo object 2");
try
{
RegionInfo regionInfo = new RegionInfo("zh-CN");
string strCurrencySymbol = regionInfo.CurrencySymbol;
if (strCurrencySymbol != (TestLibrary.Utilities.IsVistaOrLater ? "\u00A5" : "\uFFE5"))
{
TestLibrary.TestFramework.LogError("003", "the ExpectResult is "+ (TestLibrary.Utilities.IsVista ? "\u00A5" : "\uFFE5") + " but the ActualResult is " + strCurrencySymbol);
retVal = false;
}
}
catch (ArgumentException)
{
TestLibrary.TestFramework.LogInformation("The East Asian Languages are not installed. Skipping test(s)");
retVal = true;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例10: GetSelectedRegionInfo
public RegionInfo GetSelectedRegionInfo()
{
string regionPath = String.Empty;
string country = Request.Form["country"];
string province = Request.Form["province"];
string city = Request.Form["city"];
string county = Request.Form["county"];
int curRegionId=0;
if (curRegionId==0 && !String.IsNullOrEmpty(county))
int.TryParse(county,out curRegionId);
if (curRegionId == 0 && !String.IsNullOrEmpty(city))
int.TryParse(city, out curRegionId);
if (curRegionId == 0 && !String.IsNullOrEmpty(province))
int.TryParse(province, out curRegionId);
if (curRegionId == 0 && !String.IsNullOrEmpty(country))
int.TryParse(country, out curRegionId);
RegionInfo result = null;
if (curRegionId >0)
{
result = new RegionInfo(curRegionId);
}
return result;
}
示例11: PosTest2
public bool PosTest2()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest2:Return the property TwoLetterISORegionName in RegionInfo object 2");
try
{
RegionInfo regionInfo = new RegionInfo("zh-CN");
string strTwoLetterName = regionInfo.TwoLetterISORegionName;
if (strTwoLetterName != "CN")
{
TestLibrary.TestFramework.LogError("003", "the ExpectResult is CN but the ActualResult is " + strTwoLetterName);
retVal = false;
}
}
catch (ArgumentException)
{
TestLibrary.TestFramework.LogInformation("The East Asian Languages are not installed. Skipping test(s)");
retVal = true;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
retVal = false;
}
return retVal;
}
示例12: Equals
public void Equals(RegionInfo regionInfo1, object obj, bool expected)
{
Assert.Equal(expected, regionInfo1.Equals(obj));
Assert.Equal(regionInfo1.GetHashCode(), regionInfo1.GetHashCode());
if (obj is RegionInfo)
{
Assert.Equal(expected, regionInfo1.GetHashCode().Equals(obj.GetHashCode()));
}
}
示例13: MiscTest
public void MiscTest(int lcid, int geoId, string currencyEnglishName, string alternativeCurrencyEnglishName, string currencyNativeName, string threeLetterISORegionName, string threeLetterWindowsRegionName)
{
RegionInfo ri = new RegionInfo(lcid); // create it with lcid
Assert.Equal(geoId, ri.GeoId);
Assert.True(currencyEnglishName.Equals(ri.CurrencyEnglishName) ||
alternativeCurrencyEnglishName.Equals(ri.CurrencyEnglishName), "Wrong currency English Name");
Assert.Equal(currencyNativeName, ri.CurrencyNativeName);
Assert.Equal(threeLetterISORegionName, ri.ThreeLetterISORegionName);
Assert.Equal(threeLetterWindowsRegionName, ri.ThreeLetterWindowsRegionName);
}
示例14: UpdateRegionInfo
public void UpdateRegionInfo(RegionInfo region)
{
List<object> Values = new List<object>();
Values.Add(region.RegionID);
Values.Add(region.RegionName);
Values.Add(OSDParser.SerializeJsonString(region.PackRegionInfoData(true)));
Values.Add(region.Disabled ? 1 : 0);
GD.Replace("simulator", new string[]{"RegionID","RegionName",
"RegionInfo","Disabled"}, Values.ToArray());
}
示例15: CreateScene
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
{
HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager);
return
new HGScene(
regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager,
m_moduleLoader, false, m_configSettings.PhysicalPrim,
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
}