PSOD.ps1xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?xml version="1.0" encoding="utf-8" ?>
<!--############################################################################
# Author : Antony Onipko
# Copyright : (c) 2016 Antony Onipko. All rights reserved.
################################################################################
# This work is licensed under the
# Creative Commons Attribution-ShareAlike 4.0 International License.
# To view a copy of this license, visit
# https://creativecommons.org/licenses/by-sa/4.0/
#############################################################################-->
 
<Types>
  <Type>
    <Name>PSOD.OneDriveToken</Name>
    <Members>
      <ScriptProperty>
        <Name>ExpiryDate</Name>
        <GetScriptBlock>
            $this.Created.AddSeconds($this.ExpiresIn)
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptMethod>
        <Name>ToString</Name>
        <Script>
            $this.AccessToken
        </Script>
      </ScriptMethod>
      <MemberSet>
        <Name>PSStandardMembers</Name>
        <Members>
          <PropertySet>
            <Name>DefaultDisplayPropertySet</Name>
            <ReferencedProperties>
              <Name>AccessToken</Name>
              <Name>Type</Name>
              <Name>Scope</Name>
              <Name>UserId</Name>
              <Name>ExpiresIn</Name>
              <Name>ExpiryDate</Name>
            </ReferencedProperties>
          </PropertySet>
        </Members>
      </MemberSet>
    </Members>
  </Type>
  <Type>
    <Name>PSOD.OneDriveItem</Name>
    <Members>
      <AliasProperty>
        <Name>DownloadUrl</Name>
        <ReferencedMemberName>@content.downloadUrl</ReferencedMemberName>
      </AliasProperty>
      <AliasProperty>
        <Name>FullName</Name>
        <ReferencedMemberName>Path</ReferencedMemberName>
      </AliasProperty>
      <AliasProperty>
        <Name>Length</Name>
        <ReferencedMemberName>size</ReferencedMemberName>
      </AliasProperty>
      <!-- The link expires, so should use odgc.
      <ScriptMethod>
        <Name>Save</Name>
        <Script>
            Invoke-WebRequest -Uri $this."@content.downloadUrl" -OutFile $args[0] -UseBasicParsing
        </Script>
      </ScriptMethod>
      -->
      <ScriptMethod>
        <Name>ToString</Name>
        <Script>
            $this.Path
        </Script>
      </ScriptMethod>
      <ScriptProperty>
        <Name>BaseName</Name>
        <GetScriptBlock>
            [System.IO.Path]::GetFileNameWithoutExtension($this.Name)
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>CreationTime</Name>
        <GetScriptBlock>
            $dt = Get-Date $this.CreatedDateTime
            "$($dt.ToString("d")) $($dt.ToString("t"))"
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Extension</Name>
        <GetScriptBlock>
            [System.IO.Path]::GetExtension($this.Name)
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>LastWriteTime</Name>
        <GetScriptBlock>
            $dt = Get-Date $this.LastModifiedDateTime
            "$($dt.ToString("d")) $($dt.ToString("t"))"
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Parent</Name>
        <GetScriptBlock>
            [System.Web.HttpUtility]::UrlDecode($this.parentReference.path)
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>ParentId</Name>
        <GetScriptBlock>
            $this.parentReference.id
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Path</Name>
        <GetScriptBlock>
            $this.Parent + '/' + $this.name
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Type</Name>
        <GetScriptBlock>
          if ($this.deleted) {
              "deleted"
          } elseif ($this.file) {
              "file"
          } elseif ($this.folder) {
              "folder"
          } elseif ($this.photo) {
              "photo"
          } elseif ($this.image) {
              "image"
          } elseif ($this.audio) {
              "audio"
          } elseif ($this.package) {
              "package"
          } elseif ($this.video) {
              "video"
          }
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Root</Name>
        <GetScriptBlock>
          $PSOD.drive.pathRoot
        </GetScriptBlock>
      </ScriptProperty>
      <MemberSet>
        <Name>PSStandardMembers</Name>
        <Members>
          <PropertySet>
            <Name>DefaultDisplayPropertySet</Name>
            <ReferencedProperties>
              <Name>Id</Name>
              <Name>Name</Name>
              <Name>Description</Name>
              <Name>Length</Name>
              <Name>Path</Name>
              <Name>Extension</Name>
              <Name>CreationTime</Name>
              <Name>LastWriteTime</Name>
              <Name>Type</Name>
              <Name>Shared</Name>
            </ReferencedProperties>
          </PropertySet>
        </Members>
      </MemberSet>
    </Members>
  </Type>
</Types>