Пример #1
0
 public FileInfo(TorrentInfo owner, Ragnar.FileEntry file, int file_index)
 {
     this.file_path = file.Path.FixUTF8();
     this.RawSize   = file.Size;
     this.Owner     = owner;
     this.FileIndex = file_index;
     if (this.Owner != null)
     {
         this.Owner.FileInfoList.Add(this);
     }
 }
Пример #2
0
        /// <summary>
        /// No use outside of TorrentInfo.PopulateFileList()
        /// </summary>
        /// <param name="branch"></param>
        /// <param name="trunk"></param>
        public static void ProcessFile(string branch, DirectoryKey trunk, TorrentInfo owner, Ragnar.FileEntry f, int index)
        {
            string[] parts = branch.Split('\\');
            if (parts.Length == 1)
            {
                //((FileList)trunk[DirectoryKey.FILE_MARKER]).Add(new FileInfo(owner, f));
                trunk.Add(f.Path, new FileInfo(owner, f, index));
            }
            else
            {
                string node  = parts[0];
                string other = branch.Substring(node.Length + 1);

                if (!trunk.ContainsKey(node))
                {
                    trunk[node] = new DirectoryKey(node, owner);
                }
                ProcessFile(other, (DirectoryKey)trunk[node], owner, f, index);
            }
        }