예제 #1
0
        /// <summary>
        /// 初始化通用文件系统流的新实例。
        /// </summary>
        /// <param name="fullPath">要加载的文件系统的完整路径。</param>
        /// <param name="access">要加载的文件系统的访问方式。</param>
        /// <param name="createNew">是否创建新的文件系统流。</param>
        public CommonFileSystemStream(string fullPath, FileSystemAccess access, bool createNew)
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                throw new GameFrameworkException("Full path is invalid.");
            }

            switch (access)
            {
            case FileSystemAccess.Read:
                m_FileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                break;

            case FileSystemAccess.Write:
                m_FileStream = new FileStream(fullPath, createNew ? FileMode.Create : FileMode.Open, FileAccess.Write, FileShare.Read);
                break;

            case FileSystemAccess.ReadWrite:
                m_FileStream = new FileStream(fullPath, createNew ? FileMode.Create : FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
                break;

            default:
                throw new GameFrameworkException("Access is invalid.");
            }
        }
예제 #2
0
        /// <summary>
        /// 加载文件系统。
        /// </summary>
        /// <param name="fullPath">要加载的文件系统的完整路径。</param>
        /// <param name="access">要加载的文件系统的访问方式。</param>
        /// <param name="stream">要加载的文件系统的文件系统流。</param>
        /// <returns>加载的文件系统。</returns>
        public static FileSystem Load(string fullPath, FileSystemAccess access, FileSystemStream stream)
        {
            FileSystem fileSystem = new FileSystem(fullPath, access, stream);

            stream.Read(s_CachedBytes, 0, HeaderDataSize);
            fileSystem.m_HeaderData = Utility.Marshal.BytesToStructure <HeaderData>(HeaderDataSize, s_CachedBytes);
            CalcOffsets(fileSystem);

            fileSystem.m_BlockDatas.Capacity = fileSystem.m_HeaderData.BlockCount;
            for (int i = 0; i < fileSystem.m_HeaderData.BlockCount; i++)
            {
                stream.Read(s_CachedBytes, 0, BlockDataSize);
                BlockData blockData = Utility.Marshal.BytesToStructure <BlockData>(BlockDataSize, s_CachedBytes);
                fileSystem.m_BlockDatas.Add(blockData);
            }

            for (int i = 0; i < fileSystem.m_BlockDatas.Count; i++)
            {
                BlockData blockData = fileSystem.m_BlockDatas[i];
                if (blockData.Using)
                {
                    StringData stringData = fileSystem.ReadStringData(blockData.StringIndex);
                    fileSystem.m_StringDatas.Add(blockData.StringIndex, stringData);
                    fileSystem.m_FileDatas.Add(stringData.GetString(fileSystem.m_HeaderData.GetEncryptBytes()), i);
                }
                else
                {
                    fileSystem.m_FreeBlockIndexes.Add(blockData.Length, i);
                }
            }

            return(fileSystem);
        }
예제 #3
0
        public void SetDirectoryPermissionsBySIDTest()
        {
            string builtInUsersSID = "S-1-5-32-545";
            string testDir         = @"c:\TestDirectory";
            string testSubDir      = @"c:\TestDirectory\SubDir";

            if (Directory.Exists(testDir) == true)
            {
                Directory.Delete(testDir, true);
            }

            try
            {
                Directory.CreateDirectory(testSubDir);

                Assert.IsFalse(FileSystemAccess.DoesUserHaveAccessToDirectory(testDir, builtInUsersSID, FileSystemRights.FullControl));
                Assert.IsFalse(FileSystemAccess.DoesUserHaveAccessToDirectory(testSubDir, builtInUsersSID, FileSystemRights.FullControl));

                FileSystemAccess.SetDirectoryAccessBySID(testDir, builtInUsersSID, FileSystemRights.FullControl);

                Assert.IsTrue(FileSystemAccess.DoesUserHaveAccessToDirectory(testDir, builtInUsersSID, FileSystemRights.FullControl));
                Assert.IsTrue(FileSystemAccess.DoesUserHaveAccessToDirectory(testSubDir, builtInUsersSID, FileSystemRights.FullControl));
            }
            finally
            {
                //if (Directory.Exists(testDir) == true)
                //	Directory.Delete(testDir, true);
            }
        }
 public RoundhouseRedGateCompareRunner(KnownFolders known_folders, FileSystemAccess file_system, ConfigurationPropertyHolder configuration, RoundhouseMigrationRunner migration_runner)
 {
     this.known_folders    = known_folders;
     this.file_system      = file_system;
     this.configuration    = configuration;
     this.migration_runner = migration_runner;
 }
