public static IEnumerable <FileSystemEntry> FindFiles(this FileSystem?fileSystem, Func <FileSystemEntry, bool> matcher)
 {
     if (fileSystem is null)
     {
         return(Enumerable.Empty <FileSystemEntry>());
     }
     return(fileSystem.Files
            .Where(matcher)
            .Concat(fileSystem.NextFileSystem.FindFiles(matcher)));
 }
    public DirSuperBackupOptions(FileSystem?fs = null, string?infoLogFileName = null, string?errorLogFileName = null, DirSuperBackupFlags flags = DirSuperBackupFlags.Default, string encryptPassword = "", int numThreads = 0)
    {
        Fs = fs ?? Lfs;
        InfoLogFileName  = infoLogFileName;
        ErrorLogFileName = errorLogFileName;
        Flags            = flags;
        EncryptPassword  = encryptPassword._NonNull();

        if (numThreads <= 0)
        {
            numThreads = Math.Max(Env.NumCpus, 8);
        }

        numThreads = Math.Min(numThreads, 128);

        this.NumThreads = numThreads;
    }
        public LogServerOptions(FileSystem?destFileSystem, string destRootDirName, FileFlags fileFlags, Action <LogServerReceivedData, LogServerOptions>?setDestinationProc, TcpIpSystem?tcpIp, PalSslServerAuthenticationOptions sslAuthOptions, int[] ports, string?rateLimiterConfigName = null)
            : base(tcpIp, sslAuthOptions, ports, rateLimiterConfigName)
        {
            if (setDestinationProc == null)
            {
                setDestinationProc = LogServer.DefaultSetDestinationsProc;
            }

            this.DestRootDirName = destRootDirName;

            this.FileFlags = fileFlags;

            this.DestFileSystem = destFileSystem ?? LLfsUtf8;

            this.DestRootDirName = this.DestFileSystem.PathParser.RemoveLastSeparatorChar(this.DestFileSystem.PathParser.NormalizeDirectorySeparatorAndCheckIfAbsolutePath(this.DestRootDirName));

            this.SetDestinationsProc = setDestinationProc;
        }
    public override void _Ready()
    {
        OutputNode      = GetNode <RichTextLabel>("RightTabSet/JsonOutput/OutputText");
        UserPath        = GetNode <LineEdit>("CenterControls/FilePath");
        FileSystemPanel = GetNode <FileSystem>("LeftTabSet/FileSystem");

        DataObjectsList = GetNode <ItemList>("CenterControls/DataObjectsList");
        DataObjectsList.AddItem("Zoos");
        DataObjectsList.AddItem("Animals");
        DataObjectsList.AddItem("ZooAnimals");

        UserDataTable = GetNode <DataTable>("RightTabSet/DataTable");
        //UserDataTable.LoadData(new string[] { "ID", "Name" }, new string[][] { new string[] { "1", "2" }, new string[] { "3", "4" } });
        UserDataTable.LoadData <Zoo>(ZooInfo.Zoos);

        //OutputNode.Text = ZooInfo.ToString();
        GD.Print($"Current Dir: {FileDirectory.GetCurrentDir()}");
        if (FileDirectory.Open("user://") == Error.Ok)
        {
            GD.Print("user:// opened successfully");
        }

        return;
    }
Example #5
0
 public static Memory <byte> Load(string path, FileFlags flags, FileSystem?fs = null, int maxSize = int.MaxValue, CancellationToken cancel = default) =>
 path._Load(maxSize, flags, fs, cancel);
Example #6
0
 public override void _Ready()
 {
     fileSystem = Owner as FileSystem;
 }
Example #7
0
        public static X509Certificate2 LoadPkcs12(string filename, string?password = null, FileSystem?fileSystem = null)
        {
            if (fileSystem == null)
            {
                fileSystem = Lfs;
            }

            return(LoadPkcs12(fileSystem.ReadDataFromFile(filename).ToArray(), password));
        }
Example #8
0
 public DirSuperBackupOptions(FileSystem?fs = null, string?infoLogFileName = null, string?errorLogFileName = null)
 {
     Fs = fs ?? Lfs;
     InfoLogFileName  = infoLogFileName;
     ErrorLogFileName = errorLogFileName;
 }
 public static T _FileToObject <T>(this string path, FileSystem?fs = null, int maxSize = int.MaxValue, FileFlags flags = FileFlags.None, CancellationToken cancel = default,
                                   bool includeNull = false, int?maxDepth = Json.DefaultMaxDepth, bool nullIfError     = false)
 => (fs ?? Lfs).ReadJsonFromFile <T>(path, maxSize, flags, cancel, includeNull, maxDepth, nullIfError);
 public static long _ObjectToFile <T>(this T obj, string path, FileSystem?fs = null, FileFlags flags = FileFlags.None, bool doNotOverwrite = false, CancellationToken cancel = default,
                                      bool includeNull = false, bool escapeHtml = false, int?maxDepth = Json.DefaultMaxDepth, bool compact = false, bool referenceHandling = false)
 => (fs ?? Lfs).WriteJsonToFile <T>(path, obj, flags, doNotOverwrite, cancel, includeNull, escapeHtml, maxDepth, compact, referenceHandling);
Example #11
0
 public CopyDirectoryStatus CopyDir(string srcPath, string destPath, FileSystem?destFileSystem = null,
                                    CopyDirectoryParams?param = null, object?state = null, CopyDirectoryStatus?statusObject = null, CancellationToken cancel = default)
 => CopyDirAsync(srcPath, destPath, destFileSystem, param, state, statusObject, cancel)._GetResult();
Example #12
0
        public async Task <CopyDirectoryStatus> CopyDirAsync(string srcPath, string destPath, FileSystem?destFileSystem = null,
                                                             CopyDirectoryParams?param = null, object?state = null, CopyDirectoryStatus?statusObject = null, CancellationToken cancel = default)
        {
            if (destFileSystem == null)
            {
                destFileSystem = this;
            }

            return(await FileUtil.CopyDirAsync(this, srcPath, destFileSystem, destPath, param, state, statusObject, cancel));
        }
Example #13
0
 public void CopyFile(string srcPath, string destPath, CopyFileParams?param = null, object?state = null, CancellationToken cancel = default, FileSystem?destFileSystem = null, RefBool?readErrorIgnored = null)
 => CopyFileAsync(srcPath, destPath, param, state, cancel, destFileSystem, readErrorIgnored)._GetResult();
Example #14
0
        public async Task CopyFileAsync(string srcPath, string destPath, CopyFileParams?param = null, object?state = null, CancellationToken cancel = default, FileSystem?destFileSystem = null, RefBool?readErrorIgnored = null)
        {
            if (destFileSystem == null)
            {
                destFileSystem = this;
            }

            await FileUtil.CopyFileAsync(this, srcPath, destFileSystem, destPath, param, state, cancel, readErrorIgnored);
        }