コード例 #1
0
        public RestoreHelper(ItemClass itemClass)
        {
            m_remoteItemClass = itemClass;

            if (m_remoteItemClass == ItemClass.Blob)
            {
                m_azureHelper = new AzureStorageHelper();
            }
            else
            {
                m_fileHelper = new FileStorageHelper();
            }
        }
コード例 #2
0
        public RemoteFetchHelper(ItemClass itemClass)
        {
            m_remoteItemClass = itemClass;

            m_localDirectory = ConfigHelper.GetConfigurationValue("LocalPath");

            if (m_remoteItemClass == ItemClass.Blob)
            {
                m_azureHelper = new AzureStorageHelper();
            }
            else
            {
                m_remoteStorage = ConfigHelper.GetConfigurationValue("RemoteStorage");
            }
        }
コード例 #3
0
        public SyncHelper(ItemClass itemClass, bool debug)
        {
            m_remoteItemClass = itemClass;
            m_common          = new Common();

            m_isDebug = debug;

            if (m_remoteItemClass == ItemClass.Blob)
            {
                m_azureStorageHelper = m_azureStorageHelper ?? new AzureStorageHelper();
            }
            else
            {
                m_fileStorageHelper = m_fileStorageHelper ?? new FileStorageHelper();
                m_remoteStorage     = new DirectoryInfo(ConfigHelper.GetConfigurationValue("RemoteStorage"));
                m_remoteUsername    = ConfigHelper.GetFileStorageUsername();
                m_remotePassword    = ConfigHelper.GetFileStoragePassword();
            }

            m_isRunningOnWindows = Path.DirectorySeparatorChar.Equals('\\') ? true : false;

            // Get the application settings
            m_localDirectory = new DirectoryInfo(ConfigHelper.GetConfigurationValue("LocalPath"));
            m_remoteStorage  = new DirectoryInfo(ConfigHelper.GetConfigurationValue("RemoteStorage"));

            m_copyFilesToRemoteStorage             = ConfigHelper.GetConfigurationBoolean("CopyFilesToRemoteStorage");
            m_deleteExplicitFilesFromRemoteStorage = ConfigHelper.GetConfigurationBoolean("DeleteExplicitFilesFromRemoteStorage");
            m_fetchExplicitFilesFromRemoteStorage  = ConfigHelper.GetConfigurationBoolean("FetchExplicitFilesFromRemoteStorage");
            m_deleteMissingFilesFromRemoteStorage  = ConfigHelper.GetConfigurationBoolean("DeleteMissingFilesFromRemoteStorage");
            m_deleteMissingFilesFromLocalStorage   = ConfigHelper.GetConfigurationBoolean("DeleteMissingFilesFromLocalStorage");
            m_fetchFilesFromRemoteStorage          = ConfigHelper.GetConfigurationBoolean("FetchFilesFromRemoteStorage");
            m_explicitFilesToDeleteMatchingString  = ConfigHelper.GetConfigurationValue("ExplicitFilesToDeleteMatchingString");
            m_explicitFilesToFetchMatchingString   = ConfigHelper.GetConfigurationValue("ExplicitFilesToFetchMatchingString");
            m_itemSortOrder = ConfigHelper.GetConfigurationValue("ItemSortOrder")
                              .Equals("Size", StringComparison.InvariantCultureIgnoreCase)
                                ? ItemSortOrder.Size
                                : ItemSortOrder.Name;
            var compressAndEncrypt = ConfigHelper.GetConfigurationBoolean("CompressAndEncrypt");
            var encryptOnly        = ConfigHelper.GetConfigurationBoolean("EncryptOnly");


            if (string.IsNullOrEmpty(m_explicitFilesToDeleteMatchingString))
            {
                // Don't delete any explicit files from Remote Path
                m_deleteExplicitFilesFromRemoteStorage = false;
                m_explicitFilesToDeleteMatchingString  = string.Empty;
            }

            if (string.IsNullOrEmpty(m_explicitFilesToFetchMatchingString))
            {
                // Don't delete any explicit files from Remote Path
                m_fetchExplicitFilesFromRemoteStorage = false;
                m_explicitFilesToFetchMatchingString  = string.Empty;
            }

            // Override the debug value
            m_isDebug = !ConfigHelper.GetConfigurationValue("DebugOverride")
                        .Equals("True", StringComparison.InvariantCultureIgnoreCase);

            // Encrypt and Compress settings -- only one can be true, default to EncryptOnly if set
            if (compressAndEncrypt && encryptOnly)
            {
                compressAndEncrypt = false;
            }

            // Will only synchronise files that have the EncryptedFileExtension file type
            // And this is only set if either of the encryption settings is set
            m_syncEncryptedFilesOnly = compressAndEncrypt || encryptOnly;
            m_encryptedFileExtension = ConfigHelper.GetConfigurationValue("EncryptedFileExtension") ?? ".absz";
        }