예제 #5
0
        /// <summary>
        /// 创建文件系统。
        /// </summary>
        /// <param name="fullPath">要创建的文件系统的完整路径。</param>
        /// <param name="access">要创建的文件系统的访问方式。</param>
        /// <param name="stream">要创建的文件系统的文件系统流。</param>
        /// <param name="maxFileCount">要创建的文件系统的最大文件数量。</param>
        /// <param name="maxBlockCount">要创建的文件系统的最大块数据数量。</param>
        /// <returns>创建的文件系统。</returns>
        public static FileSystem Create(string fullPath, FileSystemAccess access, FileSystemStream stream, int maxFileCount, int maxBlockCount)
        {
            if (maxFileCount <= 0)
            {
                throw new GameFrameworkException("Max file count is invalid.");
            }

            if (maxBlockCount <= 0)
            {
                throw new GameFrameworkException("Max block count is invalid.");
            }

            if (maxFileCount > maxBlockCount)
            {
                throw new GameFrameworkException("Max file count can not larger than max block count.");
            }

            FileSystem fileSystem = new FileSystem(fullPath, access, stream);

            fileSystem.m_HeaderData = new HeaderData(maxFileCount, maxBlockCount);
            CalcOffsets(fileSystem);
            Utility.Marshal.StructureToBytes(fileSystem.m_HeaderData, HeaderDataSize, s_CachedBytes);

            try
            {
                stream.Write(s_CachedBytes, 0, HeaderDataSize);
                stream.SetLength(fileSystem.m_FileDataOffset);
                return(fileSystem);
            }
            catch
            {
                fileSystem.Shutdown();
                return(null);
            }
        }
        public virtual void FileSystemCache()
        {
            string dir      = TestDirHelper.GetTestDir().GetAbsolutePath();
            string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService
                                                                         ).FullName, typeof(SchedulerService).FullName, typeof(FileSystemAccessService).FullName
                                                                  ));
            Configuration hadoopConf = new Configuration(false);

            hadoopConf.Set(CommonConfigurationKeysPublic.FsDefaultNameKey, TestHdfsHelper.GetHdfsConf
                               ().Get(CommonConfigurationKeysPublic.FsDefaultNameKey));
            CreateHadoopConf(hadoopConf);
            Configuration conf = new Configuration(false);

            conf.Set("server.services", services);
            conf.Set("server.hadoop.filesystem.cache.purge.frequency", "1");
            conf.Set("server.hadoop.filesystem.cache.purge.timeout", "1");
            Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server
                                                             ("server", dir, dir, dir, dir, conf);
            try
            {
                server.Init();
                FileSystemAccess hadoop = server.Get <FileSystemAccess>();
                FileSystem       fs1    = hadoop.CreateFileSystem("u", hadoop.GetFileSystemConfiguration()
                                                                  );
                NUnit.Framework.Assert.IsNotNull(fs1);
                fs1.Mkdirs(new Path("/tmp/foo1"));
                hadoop.ReleaseFileSystem(fs1);
                //still around because of caching
                fs1.Mkdirs(new Path("/tmp/foo2"));
                FileSystem fs2 = hadoop.CreateFileSystem("u", hadoop.GetFileSystemConfiguration()
                                                         );
                //should be same instance because of caching
                NUnit.Framework.Assert.AreEqual(fs1, fs2);
                Sharpen.Thread.Sleep(4 * 1000);
                //still around because of lease count is 1 (fs2 is out)
                fs1.Mkdirs(new Path("/tmp/foo2"));
                Sharpen.Thread.Sleep(4 * 1000);
                //still around because of lease count is 1 (fs2 is out)
                fs2.Mkdirs(new Path("/tmp/foo"));
                hadoop.ReleaseFileSystem(fs2);
                Sharpen.Thread.Sleep(4 * 1000);
                //should not be around as lease count is 0
                try
                {
                    fs2.Mkdirs(new Path("/tmp/foo"));
                    NUnit.Framework.Assert.Fail();
                }
                catch (IOException)
                {
                }
                catch (Exception)
                {
                    NUnit.Framework.Assert.Fail();
                }
            }
            finally
            {
                server.Destroy();
            }
        }
예제 #7
0
        /// <summary>
        /// 获取文件系统集合。
        /// </summary>
        /// <param name="name">要获取的文件系统的名称。</param>
        /// <param name="access">要获取的文件系统的访问方式。</param>
        /// <param name="results">获取的文件系统集合。</param>
        public void GetFileSystems(string name, FileSystemAccess access, List <IFileSystem> results)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new GameFrameworkException("Name is invalid.");
            }

            if (results == null)
            {
                throw new GameFrameworkException("Results is invalid.");
            }

            results.Clear();
            GameFrameworkLinkedListRange <FileSystem> range = default(GameFrameworkLinkedListRange <FileSystem>);

            if (m_RegisteredFileSystems.TryGetValue(name, out range))
            {
                foreach (FileSystem fileSystem in range)
                {
                    if (access != FileSystemAccess.Unspecified && (fileSystem.Access & access) != access)
                    {
                        continue;
                    }

                    results.Add(fileSystem);
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 创建文件系统。
        /// </summary>
        /// <param name="fullPath">要创建的文件系统的完整路径。</param>
        /// <param name="access">要创建的文件系统的访问方式。</param>
        /// <param name="maxFileCount">要创建的文件系统的最大文件数量。</param>
        /// <param name="maxBlockCount">要创建的文件系统的最大块数据数量。</param>
        /// <returns>创建的文件系统。</returns>
        public IFileSystem CreateFileSystem(string fullPath, FileSystemAccess access, int maxFileCount, int maxBlockCount)
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                throw new GameFrameworkException("Full path is invalid.");
            }

            if (access == FileSystemAccess.Unspecified)
            {
                throw new GameFrameworkException("Access is invalid.");
            }

            if (access == FileSystemAccess.Read)
            {
                throw new GameFrameworkException("Access read is invalid.");
            }

            fullPath = Utility.Path.GetRegularPath(fullPath);
            if (m_FileSystems.ContainsKey(fullPath))
            {
                throw new GameFrameworkException(Utility.Text.Format("File system '{0}' is already exist.", fullPath));
            }

            FileSystemStream fileSystemStream = new DotNetFileSystemStream(fullPath, access, true);
            FileSystem       fileSystem       = FileSystem.Create(fullPath, access, fileSystemStream, maxFileCount, maxBlockCount);

            if (fileSystem == null)
            {
                throw new GameFrameworkException(Utility.Text.Format("Create file system '{0}' failure.", fullPath));
            }

            m_FileSystems.Add(fullPath, fileSystem);
            return(fileSystem);
        }
