From 88658b58e2dc50ef90ec199f0dadd4999a8260ad Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 12 Dec 2006 19:22:43 +0000 Subject: [PATCH] String patch, thanks Carmina --- Scripts/Commands/Batch.cs | 4 ++-- Scripts/Engines/Chat/Channel.cs | 4 ++-- Scripts/Engines/Craft/Core/CraftItem.cs | 4 ++-- Scripts/Engines/Craft/Core/CraftRes.cs | 4 ++-- Scripts/Engines/VeteranRewards/RewardSystem.cs | 4 ++-- Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs | 4 ++-- Scripts/Gumps/PlayerVendorGumps.cs | 4 ++-- Scripts/Items/Addons/BallotBox.cs | 4 ++-- Scripts/Items/Special/Solen Items/BallOfSummoning.cs | 6 +++--- Scripts/Items/Special/Solen Items/BraceletOfBinding.cs | 6 +++--- Scripts/Misc/CrashGuard.cs | 4 ++-- Scripts/Misc/NameList.cs | 4 ++-- Scripts/Misc/Profile.cs | 4 ++-- Scripts/Mobiles/Vendors/PlayerVendor.cs | 6 +++--- Scripts/Skills/Inscribe.cs | 4 ++-- 15 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Scripts/Commands/Batch.cs b/Scripts/Commands/Batch.cs index 0255130f4..71fdbf645 100644 --- a/Scripts/Commands/Batch.cs +++ b/Scripts/Commands/Batch.cs @@ -355,7 +355,7 @@ namespace Server.Commands if ( entry != null ) sc.Object = entry.Text; - if ( sc.Command == "" && sc.Object == "" ) + if ( sc.Command.Length == 0 && sc.Object.Length == 0 ) m_Batch.BatchCommands.RemoveAt( i ); } @@ -455,4 +455,4 @@ namespace Server.Commands m_From.SendGump( new BatchGump( m_From, m_Batch ) ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Chat/Channel.cs b/Scripts/Engines/Chat/Channel.cs index 05c143ba6..cd3b2d366 100644 --- a/Scripts/Engines/Chat/Channel.cs +++ b/Scripts/Engines/Chat/Channel.cs @@ -56,7 +56,7 @@ namespace Server.Engines.Chat { newValue = value.Trim(); - if ( newValue == null || newValue == String.Empty ) + if ( String.IsNullOrEmpty( newValue ) ) newValue = null; } @@ -545,4 +545,4 @@ namespace Server.Engines.Chat AddChannel( name ).AlwaysAvailable = true; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/Core/CraftItem.cs b/Scripts/Engines/Craft/Core/CraftItem.cs index e0a74114e..e4df3aff0 100644 --- a/Scripts/Engines/Craft/Core/CraftItem.cs +++ b/Scripts/Engines/Craft/Core/CraftItem.cs @@ -656,7 +656,7 @@ namespace Server.Engines.Craft if ( res.MessageNumber > 0 ) message = res.MessageNumber; - else if ( res.MessageString != null && res.MessageString != String.Empty ) + else if ( !String.IsNullOrEmpty( res.MessageString ) ) message = res.MessageString; else message = 502925; // You don't have the resources required to make that item. @@ -1306,4 +1306,4 @@ namespace Server.Engines.Craft } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/Core/CraftRes.cs b/Scripts/Engines/Craft/Core/CraftRes.cs index 7e2b963fa..00ed12e54 100644 --- a/Scripts/Engines/Craft/Core/CraftRes.cs +++ b/Scripts/Engines/Craft/Core/CraftRes.cs @@ -32,7 +32,7 @@ namespace Server.Engines.Craft { if ( m_MessageNumber > 0 ) from.SendLocalizedMessage( m_MessageNumber ); - else if ( m_MessageString != null && m_MessageString != String.Empty ) + else if ( !String.IsNullOrEmpty( m_MessageString ) ) from.SendMessage( m_MessageString ); else from.SendLocalizedMessage( 502925 ); // You don't have the resources required to make that item. @@ -68,4 +68,4 @@ namespace Server.Engines.Craft get { return m_Amount; } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/VeteranRewards/RewardSystem.cs b/Scripts/Engines/VeteranRewards/RewardSystem.cs index 9e0f59178..066e420fb 100644 --- a/Scripts/Engines/VeteranRewards/RewardSystem.cs +++ b/Scripts/Engines/VeteranRewards/RewardSystem.cs @@ -138,7 +138,7 @@ namespace Server.Engines.VeteranRewards string tag = acct.GetTag( "numRewardsChosen" ); - if ( tag == null || tag == "" ) + if ( String.IsNullOrEmpty( tag ) ) cur = 0; else cur = Utility.ToInt32( tag ); @@ -364,4 +364,4 @@ namespace Server.Engines.VeteranRewards { bool IsRewardItem{ get; set; } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs b/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs index d4c44bdc5..7925b3d7b 100644 --- a/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs @@ -55,7 +55,7 @@ namespace Server.Guilds string s = guild.Charter; - if( s == null || s == "" ) + if( String.IsNullOrEmpty( s ) ) s = "The guild leader has not yet set the guild charter."; AddHtml( 65, 216, 480, 80, s, true, true ); @@ -172,4 +172,4 @@ namespace Server.Guilds } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/PlayerVendorGumps.cs b/Scripts/Gumps/PlayerVendorGumps.cs index 706f34cf3..86b062fc5 100644 --- a/Scripts/Gumps/PlayerVendorGumps.cs +++ b/Scripts/Gumps/PlayerVendorGumps.cs @@ -25,7 +25,7 @@ namespace Server.Gumps AddHtmlLocalized( 125, 20, 250, 24, 1019070, false, false ); // You have agreed to purchase: - if ( vi.Description != null && vi.Description != "" ) + if ( !String.IsNullOrEmpty( vi.Description ) ) AddLabel( 125, 45, 0, vi.Description ); else AddHtmlLocalized( 125, 45, 250, 24, 1019072, false, false ); // an item without a description @@ -957,4 +957,4 @@ namespace Server.Gumps } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Addons/BallotBox.cs b/Scripts/Items/Addons/BallotBox.cs index cca6b3c81..3d32741a9 100644 --- a/Scripts/Items/Addons/BallotBox.cs +++ b/Scripts/Items/Addons/BallotBox.cs @@ -130,7 +130,7 @@ namespace Server.Items { string line = box.Topic[i]; - if ( line != null && line != "" ) + if ( !String.IsNullOrEmpty( line ) ) AddLabelCropped( 30, 90 + i * 20, 340, 20, 0x3E3, line ); } @@ -389,4 +389,4 @@ namespace Server.Items int version = reader.ReadEncodedInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs index b9b7fa5c0..ef0d0cd43 100644 --- a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs +++ b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs @@ -95,12 +95,12 @@ namespace Server.Items public override void AddNameProperty( ObjectPropertyList list ) { - list.Add( 1054131, m_Charges.ToString() + ( m_PetName == "" ? "\t " : "\t" + m_PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] + list.Add( 1054131, m_Charges.ToString() + ( m_PetName.Length == 0 ? "\t " : "\t" + m_PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] } public override void OnSingleClick( Mobile from ) { - LabelTo( from, 1054131, m_Charges.ToString() + ( m_PetName == "" ? "\t " : "\t" + m_PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] + LabelTo( from, 1054131, m_Charges.ToString() + ( m_PetName.Length == 0 ? "\t " : "\t" + m_PetName ) ); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~] } private delegate void BallCallback( Mobile from ); @@ -342,4 +342,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Special/Solen Items/BraceletOfBinding.cs b/Scripts/Items/Special/Solen Items/BraceletOfBinding.cs index b07589c14..78bccb881 100644 --- a/Scripts/Items/Special/Solen Items/BraceletOfBinding.cs +++ b/Scripts/Items/Special/Solen Items/BraceletOfBinding.cs @@ -96,12 +96,12 @@ namespace Server.Items public override void AddNameProperty( ObjectPropertyList list ) { - list.Add( 1054000, m_Charges.ToString() + ( m_Inscription == "" ? "\t " : " :\t" + m_Inscription ) ); // a bracelet of binding : ~1_val~ ~2_val~ + list.Add( 1054000, m_Charges.ToString() + ( m_Inscription.Length == 0 ? "\t " : " :\t" + m_Inscription ) ); // a bracelet of binding : ~1_val~ ~2_val~ } public override void OnSingleClick( Mobile from ) { - LabelTo( from, 1054000, m_Charges.ToString() + ( m_Inscription == "" ? "\t " : " :\t" + m_Inscription ) ); // a bracelet of binding : ~1_val~ ~2_val~ + LabelTo( from, 1054000, m_Charges.ToString() + ( m_Inscription.Length == 0 ? "\t " : " :\t" + m_Inscription ) ); // a bracelet of binding : ~1_val~ ~2_val~ } public override void GetContextMenuEntries( Mobile from, List list ) @@ -471,4 +471,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/CrashGuard.cs b/Scripts/Misc/CrashGuard.cs index 036e6838c..54d006d46 100644 --- a/Scripts/Misc/CrashGuard.cs +++ b/Scripts/Misc/CrashGuard.cs @@ -69,7 +69,7 @@ namespace Server.Misc private static string Combine( string path1, string path2 ) { - if ( path1 == "" ) + if ( path1.Length == 0 ) return path2; return Path.Combine( path1, path2 ); @@ -257,4 +257,4 @@ namespace Server.Misc ); } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/NameList.cs b/Scripts/Misc/NameList.cs index 51f9b6854..73c70c118 100644 --- a/Scripts/Misc/NameList.cs +++ b/Scripts/Misc/NameList.cs @@ -91,7 +91,7 @@ namespace Server { string type = element.GetAttribute( "type" ); - if ( type == null || type == String.Empty ) + if ( String.IsNullOrEmpty( type ) ) continue; try @@ -106,4 +106,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/Profile.cs b/Scripts/Misc/Profile.cs index 16eb28996..888f43c89 100644 --- a/Scripts/Misc/Profile.cs +++ b/Scripts/Misc/Profile.cs @@ -46,7 +46,7 @@ namespace Server.Misc footer = "This profile has been locked."; } - if ( footer == "" && beholder == beheld ) + if ( footer.Length == 0 && beholder == beheld ) footer = GetAccountDuration( beheld ); string body = beheld.Profile; @@ -95,4 +95,4 @@ namespace Server.Misc return false; } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/Vendors/PlayerVendor.cs b/Scripts/Mobiles/Vendors/PlayerVendor.cs index 985271838..c66d4b682 100644 --- a/Scripts/Mobiles/Vendors/PlayerVendor.cs +++ b/Scripts/Mobiles/Vendors/PlayerVendor.cs @@ -232,7 +232,7 @@ namespace Server.Mobiles else item.LabelTo( from, 1043304, vi.Price.ToString() ); // Price: ~1_COST~ - if ( vi.Description != null && vi.Description != "" ) + if ( !String.IsNullOrEmpty( vi.Description ) ) { // The localized message (1043305) is no longer valid -
Seller's Description:
"~1_DESC~" item.LabelTo( from, "Description: {0}", vi.Description ); @@ -961,7 +961,7 @@ namespace Server.Mobiles if ( vi != null ) { string name; - if ( item.Name != null && item.Name != "" ) + if ( !String.IsNullOrEmpty( item.Name ) ) name = item.Name; else name = "#" + item.LabelNumber.ToString(); @@ -1719,4 +1719,4 @@ namespace Server.Mobiles Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) ); } } -} \ No newline at end of file +} diff --git a/Scripts/Skills/Inscribe.cs b/Scripts/Skills/Inscribe.cs index 40f5bb9c6..a4d2ba4a2 100644 --- a/Scripts/Skills/Inscribe.cs +++ b/Scripts/Skills/Inscribe.cs @@ -46,7 +46,7 @@ namespace Server.SkillHandlers { foreach ( string line in page.Lines ) { - if ( line.Trim() != "" ) + if ( line.Trim().Length != 0 ) return false; } } @@ -159,4 +159,4 @@ namespace Server.SkillHandlers } } } -} \ No newline at end of file +}