Exemple #1
0
        /// <summary>
        /// Ottiene la lista dei file e delle cartelle in /mnt/cdrom/DIRS e gestisce il loro montaggio
        /// </summary>
        public static void Set()
        {
            //var running = Application.RunningConfiguration.Storage.Mounts;
            //if(running.Length < 1) {
            //    return;
            //}
            var directories = Directory.EnumerateDirectories(Parameter.RepoDirs, "DIR*", SearchOption.TopDirectoryOnly).ToArray();

            for (var i = 0; i < directories.Length; i++)
            {
                var currentDirectory = directories[i];
                var targetDirectory  = MountHelper.ConvertDirectoryDirsPathToTarget(currentDirectory);
                if (MountHelper.IsAlreadyMounted(targetDirectory) == false)
                {
                    if (Directory.Exists(currentDirectory))
                    {
                        ConsoleLogger.Log($"[mount] {currentDirectory} -> {targetDirectory}");
                        Directory.CreateDirectory(targetDirectory);
                        MountWithBind(currentDirectory, targetDirectory);
                    }
                }
            }
            var files = Directory.EnumerateFiles(Parameter.RepoDirs, "FILE*", SearchOption.TopDirectoryOnly).ToArray();

            for (var i = 0; i < files.Length; i++)
            {
                var currentFile = files[i];
                var targetFile  = MountHelper.ConvertFileDirsPathToTarget(currentFile);
                if (MountHelper.IsAlreadyMounted(targetFile) == false)
                {
                    ConsoleLogger.Log($"[mount] {currentFile} -> {targetFile}");
                    MountWithBind(currentFile, targetFile);
                }
            }
        }