예제 #9
0
        /// <summary>
        /// 加载文件系统。
        /// </summary>
        /// <param name="fullPath">要加载的文件系统的完整路径。</param>
        /// <param name="access">要加载的文件系统的访问方式。</param>
        /// <returns>加载的文件系统。</returns>
        public IFileSystem LoadFileSystem(string fullPath, FileSystemAccess access)
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                throw new GameFrameworkException("Full path is invalid.");
            }

            if (access == FileSystemAccess.Unspecified)
            {
                throw new GameFrameworkException("Access is invalid.");
            }

            fullPath = Utility.Path.GetRegularPath(fullPath);
            if (m_FileSystems.ContainsKey(fullPath))
            {
                throw new GameFrameworkException(Utility.Text.Format("File system '{0}' is already exist.", fullPath));
            }

            FileSystemStream fileSystemStream = new DotNetFileSystemStream(fullPath, access, false);
            FileSystem       fileSystem       = FileSystem.Load(fullPath, access, fileSystemStream);

            if (fileSystem == null)
            {
                throw new GameFrameworkException(Utility.Text.Format("Load file system '{0}' failure.", fullPath));
            }

            m_FileSystems.Add(fullPath, fileSystem);
            return(fileSystem);
        }
예제 #10
0
        /// <summary>
        /// 获取文件系统集合。
        /// </summary>
        /// <param name="name">要获取的文件系统的名称。</param>
        /// <param name="access">要获取的文件系统的访问方式。</param>
        /// <returns>获取的文件系统集合。</returns>
        public IFileSystem[] GetFileSystems(string name, FileSystemAccess access)
        {
            List <IFileSystem> results = new List <IFileSystem>();

            GetFileSystems(name, access, results);
            return(results.ToArray());
        }
예제 #11
0
        /// <summary>
        /// 初始化文件系统的新实例。
        /// </summary>
        /// <param name="fullPath">文件系统完整路径。</param>
        /// <param name="access">文件系统访问方式。</param>
        /// <param name="stream">文件系统流。</param>
        private FileSystem(string fullPath, FileSystemAccess access, FileSystemStream stream)
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                throw new GameFrameworkException("Full path is invalid.");
            }

            if (access == FileSystemAccess.Unspecified)
            {
                throw new GameFrameworkException("Access is invalid.");
            }

            if (stream == null)
            {
                throw new GameFrameworkException("Stream is invalid.");
            }

            m_FullPath         = fullPath;
            m_Access           = access;
            m_Stream           = stream;
            m_FileDatas        = new Dictionary <string, int>(StringComparer.Ordinal);
            m_BlockDatas       = new List <BlockData>();
            m_FreeBlockIndexes = new GameFrameworkMultiDictionary <int, int>();
            m_StringDatas      = new SortedDictionary <int, StringData>();
            m_FreeStringDatas  = new Queue <KeyValuePair <int, StringData> >();

            m_HeaderData       = default(HeaderData);
            m_BlockDataOffset  = 0;
            m_StringDataOffset = 0;
            m_FileDataOffset   = 0;

            Utility.Marshal.EnsureCachedHGlobalSize(CachedBytesLength);
        }
예제 #12
0
        public static KnownFolders build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            MigrationsFolder alter_database_folder            = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.AlterDatabaseFolderName, false, false, "AlterDatabase");
            MigrationsFolder run_after_create_database_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunAfterCreateDatabaseFolderName, true, false, "Run After Create Database");
            MigrationsFolder run_before_up_folder             = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunBeforeUpFolderName, false, false, "Run Before Update");
            MigrationsFolder up_folder        = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.UpFolderName, true, false, "Update");
            MigrationsFolder down_folder      = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.DownFolderName, true, false, "Down Folder - Nothing to see here. Move along.");
            MigrationsFolder run_first_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunFirstAfterUpFolderName, false, false, "Run First After Update");
            MigrationsFolder functions_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.FunctionsFolderName, false, false, "Function");
            MigrationsFolder views_folder     = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.ViewsFolderName, false, false, "View");
            MigrationsFolder sprocs_folder    = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.SprocsFolderName, false, false, "Stored Procedure");
            MigrationsFolder indexes_folder   = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.IndexesFolderName, false, false, "Index");
            MigrationsFolder runAfterOtherAnyTimeScripts_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunAfterOtherAnyTimeScriptsFolderName, false, false, "Run after Other Anytime Scripts");
            MigrationsFolder permissions_folder      = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.PermissionsFolderName, false, true, "Permission");
            MigrationsFolder before_migration_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.BeforeMigrationFolderName, false, true, "BeforeMigration");
            MigrationsFolder after_migration_folder  = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.AfterMigrationFolderName, false, true, "AfterMigration");

            Folder change_drop_folder = new DefaultFolder(file_system, combine_items_into_one_path(file_system,
                                                                                                   configuration_property_holder.OutputPath,
                                                                                                   "migrations",
                                                                                                   remove_paths_from(configuration_property_holder.DatabaseName, file_system),
                                                                                                   remove_paths_from(configuration_property_holder.ServerName, file_system)),
                                                          get_run_date_time_string());

            return(new DefaultKnownFolders(alter_database_folder, run_after_create_database_folder, run_before_up_folder, up_folder, down_folder, run_first_folder, functions_folder, views_folder, sprocs_folder, indexes_folder, runAfterOtherAnyTimeScripts_folder, permissions_folder, before_migration_folder, after_migration_folder, change_drop_folder));
        }
 public RoundhouseMigrationRunner(
     string repository_path,
     Environment environment,
     KnownFolders known_folders,
     FileSystemAccess file_system,
     DatabaseMigrator database_migrator,
     VersionResolver version_resolver,
     bool silent,
     bool dropping_the_database,
     bool dont_create_the_database,
     bool run_in_a_transaction,
     bool use_simple_recovery,
     ConfigurationPropertyHolder configuration)
 {
     this.known_folders = known_folders;
     this.repository_path = repository_path;
     this.environment = environment;
     this.file_system = file_system;
     this.database_migrator = database_migrator;
     this.version_resolver = version_resolver;
     this.silent = silent;
     this.dropping_the_database = dropping_the_database;
     this.dont_create_the_database = dont_create_the_database;
     this.run_in_a_transaction = run_in_a_transaction;
     this.use_simple_recovery = use_simple_recovery;
     this.configuration = configuration;
 }
