Using ToLowerInvariant instead of ToLower (the game works for Turkish players now!)

http://www.moserware.com/2008/02/does-your-code-pass-turkey-test.html
This commit is contained in:
Regalis
2016-04-27 17:14:09 +03:00
parent 81ca1a409b
commit d3ab7946a8
52 changed files with 96 additions and 94 deletions

View File

@@ -39,7 +39,7 @@ namespace Barotrauma
if (GameMain.GameSession!=null && GameMain.GameSession.CrewManager!=null)
{
CurrentOrder = Order.PrefabList.Find(o => o.Name.ToLower() == "dismissed");
CurrentOrder = Order.PrefabList.Find(o => o.Name.ToLowerInvariant() == "dismissed");
objectiveManager.SetOrder(CurrentOrder, "");
GameMain.GameSession.CrewManager.SetCharacterOrder(Character, CurrentOrder);
}

View File

@@ -71,7 +71,7 @@ namespace Barotrauma
currentObjective = null;
switch (order.Name.ToLower())
switch (order.Name.ToLowerInvariant())
{
case "follow":
currentObjective = new AIObjectiveGoTo(Character.Controlled, character, true);

View File

@@ -39,7 +39,7 @@ namespace Barotrauma
foreach (XElement orderElement in doc.Root.Elements())
{
if (orderElement.Name.ToString().ToLower() != "order") continue;
if (orderElement.Name.ToString().ToLowerInvariant() != "order") continue;
PrefabList.Add(new Order(orderElement));
}
@@ -100,7 +100,7 @@ namespace Barotrauma
foreach (XElement subElement in orderElement.Elements())
{
if (subElement.Name.ToString().ToLower() != "sprite") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
SymbolSprite = new Sprite(subElement);
break;
}

View File

@@ -121,7 +121,8 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() == "particleemitter") particleEmitterPrefab = new ParticleEmitterPrefab(subElement);
if (subElement.Name.ToString().ToLowerInvariant() != "particleemitter") continue;
particleEmitterPrefab = new ParticleEmitterPrefab(subElement);
}
}

View File

@@ -36,7 +36,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "sprite") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
Sprite = new Sprite(subElement);
break;

View File

@@ -37,7 +37,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "sprite") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
Sprite = new Sprite(subElement);
break;

View File

@@ -163,7 +163,7 @@ namespace Barotrauma
XElement ragdollElement = doc.Root.Element("ragdoll");
foreach (XElement limbElement in ragdollElement.Elements())
{
if (ToolBox.GetAttributeString(limbElement, "type", "").ToLower() != "head") continue;
if (ToolBox.GetAttributeString(limbElement, "type", "").ToLowerInvariant() != "head") continue;
XElement spriteElement = limbElement.Element("sprite");
@@ -255,7 +255,7 @@ namespace Barotrauma
{
Name = ToolBox.GetAttributeString(element, "name", "unnamed");
string genderStr = ToolBox.GetAttributeString(element, "gender", "male").ToLower();
string genderStr = ToolBox.GetAttributeString(element, "gender", "male").ToLowerInvariant();
gender = (genderStr == "m") ? Gender.Male : Gender.Female;
File = ToolBox.GetAttributeString(element, "file", "");
@@ -277,7 +277,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "job") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "job") continue;
Job = new Job(subElement);
break;

View File

