本文整理汇总了C#中RegionInfo类的典型用法代码示例。如果您正苦于以下问题:C# RegionInfo类的具体用法?C# RegionInfo怎么用?C# RegionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegionInfo类属于命名空间,在下文中一共展示了RegionInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:25,代码来源:OpenSimMap.cs
示例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();
}
开发者ID:rajgit31,项目名称:RajBlog,代码行数:36,代码来源:Profiles.aspx.cs
示例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();
}
开发者ID:kow,项目名称:Aurora-Sim,代码行数:25,代码来源:LocalRegionInfoConnector.cs
示例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;
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:26,代码来源:regioninfogethashcode.cs
示例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();
}
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:60,代码来源:RegionManager.cs
示例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());
}
}
开发者ID:shangcheng,项目名称:Aurora,代码行数:60,代码来源:LocalRegionInfoConnector.cs
示例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;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:26,代码来源:regioninfoismetric.cs
示例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;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:26,代码来源:regioninfotostring.cs
示例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;
}
开发者ID:rdterner,项目名称:coreclr,代码行数:26,代码来源:regioninfocurrencysymbol.cs
示例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;
}
开发者ID:ViniciusConsultor,项目名称:noname-netshop,代码行数:26,代码来源:RegionSelect.ascx.cs
示例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;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:26,代码来源:regioninfotwoletterisoregionname.cs
示例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()));
}
}
开发者ID:kkurni,项目名称:corefx,代码行数:9,代码来源:RegionInfoTests.Methods.cs
示例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);
}
开发者ID:Corillian,项目名称:corefx,代码行数:10,代码来源:RegionInfoTests.netstandard1.7.cs
示例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());
}
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:10,代码来源:LocalRegionInfoConnector.cs
示例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);
}
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:13,代码来源:HGCommands.cs
示例16: LoadRegions
public RegionInfo[] LoadRegions()
{
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
try
{
IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
}
catch (Exception)
{
// No INI setting recorded.
}
if (!Directory.Exists(regionConfigPath))
{
Directory.CreateDirectory(regionConfigPath);
}
string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
if (configFiles.Length == 0 && iniFiles.Length == 0)
{
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
}
List<RegionInfo> regionInfos = new List<RegionInfo>();
int i = 0;
foreach (string file in iniFiles)
{
IConfigSource source = new IniConfigSource(file);
foreach (IConfig config in source.Configs)
{
//m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name);
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
regionInfos.Add(regionInfo);
i++;
}
}
foreach (string file in configFiles)
{
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
regionInfos.Add(regionInfo);
i++;
}
return regionInfos.ToArray();
}
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:53,代码来源:RegionLoaderFileSystem.cs
示例17: LoadRegions
public RegionInfo[] LoadRegions()
{
if (m_configSource == null)
{
m_log.Error("[WEBLOADER]: Unable to load configuration source!");
return null;
}
else
{
IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
if (url == String.Empty)
{
m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty.");
return null;
}
else
{
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
webRequest.Timeout = 45000; //30 Second Timeout
m_log.Debug("[WEBLOADER]: Sending Download Request...");
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
string xmlSource = String.Empty;
string tempStr = reader.ReadLine();
while (tempStr != null)
{
xmlSource = xmlSource + tempStr;
tempStr = reader.ReadLine();
}
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
xmlSource.Length);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlSource);
if (xmlDoc.FirstChild.Name == "Regions")
{
RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count];
int i;
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
{
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
regionInfos[i] =
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
}
return regionInfos;
}
return null;
}
}
}
开发者ID:BogusCurry,项目名称:halcyon,代码行数:52,代码来源:RegionLoaderWebServer.cs
示例18: CurrentRegion
public void CurrentRegion()
{
CultureInfo oldThreadCulture = CultureInfo.CurrentCulture;
try
{
CultureInfo.CurrentCulture = new CultureInfo("en-US");
RegionInfo ri = new RegionInfo(new RegionInfo(CultureInfo.CurrentCulture.Name).TwoLetterISORegionName);
Assert.True(RegionInfo.CurrentRegion.Equals(ri) || RegionInfo.CurrentRegion.Equals(new RegionInfo(CultureInfo.CurrentCulture.Name)));
Assert.Same(RegionInfo.CurrentRegion, RegionInfo.CurrentRegion);
}
finally
{
CultureInfo.CurrentCulture = oldThreadCulture;
}
}
开发者ID:swaroop-sridhar,项目名称:corefx,代码行数:17,代码来源:RegionInfoTests.Properties.cs
示例19: Start
public void Start(IScene scene)
{
m_scene = scene;
m_regionInfo = m_scene.GetSceneModule<RegionInfo>();
m_permissions = m_scene.GetSceneModule<LLPermissions>();
m_udp = m_scene.GetSceneModule<LLUDP>();
if (m_udp != null)
{
m_udp.AddPacketHandler(PacketType.UseCircuitCode, UseCircuitCodeHandler);
m_udp.AddPacketHandler(PacketType.CompleteAgentMovement, CompleteAgentMovementHandler);
m_udp.AddPacketHandler(PacketType.LogoutRequest, LogoutRequestHandler);
m_udp.AddPacketHandler(PacketType.AgentThrottle, AgentThrottleHandler);
m_udp.AddPacketHandler(PacketType.RegionHandshakeReply, RegionHandshakeReplyHandler);
}
}
开发者ID:osgrid,项目名称:openmetaverse,代码行数:17,代码来源:Connections.cs
示例20: SetupScene
/// <summary>
/// Create a scene and its initial base structures.
/// </summary>
/// <param name="regionInfo"></param>
/// <param name="configSource"></param>
/// <returns></returns>
protected IScene SetupScene(RegionInfo regionInfo, IConfigSource configSource)
{
AgentCircuitManager circuitManager = new AgentCircuitManager();
List<IClientNetworkServer> clientServers = AuroraModuleLoader.PickupModules<IClientNetworkServer>();
List<IClientNetworkServer> allClientServers = new List<IClientNetworkServer>();
foreach (IClientNetworkServer clientServer in clientServers)
{
clientServer.Initialise(MainServer.Instance.Port, m_configSource, circuitManager);
allClientServers.Add(clientServer);
}
AsyncScene scene = new AsyncScene();
scene.AddModuleInterfaces(m_openSimBase.ApplicationRegistry.GetInterfaces());
scene.Initialize(regionInfo, circuitManager, allClientServers);
return scene;
}
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:23,代码来源:AsyncSceneLoader.cs
注:本文中的RegionInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论