Skip to content

pmahend1/PList-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PList-Parser

Plist parser in dotnet and powershell core.

1. Dotnet

Look at sample for more details

Example

var text = File.ReadAllText("Plist/PlistFile1.plist", System.Text.Encoding.UTF8);
var parser = new PListParserLibrary.Parser();
Dictionary<string, object> dictionaryOutput = parser.Parse(text);
Console.WriteLine("UIDeviceFamily=" + string.Join(',', dictionaryOutput["UIDeviceFamily"] as List<int>));
Console.WriteLine("MinimumOSVersion=" + dictionaryOutput["MinimumOSVersion"]);
//further use
var json = JsonConvert.SerializeObject(dictionaryOutput, Formatting.Indented);
Console.WriteLine(Environment.NewLine + "As Json" + Environment.NewLine + "----------------" + Environment.NewLine + json);

Output

UIDeviceFamily=1,2
MinimumOSVersion=8.0

As Json
----------------
{
  "UIDeviceFamily": [
    1,
    2
  ],
  "UISupportedInterfaceOrientations": [
    "UIInterfaceOrientationPortrait",
    "UIInterfaceOrientationLandscapeLeft",
    "UIInterfaceOrientationLandscapeRight"
  ],
  "UISupportedInterfaceOrientations~ipad": [
    "UIInterfaceOrientationPortrait",
    "UIInterfaceOrientationPortraitUpsideDown",
    "UIInterfaceOrientationLandscapeLeft",
    "UIInterfaceOrientationLandscapeRight"
  ],
  "MinimumOSVersion": "8.0",
  "CFBundleDisplayName": "App2",
  "CFBundleIdentifier": "com.companyname.App2",
  "CFBundleVersion": "1.0",
  "UILaunchStoryboardName": "LaunchScreen",
  "CFBundleName": "App2",
  "XSAppIconAssets": "Assets.xcassets/AppIcon.appiconset",
  "Required device capabilities": {
    "telephony": "wifi",
    "wifi": "wifi",
    "sms": "sms"
  },
  "Bundle OS type code": false,
  "CustomProperty": "1.2"
}

2. Powershell

Install-Module -Name PListParserLibrary.Powershell.PListParser

Example

Import-Module PListParserLibrary.Powershell.PlistParser
$text = Get-Content -Path .\DotNet\PListParserLibrary.Sample\Plist\PlistFile1.plist -Raw
$dictionaryText = Get-PlistFromText -Input $text
$dictionaryText
Key                                   Value
---                                   -----
UIDeviceFamily                        {1, 2}
UISupportedInterfaceOrientations      {UIInterfaceOrientationPortrait, UIInterfaceOrientationLandscapeLeft, UIInterfac…
UISupportedInterfaceOrientations~ipad {UIInterfaceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown, UIInt…
MinimumOSVersion                      8.0
CFBundleDisplayName                   App2
CFBundleIdentifier                    com.companyname.App2
CFBundleVersion                       1.0
UILaunchStoryboardName                LaunchScreen
CFBundleName                          App2
XSAppIconAssets                       Assets.xcassets/AppIcon.appiconset
Required device capabilities          {[telephony, wifi], [wifi, wifi], [sms, sms]}
Bundle OS type code                   False
CustomProperty                        1.2


$dictionaryText["UIDeviceFamily"]
1
2

dictionaryText["MinimumOSVersion"]
8.0

$dictionaryText["Required device capabilities"]
Key       Value
---       -----
telephony wifi
wifi      wifi
sms       sms

About

Plist parser with C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published