msftrncs / pwshjsontoplist Goto Github PK
View Code? Open in Web Editor NEWGenerate PList XML with PowerShell, Convert tmLanguage.JSON to PList
License: MIT License
Generate PList XML with PowerShell, Convert tmLanguage.JSON to PList
License: MIT License
PwshJSONtoPList/ConvertTo-PList.ps1
Line 215 in 9f58ba8
For instance, add local:
to the use of $IsCoreCLR
and $IsWindows
, as they do not exist on Windows PowerShell, but could have been defined in a parent scope, possibly unrelated to the PowerShell Core implementation of the built in version of these variables.
Consider that empty properties could use the XML <element/>
syntax. This would primarily affect:
<dict>
<array>
But it could also affect:
<string>
<data>
I am not sure if there is some guidelines on this behavior.
Reference issue #7
Improve the ConvertTo-PList function with the following:
<dict>
or <array>
) will be indented. Samples of XML PList files generally show the first object not indented, but a generic XML writer usually will indent the first object because its a child object from the <plist>
root object of the XML document.<string>
characters not supported directly in an XML document.I plan to split away the part of 'ConvertTo-Plist.ps1' that deals with converting a 'PowerShell.tmLanguage.json' to the PowerShell.tmLanguage repository as 'build_plist.ps1' so that this repository can focus on just the conversion of a PowerShell object to PList XML.
test file:
Config.zip
befor:
<string></string>
after:
<dict>
</dict>
befor:
<key>Name</key>
<string>IONVMeFamily</string>
<key>Find</key>
<data>
BgIAAEyNuAAQAABMiflIgeEA8P//SYmGGgEAAEmJjiIBAABBvAAQAABJKfQ=
</data>
<key>Replace</key>
<data>
BgIAAEyNuAACAABMiflIgeEA8P//SYmGGgEAAEmJjiIBAABBvAACAABJKfQ=
</data>
after:
<key>Name</key>
<string>IONVMeFamily</string>
<key>Find</key>
<data>
BgIAAEyNuAAQAABMiflIgeEA8P//SYmGGgEAAEmJjiIB
AABBvAAQAABJKfQ=
</data>
<key>Replace</key>
<data>
BgIAAEyNuAACAABMiflIgeEA8P//SYmGGgEAAEmJjiIB
AABBvAACAABJKfQ=
</data>
(this is just one example)
PwshJSONtoPList/ConvertTo-PList.ps1
Line 190 in 9f58ba8
PwshJSONtoPList/ConvertTo-PList.ps1
Line 215 in 9f58ba8
Use either !
or -not
consistently.
Preferring -not
as it is more clear and consistent with the other PowerShell logical operators.
For instance:
[flags()] enum WineSweetness : byte { # requires PS 6.2
VeryDry
Dry
Moderate
Sweet
VerySweet
}
[WineSweetness]::Moderate | ConvertTo-Plist
Will result in an output of:
<integer>Moderate</integer>
But it should be either:
<integer>2</integer>
or
<string>Moderate</string>
Tag changed to
For example:
before:
Find
<data>SEVDSQ==</data>
Replace
<data>SU1FSQ==</data>
after:
Find
<string>SEVDSQ==</string>
Replace
<string>SU1FSQ==</string>
My programming level, English expression is not very good,
so, I recorded a video demonstration: https://www60.zippyshare.com/v/72znRFfX/file.html
Related documents: https://www60.zippyshare.com/v/JX5BgvUh/file.html
It may be the same as the following question
msftrncs/PwshReadXmlPList#4
For example:
[byte[]](1..100) | ConvertTo-Plist # specifically no wrapping comma
will only output (instead of a <data>
block with the encoded array):
<integer>100</integer>
As an enhancement that might relate to examples of PList files, consider condensing the <DATA>
output when the result is less than one line anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.