示例#1
0
        /// <summary>
        /// OfficeFileオブジェクトの新しいインスタンスを初期化します。
        /// </summary>
        /// <param name="fileType"></param>
        protected OfficeFile(OfficeFileType fileType)
        {
            this.m_ScriptOutputMessage = "";
            this.m_FileType            = fileType;
            this.m_FileName            = "";
            this.m_ExportDate          = null;

            this.m_BackupPathList = new List <string>();

            //WorkspacelFolder
            this.m_WorkspaceFolder = new WorkFolder {
                BaseFolderPath = AppMain.g_AppMain.WorkspaceFolderPath,
                DeleteAtClose  = false
            };
            this.m_WorkspaceFolder.PathChanged        += this.M_WorkspaceFolder_PathChanged;
            this.m_WorkspaceFolder.BeforeDeleteFolder += this.M_WorkspaceFolder_BeforeDeleteFolder;
            this.m_WorkspaceFolder.AfterCreateFolder  += this.M_WorkspaceFolder_AfterCreateFolder;

            //FileSystemWatcherのインスタンスはコンストラクタで生成するが、監視は別タイミングで開始する
            this.m_TargetFileWatcher      = new FileSystemWatcher();
            this.m_WorkspaceFolderWatcher = new FileSystemWatcher();

            //FileNameの変更タイミングでファイル監視を開始/終了する
            this.FileNameChanged += this.OfficeFile_FileNameChanged;

            //Workspaceフォルダ監視のタイミング調整のため、Exportingプロパティを監視
            this.ExportingChanged += this.OfficeFile_ExportingChanged;
            //TargetFileの監視タイミング調整のため、Importingプロパティを監視
            this.ImportingChanged += this.OfficeFile_ImportingChanged;
        }
示例#2
0
        /// <summary>
        /// 指定したフォルダを履歴情報に追加します。
        /// </summary>
        /// <param name="folderName"></param>
        public void AddHistory(string folderName)
        {
            if (Directory.Exists(folderName))
            {
                string name = Path.GetFileName(folderName);
                string path = Path.Combine(AppMain.g_AppMain.HistoryFolderPath, name);

                if (path != folderName)
                {
                    //folderNameがHistoryFolder直下ではない場合、フォルダコピー
                    WorkFolder folder = new WorkFolder()
                    {
                        Path = folderName, DeleteAtClose = false
                    };
                    folder.CopyFolder(AppMain.g_AppMain.HistoryFolderPath, name);
                }
                this.m_BackupPathList.Add(name);
            }
        }