Skip to content

Commit 4140542

Browse files
author
SlavaRa
committed
Replace 'string_value != "" && string_value != null' by '!string.IsNullOrEmpty(string_value)'
Replace 'string_value == "" && string_value == null' by 'string.IsNullOrEmpty(string_value)' Small cleanup...
1 parent 5eea6e3 commit 4140542

File tree

8 files changed

+13
-14
lines changed

8 files changed

+13
-14
lines changed

External/Plugins/AS3Context/Context.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ private string MatchPlayerGlobalAny(ref int majorVersion, ref int minorVersion,
389389
{
390390
char S = Path.DirectorySeparatorChar;
391391
string libPlayer = sdkLibs + S + "player";
392-
string playerglobal = null;
393392
for (int i = minorVersion; i >= 0; i--)
394393
{
395394
string version = majorVersion + "." + i;
@@ -399,7 +398,8 @@ private string MatchPlayerGlobalAny(ref int majorVersion, ref int minorVersion,
399398
return libPlayer + S + version + S + "playerglobal.swc";
400399
}
401400
}
402-
if (playerglobal == null && Directory.Exists(libPlayer + S + majorVersion))
401+
string playerglobal = null;
402+
if (Directory.Exists(libPlayer + S + majorVersion))
403403
playerglobal = "player" + S + majorVersion + S + "playerglobal.swc";
404404

405405
if (playerglobal == null && majorVersion > 9)
@@ -841,7 +841,6 @@ public override bool OnCompletionInsert(ScintillaControl sci, int position, stri
841841
return true;
842842
}
843843
}
844-
if (insert == null) return false;
845844
if (trigger == '.')
846845
{
847846
sci.InsertText(position + text.Length, insert.Substring(1));

External/Plugins/ASCompletion/Completion/ASGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ private static void EventMetatag(ClassModel inClass, ScintillaControl Sci, Membe
13661366
}
13671367
else value = resolve.Member.Type;
13681368

1369-
if (value == "" || value == null)
1369+
if (string.IsNullOrEmpty(value))
13701370
return;
13711371

13721372
Regex re1 = new Regex("'(?:[^'\\\\]|(?:\\\\\\\\)|(?:\\\\\\\\)*\\\\.{1})*'");
@@ -3191,7 +3191,7 @@ private static void addTypeOnce(List<string> typesUsed, string qualifiedName)
31913191

31923192
private static string getQualifiedType(string type, ClassModel aType)
31933193
{
3194-
if (type == null || type == "") return "*";
3194+
if (string.IsNullOrEmpty(type)) return "*";
31953195
if (type.IndexOf('<') > 0) // Vector.<Point>
31963196
{
31973197
Match mGeneric = Regex.Match(type, "<([^>]+)>");

External/Plugins/ASCompletion/Context/ASContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ static public string GetLastStringToken(string str, string sep)
15571557
static public void ParseVersion(string version, ref int majorVersion, ref int minorVersion)
15581558
{
15591559
//if (version == "0.0") return;
1560-
if (version == null || version == "") return;
1560+
if (string.IsNullOrEmpty(version)) return;
15611561
string[] parts = version.Split('.');
15621562
int.TryParse(parts[0], out majorVersion);
15631563
if (parts.Length > 1) int.TryParse(parts[1], out minorVersion);

External/Plugins/ASCompletion/Model/ASFileParser.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static TypeDefinitionKind Parse(string comment, MemberModel model)
8282
}
8383
public static TypeDefinitionKind Parse(string comment, MemberModel model, bool detectKindOnly)
8484
{
85-
if (model != null && comment != null && comment != "")
85+
if (model != null && !string.IsNullOrEmpty(comment))
8686
{
8787
switch (model.Type)
8888
{
@@ -108,7 +108,7 @@ public static TypeDefinitionKind ParseTypedObject(string comment, MemberModel mo
108108
}
109109
public static TypeDefinitionKind ParseTypedObject(string comment, MemberModel model, bool detectKindOnly)
110110
{
111-
if (model != null && comment != null && comment != "")
111+
if (model != null && !string.IsNullOrEmpty(comment))
112112
{
113113
Match m = ASFileParserRegexes.ValidObjectType.Match(comment);
114114
if (m.Success)
@@ -130,7 +130,7 @@ public static TypeDefinitionKind ParseTypedArray(string comment, MemberModel mod
130130
}
131131
public static TypeDefinitionKind ParseTypedArray(string comment, MemberModel model, bool detectKindOnly)
132132
{
133-
if (model != null && comment != null && comment != "")
133+
if (model != null && !string.IsNullOrEmpty(comment))
134134
{
135135
Match m = ASFileParserRegexes.ValidTypeName.Match(comment);
136136
if (m.Success)
@@ -153,7 +153,7 @@ public static TypeDefinitionKind ParseTypedCallback(string comment, MemberModel
153153
}
154154
public static TypeDefinitionKind ParseTypedCallback(string comment, MemberModel model, bool detectKindOnly)
155155
{
156-
if (model != null && comment != null && comment != ""
156+
if (model != null && !string.IsNullOrEmpty(comment)
157157
&& (model.Flags & FlagType.Function) == 0)
158158
{
159159
MemberModel fnModel = extractTypedCallbackModel(comment);

External/Plugins/BookmarkPanel/PluginUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ private void UpdateMarkers(String filename)
481481
ListViewGroup group = this.FindGroup(document.FileName);
482482
if (group == null) return;
483483
List<Int32> markers = this.GetMarkers(document.SciControl);
484-
if (group != null && this.NeedRefresh(document.SciControl, markers, group.Items))
484+
if (this.NeedRefresh(document.SciControl, markers, @group.Items))
485485
{
486486
Int32 index = 0;
487487
ListViewItem item;

External/Plugins/CodeAnalyzer/PMDRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static void Analyze(String pmdPath, String projectPath, String sourcePath
4444
private void RunPMD(String pmdPath, String projectPath, String sourcePath, String pmdRuleset)
4545
{
4646
String args = "-Xmx256m -jar \"" + pmdPath + "\" -s \"" + sourcePath + "\" -o \"" + projectPath + "\"";
47-
if (pmdRuleset != "" && pmdRuleset != null && File.Exists(pmdRuleset)) args += " -r \"" + pmdRuleset + "\"";
47+
if (!string.IsNullOrEmpty(pmdRuleset) && File.Exists(pmdRuleset)) args += " -r \"" + pmdRuleset + "\"";
4848
this.SetStatusText(TextHelper.GetString("Info.RunningFlexPMD"));
4949
this.pmdRunner = new ProcessRunner();
5050
this.pmdRunner.ProcessEnded += new ProcessEndedHandler(this.PmdRunnerProcessEnded);

External/Plugins/ProjectManager/Controls/Icons.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public static FDImage GetResource(string resourceID)
215215

216216
public static FDImage GetImageForFile(string file)
217217
{
218-
if (file == null || file == string.Empty)
218+
if (string.IsNullOrEmpty(file))
219219
return BlankFile;
220220
string ext = Path.GetExtension(file).ToLower();
221221
if (FileInspector.IsActionScript(file, ext))

External/Plugins/ProjectManager/PluginMain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ public void OpenLastProject()
742742
{
743743
// try to open the last opened project
744744
string lastProject = Settings.LastProject;
745-
if (lastProject != null && lastProject != "" && File.Exists(lastProject))
745+
if (!string.IsNullOrEmpty(lastProject) && File.Exists(lastProject))
746746
{
747747
SetProject(projectActions.OpenProjectSilent(lastProject), false, true);
748748
}

0 commit comments

Comments
 (0)