@@ -54,13 +54,13 @@ namespace Barotrauma
public Job(XElement element)
{
string name = ToolBox.GetAttributeString(element, "name", "").ToLower();
prefab = JobPrefab.List.Find(jp => jp.Name.ToLower() == name);
string name = ToolBox.GetAttributeString(element, "name", "").ToLowerInvariant();
prefab = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == name);
skills = new Dictionary<string, Skill>();
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "skill") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "skill") continue;
string skillName = ToolBox.GetAttributeString(subElement, "name", "");
if (string.IsNullOrEmpty(name)) continue;
skills.Add(
@@ -86,6 +86,8 @@ namespace Barotrauma
public void GiveJobItems(Character character, WayPoint spawnPoint)
{
if (SpawnItems == null) return;
foreach (XElement itemElement in SpawnItems.Elements())
{
InitializeJobItem(character, spawnPoint, itemElement);

View File

@@ -77,7 +77,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "items":
Items = subElement;

View File

@@ -265,7 +265,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "sprite":
string spritePath = subElement.Attribute("texture").Value;

View File

@@ -137,14 +137,14 @@ namespace Barotrauma
int n = 0;
foreach (XAttribute attribute in propertyAttributes)
{
propertyNames[n] = attribute.Name.ToString().ToLower();
propertyNames[n] = attribute.Name.ToString().ToLowerInvariant();
propertyEffects[n] = ToolBox.GetAttributeObject(attribute);
n++;
}
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "explosion":
explosion = new Explosion(subElement);

View File

@@ -146,7 +146,7 @@ namespace Barotrauma
if (command == "") return;
string[] commands = command.Split(' ');
switch (commands[0].ToLower())
switch (commands[0].ToLowerInvariant())
{
case "help":
NewMessage("menu: go to main menu", Color.Cyan);
@@ -203,7 +203,7 @@ namespace Barotrauma
if (commands.Length > 2)
{
switch (commands[2].ToLower())
switch (commands[2].ToLowerInvariant())
{
case "inside":
spawnPoint = WayPoint.GetRandom(SpawnType.Human);
@@ -233,19 +233,19 @@ namespace Barotrauma
}
break;
default:
spawnPoint = WayPoint.GetRandom(commands[1].ToLower()=="human" ? SpawnType.Human : SpawnType.Enemy);
spawnPoint = WayPoint.GetRandom(commands[1].ToLowerInvariant()=="human" ? SpawnType.Human : SpawnType.Enemy);
break;
}
}
else
{
spawnPoint = WayPoint.GetRandom(commands[1].ToLower() == "human" ? SpawnType.Human : SpawnType.Enemy);
spawnPoint = WayPoint.GetRandom(commands[1].ToLowerInvariant() == "human" ? SpawnType.Human : SpawnType.Enemy);
}
spawnPosition = spawnPoint == null ? Vector2.Zero : spawnPoint.WorldPosition;
if (commands[1].ToLower()=="human")
if (commands[1].ToLowerInvariant()=="human")
{
spawnedCharacter = Character.Create(Character.HumanConfigFile, spawnPosition);
Character.Controlled = spawnedCharacter;
@@ -315,8 +315,8 @@ namespace Barotrauma
case "controlcharacter":
case "control":
if (commands.Length < 2) break;
commands[1] = commands[1].ToLower();
Character.Controlled = Character.CharacterList.Find(c => !c.IsNetworkPlayer && c.Name.ToLower() == commands[1]);
commands[1] = commands[1].ToLowerInvariant();
Character.Controlled = Character.CharacterList.Find(c => !c.IsNetworkPlayer && c.Name.ToLowerInvariant() == commands[1]);
break;
case "godmode":
Submarine.Loaded.GodMode = !Submarine.Loaded.GodMode;

View File

@@ -9,7 +9,7 @@ namespace Barotrauma
{
class Mission
{
private static List<Mission> list = new List<Mission>();
//private static List<Mission> list = new List<Mission>();
private string name;
@@ -86,7 +86,7 @@ namespace Barotrauma
headers = new List<string>();
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "message") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "message") continue;
headers.Add(ToolBox.GetAttributeString(subElement, "header", ""));
messages.Add(ToolBox.GetAttributeString(subElement, "text", ""));
}

View File

@@ -73,7 +73,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "sprite":
Sprite sprite = new Sprite(subElement);

View File

@@ -24,14 +24,14 @@ namespace Barotrauma
foreach (XElement subElement in doc.Root.Elements())
{
GUIComponentStyle componentStyle = new GUIComponentStyle(subElement);
componentStyles.Add(subElement.Name.ToString().ToLower(), componentStyle);
componentStyles.Add(subElement.Name.ToString().ToLowerInvariant(), componentStyle);
}
}
public void Apply(GUIComponent targetComponent, GUIComponent parent = null)
{
GUIComponentStyle componentStyle = null;
string name = (parent==null) ? targetComponent.GetType().Name.ToLower() : parent.GetType().Name.ToLower();
string name = (parent == null) ? targetComponent.GetType().Name.ToLowerInvariant() : parent.GetType().Name.ToLowerInvariant();
componentStyles.TryGetValue(name, out componentStyle);
if (componentStyle==null)

View File

@@ -57,7 +57,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower()!="character") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "character") continue;
characterInfos.Add(new CharacterInfo(subElement));
}

