public bool AddType(Type type) { if (type == null) { return(false); } type = type.ReduceType(); if (MappedTypes.ContainsKey(type)) { return(false); } MappedTypes[type] = ResolveType(type) ?? type; return(true); }
public void Load() { if (!File.Exists(CredentialManagerHelper.GetSaveFilePath())) { return; } using var stream = File.OpenRead(CredentialManagerHelper.GetSaveFilePath()); using var reader = new BinaryReader(stream); var count = reader.ReadInt32(); for (var i = 0; i < count; i++) { var type = reader.ReadString(); if (MappedTypes.ContainsKey(type)) { var res = Activator.CreateInstance(MappedTypes[type]); ((ICredentialEntry)res).Load(reader); Credentials.Add(res as ICredentialEntry); } } }