/// <summary> サウンドディレクトリの状態を確認し、ステータスと機能の有効状態を変更します。 /// </summary> /// <param name="pCommonDataModel"> 参照と設定に使用する共通データモデル </param> public void CheckSoundResourceDirectory(CommonDataModel pCommonDataModel) { if (string.IsNullOrWhiteSpace(pCommonDataModel.PluginSettingsData.SoundResourceDirectory) || !Directory.Exists(pCommonDataModel.PluginSettingsData.SoundResourceDirectory)) { pCommonDataModel.AppCommonData.SoundDirectoryStatus = "Directory Not Found."; pCommonDataModel.AppStatusData.SoundResourceDirectoryStatus = DirectoryStatus.NotFound; return; } var files = Directory.GetFiles(pCommonDataModel.PluginSettingsData.SoundResourceDirectory, "*.wav"); if (files.Count() > 0) { pCommonDataModel.AppStatusData.SoundResourceDirectoryStatus = DirectoryStatus.FoundFile; } else { pCommonDataModel.AppStatusData.SoundResourceDirectoryStatus = DirectoryStatus.ZeroFile; } pCommonDataModel.AppCommonData.SoundDirectoryStatus = string.Format("Found {0} .wav Files", files.Count()); return; }
/// <summary> タイマー処理を開始します。 /// </summary> public void TimerStart(CommonDataModel pCommonDM, TimelineObjectModel pTimelineOM) { switch (pCommonDM.AppStatusData.CurrentCombatTimerStatus) { case TimerStatus.Init: case TimerStatus.Stop: case TimerStatus.Pause: break; case TimerStatus.Run: return; } var artList = pTimelineOM.AlertList.Where(a => a.TimeFromStart >= pTimelineOM.TimerData.CurrentCombatTime); foreach (var art in artList) { art.Processed = false; } this.CurrentCombatRelativeClock.CurrentTime = pTimelineOM.TimerData.CurrentCombatTime; this.CurrentCombatTimer.Start(); pCommonDM.AppStatusData.CurrentCombatTimerStatus = TimerStatus.Run; this.TimerFunctionEnabledChange(pCommonDM); }
/*--- Method: private -----------------------------------------------------------------------------------------------------------------------------------------*/ /// <summary> 標準型タイムラインビューを開きます。 /// </summary> /// <param name="pTimelineC"> タイムラインコンポーネント </param> /// <param name="pOverlayViewC"> オーバーレイ表示コンポーネント </param> private void openStandardTimelineView(CommonDataModel pCommonDM, TimelineComponent pTimelineC, OverlayViewComponent pOverlayViewC) { OverlayWindow window = new OverlayWindow(); window.Topmost = true; var vm = window.DataContext as OverlayWindowViewModel; if (vm != null) { vm.TimelineComponent = pTimelineC; vm.OverlayViewComponent = pOverlayViewC; } if (pOverlayViewC.CommonDataModel.AppStatusData.AppMode != AppMode.Desing) { window.Show(); } // ViewのIntPtrを採取 IntPtr intPtr = new WindowInteropHelper(window).Handle; pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr = intPtr; if (!pCommonDM.AppCommonData.ViewIntPtrList.Contains(intPtr)) { pCommonDM.AppCommonData.ViewIntPtrList.Add(intPtr); } if (pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowLock) { WindowsServices.SetWindowExTransparent(pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr); } }
/*--- Method: public ------------------------------------------------------------------------------------------------------------------------------------------*/ /// <summary> タイムラインディレクトリの状態を確認し、ステータスと機能の有効状態を変更します。 /// </summary> /// <param name="pCommonDataModel"> 参照と設定に使用する共通データモデル </param> public void CheckTimelineResourceDirectory(CommonDataModel pCommonDataModel) { pCommonDataModel.TimelineFileCollection.Clear(); pCommonDataModel.SelectedTimelineFileData = null; pCommonDataModel.AppEnableManageData.TimelineFileLoadEnabled = false; if (string.IsNullOrWhiteSpace(pCommonDataModel.PluginSettingsData.TimelineResourceDirectory) || !Directory.Exists(pCommonDataModel.PluginSettingsData.TimelineResourceDirectory)) { pCommonDataModel.AppCommonData.TimelineDirectoryStatus = "Directory Not Found."; pCommonDataModel.AppStatusData.TimelineResourceDirectoryStatus = DirectoryStatus.NotFound; return; } var files = Directory.GetFiles(pCommonDataModel.PluginSettingsData.TimelineResourceDirectory, "*.txt"); if (files.Count() > 0) { pCommonDataModel.AppStatusData.TimelineResourceDirectoryStatus = DirectoryStatus.FoundFile; this.CreateTimelineFileCollection(pCommonDataModel); pCommonDataModel.SelectedTimelineFileData = pCommonDataModel.TimelineFileCollection[0]; pCommonDataModel.AppEnableManageData.TimelineFileLoadEnabled = true; } else { pCommonDataModel.AppStatusData.TimelineResourceDirectoryStatus = DirectoryStatus.ZeroFile; } pCommonDataModel.AppCommonData.TimelineDirectoryStatus = string.Format("Found {0} .txt Files", files.Count()); return; }
/// <summary> プラグインの更新確認を実行します。 /// </summary> /// <param name="pCommonDM"> 設定情報を参照する共通データモデル </param> /// <returns> 正常にアップデート確認できた場合 True </returns> public bool PluginUpdateCheck(CommonDataModel pCommonDM) { var ass = Assembly.GetExecutingAssembly(); var name = ass.GetName(); UpdateCheckSettingsData data = new UpdateCheckSettingsData(); data.PluginVersion = name.Version; //data.PluginVersion = new Version(0, 0, 0, 1); pCommonDM.LogDataCollection.Add( Globals.SysLogger.WriteSystemLog.NonState.DEBUG.Write(string.Format("PluginVersion: {0}", name.Version))); data.InfoDonwloadUri = pCommonDM.PluginVersionInfo.CheckPluginInfoUri; data.SaveInfoDirectory = pCommonDM.ApplicationData.RoamingDirectoryPath; data.SaveInfoFileName = "New" + pCommonDM.ApplicationData.VersionInfoFileName; if (!string.IsNullOrWhiteSpace(pCommonDM.ApplicationData.PluginDllDirectory)) { data.SaveZipDirectory = pCommonDM.ApplicationData.PluginDllDirectory + @"\Download"; } else { data.SaveZipDirectory = this.getAssemblyDataProcess.GetAssemblyDirectory() + @"\Download"; } Task.Run(() => this.PluginUpdateObjectModel.UpdateCheck(data)); return(true); }
/// <summary> オーバーレイを全て表示します。 /// </summary> /// <param name="pTimelineComponent"> オーバーレイに搭載するタイムラインコンポーネント </param> /// <param name="pOverlayViewList"> 表示するオーバーレイのリスト(IF) </param> public void ShowOverlay(CommonDataModel pCommonDM, TimelineComponent pTimelineComponent, IList <OverlayViewComponent> pOverlayViewList) { foreach (var overlay in pOverlayViewList) { this.ShowOverlay(pCommonDM, pTimelineComponent, overlay); } }
/// <summary> タイムラインの各種パスを生成します。 /// </summary> /// <param name="pApplicationData"> パス情報を設定するアプリケーションデータ </param> public void CreateTimelinePath(CommonDataModel pCommonDM) { // Roaming pCommonDM.ApplicationData.RoamingDirectoryPath = this.appDataPathCreateProcess.CreateRoamingDirectoryPath(); // DLL if (!string.IsNullOrWhiteSpace(Globals.PluginDllDirectoryPath)) { pCommonDM.ApplicationData.PluginDllDirectory = Globals.PluginDllDirectoryPath; pCommonDM.LogDataCollection.Add( Globals.SysLogger.WriteSystemLog.Success.DEBUG.Write(string.Format("DllPath-Globals {0}", Globals.PluginDllDirectoryPath))); } else { pCommonDM.ApplicationData.PluginDllDirectory = getAssemblyDataProcess.GetAssemblyDirectory(); pCommonDM.LogDataCollection.Add( Globals.SysLogger.WriteSystemLog.Success.DEBUG.Write(string.Format("DllPath-Assembly {0}", Globals.PluginDllDirectoryPath))); } // Temp this.appDataPathCreateProcess.SetTempDirectoryPath(pCommonDM.ApplicationData); // Overlay this.appDataPathCreateProcess.SetOverlayDirectoryPath(pCommonDM.ApplicationData); return; }
/// <summary> 新しいオーバーレイカスタムウィンドウを作成し、表示します。 /// </summary> /// <param name="pOverlayViewComponent"> カスタム対象のオーバーレイコンポーネント </param> public void NewOverlayCustomWindowOpen(CommonDataModel pCommonDM, OverlayViewComponent pOverlayViewComponent) { pOverlayViewComponent.OverlayDataModel.OverlayViewData.OverlayCustomClosed = false; OverlayCustomWindow window = new OverlayCustomWindow(); ElementHost.EnableModelessKeyboardInterop(window); var vm = window.DataContext as OverlayCustomWindowViewModel; if (vm == null) { return; } vm.OverlayViewComponent = pOverlayViewComponent; if (pOverlayViewComponent.CommonDataModel.AppStatusData.AppMode != AppMode.Desing) { window.Show(); } // ViewのIntPtrを採取 IntPtr intPtr = new WindowInteropHelper(window).Handle; if (!pCommonDM.AppCommonData.ViewIntPtrList.Contains(intPtr)) { pCommonDM.AppCommonData.ViewIntPtrList.Add(intPtr); } }
/// <summary> 戦闘時間が進む時の処理を実行します。 /// </summary> /// <param name="pTimerDataModel"></param> /// <param name="pTimelineDataModel"></param> public void CombatTimeTick(CommonDataModel pCommonDM, TimelineObjectModel pTimelineOM) { if (pCommonDM.AppStatusData.CurrentCombatTimerStatus != TimerStatus.Run) { return; } pTimelineOM.TimerData.CurrentCombatTime = this.CurrentCombatRelativeClock.CurrentTime; // アラート再生 var pendingAlerts = pTimelineOM.PendingAlertsAt(pTimelineOM.TimerData.CurrentCombatTime, AppConst.TooOldThreshold); foreach (var pendingAlert in pendingAlerts) { if (pendingAlert.AlertSoundData != null) { pendingAlert.Processed = soundPlayProcess.PlayAlert(pendingAlert, pCommonDM.PluginSettingsData.PlaySoundByACT); pCommonDM.TimelineLogCollection.Add( Globals.TimelineLogger.WriteSystemLog.Success.INFO.Write(string.Format("PendingAlerts: {0}", pendingAlert.AlertSoundData.Filename), Globals.ProjectName)); } else { pendingAlert.Processed = pendingAlert.TtsSpeaker.Synthesizer.SpeakAsync(pendingAlert.TtsSentence); //pCommonDM.TimelineLogCollection.Add( // Globals.TimelineLogger.WriteSystemLog.Success.INFO.Write(string.Format("PendingAlerts: {0}", pendingAlert.TtsSentenc), Globals.ProjectName)); } //pCommonDM.TimelineLogCollection.Add( // Globals.TimelineLogger.WriteSystemLog.Success.INFO.Write(string.Format("PendingAlerts: {0}", pendingAlert.AlertSoundData.Filename), Globals.ProjectName)); } }
/*--- Method: public ------------------------------------------------------------------------------------------------------------------------------------------*/ /// <summary> タイムラインデータモデルを生成します。 /// </summary> /// <param name="pCommonDM"> 共通データモデル </param> /// <param name="pTimelineDM"> 作成データを格納するタイムラインデータモデル </param> /// <param name="pTimerDM"> タイマーデータモデル </param> //public void CreateTimelineDataModel(CommonDataModel pCommonDM, TimelineDataModel pTimelineDM, TimerDataModel pTimerDM) public void CreateTimelineDataModel(CommonDataModel pCommonDM, TimelineObjectModel pTimelineOM) { switch (pCommonDM.AppStatusData.TimelineLoadStatus) { case TimelineLoadStatus.NowLoading: return; } this.TimelineDataClear(pCommonDM, pTimelineOM); pCommonDM.AppStatusData.TimelineLoadStatus = TimelineLoadStatus.NowLoading; this.TimelineFunctionEnabledChange(pCommonDM); Globals.SoundFilesRoot = pCommonDM.PluginSettingsData.SoundResourceDirectory; if (pCommonDM.SelectedTimelineFileData == null) { pCommonDM.AppStatusData.TimelineLoadStatus = TimelineLoadStatus.Failure; this.TimelineFunctionEnabledChange(pCommonDM); return; } try { TimelineLoader.LoadFromFile(pTimelineOM, pCommonDM.SelectedTimelineFileData.TimelineFileFullPath); } catch (Exception e) { pCommonDM.LogDataCollection.Add(Globals.SysLogger.WriteSystemLog.Failure.ERROR.Write(e.Message, Globals.ProjectName)); Globals.ErrLogger.WriteStackTrace(e); pCommonDM.AppCommonData.TimelineLoadErrorMsg = "LoadError: " + e.Message; pCommonDM.AppStatusData.TimelineLoadStatus = TimelineLoadStatus.Failure; this.TimelineFunctionEnabledChange(pCommonDM); pCommonDM.SelectedTimelineFileData.TimelineFileName = string.Empty; pCommonDM.SelectedTimelineFileData.TimelineFileFullPath = string.Empty; return; } finally { } // タイムラインアイテムコレクションの生成 foreach (var data in pTimelineOM.ActivityCollection) { // タイムラインタイプとジョブを設定 this.timelineItemAnalyzProcess.SetTimelineType(data); this.timelineItemAnalyzProcess.SetTimelineJob(data); } // 最終ロードファイルの変更 pCommonDM.PluginSettingsData.LastLoadTimelineFileName = pCommonDM.SelectedTimelineFileData.TimelineFileName; pCommonDM.PluginSettingsData.LastLoadTimelineFullPath = pCommonDM.SelectedTimelineFileData.TimelineFileFullPath; pCommonDM.ViewRefresh(); pCommonDM.AppStatusData.TimelineLoadStatus = TimelineLoadStatus.Success; this.TimelineFunctionEnabledChange(pCommonDM); }
/// <summary> オーバーレイを表示します。 /// </summary> /// <param name="pTimelineComponent"> タイムラインコンポーネント </param> /// <param name="pOverlayViewComponent"> </param> public void ShowOverlay(CommonDataModel pCommonDM, TimelineComponent pTimelineComponent, OverlayViewComponent pOverlayViewComponent) { if (!pOverlayViewComponent.OverlayDataModel.OverlayWindowData.WindowVisibility) { return; } this.overlayViewOpenProcess.NewOverlayOpen(pCommonDM, pTimelineComponent, pOverlayViewComponent); }
/// <summary> タイムラインロードステータスを参照し、機能の有効状態を更新します。 /// </summary> /// <param name="pCommonDM"></param> public void TimelineFunctionEnabledChange(CommonDataModel pCommonDM) { switch (pCommonDM.AppStatusData.TimelineLoadStatus) { case TimelineLoadStatus.NowLoading: pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = false; pCommonDM.AppEnableManageData.RefreshTimelineListEnabled = false; pCommonDM.AppEnableManageData.TimelinePlayEnabled = false; pCommonDM.AppEnableManageData.TimelinePauseEnabled = false; pCommonDM.AppEnableManageData.TimelineRewindEnabled = false; pCommonDM.AppEnableManageData.TimelineTrackerEnabled = false; pCommonDM.AppEnableManageData.TimelineUnloadEnabled = false; break; case TimelineLoadStatus.Success: pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = true; if (pCommonDM.SelectedTimelineFileData == null) { pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = false; } pCommonDM.AppEnableManageData.RefreshTimelineListEnabled = true; pCommonDM.AppEnableManageData.TimelinePlayEnabled = true; pCommonDM.AppEnableManageData.TimelinePauseEnabled = true; pCommonDM.AppEnableManageData.TimelineRewindEnabled = true; pCommonDM.AppEnableManageData.TimelineTrackerEnabled = true; pCommonDM.AppEnableManageData.TimelineUnloadEnabled = true; break; case TimelineLoadStatus.NonLoad: case TimelineLoadStatus.NotFoundTimeline: case TimelineLoadStatus.Failure: pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = true; if (pCommonDM.SelectedTimelineFileData == null) { pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = false; } pCommonDM.AppEnableManageData.RefreshTimelineListEnabled = true; pCommonDM.AppEnableManageData.TimelinePlayEnabled = false; pCommonDM.AppEnableManageData.TimelinePauseEnabled = false; pCommonDM.AppEnableManageData.TimelineRewindEnabled = false; pCommonDM.AppEnableManageData.TimelineTrackerEnabled = false; pCommonDM.AppEnableManageData.TimelineUnloadEnabled = false; break; } pCommonDM.ViewRefresh(); }
/// <summary> タイムラインデータのクリアを実行し、ステータスを変更します。 /// </summary> /// <param name="pCommonDM"></param> /// <param name="pTimelineDM"></param> public void TimelineDataClear(CommonDataModel pCommonDM, TimelineObjectModel pTimelineOM) { pTimelineOM.TimerData.Clear(); pTimelineOM.Clear(); pCommonDM.AppStatusData.TimelineLoadStatus = TimelineLoadStatus.NonLoad; this.TimelineFunctionEnabledChange(pCommonDM); pCommonDM.ViewRefresh(); return; }
/// <summary> タイマーステータスを参照し、機能の有効状態を更新します。 /// </summary> /// <param name="pCommonDM"></param> public void TimerFunctionEnabledChange(CommonDataModel pCommonDM) { switch (pCommonDM.AppStatusData.CurrentCombatTimerStatus) { case TimerStatus.Pause: pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = true; if (pCommonDM.SelectedTimelineFileData == null) { pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = false; } pCommonDM.AppEnableManageData.RefreshTimelineListEnabled = true; pCommonDM.AppEnableManageData.TimelinePlayEnabled = true; pCommonDM.AppEnableManageData.TimelinePauseEnabled = false; pCommonDM.AppEnableManageData.TimelineRewindEnabled = true; pCommonDM.AppEnableManageData.TimelineTrackerEnabled = true; pCommonDM.AppEnableManageData.TimelineUnloadEnabled = true; break; case TimerStatus.Run: pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = false; pCommonDM.AppEnableManageData.RefreshTimelineListEnabled = true; pCommonDM.AppEnableManageData.TimelinePlayEnabled = false; pCommonDM.AppEnableManageData.TimelinePauseEnabled = true; pCommonDM.AppEnableManageData.TimelineRewindEnabled = true; pCommonDM.AppEnableManageData.TimelineTrackerEnabled = false; pCommonDM.AppEnableManageData.TimelineUnloadEnabled = false; break; case TimerStatus.Init: case TimerStatus.Stop: pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = true; if (pCommonDM.SelectedTimelineFileData == null) { pCommonDM.AppEnableManageData.TimelineFileLoadEnabled = false; } pCommonDM.AppEnableManageData.RefreshTimelineListEnabled = true; pCommonDM.AppEnableManageData.TimelinePlayEnabled = true; pCommonDM.AppEnableManageData.TimelinePauseEnabled = false; pCommonDM.AppEnableManageData.TimelineRewindEnabled = true; pCommonDM.AppEnableManageData.TimelineTrackerEnabled = true; pCommonDM.AppEnableManageData.TimelineUnloadEnabled = true; break; } }
/// <summary> タイマーをリブートします。 /// </summary> public void TimerReboot(CommonDataModel pCommonDM, TimelineObjectModel pTimelineOM) { switch (pCommonDM.AppStatusData.CurrentCombatTimerStatus) { case TimerStatus.Init: case TimerStatus.Stop: case TimerStatus.Pause: case TimerStatus.Run: break; } this.TimerStop(pCommonDM, pTimelineOM); this.TimerStart(pCommonDM, pTimelineOM); }
/// <summary> オーバーレイファイルのダウンロードを実行します。 /// </summary> /// <param name="pCommonDM"> 共通データモデル </param> /// <param name="pDownloadURI"> ダウンロードするファイルのURI </param> /// <returns></returns> public bool DownloadOverlay(CommonDataModel pCommonDM, string pDownloadURI) { bool result = false; try { result = this.downloadUnit.FileDownload(pDownloadURI, pCommonDM.ApplicationData.TempDirectoryPath, pCommonDM.ApplicationData.TempOverlayName, SaveType.OverRide); } catch (Exception e) { throw e; } return(result); }
/// <summary> タイマーを一時停止します。 /// </summary> public void TimerPause(CommonDataModel pCommonDM) { switch (pCommonDM.AppStatusData.CurrentCombatTimerStatus) { case TimerStatus.Init: case TimerStatus.Stop: case TimerStatus.Pause: return; case TimerStatus.Run: break; } this.CurrentCombatTimer.Stop(); pCommonDM.AppStatusData.CurrentCombatTimerStatus = TimerStatus.Pause; this.TimerFunctionEnabledChange(pCommonDM); }
/// <summary> ファイル選択ダイアログを表示後、オーバーレイをインポートします。 /// </summary> public bool ImportOverlay(CommonDataModel pCommonDataModel, TimelineComponent pTimelineComponent, OverlayManageDataModel pOverlayManageDataModel) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.FilterIndex = 1; openFileDialog.Filter = "Overlay Xml|*.xml|All Files (*.*)|*.*"; openFileDialog.InitialDirectory = pCommonDataModel.ApplicationData.PluginDllDirectory; openFileDialog.Title = "Import Overlay Data"; bool?result = openFileDialog.ShowDialog(); if (result == true) { return(this.ImportOverlay(pCommonDataModel, pTimelineComponent, pOverlayManageDataModel, openFileDialog.FileName, string.Empty)); } return(false); }
/*--- Method: public ------------------------------------------------------------------------------------------------------------------------------------------*/ /// <summary> 新しいオーバーレイを作成し、表示します。 /// </summary> /// <param name="pTimelineComponent"></param> /// <param name="pViewControlComponent"></param> public void NewOverlayOpen(CommonDataModel pCommonDM, TimelineComponent pTimelineComponent, OverlayViewComponent pOverlayViewComponent) { switch (pOverlayViewComponent.OverlayDataModel.OverlayWindowData.OverlayType) { case OverlayType.StandardTimeline: this.openStandardTimelineView(pCommonDM, pTimelineComponent, pOverlayViewComponent); break; case OverlayType.TimelineControl: this.openOverlayControlView(pCommonDM, pTimelineComponent, pOverlayViewComponent); break; default: return; } return; }
/// <summary> タイマーを0に巻き戻し、ステータスがRunの場合は再スタートさせます。 /// </summary> public void TimerRewind(CommonDataModel pCommonDM, TimelineObjectModel pTimelineOM) { switch (pCommonDM.AppStatusData.CurrentCombatTimerStatus) { case TimerStatus.Init: case TimerStatus.Stop: case TimerStatus.Pause: case TimerStatus.Run: break; } var status = pCommonDM.AppStatusData.CurrentCombatTimerStatus; this.TimerStop(pCommonDM, pTimelineOM); if (status == TimerStatus.Run) { this.TimerStart(pCommonDM, pTimelineOM); } }
/// <summary> デフォルトリソースディレクトリを設定します。 /// </summary> /// <param name="pCommonDM"> 参照と設定に使用する共通データモデル </param> public void SetDefaultResourceDirectory(CommonDataModel pCommonDM) { if (!string.IsNullOrWhiteSpace(Globals.PluginDllDirectoryPath)) { pCommonDM.PluginSettingsData.TimelineResourceDirectory = Globals.PluginDllDirectoryPath + @"\resources\timeline"; pCommonDM.PluginSettingsData.SoundResourceDirectory = Globals.PluginDllDirectoryPath + @"\resources\wav"; } else if (!string.IsNullOrWhiteSpace(pCommonDM.ApplicationData.PluginDllDirectory)) { pCommonDM.PluginSettingsData.TimelineResourceDirectory = pCommonDM.ApplicationData.PluginDllDirectory + @"\resources\timeline"; pCommonDM.PluginSettingsData.SoundResourceDirectory = pCommonDM.ApplicationData.PluginDllDirectory + @"\resources\wav"; } else { string path = this.getAssemblyDataProcess.GetAssemblyDirectory(); pCommonDM.PluginSettingsData.TimelineResourceDirectory = path + @"\resources\timeline"; pCommonDM.PluginSettingsData.SoundResourceDirectory = path + @"\resources\wav"; } }
/// <summary> 保存されているオーバーレイを全てロードします。 /// </summary> /// <param name="pCommonDataModel"> 共通データモデル </param> /// <param name="pTimelineComponent"> タイムラインコンポーネント </param> /// <param name="pOverlayManageDataModel"> 読込データを追加する管理データモデル </param> public void OverlayDataModelLoad(CommonDataModel pCommonDataModel, TimelineComponent pTimelineComponent, OverlayManageDataModel pOverlayManageDataModel) { if (pCommonDataModel == null || pCommonDataModel.ApplicationData == null) { return; } if (pCommonDataModel.ApplicationData.OverlayDataFilePathList.Count == 0) { return; } var dataList = this.OverlayDataModelLoad(pCommonDataModel.ApplicationData.OverlayDataFilePathList, true); if (dataList.Count == 0) { return; } foreach (var data in dataList) { OverlayViewComponent component = new OverlayViewComponent(pCommonDataModel); this.overlayDataRevisionProcess.DataRevisionExecute(data); // バージョン設定 data.DataVersion = pCommonDataModel.ApplicationData.ApplicationVersion; component.OverlayDataModel = data; component.OverlayDataModel.OverlayViewData.TimelineViewSource = new CollectionViewSource() { Source = pTimelineComponent.TimelineObjectModel.ActivityCollection }; this.setFilterProcess.SetResetFilter(component.OverlayDataModel.OverlayViewData.TimelineViewSource, false); pOverlayManageDataModel.OverlayViewComponentCollection.Add(component); pCommonDataModel.ViewCollection.Add(component); } }
/*--- Method: public ------------------------------------------------------------------------------------------------------------------------------------------*/ /// <summary> 新しいオーバーレイを作成します。 /// </summary> public void AddNewOverlay(CommonDataModel pCommonDM, OverlayDataModel pAddOverlayDM, TimelineComponent pTimelineC, OverlayManageDataModel pOverlayManageM, bool IsImport) { // ID設定 if (pOverlayManageM.OverlayViewComponentCollection.Count > 0) { pAddOverlayDM.OverlayWindowData.ID = pOverlayManageM.OverlayViewComponentCollection.Max(m => m.OverlayDataModel.OverlayWindowData.ID) + 1; } else { pAddOverlayDM.OverlayWindowData.ID = 1; } OverlayViewComponent component = new OverlayViewComponent(pCommonDM); component.OverlayDataModel = pAddOverlayDM; if (IsImport) { pAddOverlayDM.OverlayWindowData.WindowTop = 10; pAddOverlayDM.OverlayWindowData.WindowLeft = 10; pAddOverlayDM.OverlayWindowData.WindowVisibility = false; pAddOverlayDM.OverlayWindowData.WindowLock = false; } else { this.SetDefaultOverlayWindowData(component.OverlayDataModel.OverlayWindowData); this.SetDefaultOverlaySettingData(component.OverlayDataModel.OverlayOptionData); } component.OverlayDataModel.OverlayViewData.TimelineViewSource = new CollectionViewSource() { Source = pTimelineC.TimelineObjectModel.ActivityCollection }; this.setFilterProcess.SetResetFilter(component.OverlayDataModel.OverlayViewData.TimelineViewSource, false); // バージョン設定 component.OverlayDataModel.DataVersion = pCommonDM.ApplicationData.ApplicationVersion; pOverlayManageM.OverlayViewComponentCollection.Add(component); pCommonDM.ViewCollection.Add(component); }
/// <summary> オーバーレイをインポートします。 /// </summary> public bool ImportOverlay(CommonDataModel pCommonDataModel, TimelineComponent pTimelineComponent, OverlayManageDataModel pOverlayManageDataModel, string pOverlayFullPath, string pImportOverlayName) { var data = this.OverlayDataModelLoad(pOverlayFullPath, false); if (data != null) { this.overlayDataRevisionProcess.DataRevisionExecute(data); if (!string.IsNullOrWhiteSpace(pImportOverlayName)) { data.OverlayWindowData.OverlayName = pImportOverlayName; } this.AddNewOverlay(pCommonDataModel, data, pTimelineComponent, pOverlayManageDataModel, true); } else { throw new FileLoadException(); } return(true); }
/// <summary> プラグインバージョン情報を生成します。 /// </summary> /// <param name="pCommonDM"> データ格納する共通データモデル </param> public void CreateVersionInfo(CommonDataModel pCommonDM) { pCommonDM.PluginVersionInfo.PluginName = "FZ.Timeline"; pCommonDM.PluginVersionInfo.PluginWebUri = "https://github.com/FairyZeta/ACT.Timeline/releases"; pCommonDM.PluginVersionInfo.CheckPluginInfoUri = "https://raw.githubusercontent.com/FairyZeta/ACT.Timeline/master/" + pCommonDM.ApplicationData.VersionInfoFileName; pCommonDM.PluginVersionInfo.PluginVersion = pCommonDM.ApplicationData.ApplicationVersion.ToString(); pCommonDM.PluginVersionInfo.PluginDownloadUri = pCommonDM.PluginVersionInfo.PluginWebUri + string.Format(@"/download/{0}/{1}-{0}.zip", pCommonDM.PluginVersionInfo.PluginVersion, pCommonDM.PluginVersionInfo.PluginName); pCommonDM.PluginVersionInfo.ReleaseDay = string.Empty; pCommonDM.PluginVersionInfo.Priority = string.Empty; pCommonDM.PluginVersionInfo.Msg = string.Empty; pCommonDM.PluginVersionInfo.DataBaseVersion = "1.0.0.0"; pCommonDM.PluginVersionInfo.DataBaseDownloadUri = string.Empty; if (this.PluginHistoryObjectModel.UpdateHistoryDictionary.ContainsKey(pCommonDM.ApplicationData.ApplicationVersion)) { pCommonDM.PluginVersionInfo.SummaryList = this.PluginHistoryObjectModel.UpdateHistoryDictionary[pCommonDM.ApplicationData.ApplicationVersion]; } }
/// <summary> タイマー処理を停止します。 /// </summary> public void TimerStop(CommonDataModel pCommonDM, TimelineObjectModel pTimelineOM) { switch (pCommonDM.AppStatusData.CurrentCombatTimerStatus) { case TimerStatus.Init: case TimerStatus.Stop: case TimerStatus.Pause: case TimerStatus.Run: break; } pCommonDM.AppStatusData.CurrentCombatTimerStatus = TimerStatus.Stop; this.TimerFunctionEnabledChange(pCommonDM); this.CurrentCombatTimer.Stop(); this.CurrentCombatRelativeClock.CurrentTime = 0; pTimelineOM.TimerData.CurrentCombatTime = pTimelineOM.TimerData.CurrentCombatStartTime; foreach (var item in pTimelineOM.ActivityCollection) { item.ViewRefresh(); } }
/// <summary> 既存のオーバーレイを削除します。 /// </summary> /// <param name="pOverlayViewC"> 削除するオーバーレイデータ </param> /// <param name="pCommonDM"> 値参照用の共通データモデル </param> /// <param name="pOverlayManageDM"> 削除データのコレクションを持つオーバーレイ管理モデル </param> public void DeleteOverlay(OverlayViewComponent pOverlayViewC, CommonDataModel pCommonDM, OverlayManageDataModel pOverlayManageDM) { if (pCommonDM == null || pCommonDM.ApplicationData == null) { return; } string fileName = pCommonDM.ApplicationData.OverlayDataPartName + String.Format("{0:0000}", pOverlayViewC.OverlayDataModel.OverlayWindowData.ID) + ".xml"; string path = Path.Combine(pCommonDM.ApplicationData.RoamingDirectoryPath, "OverlayData", fileName); pOverlayManageDM.OverlayViewComponentCollection.Remove(pOverlayViewC); pCommonDM.ViewCollection.Remove(pOverlayViewC); WindowsServices.WindowCloseSendMessage(pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr); pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr = IntPtr.Zero; pOverlayViewC = null; if (File.Exists(path)) { File.Delete(path); } }
/// <summary> タイムラインファイルコレクションを生成します。 /// </summary> /// <param name="pCommonDataModel"> 参照と設定に使用する共通データモデル </param> public void CreateTimelineFileCollection(CommonDataModel pCommonDataModel) { switch (pCommonDataModel.AppStatusData.TimelineResourceDirectoryStatus) { case DirectoryStatus.Init: case DirectoryStatus.NotFound: case DirectoryStatus.ZeroFile: return; } pCommonDataModel.TimelineFileCollection.Clear(); var files = Directory.GetFiles(pCommonDataModel.PluginSettingsData.TimelineResourceDirectory, "*.txt"); foreach (var file in files) { TimelineFileData data = new TimelineFileData(); data.TimelineFileName = Path.GetFileName(file); data.TimelineFileFullPath = file; pCommonDataModel.TimelineFileCollection.Add(data); } pCommonDataModel.TimelineFileViewSource.View.Refresh(); }
/// <summary> オーバーレイをエクスポートします。 /// </summary> /// <param name="pCommonDataModel"> 共通データモデル </param> /// <param name="pOverlayDataModel"> 保存するオーバーレイ情報 </param> public void ExportOverlay(CommonDataModel pCommonDataModel, OverlayDataModel pOverlayDataModel) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.FilterIndex = 1; saveFileDialog.Filter = "Overlay Xml|*.xml|All Files (*.*)|*.*"; saveFileDialog.InitialDirectory = pCommonDataModel.ApplicationData.PluginDllDirectory; saveFileDialog.Title = "Export Overlay Data"; bool?result = saveFileDialog.ShowDialog(); if (result == true) { try { this.OverlayDataModelSave(saveFileDialog.FileName, pOverlayDataModel, false); } catch (Exception e) { string msg = string.Format("Overlay Export Error: {0}", e.Message); pCommonDataModel.LogDataCollection.Add( Globals.ErrLogger.WriteSystemLog.Failure.ERROR.Write(msg, Globals.ProjectName)); } } }
/*--- Constructers --------------------------------------------------------------------------------------------------------------------------------------------*/ /// <summary> タイムライン/オーバーレイ管理コンポーネント/コンストラクタ /// </summary> public OverlayManageComponent(TimelineComponent pComponent, CommonDataModel pCommonDataModel) : base(pCommonDataModel) { this.TimelineComponent = pComponent; this.initComponent(); }