예제 #14
0
        public static KnownFolders build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            MigrationsFolder alter_database_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.AlterDatabaseFolderName, false, false, "AlterDatabase");
            MigrationsFolder run_after_create_database_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunAfterCreateDatabaseFolderName, true, false, "Run After Create Database");
	        MigrationsFolder run_before_up_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunBeforeUpFolderName, false, false, "Run Before Update");
	        MigrationsFolder up_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.UpFolderName, true, false, "Update");
            MigrationsFolder down_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.DownFolderName, true, false, "Down Folder - Nothing to see here. Move along.");
            MigrationsFolder run_first_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunFirstAfterUpFolderName, false, false, "Run First After Update");
            MigrationsFolder functions_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.FunctionsFolderName, false, false, "Function");
            MigrationsFolder views_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.ViewsFolderName, false, false, "View");
            MigrationsFolder sprocs_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.SprocsFolderName, false, false, "Stored Procedure");
            MigrationsFolder indexes_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.IndexesFolderName, false, false, "Index");
            MigrationsFolder runAfterOtherAnyTimeScripts_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.RunAfterOtherAnyTimeScriptsFolderName, false, false, "Run after Other Anytime Scripts");
            MigrationsFolder permissions_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.PermissionsFolderName, false, true, "Permission");
            MigrationsFolder before_migration_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.BeforeMigrationFolderName, false, true, "BeforeMigration");
            MigrationsFolder after_migration_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory, configuration_property_holder.AfterMigrationFolderName, false, true, "AfterMigration");

            Folder change_drop_folder = new DefaultFolder(file_system, combine_items_into_one_path(file_system,
                                                                                                   configuration_property_holder.OutputPath,
                                                                                                   "migrations",
                                                                                                   remove_paths_from(configuration_property_holder.DatabaseName,file_system),
                                                                                                   remove_paths_from(configuration_property_holder.ServerName,file_system)),
                                                          get_run_date_time_string());

			return new DefaultKnownFolders(alter_database_folder, run_after_create_database_folder, run_before_up_folder, up_folder, down_folder, run_first_folder, functions_folder, views_folder, sprocs_folder, indexes_folder, runAfterOtherAnyTimeScripts_folder, permissions_folder, before_migration_folder, after_migration_folder, change_drop_folder);
        }
예제 #15
0
        public void SetDirectoryPermissionsTest()
        {
            string testDir    = @"c:\TestDirectory";
            string testSubDir = @"c:\TestDirectory\SubDir";

            if (Directory.Exists(testDir) == true)
            {
                Directory.Delete(testDir, true);
            }

            try
            {
                Directory.CreateDirectory(testSubDir);

                Assert.IsFalse(FileSystemAccess.DoesUserHaveAccessToDirectory(testDir, "BUILTIN\\Users", FileSystemRights.FullControl));
                Assert.IsFalse(FileSystemAccess.DoesUserHaveAccessToDirectory(testSubDir, "BUILTIN\\Users", FileSystemRights.FullControl));

                FileSystemAccess.SetDirectoryAccessByUserName(testDir, "BUILTIN\\Users", FileSystemRights.FullControl);

                Assert.IsTrue(FileSystemAccess.DoesUserHaveAccessToDirectory(testDir, "BUILTIN\\Users", FileSystemRights.FullControl));
                Assert.IsTrue(FileSystemAccess.DoesUserHaveAccessToDirectory(testSubDir, "BUILTIN\\Users", FileSystemRights.FullControl));
            }
            finally
            {
                //if (Directory.Exists(testDir) == true)
                //	Directory.Delete(testDir, true);
            }
        }
예제 #16
0
        /// <summary>
        /// 初始化安卓文件系统流的新实例。
        /// </summary>
        /// <param name="fullPath">要加载的文件系统的完整路径。</param>
        /// <param name="access">要加载的文件系统的访问方式。</param>
        /// <param name="createNew">是否创建新的文件系统流。</param>
        public AndroidFileSystemStream(string fullPath, FileSystemAccess access, bool createNew)
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                throw new Exception("Full path is invalid.");
            }

            if (access != FileSystemAccess.Read)
            {
                throw new Exception(DBD.Utility.Text.Format("'{0}' is not supported in AndroidFileSystemStream.", access.ToString()));
            }

            if (createNew)
            {
                throw new Exception("Create new is not supported in AndroidFileSystemStream.");
            }

            int position = fullPath.LastIndexOf(SplitFlag, StringComparison.Ordinal);

            if (position < 0)
            {
                throw new Exception("Can not find split flag in full path.");
            }

            string fileName = fullPath.Substring(position + SplitFlagLength);

            m_FileStream = InternalOpen(fileName);
            if (m_FileStream == null)
            {
                throw new Exception(DBD.Utility.Text.Format("Open file '{0}' from Android asset manager failure.", fullPath));
            }

            m_FileStreamRawObject = m_FileStream.GetRawObject();
        }
 public DefaultMigrationsFolder(FileSystemAccess file_system, string folder_path, string folder_name, bool should_run_items_in_folder_once, bool should_run_items_every_time, string friendly_name)
     : base(file_system, folder_path, folder_name)
 {
     this.should_run_items_in_folder_once  = should_run_items_in_folder_once;
     should_run_items_in_folder_every_time = should_run_items_every_time;
     this.friendly_name = friendly_name;
 }
