示例#1
0
文件: Entry.cs 项目: 0x49D1/WinPass
        public Entry(ICollection<Field> fields)
        {
            if (fields == null)
                throw new ArgumentNullException("fields");

            Icon = new IconData();

            _original = fields;
            _fields = fields.ToDictionary(
                x => x.Name, x => x.Clone());

            _protects = new EntryProtects(_fields);
        }
示例#2
0
        public Entry(ICollection <Field> fields)
        {
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }

            Icon = new IconData();

            _original = fields;
            _fields   = fields.ToDictionary(
                x => x.Name, x => x.Clone());

            _protects = new EntryProtects(_fields);
        }
示例#3
0
文件: Cache.cs 项目: 0x49D1/WinPass
        /// <summary>
        /// Gets the overlay icon.
        /// </summary>
        /// <param name="dispatcher">The dispatcher.</param>
        /// <param name="icon">The icon information.</param>
        /// <returns>
        /// The overlay icon.
        /// </returns>
        public static ImageSource GetOverlay(
            Dispatcher dispatcher, IconData icon)
        {
            if (icon == null)
                throw new ArgumentNullException("icon");
            ImageSource source;

            if (!string.IsNullOrEmpty(icon.Custom) &&
                Database.Icons.TryGetValue(icon.Custom, out source))
                return source;

            var id = icon.Standard;
            if (!_standards.TryGetValue(id, out source))
            {

                lock (_lckStandards)
                {
                    if (!_standards.TryGetValue(id, out source))
                    {
                        var wait = new ManualResetEvent(false);

                        dispatcher.BeginInvoke(() =>
                        {
                            //  "/Images/KeePass/classic/{0:00}.png", id);
                            var uri = string.Format(_imagePath, id, _theamPrefix);
                            source = new BitmapImage(new Uri(
                                uri, UriKind.Relative));
                            _standards.Add(id, source);

                            wait.Set();
                        });

                        wait.WaitOne();
                    }
                }
            }

            return source;
        }
示例#4
0
        private static IconData ParseIcon(XmlReader reader)
        {
            var data = new IconData();

            if (reader.Name != "IconID")
                reader.ReadToNextSibling("IconID");

            data.Standard = reader
                .ReadElementContentAsInt();

            if (reader.Name == "CustomIconUUID")
            {
                data.Custom = reader
                    .ReadElementContentAsString();
            }

            return data;
        }
示例#5
0
 public Group()
 {
     Icon     = new IconData();
     _groups  = new List <Group>();
     _entries = new List <Entry>();
 }
示例#6
0
文件: Group.cs 项目: AFPass/7Pass
 public Group()
 {
     Icon = new IconData();
     _groups = new List<Group>();
     _entries = new List<Entry>();
 }