Beispiel #1
0
        public void AddProperty(D2pProperty property)
        {
            if (property.Key == "link")
            {
                InternalAddLink(property.Value);
            }

            InternalAddProperty(property);
        }
Beispiel #2
0
        private void ReadProperties()
        {
            m_reader.Seek(IndexTable.PropertiesOffset, SeekOrigin.Begin);
            for (int i = 0; i < IndexTable.PropertiesCount; i++)
            {
                var property = new D2pProperty();
                property.ReadProperty(m_reader);

                if (property.Key == "link")
                {
                    InternalAddLink(property.Value);
                }

                m_properties.Add(property);
            }
        }
Beispiel #3
0
        public bool RemoveLink(D2pFile file)
        {
            D2pProperty property =
                m_properties.FirstOrDefault(entry =>
                                            Path.GetFullPath(GetLinkFileAbsolutePath(entry.Value)) ==
                                            Path.GetFullPath(file.FilePath));

            if (property == null)
            {
                return(false);
            }

            bool result = InternalRemoveLink(file) && m_properties.Remove(property);

            if (result)
            {
                OnPropertyChanged("Properties");
            }

            return(result);
        }
Beispiel #4
0
        public bool RemoveProperty(D2pProperty property)
        {
            if (property.Key == "link")
            {
                D2pFile link = m_links.FirstOrDefault(entry =>
                                                      Path.GetFullPath(GetLinkFileAbsolutePath(property.Value)) ==
                                                      Path.GetFullPath(entry.FilePath));

                if (link == null || !InternalRemoveLink(link))
                {
                    throw new Exception(string.Format("Cannot remove the associated link {0} to this property",
                                                      property.Value));
                }
            }

            if (m_properties.Remove(property))
            {
                OnPropertyChanged("Properties");
                IndexTable.PropertiesCount--;
                return(true);
            }

            return(false);
        }
Beispiel #5
0
 private void InternalAddProperty(D2pProperty property)
 {
     m_properties.Add(property);
     OnPropertyChanged("Properties");
     IndexTable.PropertiesCount++;
 }