public void AddProperty(D2pProperty property) { if (property.Key == "link") { InternalAddLink(property.Value); } InternalAddProperty(property); }
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); } }
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); }
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); }
private void InternalAddProperty(D2pProperty property) { m_properties.Add(property); OnPropertyChanged("Properties"); IndexTable.PropertiesCount++; }
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; }