예제 #18
0
        public static KnownFolders build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            MigrationsFolder up_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                     configuration_property_holder.UpFolderName, true, false);
            MigrationsFolder down_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                       configuration_property_holder.DownFolderName, true, false);
            MigrationsFolder run_first_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                            configuration_property_holder.RunFirstAfterUpFolderName, false, false);
            MigrationsFolder functions_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                            configuration_property_holder.FunctionsFolderName, false, false);
            MigrationsFolder views_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                        configuration_property_holder.ViewsFolderName, false, false);
            MigrationsFolder sprocs_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                         configuration_property_holder.SprocsFolderName, false, false);

            MigrationsFolder runAfterOtherAnyTimeScripts_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                                              configuration_property_holder.RunAfterOtherAnyTimeScriptsFolderName, false, false);

            MigrationsFolder permissions_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                              configuration_property_holder.PermissionsFolderName, false, true);
            Folder change_drop_folder = new DefaultFolder(file_system, combine_items_into_one_path(file_system,
                                                                                                   configuration_property_holder.OutputPath,
                                                                                                   configuration_property_holder.DatabaseName,
                                                                                                   configuration_property_holder.ServerName),
                                                          get_run_date_time_string());

            return(new DefaultKnownFolders(up_folder, down_folder, run_first_folder, functions_folder, views_folder, sprocs_folder,
                                           runAfterOtherAnyTimeScripts_folder, permissions_folder, change_drop_folder));
        }
예제 #19
0
        public static Logger build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            IList <Logger> loggers     = new List <Logger>();
            Logger         nant_logger = new NAntLogger(configuration_property_holder);

            loggers.Add(nant_logger);

            if (configuration_property_holder.MSBuildTask != null)
            {
                Logger msbuild_logger = new MSBuildLogger(configuration_property_holder);
                loggers.Add(msbuild_logger);
            }

            Logger log4net_logger = new Log4NetLogger(configuration_property_holder.Log4NetLogger);

            loggers.Add(log4net_logger);
            //Logger file_logger = new FileLogger(
            //            combine_items_into_one_path(
            //                file_system,
            //                known_folders.change_drop.folder_full_path,
            //                string.Format("{0}_{1}.log", ApplicationParameters.name, known_folders.change_drop.folder_name)
            //                ),
            //            file_system
            //        );
            //loggers.Add(file_logger);

            return(new MultipleLogger(loggers));
        }
예제 #20
0
 public DefaultMigrationsFolder(FileSystemAccess file_system, string folder_path, string folder_name, bool should_run_items_in_folder_once,bool should_run_items_every_time, string friendly_name)
     : base(file_system, folder_path, folder_name)
 {
     this.should_run_items_in_folder_once = should_run_items_in_folder_once;
     should_run_items_in_folder_every_time = should_run_items_every_time;
     this.friendly_name = friendly_name;
 }
예제 #21
0
 public RoundhouseMigrationRunner(
     string repository_path,
     Environment environment,
     KnownFolders known_folders,
     FileSystemAccess file_system,
     DatabaseMigrator database_migrator,
     VersionResolver version_resolver,
     bool silent,
     bool dropping_the_database,
     bool dont_create_the_database,
     bool run_in_a_transaction,
     bool use_simple_recovery)
 {
     this.known_folders            = known_folders;
     this.repository_path          = repository_path;
     this.environment              = environment;
     this.file_system              = file_system;
     this.database_migrator        = database_migrator;
     this.version_resolver         = version_resolver;
     this.silent                   = silent;
     this.dropping_the_database    = dropping_the_database;
     this.dont_create_the_database = dont_create_the_database;
     this.run_in_a_transaction     = run_in_a_transaction;
     this.use_simple_recovery      = use_simple_recovery;
 }
 public RoundhouseRedGateCompareRunner(KnownFolders known_folders, FileSystemAccess file_system, ConfigurationPropertyHolder configuration, RoundhouseMigrationRunner migration_runner)
 {
     this.known_folders = known_folders;
     this.file_system = file_system;
     this.configuration = configuration;
     this.migration_runner = migration_runner;
 }
예제 #23
0
        public static KnownFolders build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            MigrationsFolder alter_database_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                     configuration_property_holder.AlterDatabaseFolderName,false,false);
            MigrationsFolder run_after_create_database_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                     configuration_property_holder.RunAfterCreateDatabaseFolderName,true,false);
            MigrationsFolder up_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                     configuration_property_holder.UpFolderName, true, false);
            MigrationsFolder down_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                       configuration_property_holder.DownFolderName, true, false);
            MigrationsFolder run_first_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                            configuration_property_holder.RunFirstAfterUpFolderName, false, false);
            MigrationsFolder functions_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                            configuration_property_holder.FunctionsFolderName, false, false);
            MigrationsFolder views_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                        configuration_property_holder.ViewsFolderName, false, false);
            MigrationsFolder sprocs_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                         configuration_property_holder.SprocsFolderName, false, false);
            MigrationsFolder indexes_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                         configuration_property_holder.IndexesFolderName, false, false);

            MigrationsFolder runAfterOtherAnyTimeScripts_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                         configuration_property_holder.RunAfterOtherAnyTimeScriptsFolderName, false, false);

            MigrationsFolder permissions_folder = new DefaultMigrationsFolder(file_system, configuration_property_holder.SqlFilesDirectory,
                                                                              configuration_property_holder.PermissionsFolderName, false, true);
            Folder change_drop_folder = new DefaultFolder(file_system, combine_items_into_one_path(file_system,
                                                                                                   configuration_property_holder.OutputPath,
                                                                                                   configuration_property_holder.DatabaseName,
                                                                                                   configuration_property_holder.ServerName),
                                                          get_run_date_time_string());

            return new DefaultKnownFolders(alter_database_folder, run_after_create_database_folder,up_folder, down_folder, run_first_folder, functions_folder, views_folder, sprocs_folder, indexes_folder,
                runAfterOtherAnyTimeScripts_folder, permissions_folder, change_drop_folder);
        }