View File

@@ -89,7 +89,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "crew") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "crew") continue;
GameMain.GameSession.CrewManager = new CrewManager(subElement);
}

View File

@@ -36,7 +36,7 @@ namespace Barotrauma.Tutorials
public virtual void Initialize()
{
GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameModePreset.list.Find(gm => gm.Name.ToLower() == "tutorial"));
GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameModePreset.list.Find(gm => gm.Name.ToLowerInvariant() == "tutorial"));
(GameMain.GameSession.gameMode as TutorialMode).tutorialType = this;
GameMain.GameSession.StartShift("tuto1");
@@ -58,7 +58,7 @@ namespace Barotrauma.Tutorials
CharacterInfo charInfo = new CharacterInfo(Character.HumanConfigFile, "", Gender.None, JobPrefab.List.Find(jp => jp.Name == "Engineer"));
character = Character.Create(charInfo, wayPoint.WorldPosition);
character = Character.Create(charInfo, wayPoint.WorldPosition, false, false);
Character.Controlled = character;
character.GiveJobItems(null);

View File

@@ -96,7 +96,7 @@ namespace Barotrauma
foreach (XElement subElement in doc.Root.Elements())
{
if (subElement.Name.ToString().ToLower() != "gamemode") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "gamemode") continue;
gameMode = new SinglePlayerMode(subElement);
}

View File

