public ApplicationOperator(IOpenStackService openstack, IOptions <Models.ApplicationOptions> options)
        {
            //this.m_Timer = new System.Timers.Timer();
            this.m_Zipper = new MyApplication.Archive.Zip(this);
            this.m_Unit   = new DataCapacityUnit()
            {
                Bytes = 0
            };

            this.Options   = options.Value;
            this.OpenStack = openstack;

            // イベント登録
            //this.m_Timer.Elapsed += this.OnTimerTick;
            this.m_Zipper.AsyncEnd += this.OnAsyncCompressed;
        }
        public void Execute()
        {
            // セーブデータディレクトリがあるかどうかチェックする。なければ作る。
            if (!System.IO.Directory.Exists(Options.SavedataPath))
            {
                System.IO.Directory.CreateDirectory(Options.SavedataPath);
            }

            // テンポラリ用ディレクトリのパスをチェック。
            // 中身がなければ、 ./temp で初期化する。
            if (String.IsNullOrEmpty(TemporaryPath))
            {
                TemporaryPath = "./temp";
            }

            // アプリケーションのパスを取得します。
            this.UpdateBasePath();

            // コンテナリスト
            System.Collections.Generic.IEnumerable <MyApplication.Objects.Container> ContainerList = OpenStack.GetContainers();

            // オブジェクトリスト
            //System.Collections.Generic.IEnumerable<MyApplication.Objects.ContainerObject> ObjectList = null;

            // オブジェクトストレージ内の全体使用率をみる

            if (ContainerList.Count() > 0)
            {
                DataCapacityUnit Unit = new DataCapacityUnit()
                {
                    Bytes = 0
                };

                // 全コンテナのサイズ計算
                foreach (var entry in ContainerList)
                {
                    Unit.Bytes += entry.Bytes;
                }

                // 全体で50GB以上使用してるなら、オブジェクトストレージ内を一掃する。
                if (Unit.Giga > 50)
                {
                    foreach (var entry in ContainerList)
                    {
                        OpenStack.DeleteContainer(entry.Name, true);
                    }

                    this.Logger.WriteLine("Object storage clean up executed.");
                }
            }

            // オブジェクトストレージ内に使用するコンテナ作成準備。
            // 既に同名のコンテナがあれば作りません。

            // 多重防止用汎用フラグ。存在するなら true, しないなら false
            bool IsExists = false;

            if (!OpenStack.SearchContainer(Options.UseContainerName))
            {
                OpenStack.CreateContainer(Options.UseContainerName);
            }

            // ローカル内の最新セーブデータ日付
            string LastDateInLocal = null;

            try {
                // セーブデータがあるディレクトリのサブディレクトリを列挙します。
                string[] SubDirectories = System.IO.Directory.GetDirectories(Options.SavedataPath, "*", System.IO.SearchOption.TopDirectoryOnly);

                // サブディレクトリが1個もなければ、なにもしません。
                if (SubDirectories.Length > 0)
                {
                    // 関数に使用する整形したリストを作ります。
                    List <string> FormatList = new List <string>(SubDirectories.Length);

                    foreach (var entry in SubDirectories)
                    {
                        FormatList.Add(System.IO.Path.GetFileName(entry));
                    }

                    // ローカル内の最新日付を取得します。
                    LastDateInLocal = this.GetLastedDateTime(FormatList, Options.SavedataFormat);
                }
            } catch (System.Exception ex) {
                this.Logger.WriteLine(ex.Message, eLogLevel.ERROR);
            }

            // ローカルのセーブデータ名の取得に失敗してたならエラーなので、関数を抜けます。
            if (string.IsNullOrEmpty(LastDateInLocal))
            {
                this.Logger.WriteLine("Failed to get local save data name.", eLogLevel.ERROR);
                return;
            }

            // アップロード準備
            // 日付の文字列形式をアップロード用に変化させます。
            DateTime offset          = DateTime.ParseExact(LastDateInLocal, Options.SavedataFormat, null);
            string   ArchiveFileName = offset.ToString(Options.ArchiveFormat) + ".zip";

            IsExists = false;

            ContainerList = OpenStack.GetContainers();

            // コンテナの中身がなければ、確定でアップロードします。
            if (ContainerList.Count() > 0)
            {
                // 既に同名のアーカイブがオブジェクトストレージ内にあるならアップロードしません。
                if (OpenStack.SearchObject(Options.UseContainerName, ArchiveFileName))
                {
                    IsExists = true;

                    this.Logger.WriteLine("The same file is in object storage.");
                }
            }

            // テンポラリディレクトリを新しく作ります。
            if (!System.IO.Directory.Exists(this.TemporaryPath))
            {
                System.IO.Directory.CreateDirectory(this.TemporaryPath);
            }

            // オブジェクトストレージに同一アーカイブがないなら圧縮しません。
            if (!IsExists)
            {
                // ローカル内のセーブデータディレクトリをzip形式に圧縮します。
                this.m_Zipper.Compress(Options.SavedataPath + "/" + LastDateInLocal, this.TemporaryPath + "/" + ArchiveFileName);
            }
        }