public SnapshotFileData(FileInfo info) { FileInfo = info; using (var snapshot = LoadSnapshot()) { MetaData snapshotMetadata = snapshot.metadata; m_GuiData = new SnapshotFileGUIData(snapshot.recordDate); m_GuiData.name = new GUIContent(Path.GetFileNameWithoutExtension(FileInfo.Name)); m_GuiData.metaInfo = new GUIContent(snapshotMetadata.content); m_GuiData.platform = new GUIContent(snapshotMetadata.platform); RuntimePlatform runtimePlatform; if (TryGetRuntimePlatform(snapshotMetadata.platform, out runtimePlatform)) { m_GuiData.runtimePlatform = runtimePlatform; } m_GuiData.date = new GUIContent(m_GuiData.UtcDateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture)); #if !UNITY_2020_1_OR_NEWER #pragma warning disable 618 m_GuiData.texture = snapshotMetadata.screenshot; #pragma warning restore 618 #endif #if UNITY_2019_3_OR_NEWER RefreshScreenshot(); #endif } }
internal void RefreshScreenshots(SnapshotFileGUIData guiDataFirst, SnapshotFileGUIData guiDataSecond) { if (guiDataFirst != null && m_OpenSnapshotItemUIFirst != null && m_OpenSnapshotItemUIFirst.Image != null) { m_OpenSnapshotItemUIFirst.Image.image = guiDataFirst.texture; } if (guiDataSecond != null && m_OpenSnapshotItemUISecond != null && m_OpenSnapshotItemUISecond.Image != null) { m_OpenSnapshotItemUISecond.Image.image = guiDataSecond.texture; } }
internal void RefreshScreenshots() { SnapshotFileGUIData firstGUIData = null, secondGUIData = null; if (First != null) { First.RefreshScreenshot(); firstGUIData = First.GuiData; } if (Second != null) { Second.RefreshScreenshot(); secondGUIData = Second.GuiData; } m_OpenSnapshotsPane.RefreshScreenshots(firstGUIData, secondGUIData); }
public void SetSnapshotUIData(bool first, SnapshotFileGUIData snapshotGUIData, bool isInView) { OpenSnapshotItemUI itemUI = m_OpenSnapshotItemUIFirst; if (!first) { itemUI = m_OpenSnapshotItemUISecond; } if (snapshotGUIData == null) { UIElementsHelper.SwitchVisibility(itemUI.NoData, itemUI.Name); itemUI.Name.text = ""; itemUI.Date.text = ""; itemUI.Age.text = ""; itemUI.Image.image = null; UIElementsHelper.SetVisibility(itemUI.PlatformIcon, false); UIElementsHelper.SetVisibility(itemUI.EditorPlatformIcon, false); itemUI.UtcDateTime = default(DateTime); // one of both snapshots is not open so there is no Age comparison between them. m_OpenSnapshotItemUIFirst.Age.text = ""; m_OpenSnapshotItemUISecond.Age.text = ""; } else { UIElementsHelper.SwitchVisibility(itemUI.Name, itemUI.NoData); itemUI.Name.text = snapshotGUIData.Name.text; itemUI.Date.text = snapshotGUIData.SnapshotDate.text; itemUI.Image.image = snapshotGUIData.MetaScreenshot; UIElementsHelper.SetVisibility(itemUI.PlatformIcon, true); MemoryProfilerWindow.SetPlatformIcons(itemUI.Item, snapshotGUIData); UIElementsHelper.SwitchVisibility(snapshotGUIData.dynamicVisualElements.closeButton, snapshotGUIData.dynamicVisualElements.openButton, true); itemUI.UtcDateTime = snapshotGUIData.UtcDateTime; if (first && secondIsOpen || !first && firstIsOpen) { m_OpenSnapshotItemUIFirst.Age.text = GetAgeDifference(m_OpenSnapshotItemUIFirst.UtcDateTime, m_OpenSnapshotItemUISecond.UtcDateTime); m_OpenSnapshotItemUISecond.Age.text = GetAgeDifference(m_OpenSnapshotItemUISecond.UtcDateTime, m_OpenSnapshotItemUIFirst.UtcDateTime); } } if (first) { firstIsOpen = snapshotGUIData != null; } else { secondIsOpen = snapshotGUIData != null; } if (isInView) { SetFocusFirst(first); SetFocusSecond(!first); SetFocusDiff(false); } else { if (first) { SetFocusFirst(false); } else { SetFocusSecond(false); } } m_DiffButton.SetEnabled(firstIsOpen && secondIsOpen); UpdateWidth(layout.width); }