Skip to content

Commit d5d3bc5

Browse files
committed
implemented visualizer for System.DateTime
1 parent aea8cdd commit d5d3bc5

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this package are documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [4.1.0] - 2022-??-?? (not released yet)
8+
### Added
9+
- Added visualizer for ```System.DateTime``` to the C# managed object inspector.
10+
711
## [4.0.0] - 2021-05-23
812
### Fixed
913
- Fixed search regression introduced in 3.9.0. Thanks to jojo59516 for the fix. See [PR#10](https://github.com/pschraut/UnityHeapExplorer/pull/10) for details.

Editor/Scripts/DataVisualizer/DataVisualizer.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md
2+
// Heap Explorer for Unity. Copyright (c) 2019-2022 Peter Schraut (www.console-dev.de). See LICENSE.md
33
// https://github.com/pschraut/UnityHeapExplorer/
44
//
55
using System.Collections;
@@ -259,6 +259,28 @@ void OnMenuOpenInTextEditor()
259259
}
260260
}
261261

262+
class DateTimeDataVisualizer : AbstractDataVisualizer
263+
{
264+
System.DateTime m_DateTime;
265+
266+
[InitializeOnLoadMethod]
267+
static void RegisterVisualizer()
268+
{
269+
RegisterVisualizer("System.DateTime", typeof(DateTimeDataVisualizer));
270+
}
271+
272+
protected override void OnInitialize()
273+
{
274+
var ticks = m_MemoryReader.ReadInt64(m_Address);
275+
m_DateTime = new System.DateTime(ticks);
276+
}
277+
278+
protected override void OnGUI()
279+
{
280+
EditorGUILayout.LabelField(m_DateTime.ToString());
281+
}
282+
}
283+
262284
sealed public class DataVisualizerWindow : EditorWindow
263285
{
264286
AbstractDataVisualizer m_Visualizer;

0 commit comments

Comments
 (0)