ebarnard / rust-plist

A rusty plist parser.
MIT License
71 stars 42 forks source link

NSKeyedArchive & NSKeyedUnarchiver support #74

Closed DsoTsin closed 2 years ago

DsoTsin commented 2 years ago

For example:

impl NSKeyedArchiver {
    pub fn new() -> Self {
        let mut dict = plist::Dictionary::new();
        dict.insert("$version".to_owned(), plist::Value::Integer(100000.into()));
        //plist::Integer::from(0u64);
        dict.insert("$archiver".to_owned(), plist::Value::String("NSKeyedArchiver".to_owned()));
        let mut root = plist::Dictionary::new();
        // assign root index
        root.insert("root".to_owned(), plist::Value::Uid(plist::Uid::new(1)));
        dict.insert("$top".to_owned(), plist::Value::Dictionary(root));
        // array here
        let mut objects = Vec::new();
        objects.push(plist::Value::String("$null".into()));
        dict.insert("$objects".to_owned(), plist::Value::Array(objects));
        NSKeyedArchiver {
            v: plist::Value::Dictionary(dict),
        }
    }
ebarnard commented 2 years ago

It should be possible for this to be implemented in an external crate that uses this library. It's not something I'm willing to support myself.