Пример #1
0
 public void AddProperty(D2pProperty property)
 {
     if (property.Key == "link")
     {
         this.InternalAddLink(property.Value);
     }
     this.InternalAddProperty(property);
 }
Пример #2
0
 private void ReadProperties()
 {
     this.m_reader.Seek(this.IndexTable.PropertiesOffset, SeekOrigin.Begin);
     for (int i = 0; i < this.IndexTable.PropertiesCount; i++)
     {
         D2pProperty property = new D2pProperty();
         property.ReadProperty(this.m_reader);
         if (property.Key == "link")
         {
             this.InternalAddLink(property.Value);
         }
         this.m_properties.Add(property);
     }
 }
Пример #3
0
        public bool RemoveLink(D2pFile file)
        {
            D2pProperty property = this.m_properties.FirstOrDefault((D2pProperty entry) => Path.GetFullPath(this.GetLinkFileAbsolutePath(entry.Value)) == Path.GetFullPath(file.FilePath));
            bool        result2;

            if (property == null)
            {
                result2 = false;
            }
            else
            {
                bool result = this.InternalRemoveLink(file) && this.m_properties.Remove(property);
                if (result)
                {
                    this.OnPropertyChanged("Properties");
                }
                result2 = result;
            }
            return(result2);
        }
Пример #4
0
        public bool RemoveProperty(D2pProperty property)
        {
            if (property.Key == "link")
            {
                D2pFile link = this.m_links.FirstOrDefault((D2pFile entry) => Path.GetFullPath(this.GetLinkFileAbsolutePath(property.Value)) == Path.GetFullPath(entry.FilePath));
                if (link == null || !this.InternalRemoveLink(link))
                {
                    throw new Exception(string.Format("Cannot remove the associated link {0} to this property", property.Value));
                }
            }
            bool result;

            if (this.m_properties.Remove(property))
            {
                this.OnPropertyChanged("Properties");
                this.IndexTable.PropertiesCount--;
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Пример #5
0
 private void InternalAddProperty(D2pProperty property)
 {
     this.m_properties.Add(property);
     this.OnPropertyChanged("Properties");
     this.IndexTable.PropertiesCount++;
 }