Inline variable declarations

This commit is contained in:
Jason Nelson
2020-11-18 09:21:45 -08:00
parent d8804ae108
commit fa241bb0d7
2 changed files with 4 additions and 8 deletions

View File

@@ -68,7 +68,7 @@ namespace SharpCompress.Archives.Rar
// .rar, .r00, .r01, ...
string extension = currentFileInfo.Extension;
StringBuilder buffer = new StringBuilder(currentFileInfo.FullName.Length);
var buffer = new StringBuilder(currentFileInfo.FullName.Length);
buffer.Append(currentFileInfo.FullName.Substring(0,
currentFileInfo.FullName.Length - extension.Length));
if (string.Compare(extension, ".rar", StringComparison.OrdinalIgnoreCase) == 0)
@@ -77,8 +77,7 @@ namespace SharpCompress.Archives.Rar
}
else
{
int num = 0;
if (int.TryParse(extension.Substring(2, 2), out num))
if (int.TryParse(extension.Substring(2, 2), out int num))
{
num++;
buffer.Append(".r");
@@ -111,12 +110,11 @@ namespace SharpCompress.Archives.Rar
}
StringBuilder buffer = new StringBuilder(currentFileInfo.FullName.Length);
buffer.Append(currentFileInfo.FullName, 0, startIndex);
int num = 0;
string numString = currentFileInfo.FullName.Substring(startIndex + 5,
currentFileInfo.FullName.IndexOf('.', startIndex + 5) -
startIndex - 5);
buffer.Append(".part");
if (int.TryParse(numString, out num))
if (int.TryParse(numString, out int num))
{
num++;
for (int i = 0; i < numString.Length - num.ToString().Length; i++)

View File

@@ -34,9 +34,7 @@ namespace SharpCompress.Compressors.LZMA
throw new NotSupportedException("AES decoder does not support padding.");
}
int numCyclesPower;
byte[] salt, seed;
Init(info, out numCyclesPower, out salt, out seed);
Init(info, out int numCyclesPower, out byte[] salt, out byte[] seed);
byte[] password = Encoding.Unicode.GetBytes(pass.CryptoGetTextPassword());
byte[] key = InitKey(numCyclesPower, salt, password);