| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | ImageInfo.cpp |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | This file contains the implementation of the WinRT wrapper for the WSLC SDK ImageInfo class. |
| 12 | |
| 13 | --*/ |
| 14 | |
| 15 | #include "precomp.h" |
| 16 | #include "ImageInfo.h" |
| 17 | #include "Microsoft.WSL.Containers.ImageInfo.g.cpp" |
| 18 | |
| 19 | namespace winrt::Microsoft::WSL::Containers::implementation { |
| 20 | ImageInfo::ImageInfo(WslcImageInfo const& info) |
| 21 | { |
| 22 | m_name = winrt::to_hstring(info.name); |
| 23 | m_size = info.sizeBytes; |
| 24 | m_createdTimestamp = winrt::clock::from_time_t(static_cast<time_t>(info.createdUnixTime)); |
| 25 | |
| 26 | winrt::Windows::Storage::Streams::DataWriter writer; |
| 27 | writer.WriteBytes(info.sha256); |
| 28 | m_sha256 = writer.DetachBuffer(); |
| 29 | } |
| 30 | |
| 31 | hstring ImageInfo::Name() |
| 32 | { |
| 33 | return m_name; |
| 34 | } |
| 35 | |
| 36 | winrt::Windows::Storage::Streams::IBuffer ImageInfo::Sha256() |
| 37 | { |
| 38 | return m_sha256; |
| 39 | } |
| 40 | |
| 41 | uint64_t ImageInfo::Size() |
| 42 | { |
| 43 | return m_size; |
| 44 | } |
| 45 | |
| 46 | winrt::Windows::Foundation::DateTime ImageInfo::CreatedTimestamp() |
| 47 | { |
| 48 | return m_createdTimestamp; |
| 49 | } |
| 50 | } // namespace winrt::Microsoft::WSL::Containers::implementation |