Fix RCS1218
This commit is contained in:
@@ -1097,6 +1097,9 @@ dotnet_diagnostic.RCS1215.severity = warning
|
|||||||
# Unnecessary unsafe context.
|
# Unnecessary unsafe context.
|
||||||
dotnet_diagnostic.RCS1216.severity = warning
|
dotnet_diagnostic.RCS1216.severity = warning
|
||||||
|
|
||||||
|
# Simplify code branching.
|
||||||
|
dotnet_diagnostic.RCS1218.severity = warning
|
||||||
|
|
||||||
# Use pattern matching instead of combination of 'is' operator and cast operator.
|
# Use pattern matching instead of combination of 'is' operator and cast operator.
|
||||||
dotnet_diagnostic.RCS1220.severity = warning
|
dotnet_diagnostic.RCS1220.severity = warning
|
||||||
|
|
||||||
|
|||||||
@@ -105,13 +105,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
defaultSaveFilename = world.Map.Title;
|
defaultSaveFilename = world.Map.Title;
|
||||||
var filenameAttempt = 0;
|
var filenameAttempt = 0;
|
||||||
while (true)
|
while (File.Exists(Path.Combine(baseSavePath, defaultSaveFilename + ".orasav")))
|
||||||
{
|
|
||||||
if (!File.Exists(Path.Combine(baseSavePath, defaultSaveFilename + ".orasav")))
|
|
||||||
break;
|
|
||||||
|
|
||||||
defaultSaveFilename = world.Map.Title + $" ({++filenameAttempt})";
|
defaultSaveFilename = world.Map.Title + $" ({++filenameAttempt})";
|
||||||
}
|
|
||||||
|
|
||||||
var saveButton = panel.Get<ButtonWidget>("SAVE_BUTTON");
|
var saveButton = panel.Get<ButtonWidget>("SAVE_BUTTON");
|
||||||
saveButton.IsDisabled = () => string.IsNullOrWhiteSpace(saveTextField.Text);
|
saveButton.IsDisabled = () => string.IsNullOrWhiteSpace(saveTextField.Text);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace OpenRA.Platforms.Default
|
|||||||
var buffer = new List<byte>();
|
var buffer = new List<byte>();
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
|
|
||||||
while (true)
|
do
|
||||||
{
|
{
|
||||||
var b = Marshal.ReadByte(devicesPtr, offset++);
|
var b = Marshal.ReadByte(devicesPtr, offset++);
|
||||||
if (b != 0)
|
if (b != 0)
|
||||||
@@ -85,11 +85,8 @@ namespace OpenRA.Platforms.Default
|
|||||||
// A null indicates termination of that string, so add that to our list.
|
// A null indicates termination of that string, so add that to our list.
|
||||||
devices.Add(Encoding.UTF8.GetString(buffer.ToArray()));
|
devices.Add(Encoding.UTF8.GetString(buffer.ToArray()));
|
||||||
buffer.Clear();
|
buffer.Clear();
|
||||||
|
|
||||||
// Two successive nulls indicates the end of the list.
|
|
||||||
if (Marshal.ReadByte(devicesPtr, offset) == 0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
while (Marshal.ReadByte(devicesPtr, offset) != 0); // Two successive nulls indicates the end of the list.
|
||||||
|
|
||||||
return devices.ToArray();
|
return devices.ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user