示例#1
0
        }                               //任务的GID

        public async void GetFileInfo() //获得文件信息
        {
            JRCtler.JsonRpcRes x = await Aria2Methords.GetFiles(Gid);

            if (x.Result.Count == 1)
            {
                string filepath = x.Result[0].path;
                if (filepath != null)
                {
                    FileName       = filepath.Substring(filepath.LastIndexOf(@"/") + 1);
                    FileNameSource = FileNameSources.Path;
                }
                else
                {
                    string uri = x.Result[0].uris[0].uri;
                    FileName       = uri.Substring(uri.LastIndexOf(@"/") + 1);
                    FileNameSource = FileNameSources.Uri;
                }
            }
            else
            {
                string path  = x.Result[0].path;
                int    count = x.Result.Count;
                FileName = path.Substring(path.IndexOf(@"/") + 1, path.LastIndexOf(@"/")) + ",共计" + count.ToString() + "个文件";
            }
            OnPropertyChanged("FileName");
        }
示例#2
0
 private async void Add()
 {
     string[] DownloadUris = UriBox.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
     foreach (string uri in DownloadUris)
     {
         await Aria2Methords.AddUri(uri);
     }
 }
示例#3
0
        private async void Refresh()//更新任务列表
        {
            JRCtler.JsonRpcRes x = await Aria2Methords.TellActive();

            CheckRefreshResult(x);
            JRCtler.JsonRpcRes y = await Aria2Methords.TellWaiting();

            CheckRefreshResult(y);
            JRCtler.JsonRpcRes z = await Aria2Methords.TellStopped();

            CheckRefreshResult(z);
        }
示例#4
0
        public async Task Refresh()//刷新任务状态
        {
            if (OughtToRefresh <= 0)
            {
                JRCtler.JsonRpcRes e = await Aria2Methords.TellStatus(Gid);

                InformationRefresh(e);
            }
            else
            {
                OughtToRefresh--;
            }
        }
示例#5
0
        private async void MT_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                Filter = "MetaLink文件 (*.metalink)|*.metalink"
            };
            var result = openFileDialog.ShowDialog();

            if (result == true)
            {
                await Aria2Methords.AddMetalink(openFileDialog.FileName);

                Close();
            }
        }
示例#6
0
        private async void BT_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                Filter = "BT下载的种子文件 (*.torrent)|*.torrent"
            };
            var result = openFileDialog.ShowDialog();

            if (result == true)
            {
                await Aria2Methords.AddTorrent(openFileDialog.FileName);

                Close();
            }
        }
示例#7
0
        public async void StateChangeFunction()
        {
            if (State == "none")
            {
                await Aria2Methords.Pause(Gid);

                State = "error";
            }
            else
            {
                await Aria2Methords.UpPause(Gid);

                State = "none";
            }
            OughtToRefresh = 0;
            OnPropertyChanged("State");
        }
示例#8
0
        public async void TaskCompleted(TaskLite e)
        {
            if (FinishedGidList.Contains(e.Gid) == false)
            {
                var y = await Aria2Methords.GetFiles(e.Gid);

                Newtonsoft.Json.Linq.JArray results = y.Result;
                foreach (dynamic x in results)
                {
                    FinishedTask a = new FinishedTask
                    {
                        Path     = x.path,
                        FileSize = x.length,
                        FromGid  = e.Gid
                    };
                    a.FileName = a.Path.Substring(a.Path.LastIndexOf(@"/") + 1);
                    Add(a);
                }
                FinishedGidList.Add(e.Gid);
            }
        }
示例#9
0
 public async Task Remove()
 {
     await Aria2Methords.Remove(Gid);
 }
示例#10
0
文件: Statics.cs 项目: weinre/ezAria2
 private static void Quit(object sender, ExitEventArgs e)//程序关闭事件
 {
     ProCtl.Dispose();
     Aria2Methords.ShutDown();
 }