mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-06 17:43:17 +02:00
Minor code refactoring
This commit is contained in:
parent
7eda93f5da
commit
de4ab95d80
2 changed files with 5 additions and 6 deletions
|
@ -36,13 +36,13 @@ namespace SMBLibrary.SMB1
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <exception cref="SMBLibrary.UnsupportedInformationLevelException"></exception>
|
/// <exception cref="SMBLibrary.UnsupportedInformationLevelException"></exception>
|
||||||
public static FindInformationList GetFindInformationList(List<QueryDirectoryFileInformation> entries, bool isUnicode, int maxLength)
|
public static FindInformationList ToFindInformationList(List<QueryDirectoryFileInformation> entries, bool isUnicode, int maxLength)
|
||||||
{
|
{
|
||||||
FindInformationList result = new FindInformationList();
|
FindInformationList result = new FindInformationList();
|
||||||
int pageLength = 0;
|
int pageLength = 0;
|
||||||
for (int index = 0; index < entries.Count; index++)
|
for (int index = 0; index < entries.Count; index++)
|
||||||
{
|
{
|
||||||
FindInformation infoEntry = GetFindInformation(entries[index]);
|
FindInformation infoEntry = ToFindInformation(entries[index]);
|
||||||
int entryLength = infoEntry.GetLength(isUnicode);
|
int entryLength = infoEntry.GetLength(isUnicode);
|
||||||
if (pageLength + entryLength <= maxLength)
|
if (pageLength + entryLength <= maxLength)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ namespace SMBLibrary.SMB1
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <exception cref="SMBLibrary.UnsupportedInformationLevelException"></exception>
|
/// <exception cref="SMBLibrary.UnsupportedInformationLevelException"></exception>
|
||||||
public static FindInformation GetFindInformation(QueryDirectoryFileInformation fileInformation)
|
public static FindInformation ToFindInformation(QueryDirectoryFileInformation fileInformation)
|
||||||
{
|
{
|
||||||
if (fileInformation is FileDirectoryInformation)
|
if (fileInformation is FileDirectoryInformation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
|
||||||
using SMBLibrary.SMB1;
|
using SMBLibrary.SMB1;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ namespace SMBLibrary.Server.SMB1
|
||||||
FindInformationList findInformationList;
|
FindInformationList findInformationList;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
findInformationList = FindInformationHelper.GetFindInformationList(segment, header.UnicodeFlag, maxLength);
|
findInformationList = FindInformationHelper.ToFindInformationList(segment, header.UnicodeFlag, maxLength);
|
||||||
}
|
}
|
||||||
catch (UnsupportedInformationLevelException)
|
catch (UnsupportedInformationLevelException)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +111,7 @@ namespace SMBLibrary.Server.SMB1
|
||||||
FindInformationList findInformationList;
|
FindInformationList findInformationList;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
findInformationList = FindInformationHelper.GetFindInformationList(segment, header.UnicodeFlag, maxLength);
|
findInformationList = FindInformationHelper.ToFindInformationList(segment, header.UnicodeFlag, maxLength);
|
||||||
}
|
}
|
||||||
catch (UnsupportedInformationLevelException)
|
catch (UnsupportedInformationLevelException)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue