BTTool.TorrentFile.SaveFile C# (CSharp) Method

SaveFile() public method

保存BT文件
public SaveFile ( string filename ) : void
filename string 文件保存路径
return void
        public void SaveFile(string filename)
        {
            if (_bRootNode == null)
                return;
            using (FileStream stream = new FileStream(filename, FileMode.Create))
            {
                byte[] buffer = _bRootNode.ToBytes();
                stream.Write(buffer, 0, buffer.Length);
            }
        }

Usage Example

Esempio n. 1
0
        public void BacthVonverse()
        {
            long tick = Environment.TickCount;

            IAnalyser btAnalyser = new CommonAnalyser();

            foreach (FileInfo fInfo in _sourFilenameList)
            {
                if (!fInfo.Extension.Equals(".torrent"))
                {
                    continue; // 过滤非BT文件
                }
                TorrentFile torrentFile = new TorrentFile();
                torrentFile.OpenFile(fInfo.FullName);
                torrentFile.Modify();
                string newFilename = String.Format("{0}\\{1}", _destFolder, fInfo.Name);
                torrentFile.SaveFile(newFilename);
            }

            if (_callBackFunc != null)
            {
                _callBackFunc(String.Format("转换完毕, 总用时{0} 秒", (Environment.TickCount - tick) / 1000.0));
            }
        }
All Usage Examples Of BTTool.TorrentFile::SaveFile