| | 1 | | using System.Collections.Generic; |
| | 2 | |
|
| | 3 | | internal class ScenesRefreshHelper |
| | 4 | | { |
| 0 | 5 | | public Dictionary<string, ISceneCardView> oldDeployedScenes { get; private set; } |
| 0 | 6 | | public Dictionary<string, ISceneCardView> oldProjectsScenes { get; private set; } |
| 0 | 7 | | public bool isOldDeployedScenesEmpty { get; private set; } |
| 0 | 8 | | public bool isOldProjectScenesEmpty { get; private set; } |
| | 9 | |
|
| | 10 | | public void Set(Dictionary<string, ISceneCardView> oldDeployedScenes, |
| | 11 | | Dictionary<string, ISceneCardView> oldProjectsScenes) |
| | 12 | | { |
| 12 | 13 | | this.oldDeployedScenes = oldDeployedScenes; |
| 12 | 14 | | this.oldProjectsScenes = oldProjectsScenes; |
| | 15 | |
|
| 12 | 16 | | isOldDeployedScenesEmpty = oldDeployedScenes == null || oldDeployedScenes.Count == 0; |
| 12 | 17 | | isOldProjectScenesEmpty = oldProjectsScenes == null || oldProjectsScenes.Count == 0; |
| 12 | 18 | | } |
| | 19 | |
|
| | 20 | | public bool WasDeployedScene(ISceneData sceneData) |
| | 21 | | { |
| 49 | 22 | | if (isOldDeployedScenesEmpty) |
| 10 | 23 | | return false; |
| | 24 | |
|
| 39 | 25 | | return oldDeployedScenes.ContainsKey(sceneData.id); |
| | 26 | | } |
| | 27 | |
|
| | 28 | | public bool WasProjectScene(ISceneData sceneData) |
| | 29 | | { |
| 29 | 30 | | if (isOldProjectScenesEmpty) |
| 7 | 31 | | return false; |
| | 32 | |
|
| 22 | 33 | | return oldProjectsScenes.ContainsKey(sceneData.id); |
| | 34 | | } |
| | 35 | |
|
| 22 | 36 | | public bool IsSceneUpdate(ISceneData sceneData) { return WasDeployedScene(sceneData) || WasProjectScene(sceneData); |
| | 37 | |
|
| 25 | 38 | | public bool IsSceneDeployStatusChanged(ISceneData sceneData) { return (!sceneData.isDeployed && WasDeployedScene(sce |
| | 39 | |
|
| | 40 | | public Dictionary<string, ISceneCardView> GetOldDictionary(ISceneData sceneData) |
| | 41 | | { |
| 0 | 42 | | if (WasDeployedScene(sceneData)) |
| | 43 | | { |
| 0 | 44 | | return oldDeployedScenes; |
| | 45 | | } |
| 0 | 46 | | if (WasProjectScene(sceneData)) |
| | 47 | | { |
| 0 | 48 | | return oldProjectsScenes; |
| | 49 | | } |
| | 50 | |
|
| 0 | 51 | | return null; |
| | 52 | | } |
| | 53 | | } |