Exemple #1
0
        // Get information of the current user as a `Person`.
        public Person GetUser()
        {
            var settingsPath = Locator.Locate("mmsetting.archive");
            var settings     = Unarchiver.DeepParse(PropertyListParser.Parse(settingsPath));
            var me           = new Person();

            DictUtil.TryGet(settings, "UsrName", out me.UsrName);
            DictUtil.TryGet(settings, "AliasName", out me.Alias);
            DictUtil.TryGet(settings, "NickName", out me.NickName);
            if (DictUtil.TryGetSubclass(settings, "new_dicsetting", out var setting))
            {
                DictUtil.TryGet(setting, "headimgurl", out me.Portrait);
                DictUtil.TryGet(setting, "headhdimgurl", out me.PortraitHD);
            }
            return(me);
        }
Exemple #2
0
        private static MBFile ReadFileBlob(Stream blob)
        {
            var dict   = Unarchiver.DeepParse(PropertyListParser.Parse(blob));
            var mbFile = new MBFile();

            DictUtil.TryGet(dict, "RelativePath", out mbFile.RelativePath);
            DictUtil.TryGet(dict, "Target", out mbFile.Target);
            DictUtil.TryGet(dict, "Mode", out mbFile.Mode);
            DictUtil.TryGet(dict, "InodeNumber", out mbFile.InodeNumber);
            DictUtil.TryGet(dict, "UserID", out mbFile.UserID);
            DictUtil.TryGet(dict, "GroupID", out mbFile.GroupID);
            DictUtil.TryGet(dict, "LastModified", out mbFile.LastModified);
            DictUtil.TryGet(dict, "LastStatusChange", out mbFile.LastStatusChange);
            DictUtil.TryGet(dict, "Birth", out mbFile.Birth);
            DictUtil.TryGet(dict, "Size", out mbFile.Size);
            DictUtil.TryGet(dict, "ProtectionClass", out mbFile.ProtectionClass);
            return(mbFile);
        }