예제 #24
0
        /// <summary>
        /// Executes a
        /// <see cref="Org.Apache.Hadoop.Lib.Service.FileSystemAccess.FileSystemExecutor{T}"/
        ///     >
        /// using a filesystem for the effective
        /// user.
        /// </summary>
        /// <param name="ugi">user making the request.</param>
        /// <param name="executor">FileSystemExecutor to execute.</param>
        /// <returns>FileSystemExecutor response</returns>
        /// <exception cref="System.IO.IOException">thrown if an IO error occurrs.</exception>
        /// <exception cref="Org.Apache.Hadoop.Lib.Service.FileSystemAccessException">
        /// thrown if a FileSystemAccess releated error occurred. Thrown
        /// exceptions are handled by
        /// <see cref="HttpFSExceptionProvider"/>
        /// .
        /// </exception>
        private T FsExecute <T>(UserGroupInformation ugi, FileSystemAccess.FileSystemExecutor
                                <T> executor)
        {
            FileSystemAccess fsAccess = HttpFSServerWebApp.Get().Get <FileSystemAccess>();
            Configuration    conf     = HttpFSServerWebApp.Get().Get <FileSystemAccess>().GetFileSystemConfiguration
                                            ();

            return(fsAccess.Execute(ugi.GetShortUserName(), conf, executor));
        }
예제 #25
0
        private static bool restore_from_file_ends_with_LiteSpeed_extension(FileSystemAccess file_system, string restore_path)
        {
            if (string.IsNullOrEmpty(restore_path))
            {
                return(false);
            }

            return(file_system.get_file_name_without_extension_from(restore_path).ToLower().EndsWith("ls"));
        }
예제 #26
0
 public FileExplorerViewModel()
 {
     ContentId  = "FileExplorer";
     Title      = "File Explorer";
     IconSource = new BitmapImage(new Uri($"pack://application:,,/Resources/Images/FileExplore.png"));
     Items      = new ObservableCollection <DirectoryItemViewModel>(FileSystemAccess.GetDrives().ToList().Select(drive => {
         return(new DirectoryItemViewModel(drive));
     }));
 }
        public static VersionResolver build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            VersionResolver xml_version_finder = new XmlFileVersionResolver(file_system, configuration_property_holder.VersionXPath, configuration_property_holder.VersionFile);
            VersionResolver dll_version_finder = new DllFileVersionResolver(file_system, configuration_property_holder.VersionFile);
            VersionResolver script_number_version_finder = new ScriptfileVersionResolver(file_system, configuration_property_holder);

            IEnumerable<VersionResolver> resolvers = new List<VersionResolver> { xml_version_finder, dll_version_finder, script_number_version_finder };

            return new ComplexVersionResolver(resolvers);
        }
예제 #28
0
 /// <summary>
 /// 创建文件系统流。
 /// </summary>
 /// <param name="fullPath">要加载的文件系统的完整路径。</param>
 /// <param name="access">要加载的文件系统的访问方式。</param>
 /// <param name="createNew">是否创建新的文件系统流。</param>
 /// <returns>创建的文件系统流。</returns>
 public override FileSystemStream CreateFileSystemStream(string fullPath, FileSystemAccess access, bool createNew)
 {
     if (fullPath.StartsWith(AndroidFileSystemPrefixString))
     {
         return(new AndroidFileSystemStream(fullPath, access, createNew));
     }
     else
     {
         return(new CommonFileSystemStream(fullPath, access, createNew));
     }
 }
예제 #29
0
        /// <summary>Returns a filesystem instance.</summary>
        /// <remarks>
        /// Returns a filesystem instance. The fileystem instance is wired for release at the completion of
        /// the current Servlet request via the
        /// <see cref="Org.Apache.Hadoop.Lib.Servlet.FileSystemReleaseFilter"/>
        /// .
        /// <p>
        /// If a do-as user is specified, the current user must be a valid proxyuser, otherwise an
        /// <code>AccessControlException</code> will be thrown.
        /// </remarks>
        /// <param name="ugi">principal for whom the filesystem instance is.</param>
        /// <returns>a filesystem for the specified user or do-as user.</returns>
        /// <exception cref="System.IO.IOException">
        /// thrown if an IO error occurred. Thrown exceptions are
        /// handled by
        /// <see cref="HttpFSExceptionProvider"/>
        /// .
        /// </exception>
        /// <exception cref="Org.Apache.Hadoop.Lib.Service.FileSystemAccessException">
        /// thrown if a FileSystemAccess releated error occurred. Thrown
        /// exceptions are handled by
        /// <see cref="HttpFSExceptionProvider"/>
        /// .
        /// </exception>
        private FileSystem CreateFileSystem(UserGroupInformation ugi)
        {
            string           hadoopUser = ugi.GetShortUserName();
            FileSystemAccess fsAccess   = HttpFSServerWebApp.Get().Get <FileSystemAccess>();
            Configuration    conf       = HttpFSServerWebApp.Get().Get <FileSystemAccess>().GetFileSystemConfiguration
                                              ();
            FileSystem fs = fsAccess.CreateFileSystem(hadoopUser, conf);

            FileSystemReleaseFilter.SetFileSystem(fs);
            return(fs);
        }
