示例#1
0
        public static D2pEntry CreateEntryDefinition(D2pFile container, IDataReader reader)
        {
            var entry = new D2pEntry(container);

            entry.ReadEntryDefinition(reader);

            return(entry);
        }
示例#2
0
 public D2pEntry(D2pFile container, string fileName, byte[] data)
 {
     Container = container;
     FullFileName = fileName;
     m_newData = data;
     State = D2pEntryState.Added;
     Size = data.Length;
     Index = -1;
 }
示例#3
0
 public D2pEntry(D2pFile container, string fileName, byte[] data)
 {
     Container    = container;
     FullFileName = fileName;
     m_newData    = data;
     State        = D2pEntryState.Added;
     Size         = data.Length;
     Index        = -1;
 }
示例#4
0
        private void InternalAddLink(string linkFile)
        {
            string path = GetLinkFileAbsolutePath(linkFile);

            if (!File.Exists(path))
            {
                throw new FileNotFoundException(linkFile);
            }

            var link = new D2pFile(path);

            foreach (D2pEntry entry in link.Entries)
            {
                InternalAddEntry(entry);
            }

            m_links.Add(link);
            OnPropertyChanged("Links");
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
0
        private bool InternalRemoveLink(D2pFile link)
        {
            if (m_links.Remove(link))
            {
                OnPropertyChanged("Links");

                return true;
            }

            return false;
        }
示例#8
0
        private void InternalAddLink(string linkFile)
        {
            string path = GetLinkFileAbsolutePath(linkFile);

            if (!File.Exists(path))
            {
                throw new FileNotFoundException(linkFile);
            }

            var link = new D2pFile(path);
            foreach (D2pEntry entry in link.Entries)
            {
                InternalAddEntry(entry);
            }

            m_links.Add(link);
            OnPropertyChanged("Links");
        }
示例#9
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;
        }
示例#10
0
 private D2pEntry(D2pFile container)
 {
     Container = container;
     Index = -1;
 }
示例#11
0
 public D2pEntry(D2pFile container, string fileName)
 {
     Container = container;
     FullFileName = fileName;
     Index = -1;
 }
示例#12
0
        public static D2pEntry CreateEntryDefinition(D2pFile container, IDataReader reader)
        {
            var entry = new D2pEntry(container);
            entry.ReadEntryDefinition(reader);

            return entry;
        }
示例#13
0
 public D2pIndexTable(D2pFile container)
 {
     Container = container;
 }
示例#14
0
 public D2pEntry(D2pFile container, string fileName)
 {
     Container    = container;
     FullFileName = fileName;
     Index        = -1;
 }
示例#15
0
 private D2pEntry(D2pFile container)
 {
     Container = container;
     Index     = -1;
 }
示例#16
0
 public D2pIndexTable(D2pFile container)
 {
     Container = container;
 }