[Refs #87: Static Analysis] string compare as uppercase or by length

This commit is contained in:
baldurk
2014-10-05 16:34:59 +01:00
parent d29024dd8b
commit e749f42876
20 changed files with 109 additions and 110 deletions
+3 -3
View File
@@ -71,7 +71,7 @@ namespace renderdocui.Code
// save it)
foreach(var a in args)
{
if(a.ToLowerInvariant() == "--tempfile")
if(a.ToUpperInvariant() == "--tempfile")
temp = true;
}
@@ -80,7 +80,7 @@ namespace renderdocui.Code
for (int i = 0; i < args.Length; i++)
{
if (args[i].ToLowerInvariant() == "--remoteaccess" && i + 1 < args.Length)
if (args[i].ToUpperInvariant() == "--remoteaccess" && i + 1 < args.Length)
{
var regexp = @"^([a-zA-Z0-9_-]+:)?([0-9]+)$";
@@ -89,7 +89,7 @@ namespace renderdocui.Code
if (match.Success)
{
var host = match.Groups[1].Value;
if (host != "" && host[host.Length - 1] == ':')
if (host.Length > 0 && host[host.Length - 1] == ':')
host = host.Substring(0, host.Length - 1);
uint ident = 0;
if (uint.TryParse(match.Groups[2].Value, out ident))
+1 -1
View File
@@ -573,7 +573,7 @@ namespace renderdocui.Code
string folder = Config.CaptureSavePath;
try
{
if (folder == "" || !Directory.Exists(folder))
if (folder.Length == 0 || !Directory.Exists(folder))
folder = Path.GetTempPath();
}
catch (ArgumentException)
+1 -1
View File
@@ -319,7 +319,7 @@ namespace renderdocui.Code
var line = l;
line = line.Trim();
if (line == "") continue;
if (line.Length == 0) continue;
var match = regParser.Match(line);
+1 -1
View File
@@ -160,7 +160,7 @@ namespace renderdocui.Code
foreach (var kv in c.ReplayHostKeyValues)
{
if(kv.Key != null && kv.Key != "" &&
if (kv.Key != null && kv.Key.Length > 0 &&
kv.Value != null)
c.ReplayHosts.Add(kv.Key, kv.Value);
}
@@ -61,7 +61,7 @@ namespace renderdocui.Windows.Dialogs
public void SetErrors(string err)
{
errors.Text = err;
if (errors.Text == "")
if (errors.Text.Length == 0)
errors.Visible = false;
else
errors.Visible = true;
+2 -2
View File
@@ -204,8 +204,8 @@ namespace renderdocui.Controls
(m_Core.CurTextures[i].creationFlags & TextureCreationFlags.DSV) > 0));
include |= (Texs && (m_Core.CurTextures[i].creationFlags & TextureCreationFlags.RTV) == 0 &&
(m_Core.CurTextures[i].creationFlags & TextureCreationFlags.DSV) == 0);
include |= (filter != "" && (m_Core.CurTextures[i].name.ToLowerInvariant().Contains(filter.ToLowerInvariant())));
include |= (!RTs && !Texs && filter == "");
include |= (filter.Length > 0 && (m_Core.CurTextures[i].name.ToUpperInvariant().Contains(filter.ToUpperInvariant())));
include |= (!RTs && !Texs && filter.Length == 0);
if (include)
{
+2 -2
View File
@@ -100,7 +100,7 @@ namespace renderdocui.Windows
for (int i = 1; i < lines.Length; i++)
{
string l = rgx.Replace(lines[i], replacement);
if (l != "")
if (l.Length == 0)
node.Nodes.Add(new TreelistView.Node(new object[] { "", l }));
}
@@ -164,7 +164,7 @@ namespace renderdocui.Windows
callstack.Items.Clear();
if (calls.Length == 1 && calls[0] == "")
if (calls.Length == 1 && calls[0].Length == 0)
{
callstack.Items.Add("Symbols not loaded. Tools -> Resolve Symbols.");
}
+8 -8
View File
@@ -720,7 +720,7 @@ namespace renderdocui.Windows
f[i] = new FormatElement();
f[i].buffer = 0;
f[i].name = details.OutputSig[i].varName != "" ? details.OutputSig[i].varName : details.OutputSig[i].semanticIdxName;
f[i].name = details.OutputSig[i].varName.Length > 0 ? details.OutputSig[i].varName : details.OutputSig[i].semanticIdxName;
f[i].format.compByteWidth = sizeof(float);
f[i].format.compCount = sig.compCount;
f[i].format.compType = sig.compType;
@@ -1273,7 +1273,7 @@ namespace renderdocui.Windows
strm.Seek(offs, SeekOrigin.Begin);
}
string elname = bufferFormats[el].name.ToLowerInvariant();
string elname = bufferFormats[el].name.ToUpperInvariant();
var fmt = bufferFormats[el].format;
int byteWidth = (int)fmt.compByteWidth;
@@ -1285,7 +1285,7 @@ namespace renderdocui.Windows
if (bytes.Length != bytesToRead)
throw new System.IO.EndOfStreamException();
if (elname == "position" || elname == "sv_position")
if (elname == "POSITION" || elname == "SV_POSITION")
{
for (int i = 0; i < fmt.compCount; i++)
{
@@ -1973,9 +1973,9 @@ namespace renderdocui.Windows
foreach (var el in ui.m_Input.BufferFormats)
{
// prioritise SV_Position over general POSITION
if (el.name.ToUpper() == "SV_POSITION")
if (el.name.ToUpperInvariant() == "SV_POSITION")
pos = el;
if (el.name.ToUpper() == "POSITION" && pos == null)
if (el.name.ToUpperInvariant() == "POSITION" && pos == null)
pos = el;
}
}
@@ -2013,7 +2013,7 @@ namespace renderdocui.Windows
float aspect = 0.0f;
if (aspectGuess.Text != "")
if (aspectGuess.Text.Length > 0)
{
float.TryParse(aspectGuess.Text, out aspect);
}
@@ -2025,7 +2025,7 @@ namespace renderdocui.Windows
float near = -float.MaxValue;
if (nearGuess.Text != "")
if (nearGuess.Text.Length > 0)
{
float.TryParse(nearGuess.Text, out near);
}
@@ -2037,7 +2037,7 @@ namespace renderdocui.Windows
float far = -float.MaxValue;
if (farGuess.Text != "")
if (farGuess.Text.Length > 0)
{
float.TryParse(farGuess.Text, out far);
}
+7 -7
View File
@@ -323,9 +323,9 @@ namespace renderdocui.Windows.Dialogs
{
try
{
if (exePath.Text != "" && Directory.Exists(Path.GetDirectoryName(exePath.Text)))
if (exePath.Text.Length > 0 && Directory.Exists(Path.GetDirectoryName(exePath.Text)))
exeBrowser.InitialDirectory = Path.GetDirectoryName(exePath.Text);
else if (m_Core.Config.LastCapturePath != "")
else if (m_Core.Config.LastCapturePath.Length > 0)
exeBrowser.InitialDirectory = m_Core.Config.LastCapturePath;
}
catch (ArgumentException)
@@ -347,7 +347,7 @@ namespace renderdocui.Windows.Dialogs
private void exePath_DragEnter(object sender, DragEventArgs e)
{
if (ValidData(e.Data) != "")
if (ValidData(e.Data).Length > 0)
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
@@ -356,7 +356,7 @@ namespace renderdocui.Windows.Dialogs
private void exePath_DragDrop(object sender, DragEventArgs e)
{
string fn = ValidData(e.Data);
if (fn != "")
if (fn.Length > 0)
{
exePath.Text = fn;
@@ -374,7 +374,7 @@ namespace renderdocui.Windows.Dialogs
workDirBrowser.SelectedPath = workDirPath.Text;
else if (Directory.Exists(Path.GetDirectoryName(exePath.Text)))
workDirBrowser.SelectedPath = Path.GetDirectoryName(exePath.Text);
else if (m_Core.Config.LastCapturePath != "")
else if (m_Core.Config.LastCapturePath.Length > 0)
exeBrowser.InitialDirectory = m_Core.Config.LastCapturePath;
}
catch (ArgumentException)
@@ -478,7 +478,7 @@ namespace renderdocui.Windows.Dialogs
private void workDirPath_Leave(object sender, EventArgs e)
{
if (workDirPath.Text == "")
if (workDirPath.Text.Length == 0)
{
workDirHint = true;
workDirPath.ForeColor = SystemColors.GrayText;
@@ -497,7 +497,7 @@ namespace renderdocui.Windows.Dialogs
{
if (workDirHint == false) return;
if (exePath.Text == "")
if (exePath.Text.Length == 0)
{
workDirPath.Text = "";
return;
@@ -237,7 +237,7 @@ namespace renderdocui.Controls
{
if (needName &&
Slot < reflection.ConstantBlocks.Length &&
reflection.ConstantBlocks[Slot].name != "")
reflection.ConstantBlocks[Slot].name.Length > 0)
BufferName = "<" + reflection.ConstantBlocks[Slot].name + ">";
}
@@ -302,7 +302,7 @@ namespace renderdocui.Controls
public void ProcessBufferFormat(string formatText)
{
if (formatText == "")
if (formatText.Length == 0)
{
m_FormatOverride = null;
if (m_FormatSpecifier != null)
+7 -7
View File
@@ -108,7 +108,7 @@ namespace renderdocui.Windows
m_ConnectThread = null;
Text = (m_Host != "" ? m_Host + " - " : "") + "Connecting...";
Text = (m_Host.Length > 0 ? (m_Host + " - ") : "") + "Connecting...";
connectionStatus.Text = "Connecting...";
connectionIcon.Image = global::renderdocui.Properties.Resources.hourglass;
@@ -145,7 +145,7 @@ namespace renderdocui.Windows
if (m_Connection.Connected)
{
string api = "...";
if (m_Connection.API != "") api = m_Connection.API;
if (m_Connection.API.Length > 0) api = m_Connection.API;
this.BeginInvoke((MethodInvoker)delegate
{
if (m_Connection.PID == 0)
@@ -211,17 +211,17 @@ namespace renderdocui.Windows
byte[] thumb = m_Connection.CaptureFile.thumbnail;
string path = m_Connection.CaptureFile.localpath;
if (path == "" || File.Exists(path))
if (path.Length == 0 || File.Exists(path))
{
this.BeginInvoke((MethodInvoker)delegate
{
CaptureAdded(capID, m_Connection.Target, m_Connection.API, thumb, timestamp);
if (path != "")
if (path.Length > 0)
CaptureRetrieved(capID, path);
});
m_Connection.CaptureExists = false;
if (path == "")
if (path.Length == 0)
m_Connection.CopyCapture(capID, m_Core.TempLogFilename("remotecopy_" + m_Connection.Target));
}
}
@@ -278,7 +278,7 @@ namespace renderdocui.Windows
{
this.BeginInvoke((MethodInvoker)delegate
{
Text = (m_Host != "" ? m_Host + " - " : "") + "Connection failed";
Text = (m_Host.Length > 0 ? (m_Host + " - ") : "") + "Connection failed";
connectionStatus.Text = "Connection failed";
connectionIcon.Image = global::renderdocui.Properties.Resources.delete;
@@ -388,7 +388,7 @@ namespace renderdocui.Windows
string path = m_Main.GetSavePath();
if (path != "")
if (path.Length > 0)
{
File.Copy(log.localpath, path, true);
File.Delete(log.localpath);
@@ -215,7 +215,7 @@ namespace renderdocui.Windows.Dialogs
private void AddNewHost()
{
if (hostname.Text.Trim() != "" && !m_Core.Config.RecentHosts.Contains(hostname.Text.ToLower()))
if (hostname.Text.Trim().Length > 0 && !m_Core.Config.RecentHosts.Contains(hostname.Text, StringComparer.OrdinalIgnoreCase))
{
m_Core.Config.RecentHosts.Add(hostname.Text);
m_Core.Config.Serialize(Core.ConfigFilename);
@@ -115,7 +115,7 @@ namespace renderdocui.Windows.Dialogs
hosts.Clear();
if (kv.Value != "")
if (kv.Value.Length > 0)
hosts.Add(kv.Value);
var plugins = renderdocplugin.PluginHelpers.GetPlugins();
@@ -151,7 +151,7 @@ namespace renderdocui.Windows.Dialogs
hosts.Remove("");
host.Items.AddRange(hosts.ToArray());
if (kv.Value != "")
if (kv.Value.Length > 0)
host.SelectedIndex = 0;
host.Tag = driver;
@@ -179,7 +179,7 @@ namespace renderdocui.Windows.Dialogs
var host = sender as ComboBox;
string driver = host.Tag as string;
if (driver != "" && m_Core.Config.ReplayHosts.ContainsKey(driver))
if (driver.Length > 0 && m_Core.Config.ReplayHosts.ContainsKey(driver))
m_Core.Config.ReplayHosts[driver] = host.Text;
}
@@ -194,7 +194,7 @@ namespace renderdocui.Windows.Dialogs
{
string driver = host.Tag as string;
if(host.Text == "")
if (host.Text.Length == 0)
continue;
bool found = false;
@@ -25,8 +25,8 @@ namespace renderdocui.Windows.Dialogs
{
fileFormat.Items.Add(ft.ToString());
if (filter != "") filter += "|";
filter += String.Format("{0} Files (*.{1})|*.{1}", ft.ToString(), ft.ToString().ToLowerInvariant());
if (filter.Length > 0) filter += "|";
filter += String.Format("{0} Files (*.{1})|*.{1}", ft.ToString(), ft.ToString().ToUpperInvariant());
}
saveTexDialog.Filter = filter;
@@ -228,11 +228,11 @@ namespace renderdocui.Windows.Dialogs
try
{
string ext = Path.GetExtension(filename.Text).ToLowerInvariant().Substring(1); // trim . from extension
string ext = Path.GetExtension(filename.Text).ToUpperInvariant().Substring(1); // trim . from extension
foreach (var ft in (FileType[])Enum.GetValues(typeof(FileType)))
{
if (ft.ToString().ToLowerInvariant() == ext)
if (ft.ToString().ToUpperInvariant() == ext)
{
fileFormat.SelectedIndex = (int)ft;
break;
+12 -12
View File
@@ -475,7 +475,7 @@ namespace renderdocui.Windows
{
if (n.Tag is DeferredEvent)
{
if (n["Name"].ToString().ToLowerInvariant().Contains(filter))
if (n["Name"].ToString().ToUpperInvariant().Contains(filter))
{
n.Image = global::renderdocui.Properties.Resources.find;
results++;
@@ -493,10 +493,10 @@ namespace renderdocui.Windows
private int SetFindIcons(string filter)
{
if(filter == "")
if (filter.Length == 0)
return 0;
return SetFindIcons(eventView.Nodes[0].Nodes, filter.ToLowerInvariant());
return SetFindIcons(eventView.Nodes[0].Nodes, filter.ToUpperInvariant());
}
private TreelistView.Node FindNode(TreelistView.NodeCollection nodes, string filter, UInt32 after)
@@ -505,7 +505,7 @@ namespace renderdocui.Windows
{
if (n.Tag is DeferredEvent)
{
if ((UInt32)n["EID"] > after && n["Name"].ToString().ToLowerInvariant().Contains(filter))
if ((UInt32)n["EID"] > after && n["Name"].ToString().ToUpperInvariant().Contains(filter))
return n;
}
@@ -537,7 +537,7 @@ namespace renderdocui.Windows
bool matchesAfter = (forward && def.eventID > after) || (!forward && def.eventID < after);
if (matchesAfter && n["Name"].ToString().ToLowerInvariant().Contains(filter))
if (matchesAfter && n["Name"].ToString().ToUpperInvariant().Contains(filter))
return (int)def.eventID;
}
@@ -558,7 +558,7 @@ namespace renderdocui.Windows
if (eventView.Nodes.Count == 0)
return 0;
return FindEvent(eventView.Nodes[0].Nodes, filter.ToLowerInvariant(), after, forward);
return FindEvent(eventView.Nodes[0].Nodes, filter.ToUpperInvariant(), after, forward);
}
public void OnEventSelected(UInt32 frameID, UInt32 eventID)
@@ -614,7 +614,7 @@ namespace renderdocui.Windows
{
jumpStrip.Visible = false;
if (findEvent.Text == "")
if (findEvent.Text.Length == 0)
{
findStrip.Visible = false;
@@ -713,7 +713,7 @@ namespace renderdocui.Windows
private void findEvent_TextChanged(object sender, EventArgs e)
{
if (findEvent.Text != "")
if (findEvent.Text.Length > 0)
{
findHighlight.Enabled = false;
findHighlight.Enabled = true;
@@ -729,7 +729,7 @@ namespace renderdocui.Windows
private void findHighlight_Tick(object sender, EventArgs e)
{
if (findEvent.Text == "")
if (findEvent.Text.Length == 0)
{
findEvent.BackColor = SystemColors.Window;
ClearFindIcons();
@@ -768,8 +768,8 @@ namespace renderdocui.Windows
findHighlight.Enabled = false;
findHighlight_Tick(sender, null);
}
if (findEvent.Text != "")
if (findEvent.Text.Length > 0)
{
Find(true);
}
@@ -829,7 +829,7 @@ namespace renderdocui.Windows
private void Find(bool forward)
{
if(findEvent.Text == "")
if (findEvent.Text.Length == 0)
return;
UInt32 curEID = m_Core.CurEvent;
+13 -13
View File
@@ -200,7 +200,7 @@ namespace renderdocui.Windows
ShowLiveCapture(live);
}
if (m_InitFilename != "")
if (m_InitFilename.Length > 0)
{
if (Path.GetExtension(m_InitFilename) == ".rdc")
{
@@ -409,7 +409,7 @@ namespace renderdocui.Windows
return m_Core.CaptureDialog;
}
else if (persistString != null && persistString != "")
else if (persistString != null && persistString.Length > 0)
LoadCustomString(persistString);
return null;
@@ -508,7 +508,7 @@ namespace renderdocui.Windows
if (m_Core != null && m_Core.LogLoaded)
{
prefix = Path.GetFileName(m_Core.LogFileName);
if (m_RemoteReplay != "")
if (m_RemoteReplay.Length > 0)
prefix += String.Format(" (Remote replay on {0})", m_RemoteReplay);
prefix += " - ";
}
@@ -535,12 +535,12 @@ namespace renderdocui.Windows
Thread thread = null;
if (!m_Core.Config.ReplayHosts.ContainsKey(driver) && driver.Trim() != "")
if (!m_Core.Config.ReplayHosts.ContainsKey(driver) && driver.Trim().Length > 0)
m_Core.Config.ReplayHosts.Add(driver, "");
// if driver is "" something went wrong loading the log, let it be handled as usual
// if driver is empty something went wrong loading the log, let it be handled as usual
// below. Otherwise prompt to replay remotely.
if (driver != "" && (!support || m_Core.Config.ReplayHosts[driver] != ""))
if (driver.Length > 0 && (!support || m_Core.Config.ReplayHosts[driver].Length > 0))
{
string remoteMessage = String.Format("This log was captured with {0}", driver);
@@ -549,7 +549,7 @@ namespace renderdocui.Windows
else
remoteMessage += " and your settings say to replay this remotely.\n";
if(m_Core.Config.ReplayHosts[driver] == "")
if (m_Core.Config.ReplayHosts[driver].Length == 0)
remoteMessage += "Do you wish to select a remote host to replay on?\n\n" +
"You can set up a default host for this driver on the next screen.";
else
@@ -560,11 +560,11 @@ namespace renderdocui.Windows
if (res == DialogResult.Yes)
{
if (m_Core.Config.ReplayHosts[driver] == "")
if (m_Core.Config.ReplayHosts[driver].Length == 0)
{
(new Dialogs.ReplayHostManager(m_Core, this)).ShowDialog();
if (m_Core.Config.ReplayHosts[driver] == "")
if (m_Core.Config.ReplayHosts[driver].Length == 0)
return;
}
@@ -863,7 +863,7 @@ namespace renderdocui.Windows
if(!PromptCloseLog())
return;
if (m_Core.Config.LastLogPath != "")
if (m_Core.Config.LastLogPath.Length > 0)
openDialog.InitialDirectory = m_Core.Config.LastLogPath;
DialogResult res = openDialog.ShowDialog();
@@ -982,7 +982,7 @@ namespace renderdocui.Windows
CloseLogfile();
if(deletepath != "")
if (deletepath.Length > 0)
File.Delete(deletepath);
return true;
@@ -1440,7 +1440,7 @@ namespace renderdocui.Windows
private void MainWindow_DragDrop(object sender, DragEventArgs e)
{
string fn = ValidData(e.Data);
if (fn != "")
if (fn.Length > 0)
{
LoadLogfile(fn, false);
}
@@ -1448,7 +1448,7 @@ namespace renderdocui.Windows
private void MainWindow_DragEnter(object sender, DragEventArgs e)
{
if(ValidData(e.Data) != "")
if (ValidData(e.Data).Length > 0)
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
@@ -116,7 +116,6 @@ namespace renderdocui.Windows.PipelineState
gsStreams.Nodes.Clear();
var tick = global::renderdocui.Properties.Resources.tick;
var cross = global::renderdocui.Properties.Resources.cross;
fillMode.Text = "Solid";
cullMode.Text = "Front";
@@ -194,7 +193,7 @@ namespace renderdocui.Windows.PipelineState
else
shader.Text = stage.ShaderName;
if (shaderDetails != null && shaderDetails.DebugInfo.entryFunc != "" && shaderDetails.DebugInfo.files.Length > 0)
if (shaderDetails != null && shaderDetails.DebugInfo.entryFunc.Length > 0 && shaderDetails.DebugInfo.files.Length > 0)
shader.Text = shaderDetails.DebugInfo.entryFunc + "()" + " - " +
Path.GetFileName(shaderDetails.DebugInfo.files[0].filename);
@@ -227,7 +226,7 @@ namespace renderdocui.Windows.PipelineState
{
string slotname = i.ToString();
if (shaderInput != null && shaderInput.name != "")
if (shaderInput != null && shaderInput.name.Length > 0)
slotname += ": " + shaderInput.name;
UInt32 w = 1, h = 1, d = 1;
@@ -337,7 +336,7 @@ namespace renderdocui.Windows.PipelineState
}
}
bool filledSlot = (s.AddressU != "");
bool filledSlot = (s.AddressU.Length > 0);
bool usedSlot = (shaderInput != null);
// show if
@@ -348,7 +347,7 @@ namespace renderdocui.Windows.PipelineState
{
string slotname = i.ToString();
if (shaderInput != null && shaderInput.name != "")
if (shaderInput != null && shaderInput.name.Length > 0)
slotname += ": " + shaderInput.name;
string borderColor = s.BorderColor[0].ToString() + ", " +
@@ -411,7 +410,7 @@ namespace renderdocui.Windows.PipelineState
{
ConstantBlock shaderCBuf = null;
if (shaderDetails != null && i < shaderDetails.ConstantBlocks.Length && shaderDetails.ConstantBlocks[i].name != "")
if (shaderDetails != null && i < shaderDetails.ConstantBlocks.Length && shaderDetails.ConstantBlocks[i].name.Length > 0)
shaderCBuf = shaderDetails.ConstantBlocks[i];
bool filledSlot = (b.Buffer != ResourceId.Null);
@@ -444,7 +443,7 @@ namespace renderdocui.Windows.PipelineState
string slotname = i.ToString();
if (shaderCBuf != null && shaderCBuf.name != "")
if (shaderCBuf != null && shaderCBuf.name.Length > 0)
slotname += ": " + shaderCBuf.name;
var node = cbuffers.Nodes.Add(new object[] { slotname, name, b.VecOffset, b.VecCount, numvars, length });
@@ -550,7 +549,7 @@ namespace renderdocui.Windows.PipelineState
if(state.m_IA.Bytecode == null)
iaBytecode.Text = "None";
else if(state.m_IA.Bytecode.DebugInfo == null || state.m_IA.Bytecode.DebugInfo.entryFunc == "")
else if (state.m_IA.Bytecode.DebugInfo == null || state.m_IA.Bytecode.DebugInfo.entryFunc.Length == 0)
iaBytecode.Text = "Layout " + state.m_IA.layout.ToString();
else
iaBytecode.Text = state.m_IA.Bytecode.DebugInfo.entryFunc;
@@ -577,7 +576,7 @@ namespace renderdocui.Windows.PipelineState
for (int i = 0; i < count; i++)
{
// misorder or misnamed semantics
if (IA[i].semanticIdxName.ToLowerInvariant() != VS[i].semanticIdxName.ToLowerInvariant())
if (IA[i].semanticIdxName.ToUpperInvariant() != VS[i].semanticIdxName.ToUpperInvariant())
mismatchDetails += String.Format("IA bytecode semantic {0}: {1} != VS bytecode semantic {0}: {2}\n", i,
IA[i].semanticIdxName, VS[i].semanticIdxName);
@@ -1469,7 +1468,7 @@ namespace renderdocui.Windows.PipelineState
{
if (r.variableType.members.Length == 0)
{
if (r.variableType.Name != "")
if (r.variableType.Name.Length > 0)
format = r.variableType.Name + " " + r.name + ";";
}
else
@@ -1486,7 +1485,7 @@ namespace renderdocui.Windows.PipelineState
if (buf.ID != ResourceId.Null)
{
var viewer = new BufferViewer(m_Core, false);
if (format == "")
if (format.Length == 0)
viewer.ViewRawBuffer(buf.ID);
else
viewer.ViewRawBuffer(buf.ID, format);
@@ -1652,7 +1651,7 @@ namespace renderdocui.Windows.PipelineState
string mainfile = "";
var files = new Dictionary<string, string>();
if (shaderDetails.DebugInfo.entryFunc != "" && shaderDetails.DebugInfo.files.Length > 0)
if (shaderDetails.DebugInfo.entryFunc.Length > 0 && shaderDetails.DebugInfo.files.Length > 0)
{
entryFunc = shaderDetails.DebugInfo.entryFunc;
@@ -1708,7 +1707,7 @@ namespace renderdocui.Windows.PipelineState
int cbufIdx = 0;
foreach (var cbuf in shaderDetails.ConstantBlocks)
{
if (cbuf.name != "" && cbuf.variables.Length > 0)
if (cbuf.name.Length > 0 && cbuf.variables.Length > 0)
{
cbuffers += String.Format("cbuffer {0} : register(b{1}) {{", cbuf.name, cbufIdx) + nl;
MakeShaderVariablesHLSL(true, cbuf.variables, ref cbuffers, ref hlsl);
@@ -1721,12 +1720,12 @@ namespace renderdocui.Windows.PipelineState
hlsl += String.Format("struct {0}Input{1}{{{1}", shType, nl);
foreach(var sig in shaderDetails.InputSig)
hlsl += String.Format("\t{0} {1} : {2};" + nl, sig.TypeString, sig.varName != "" ? sig.varName : "param" + sig.regIndex, sig.D3D11SemanticString);
hlsl += String.Format("\t{0} {1} : {2};" + nl, sig.TypeString, sig.varName.Length > 0 ? sig.varName : ("param" + sig.regIndex), sig.D3D11SemanticString);
hlsl += "};" + nl2;
hlsl += String.Format("struct {0}Output{1}{{{1}", shType, nl);
foreach (var sig in shaderDetails.OutputSig)
hlsl += String.Format("\t{0} {1} : {2};" + nl, sig.TypeString, sig.varName != "" ? sig.varName : "param" + sig.regIndex, sig.D3D11SemanticString);
hlsl += String.Format("\t{0} {1} : {2};" + nl, sig.TypeString, sig.varName.Length > 0 ? sig.varName : ("param" + sig.regIndex), sig.D3D11SemanticString);
hlsl += "};" + nl2;
hlsl += String.Format("{0}Output {1}(in {0}Input IN){2}{{{2}\t{0}Output OUT = ({0}Output)0;{2}{2}\t// ...{2}{2}\treturn OUT;{2}}}{2}", shType, entryFunc, nl);
@@ -1854,7 +1853,7 @@ namespace renderdocui.Windows.PipelineState
{
if (stage.ShaderDetails != null &&
(stage.ShaderDetails.ConstantBlocks.Length <= slot ||
stage.ShaderDetails.ConstantBlocks[slot].name == "")
stage.ShaderDetails.ConstantBlocks[slot].name.Length == 0)
)
{
// unused cbuffer, open regular buffer viewer
+10 -10
View File
@@ -398,7 +398,7 @@ namespace renderdocui.Windows
w.CloseButtonVisible = false;
}
if (shader.DebugInfo.entryFunc != "" && shader.DebugInfo.files.Length > 0)
if (shader.DebugInfo.entryFunc.Length > 0 && shader.DebugInfo.files.Length > 0)
{
if(trace != null)
Text = String.Format("Debug {0}() - {1}", shader.DebugInfo.entryFunc, debugContext);
@@ -459,8 +459,8 @@ namespace renderdocui.Windows
foreach (var s in m_ShaderDetails.InputSig)
{
string name = s.varName == "" ? s.semanticName : String.Format("{0} ({1})", s.varName, s.semanticName);
if (s.semanticName == "") name = s.varName;
string name = s.varName.Length == 0 ? s.semanticName : String.Format("{0} ({1})", s.varName, s.semanticName);
if (s.semanticName.Length == 0) name = s.varName;
var node = inSig.Nodes.Add(new object[] { name, s.semanticIndex, s.regIndex, s.TypeString, s.systemValue.ToString(),
SigParameter.GetComponentString(s.regChannelMask), SigParameter.GetComponentString(s.channelUsedMask) });
@@ -478,8 +478,8 @@ namespace renderdocui.Windows
foreach (var s in m_ShaderDetails.OutputSig)
{
string name = s.varName == "" ? s.semanticName : String.Format("{0} ({1})", s.varName, s.semanticName);
if (s.semanticName == "") name = s.varName;
string name = s.varName.Length == 0 ? s.semanticName : String.Format("{0} ({1})", s.varName, s.semanticName);
if (s.semanticName.Length == 0) name = s.varName;
if(multipleStreams)
name = String.Format("Stream {0} : {1}", s.stream, name);
@@ -667,7 +667,7 @@ namespace renderdocui.Windows
hoverTimer.Enabled = false;
if (m_HoverScintilla != null && m_HoverReg != "")
if (m_HoverScintilla != null && m_HoverReg.Length > 0)
{
var pt = m_HoverScintilla.PointToClient(Cursor.Position);
@@ -995,7 +995,7 @@ namespace renderdocui.Windows
var swizzle = match.Groups[3].Value.Replace(".", "");
var regcast = match.Groups[4].Value.Replace(",", "");
if (regcast == "")
if (regcast.Length == 0)
{
if (displayInts.Checked)
regcast = "i";
@@ -1039,7 +1039,7 @@ namespace renderdocui.Windows
{
ShaderVariable vr = vars[regindex];
if (swizzle == "")
if (swizzle.Length == 0)
{
swizzle = "xyzw".Substring(0, (int)vr.columns);
@@ -1469,9 +1469,9 @@ namespace renderdocui.Windows
private void watchRegs_AfterLabelEdit(object sender, LabelEditEventArgs e)
{
if (e.Label == "" && e.Item < watchRegs.Items.Count - 1)
if (e.Label.Length == 0 && e.Item < watchRegs.Items.Count - 1)
watchRegs.Items.RemoveAt(e.Item);
else if (e.Label != null && e.Label != "" && e.Item == watchRegs.Items.Count - 1)
else if (e.Label != null && e.Label.Length > 0 && e.Item == watchRegs.Items.Count - 1)
watchRegs.Items.Add(new ListViewItem(new string[] { "", "", "" }));
this.BeginInvoke((MethodInvoker)delegate { UpdateDebugging(); });
+13 -13
View File
@@ -346,7 +346,7 @@ namespace renderdocui.Windows
private void TextureViewer_Load(object sender, EventArgs e)
{
if (onloadLayout != "")
if (onloadLayout.Length > 0)
{
Control[] persistors = {
renderToolstripContainer,
@@ -494,7 +494,7 @@ namespace renderdocui.Windows
{
if (!m_Core.LogLoaded) return;
if (filter == "")
if (filter.Length > 0)
{
var shaders = m_CustomShaders.Values.ToArray();
@@ -510,7 +510,7 @@ namespace renderdocui.Windows
else
{
var fn = Path.GetFileNameWithoutExtension(filter);
var key = fn.ToLowerInvariant();
var key = fn.ToUpperInvariant();
if (m_CustomShaders.ContainsKey(key))
{
@@ -543,7 +543,7 @@ namespace renderdocui.Windows
foreach (var f in Directory.EnumerateFiles(Core.ConfigDirectory, "*.hlsl"))
{
var fn = Path.GetFileNameWithoutExtension(f);
var key = fn.ToLowerInvariant();
var key = fn.ToUpperInvariant();
if (!m_CustomShaders.ContainsKey(key))
{
@@ -583,13 +583,13 @@ namespace renderdocui.Windows
private void customCreate_Click(object sender, EventArgs e)
{
if (customShader.Text == null || customShader.Text == "")
if (customShader.Text == null || customShader.Text.Length == 0)
{
MessageBox.Show("No name entered.\nEnter a name in the textbox.", "Error Creating Shader", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (m_CustomShaders.ContainsKey(customShader.Text.ToLowerInvariant()))
if (m_CustomShaders.ContainsKey(customShader.Text.ToUpperInvariant()))
{
MessageBox.Show("Selected shader already exists.\nEnter a new name in the textbox.", "Error Creating Shader", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@@ -633,13 +633,13 @@ namespace renderdocui.Windows
private void customDelete_Click(object sender, EventArgs e)
{
if (customShader.Text == null || customShader.Text == "")
if (customShader.Text == null || customShader.Text.Length == 0)
{
MessageBox.Show("No shader selected.\nSelect a custom shader from the drop-down", "Error Deleting Shader", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!m_CustomShaders.ContainsKey(customShader.Text.ToLowerInvariant()))
if (!m_CustomShaders.ContainsKey(customShader.Text.ToUpperInvariant()))
{
MessageBox.Show("Selected shader doesn't exist.\nSelect a custom shader from the drop-down", "Error Deleting Shader", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@@ -877,7 +877,7 @@ namespace renderdocui.Windows
if (tex != null)
{
prev.Init(!tex.customName && bindName != "" ? bindName : tex.name, tex.width, tex.height, tex.depth, tex.mips);
prev.Init(!tex.customName && bindName.Length > 0 ? bindName : tex.name, tex.width, tex.height, tex.depth, tex.mips);
IntPtr handle = prev.ThumbnailHandle;
ResourceId id = RTs[i];
m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
@@ -887,7 +887,7 @@ namespace renderdocui.Windows
}
else if (buf != null)
{
prev.Init(!buf.customName && bindName != "" ? bindName : buf.name, buf.length, 0, 0, Math.Max(1, buf.structureSize));
prev.Init(!buf.customName && bindName.Length > 0 ? bindName : buf.name, buf.length, 0, 0, Math.Max(1, buf.structureSize));
IntPtr handle = prev.ThumbnailHandle;
m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
{
@@ -963,7 +963,7 @@ namespace renderdocui.Windows
if (tex != null)
{
prev.Init(!tex.customName && bindName != "" ? bindName : tex.name, tex.width, tex.height, tex.depth, tex.mips);
prev.Init(!tex.customName && bindName.Length > 0 ? bindName : tex.name, tex.width, tex.height, tex.depth, tex.mips);
IntPtr handle = prev.ThumbnailHandle;
ResourceId id = Texs[i];
m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
@@ -1609,10 +1609,10 @@ namespace renderdocui.Windows
m_TexDisplay.HDRMul = -1.0f;
m_TexDisplay.CustomShader = ResourceId.Null;
if (m_CustomShaders.ContainsKey(customShader.Text.ToLowerInvariant()))
if (m_CustomShaders.ContainsKey(customShader.Text.ToUpperInvariant()))
{
if (m_TexDisplay.CustomShader == ResourceId.Null) { m_CurPixelValue = null; m_CurRealValue = null; UI_UpdateStatusText(); }
m_TexDisplay.CustomShader = m_CustomShaders[customShader.Text.ToLowerInvariant()];
m_TexDisplay.CustomShader = m_CustomShaders[customShader.Text.ToUpperInvariant()];
customDelete.Enabled = customEdit.Enabled = true;
customCreate.Enabled = false;
}
+2 -2
View File
@@ -377,7 +377,7 @@ namespace renderdocui.Windows
{
float myWidth = 20.0f;
if (s.Name != "")
if (s.Name.Length > 0)
myWidth = Math.Max(myWidth, MinBarSize(g, "+ " + s.Name));
if (s.subsections == null || s.subsections.Count == 0)
@@ -499,7 +499,7 @@ namespace renderdocui.Windows
for (int i = 0; i < section.subsections.Count; i++)
{
var s = section.subsections[i];
if (s.Name != "")
if (s.Name.Length > 0)
{
g.Clip = new Region(clipRect);
var childRect = DrawBar(g, col, rect, start, widths[i], (s.Expanded ? "- " : "+ ") + s.Name, visible);