예제 #30
0
        /// <summary>
        /// 加载文件系统。
        /// </summary>
        /// <param name="fullPath">要加载的文件系统的完整路径。</param>
        /// <param name="access">要加载的文件系统的访问方式。</param>
        /// <param name="stream">要加载的文件系统的文件系统流。</param>
        /// <returns>加载的文件系统。</returns>
        public static FileSystem Load(string fullPath, FileSystemAccess access, FileSystemStream stream)
        {
            FileSystem fileSystem = new FileSystem(fullPath, access, stream);

            stream.Read(s_CachedBytes, 0, HeaderDataSize);
            fileSystem.m_HeaderData = Utility.Marshal.BytesToStructure <HeaderData>(HeaderDataSize, s_CachedBytes);
            if (!fileSystem.m_HeaderData.IsValid)
            {
                return(null);
            }

            CalcOffsets(fileSystem);

            if (fileSystem.m_BlockDatas.Capacity < fileSystem.m_HeaderData.BlockCount)
            {
                fileSystem.m_BlockDatas.Capacity = fileSystem.m_HeaderData.BlockCount;
            }

            for (int i = 0; i < fileSystem.m_HeaderData.BlockCount; i++)
            {
                stream.Read(s_CachedBytes, 0, BlockDataSize);
                BlockData blockData = Utility.Marshal.BytesToStructure <BlockData>(BlockDataSize, s_CachedBytes);
                fileSystem.m_BlockDatas.Add(blockData);
            }

            for (int i = 0; i < fileSystem.m_BlockDatas.Count; i++)
            {
                BlockData blockData = fileSystem.m_BlockDatas[i];
                if (blockData.Using)
                {
                    StringData stringData = fileSystem.ReadStringData(blockData.StringIndex);
                    fileSystem.m_StringDatas.Add(blockData.StringIndex, stringData);
                    fileSystem.m_FileDatas.Add(stringData.GetString(fileSystem.m_HeaderData.GetEncryptBytes()), i);
                }
                else
                {
                    fileSystem.m_FreeBlockIndexes.Add(blockData.Length, i);
                }
            }

            int index = 0;

            foreach (KeyValuePair <int, StringData> i in fileSystem.m_StringDatas)
            {
                while (index < i.Key)
                {
                    fileSystem.m_FreeStringIndexes.Enqueue(index++);
                }

                index++;
            }

            return(fileSystem);
        }
예제 #31
0
        private async Task <(string, string)> LoadDiff()
        {
            var assetsFolder = await FileSystemAccess.GetAssetsFolderAsync();

            var diffFolder = await assetsFolder.GetFolderAsync("DiffView");

            var old = await FileIO.ReadTextAsync(await diffFolder.GetFileAsync("old.txt"));

            var newText = await FileIO.ReadTextAsync(await diffFolder.GetFileAsync("new.txt"));

            return(old, newText);
        }
        public static VersionResolver build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            VersionResolver xml_version_finder           = new XmlFileVersionResolver(file_system, configuration_property_holder.VersionXPath, configuration_property_holder.VersionFile);
            VersionResolver dll_version_finder           = new DllFileVersionResolver(file_system, configuration_property_holder.VersionFile);
            VersionResolver script_number_version_finder = new ScriptfileVersionResolver(file_system, configuration_property_holder);

            IEnumerable <VersionResolver> resolvers = new List <VersionResolver> {
                xml_version_finder, dll_version_finder, script_number_version_finder
            };

            return(new ComplexVersionResolver(resolvers));
        }
예제 #33
0
        public static Database build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            Database database_to_migrate;

            if (Assembly.GetExecutingAssembly().Location.Contains("roundhouse.dll"))
            {
                merge_assembly_name = "roundhouse";
            }

            try
            {
                string database_type = configuration_property_holder.DatabaseType;
                database_type = database_type.Substring(0, database_type.IndexOf(','));
                database_to_migrate = DefaultInstanceCreator.create_object_from_string_type<Database>(database_type + ", " + merge_assembly_name);

            }
            catch (NullReferenceException)
            {
                database_to_migrate = DefaultInstanceCreator.create_object_from_string_type<Database>(configuration_property_holder.DatabaseType);
            }

            if (restore_from_file_ends_with_LiteSpeed_extension(file_system, configuration_property_holder.RestoreFromPath))
            {
                database_to_migrate = new SqlServerLiteSpeedDatabase(database_to_migrate);
            }

            if (configuration_property_holder.Baseline)
            {
                database_to_migrate = new BaselineModeDatabase(database_to_migrate);
            }

            if (configuration_property_holder.DryRun)
            {
                database_to_migrate = new DryRunDatabase(database_to_migrate);
            }

            database_to_migrate.configuration = configuration_property_holder;
            database_to_migrate.server_name = configuration_property_holder.ServerName ?? string.Empty;
            database_to_migrate.database_name = configuration_property_holder.DatabaseName ?? string.Empty;
            database_to_migrate.connection_string = configuration_property_holder.ConnectionString;
            database_to_migrate.admin_connection_string = configuration_property_holder.ConnectionStringAdmin;
            database_to_migrate.roundhouse_schema_name = configuration_property_holder.SchemaName;
            database_to_migrate.version_table_name = configuration_property_holder.VersionTableName;
            database_to_migrate.scripts_run_table_name = configuration_property_holder.ScriptsRunTableName;
            database_to_migrate.scripts_run_errors_table_name = configuration_property_holder.ScriptsRunErrorsTableName;
            database_to_migrate.user_name = get_identity_of_person_running_roundhouse();
            database_to_migrate.command_timeout = configuration_property_holder.CommandTimeout;
            database_to_migrate.admin_command_timeout = configuration_property_holder.CommandTimeoutAdmin;
            database_to_migrate.restore_timeout = configuration_property_holder.RestoreTimeout;

            return database_to_migrate;
        }
        public virtual void FileSystemExecutorException()
        {
            string dir      = TestDirHelper.GetTestDir().GetAbsolutePath();
            string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService
                                                                         ).FullName, typeof(SchedulerService).FullName, typeof(FileSystemAccessService).FullName
                                                                  ));
            Configuration hadoopConf = new Configuration(false);

            hadoopConf.Set(CommonConfigurationKeysPublic.FsDefaultNameKey, TestHdfsHelper.GetHdfsConf
                               ().Get(CommonConfigurationKeysPublic.FsDefaultNameKey));
            CreateHadoopConf(hadoopConf);
            Configuration conf = new Configuration(false);

            conf.Set("server.services", services);
            conf.Set("server.hadoop.filesystem.cache.purge.timeout", "0");
            Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server
                                                             ("server", dir, dir, dir, dir, conf);
            server.Init();
            FileSystemAccess hadoop = server.Get <FileSystemAccess>();

            FileSystem[] fsa = new FileSystem[1];
            try
            {
                hadoop.Execute("u", hadoop.GetFileSystemConfiguration(), new _FileSystemExecutor_377
                                   (fsa));
                NUnit.Framework.Assert.Fail();
            }
            catch (FileSystemAccessException ex)
            {
                NUnit.Framework.Assert.AreEqual(ex.GetError(), FileSystemAccessException.ERROR.H03
                                                );
            }
            catch (Exception)
            {
                NUnit.Framework.Assert.Fail();
            }
            try
            {
                fsa[0].Mkdirs(new Path("/tmp/foo"));
                NUnit.Framework.Assert.Fail();
            }
            catch (IOException)
            {
            }
            catch (Exception)
            {
                NUnit.Framework.Assert.Fail();
            }
            server.Destroy();
        }
 public RoundhouseUpdateCheckRunner(
     EnvironmentSet environment_set,
     KnownFolders known_folders,
     FileSystemAccess file_system,
     DatabaseMigrator database_migrator,
     ConfigurationPropertyHolder configuration,
     RoundhouseMigrationRunner migration_runner)
 {
     this.environment_set   = environment_set;
     this.known_folders     = known_folders;
     this.file_system       = file_system;
     this.database_migrator = database_migrator;
     this.configuration     = configuration;
     this.migration_runner  = migration_runner;
 }