@@ -25,7 +25,7 @@ namespace Barotrauma
foreach (XElement subElement in doc.Root.Elements())
{
string infoName = subElement.Name.ToString().ToLower();
string infoName = subElement.Name.ToString().ToLowerInvariant();
List<string> infoList = null;
if (!infoTexts.TryGetValue(infoName, out infoList))
{
@@ -40,7 +40,7 @@ namespace Barotrauma
public static string GetInfoText(string infoName)
{
List<string> infoList = null;
if (!infoTexts.TryGetValue(infoName.ToLower(), out infoList) || !infoList.Any())
if (!infoTexts.TryGetValue(infoName.ToLowerInvariant(), out infoList) || !infoList.Any())
{
#if DEBUG
return "Info text ''" + infoName + "'' not found";

View File

@@ -171,7 +171,7 @@ namespace Barotrauma
foreach (XElement subElement in doc.Root.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "contentpackage":
string path = ToolBox.GetAttributeString(subElement, "path", "");

View File

@@ -127,7 +127,7 @@ namespace Barotrauma.Items.Components
// isOpen = false;
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "sprite":
doorSprite = new Sprite(subElement, Path.GetDirectoryName(item.Prefab.ConfigFile));

View File

@@ -44,7 +44,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "attack") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "attack") continue;
attack = new Attack(subElement);
}
}

View File

@@ -39,7 +39,7 @@ namespace Barotrauma.Items.Components
InvSlotType allowedSlot = InvSlotType.None;
foreach (string slot in slots)
{
if (slot.ToLower()=="bothhands")
if (slot.ToLowerInvariant() == "bothhands")
{
allowedSlot = InvSlotType.LeftHand | InvSlotType.RightHand;
}

View File

@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
public Propulsion(Item item, XElement element)
: base(item,element)
{
switch (ToolBox.GetAttributeString(element, "usablein", "air").ToLower())
switch (ToolBox.GetAttributeString(element, "usablein", "air").ToLowerInvariant())
{
case "air":
usableIn = ParticlePrefab.DrawTargetType.Air;

View File

@@ -83,7 +83,7 @@ namespace Barotrauma.Items.Components
fixableEntities = new List<string>();
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "fixable":
fixableEntities.Add(subElement.Attribute("name").Value);

View File

@@ -221,7 +221,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "requireditem":
case "requireditems":
@@ -395,7 +395,7 @@ namespace Barotrauma.Items.Components
if (sound.VolumeProperty == "") return 1.0f;
ObjectProperty op = null;
if (properties.TryGetValue(sound.VolumeProperty.ToLower(), out op))
if (properties.TryGetValue(sound.VolumeProperty.ToLowerInvariant(), out op))
{
float newVolume = 0.0f;
try
@@ -682,7 +682,7 @@ namespace Barotrauma.Items.Components
foreach (XAttribute attribute in componentElement.Attributes())
{
ObjectProperty property = null;
if (!properties.TryGetValue(attribute.Name.ToString().ToLower(), out property)) continue;
if (!properties.TryGetValue(attribute.Name.ToString().ToLowerInvariant(), out property)) continue;
property.TrySetValue(attribute.Value);
}
@@ -692,7 +692,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in componentElement.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "requireditem":
RelatedItem newRequiredItem = RelatedItem.Load(subElement);
@@ -717,7 +717,7 @@ namespace Barotrauma.Items.Components
public static ItemComponent Load(XElement element, Item item, string file, bool errorMessages = true)
{
Type t;
string type = element.Name.ToString().ToLower();
string type = element.Name.ToString().ToLowerInvariant();
try
{
// Get the type of a specified class.

View File

@@ -101,7 +101,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "containable":
RelatedItem containable = RelatedItem.Load(subElement);

View File

@@ -62,7 +62,7 @@ namespace Barotrauma.Items.Components
{
if (deconstructProduct.RequireFullCondition && targetItem.Condition < 100.0f) continue;
var itemPrefab = ItemPrefab.list.FirstOrDefault(ip => ip.Name.ToLower() == deconstructProduct.ItemPrefabName.ToLower()) as ItemPrefab;
var itemPrefab = ItemPrefab.list.FirstOrDefault(ip => ip.Name.ToLowerInvariant() == deconstructProduct.ItemPrefabName.ToLowerInvariant()) as ItemPrefab;
if (itemPrefab==null)
{
DebugConsole.ThrowError("Tried to deconstruct item ''"+targetItem.Name+"'' but couldn't find item prefab ''"+deconstructProduct+"''!");

View File

@@ -22,7 +22,7 @@ namespace Barotrauma.Items.Components
{
string name = ToolBox.GetAttributeString(element, "name", "");
TargetItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == name.ToLower()) as ItemPrefab;
TargetItem = ItemPrefab.list.Find(ip => ip.Name.ToLowerInvariant() == name.ToLowerInvariant()) as ItemPrefab;
if (TargetItem == null)
{
DebugConsole.ThrowError("Error in fabricable item "+name+"! Item ''" + element.Name + "'' not found.");
@@ -40,7 +40,7 @@ namespace Barotrauma.Items.Components
{
if (string.IsNullOrWhiteSpace(requiredItemName)) continue;
ItemPrefab requiredItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == requiredItemName.Trim().ToLower()) as ItemPrefab;
ItemPrefab requiredItem = ItemPrefab.list.Find(ip => ip.Name.ToLowerInvariant() == requiredItemName.Trim().ToLowerInvariant()) as ItemPrefab;
if (requiredItem == null)
{
DebugConsole.ThrowError("Error in fabricable item " + name + "! Required item ''" + requiredItemName + "'' not found.");
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "requiredskill":
RequiredSkills.Add(new Skill(

View File

@@ -42,7 +42,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "pingcircle":
pingCircle = new Sprite(subElement);

View File

@@ -401,7 +401,7 @@ namespace Barotrauma.Items.Components
public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective)
{
switch (objective.Option.ToLower())
switch (objective.Option.ToLowerInvariant())
{
case "power up":
float tempDiff = load - temperature;

View File

@@ -188,7 +188,7 @@ namespace Barotrauma.Items.Components
{
base.ReceiveSignal(stepsTaken, signal, connection, sender, power);
if (connection.Name.Length > 5 && connection.Name.Substring(0, 6).ToLower() == "signal")
if (connection.Name.Length > 5 && connection.Name.Substring(0, 6).ToLowerInvariant() == "signal")
{
connection.SendSignal(stepsTaken, signal, sender, 0.0f);
}

View File

@@ -54,7 +54,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "attack") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "attack") continue;
attack = new Attack(subElement);
}

View File

@@ -87,7 +87,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "link":
int index = -1;

View File

@@ -93,7 +93,7 @@ namespace Barotrauma.Items.Components
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "sprite") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
light.LightSprite = new Sprite(subElement);
light.LightSprite.Origin = light.LightSprite.size / 2.0f;
break;

View File

@@ -187,7 +187,7 @@ namespace Barotrauma.Items.Components
{
var projectiles = GetLoadedProjectiles();
if (projectiles.Count==0 || (projectiles.Count==1 && objective.Option.ToLower()!="fire at will"))
if (projectiles.Count == 0 || (projectiles.Count == 1 && objective.Option.ToLowerInvariant() != "fire at will"))
{
ItemContainer container = null;
foreach (MapEntity e in item.linkedTo)
@@ -272,7 +272,7 @@ namespace Barotrauma.Items.Components
var pickedBody = Submarine.PickBody(ConvertUnits.ToSimUnits(item.WorldPosition), closestEnemy.SimPosition, null);
if (pickedBody != null && !(pickedBody.UserData is Limb)) return false;
if (objective.Option.ToLower()=="fire at will") Use(deltaTime, character);
if (objective.Option.ToLowerInvariant() == "fire at will") Use(deltaTime, character);
return false;

View File

@@ -29,7 +29,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "skill":
string skillName = ToolBox.GetAttributeString(subElement, "name", "");

View File

@@ -343,7 +343,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "body":
body = new PhysicsBody(subElement, ConvertUnits.ToSimUnits(Position));
@@ -535,7 +535,7 @@ namespace Barotrauma
{
if (tag == null) return true;
return (tags.Contains(tag) || tags.Contains(tag.ToLower()));
return (tags.Contains(tag) || tags.Contains(tag.ToLowerInvariant()));
}

View File

@@ -184,7 +184,7 @@ namespace Barotrauma
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;
if (doc.Root.Name.ToString().ToLower() == "item")
if (doc.Root.Name.ToString().ToLowerInvariant() == "item")
{
new ItemPrefab(doc.Root, filePath);
}
@@ -192,7 +192,7 @@ namespace Barotrauma
{
foreach (XElement element in doc.Root.Elements())
{
if (element.Name.ToString().ToLower() != "item") continue;
if (element.Name.ToString().ToLowerInvariant() != "item") continue;
new ItemPrefab(element, filePath);
}
@@ -253,7 +253,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLower())
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "sprite":
string spriteFolder = "";

View File

@@ -148,7 +148,7 @@ namespace Barotrauma
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "statuseffect") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "statuseffect") continue;
ri.statusEffects.Add(StatusEffect.Load(subElement));
}

View File

@@ -69,11 +69,11 @@ namespace Barotrauma
hireableJobs = new List<Tuple<JobPrefab, float>>();
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "hireable") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "hireable") continue;
string jobName = ToolBox.GetAttributeString(subElement, "name", "");
JobPrefab jobPrefab = JobPrefab.List.Find(jp => jp.Name.ToLower() == jobName.ToLower());
JobPrefab jobPrefab = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == jobName.ToLowerInvariant());
if (jobPrefab==null)
{
DebugConsole.ThrowError("Invalid job name ("+jobName+") in location type "+name);

View File

@@ -223,8 +223,8 @@ namespace Barotrauma
private bool EnterAssignedJob(GUITextBox textBox, string text)
{
string trimmedName = text.ToLower().Trim();
assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLower() == trimmedName);
string trimmedName = text.ToLowerInvariant().Trim();
assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == trimmedName);
if (assignedJob !=null && trimmedName!="none")
{
@@ -757,10 +757,10 @@ namespace Barotrauma
w.IdCardTags = idCardTagString.Split(',');
}
string jobName = ToolBox.GetAttributeString(element, "job", "").ToLower();
string jobName = ToolBox.GetAttributeString(element, "job", "").ToLowerInvariant();
if (!string.IsNullOrWhiteSpace(jobName))
{
w.assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLower() == jobName);
w.assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == jobName);
}
w.ladderId = (ushort)ToolBox.GetAttributeInt(element, "ladders", 0);

View File

@@ -975,7 +975,7 @@ namespace Barotrauma.Networking
}
else
{
string command = ChatMessage.GetChatMessageCommand(message, out message).ToLower();
string command = ChatMessage.GetChatMessageCommand(message, out message).ToLowerInvariant();
if (command=="r" || command=="radio" && CanUseRadio(Character.Controlled)) type = ChatMessageType.Radio;
}

View File

@@ -1144,10 +1144,10 @@ namespace Barotrauma.Networking
public void KickPlayer(string playerName, bool ban = false)
{
playerName = playerName.ToLower();
playerName = playerName.ToLowerInvariant();
Client client = ConnectedClients.Find( c => c.name.ToLower() == playerName ||
(c.Character != null && c.Character.Name.ToLower() == playerName));
Client client = ConnectedClients.Find(c => c.name.ToLowerInvariant() == playerName ||
(c.Character != null && c.Character.Name.ToLowerInvariant() == playerName));
if (client == null) return;
@@ -1434,7 +1434,7 @@ namespace Barotrauma.Networking
ChatMessageType type = gameStarted && myCharacter != null ? ChatMessageType.Default : ChatMessageType.Server;
string command = ChatMessage.GetChatMessageCommand(message, out message).ToLower();
string command = ChatMessage.GetChatMessageCommand(message, out message).ToLowerInvariant();
if (command=="dead" || command=="d")
{
@@ -1447,8 +1447,8 @@ namespace Barotrauma.Networking
else if (command != "")
{
targetClient = ConnectedClients.Find(c =>
command == c.name.ToLower() ||
c.Character != null && command == c.Character.Name.ToLower());
command == c.name.ToLowerInvariant() ||
(c.Character != null && command == c.Character.Name.ToLowerInvariant()));
if (targetClient == null)
{

View File

@@ -51,7 +51,7 @@ namespace Barotrauma.Particles
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "sprite") continue;
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
Sprites.Add(new Sprite(subElement));
}
@@ -140,7 +140,7 @@ namespace Barotrauma.Particles
RotateToDirection = ToolBox.GetAttributeBool(element, "rotatetodirection", false);
switch (ToolBox.GetAttributeString(element, "drawtarget", "air").ToLower())
switch (ToolBox.GetAttributeString(element, "drawtarget", "air").ToLowerInvariant())
{
case "air":
default:

View File

@@ -82,7 +82,7 @@ namespace Barotrauma
}
else if (property.PropertyType == typeof(bool))
{
propertyInfo.SetValue(obj, (value.ToLower() == "true"), null);
propertyInfo.SetValue(obj, (value.ToLowerInvariant() == "true"), null);
}
else if (property.PropertyType == typeof(int))
{
@@ -201,7 +201,7 @@ namespace Barotrauma
foreach (var property in properties)
{
dictionary.Add(property.Name.ToLower(), new ObjectProperty(property, obj));
dictionary.Add(property.Name.ToLowerInvariant(), new ObjectProperty(property, obj));
}
return dictionary;
@@ -221,7 +221,7 @@ namespace Barotrauma
foreach (var property in properties)
{
ObjectProperty objProperty = new ObjectProperty(property, obj);
dictionary.Add(property.Name.ToLower(), objProperty);
dictionary.Add(property.Name.ToLowerInvariant(), objProperty);
//set the value of the property to the default value if there is one
foreach (var ini in property.Attributes.OfType<HasDefaultValue>())
@@ -238,7 +238,7 @@ namespace Barotrauma
foreach (XAttribute attribute in element.Attributes())
{
ObjectProperty property = null;
if (!dictionary.TryGetValue(attribute.Name.ToString().ToLower(), out property)) continue;
if (!dictionary.TryGetValue(attribute.Name.ToString().ToLowerInvariant(), out property)) continue;
if (!property.Attributes.OfType<HasDefaultValue>().Any()) continue;
property.TrySetValue(attribute.Value);
}
@@ -279,7 +279,7 @@ namespace Barotrauma
stringValue = value.ToString();
}
element.Add(new XAttribute(property.Name.ToLower(), stringValue));
element.Add(new XAttribute(property.Name.ToLowerInvariant(), stringValue));
}
}
}

View File

@@ -179,7 +179,7 @@ namespace Barotrauma
GameMain.LightManager.ObstructVision = Character.Controlled != null && Character.Controlled.ObstructVision;
GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam);
if (Character.Controlled!=null)
if (Character.Controlled != null)
{
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
}
@@ -194,7 +194,6 @@ namespace Barotrauma
if (Level.Loaded == null)
{
graphics.Clear(new Color(11, 18, 26, 255));
}
else
{

View File

@@ -385,7 +385,7 @@ namespace Barotrauma
XElement modeElement = null;
foreach (XElement element in doc.Root.Elements())
{
if (element.Name.ToString().ToLower() != "gamemode") continue;
if (element.Name.ToString().ToLowerInvariant() != "gamemode") continue;
modeElement = element;
break;

View File

@@ -142,7 +142,7 @@ namespace Barotrauma
return;
}
if (masterServerData.Substring(0,5).ToLower()=="error")
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
{
DebugConsole.ThrowError("Error while connecting to master server ("+masterServerData+")!");

View File

@@ -122,7 +122,7 @@ namespace Barotrauma
foreach (XElement element in xMusic)
{
string file = ToolBox.GetAttributeString(element, "file", "");
string type = ToolBox.GetAttributeString(element, "type", "").ToLower();
string type = ToolBox.GetAttributeString(element, "type", "").ToLowerInvariant();
Vector2 priority = ToolBox.GetAttributeVector2(element, "priorityrange", new Vector2(0.0f, 100.0f));
musicClips[i] = new BackgroundMusic(file, type, priority);

View File

@@ -87,7 +87,7 @@ namespace Barotrauma
}
else
{
string lowerTrimmedVal = value.ToLower().Trim();
string lowerTrimmedVal = value.ToLowerInvariant().Trim();
if (lowerTrimmedVal == "true")
{
return true;
@@ -186,7 +186,7 @@ namespace Barotrauma
{
if (attribute == null) return defaultValue;
string val = attribute.Value.ToLower().Trim();
string val = attribute.Value.ToLowerInvariant().Trim();
if (val == "true")
{
return true;