예제 #36
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Falsche Verwendung! Bitte: SettleImageGallery Verzeichnis_für_Galerie");
                return;
            }

            IFileSystemAccess fileSystemAccess = new FileSystemAccess();
            var    gallery        = new GalleryDirectory(fileSystemAccess);
            string galleryDirPath = args[0];

            gallery.MoveAllImagesToFlatOrder(galleryDirPath);
            RemoveEmptySubdirectories(galleryDirPath);
        }
예제 #37
0
        void test()
        {
            FileSystemAccess _fileSystem = new FileSystemAccess();


            _filePath    = _fileSystem.GetCombinePath("TestH1.wav");
            _filePathFig = _fileSystem.GetCombinePath("TestH1Fig.png");

            (double[] audio, int sampleRate) = ReadWAV(_filePath);
            var sg = new SpectrogramGenerator(sampleRate, fftSize: 4096, stepSize: 500, maxFreq: 3000);

            sg.Add(audio);

            sg.SaveImage(_filePathFig);
        }
예제 #38
0
        public static VersionResolver build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
        {
            VersionResolver commandLine_version_finder = new CommandLineVersionResolver(configuration_property_holder.Version);

            if (commandLine_version_finder.meets_criteria())
            {
                return commandLine_version_finder;
            }
            else
            {
                VersionResolver xml_version_finder = new XmlFileVersionResolver(file_system, configuration_property_holder.VersionXPath, configuration_property_holder.VersionFile);
                VersionResolver dll_version_finder = new DllFileVersionResolver(file_system, configuration_property_holder.VersionFile);
                VersionResolver text_version_finder = new TextVersionResolver(file_system, configuration_property_holder.VersionFile);
                VersionResolver script_number_version_finder = new ScriptfileVersionResolver(file_system, configuration_property_holder);

                IEnumerable<VersionResolver> resolvers = new List<VersionResolver> { xml_version_finder, dll_version_finder, text_version_finder, script_number_version_finder };

                return new ComplexVersionResolver(resolvers);
            }
        }
예제 #39
0
 public DefaultFolder(FileSystemAccess file_system, string folder_path, string folder_name)
 {
     this.file_system = file_system;
     this.folder_path = folder_path;
     this.folder_name = folder_name;
 }
 public ScriptfileVersionResolver(FileSystemAccess file_system, string  version_file, string upFolder)
 {
     this.version_file = version_file;
     this.file_system = file_system;
     this.up_folder = upFolder;
 }
예제 #41
0
        private static bool restore_from_file_ends_with_LiteSpeed_extension(FileSystemAccess file_system, string restore_path)
        {
            if (string.IsNullOrEmpty(restore_path)) return false;

            return file_system.get_file_name_without_extension_from(restore_path).ToLower().EndsWith("ls");
        }
 public ScriptfileVersionResolver(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder)
 {
     this.file_system = file_system;
     this.version_file = configuration_property_holder.VersionFile;
     this.up_folder = file_system.combine_paths(configuration_property_holder.SqlFilesDirectory, configuration_property_holder.UpFolderName);
 }
예제 #43
0
 private static string remove_paths_from(string name, FileSystemAccess file_system)
 {
     return file_system.get_file_name_without_extension_from(name);
 }
예제 #44
0
 private static string combine_items_into_one_path(FileSystemAccess file_system, params string[] paths)
 {
     return file_system.combine_paths(paths);
 }
예제 #45
0
 public TextVersionResolver(FileSystemAccess file_system, string version_file)
 {
     this.file_system = file_system;
     this.version_file = file_system.get_full_path(version_file);
 }
예제 #46
0
 public XmlFileVersionResolver(FileSystemAccess file_system, string x_path, string version_file)
 {
     this.file_system = file_system;
     this.x_path = x_path;
     this.version_file = file_system.get_full_path(version_file);
 }
예제 #47
0
 public FileLogger(string log_file_path,FileSystemAccess file_system)
 {
     this.log_file_path = log_file_path;
     this.file_system = file_system;
 }