home *** CD-ROM | disk | FTP | other *** search
- var TaskManager = new Object;
-
- TaskManager.MaxtTask = 3;
- TaskManager.RunningCount = 0;
- TaskManager.DownThreadUsing = new Array();
- TaskManager.TaskList = new Array();
- TaskManager.lastDownSize = 0;
- TaskManager.lastTimeStamp = 0;
-
- ItemSatausFlag =
- [
- ["downloadling", "is_downloading.png"],
- ["converting", "is_converting.png"],
- ["finished", "is_finished.png"],
- ["waiting", "is_waiting.png"],
- ["download_paused", "is_download_paused.png"],
- ["convert_paused", "is_convert_paused.png"],
- ["download_failed", "is_download_failed.png"],
- ["convert_failed", "is_convert_failed.png"],
- ["stopped", "is_stopped.png"],
- ["convert_local_stopped","is_stopped.png"],
- ["convert_net_stopped", "is_stopped.png"],
-
-
- ["", ""]
-
- ];
-
- TaskManager.GetUnusing = GetUnusing;
- TaskManager.AddTask = AddTask;
- TaskManager.TaskSetItemStatus = TaskSetItemStatus;
- TaskManager.RunTask = RunTask;
-
- for (var i=0; i<TaskManager.MaxtTask; i++)
- {
- TaskManager.DownThreadUsing[i] = 0;
- }
-
- function GetUnusing()
- {
- var count = 0;
- for (var i=0; i<this.DownThreadUsing.length; i++)
- {
- if (this.DownThreadUsing[i] == 0)
- {
- return i;
- }
- count ++;
- }
- if(count < TaskManager.MaxtTask)
- {
- TaskManager.DownThreadUsing[count++] = 0;
- //this.DownThreadUsing.length;
- return count;
- }
- return -1;
- }
- function renamefile(filepath)
- {
- var nEnd=filepath.lastIndexOf(".")-1;
- return filepath.substring(0,nEnd);
-
- }
-
-
- function AddTask(upodurl, upodfilesize, upodprogress, upodpath, proftype, profopt, isconvert, srcfile, targetfile, realurl, bjrename, flvtmppath)
- {
- var nmax = MainWindow.listctrlfiles.GetItemCount();
-
- var task = new Object;
- task.st = "waiting";
- task.last_st = "waiting";
- task.taskid = -1;
- task.filesize = -1;
- task.filename = "";
- task.lastProgress = 0;
- task.lastDownSize = 0;
- task.lastTimeStamp = 0;
- // 0 1 2 3 4 5 6 7 8 9 10 11 12
- task.info = [isconvert, upodurl, upodfilesize, upodprogress, upodpath, proftype, profopt, isconvert, srcfile, targetfile, realurl, bjrename, ""];
-
-
- if (bjrename==1 && upodurl.length>0)
- task.filename = upodurl;
-
- // ShowMessageBox(task.info);
-
- var item1 = ["", upodurl, upodfilesize, upodprogress, upodpath];
- MainWindow.listctrlfiles.InsertItem(nmax,item1);
- MainWindow.listctrlfiles.SetItemData(nmax, task);
-
- if (TaskManager.RunningCount<TaskManager.MaxtTask)
- {
- if (isconvert==0)
- {
-
- ProcessDownload(nmax, task);
- }
- else
- {
- ProcessConvert(nmax, task);
- }
- }
- else
- {
- TaskSetItemStatus(nmax, "waiting");
- }
- }
-
- function TaskManagerProcess()
- {
- var b_need_update_ui_status = false;
- var this_total_size = 0;
-
- with(MainWindow)
- {
- if (listctrlfiles.GetItemCount()==0)
- {
- return;
- }
-
- for (var j=0; j<listctrlfiles.GetItemCount(); j++)
- {
- var task = listctrlfiles.GetItemData(j);
- if (task==null)
- {
- continue;
- }
- if(task.st=="downloadling")
- {
- if(utb_down_class.UTB_IsError(task.taskid)==1)
- {
- NewTaskSetItemStatus(j, task, "download_failed");
- TaskManager.DownThreadUsing[task.taskid] = 0;
- utb_down_class.UTB_UnInit(task.taskid);
- TaskManager.RunningCount--;
- b_need_update_ui_status = true;
- listctrlfiles.SetText(j,3,LanguageStr("_fail"));
- }
- }
- }
- }
- with (MainWindow)
- {
- if (listctrlfiles.GetItemCount()==0)
- {
- return;
- }
-
- for (var i=0; i<listctrlfiles.GetItemCount(); i++)
- {
- var task = listctrlfiles.GetItemData(i);
- if (task==null)
- continue;
-
- if (task.st=="waiting")
- {
- if (TaskManager.RunningCount<TaskManager.MaxtTask)
- {
-
- if (task.last_st=="waiting")
- {
- if (task.info[0]==0)
- {
- ProcessDownload(i, task);
- }
- else
- {
- ProcessConvert(i, task);
- }
- }else if (task.last_st=="download_failed")
- {
- ProcessDownload(i, task);
- }else if (task.last_st=="download_paused")
- {
- ProcessDownload(i, task);
- }else if (task.last_st=="downloadling")
- {
- ProcessDownload(i, task);
- }else if (task.last_st=="converting")
- {
- ProcessConvert(i, task);
- }else if(task.last_st=="stopped")
- {
- ProcessDownload(i, task);
- }
-
- b_need_update_ui_status = true;
- }
- }
- else if (task.st=="downloadling")
- {
- if (task.filesize==-1)
- {
- if (utb_down_class.UTB_GetFileSize(task.taskid)<=0)
- continue;
-
- task.filesize = utb_down_class.UTB_GetFileSize(task.taskid);
- task.lastDownSize = 0;
- task.lastTimeStamp = GetTickcount();
-
- var sz = task.filesize / (1024.0*1024.0);
-
- listctrlfiles.SetValue(i, 2, formatFloat(sz, 2)+"MB");
-
- }
- {
- if (task.info[11]==0 && task.filename=="")
- {
- var fileName = utb_down_class.UTB_GetFileName(task.taskid);
-
- if (fileName!="")
- {
- task.filename = fileName;
- listctrlfiles.SetValue(i, 1, fileName);
- }
- }
- }
-
- var dl_size = utb_down_class.UTB_GetDLSize(task.taskid);
- if (dl_size>0)
- {
- this_total_size = this_total_size + dl_size - task.lastDownSize;
- task.lastDownSize = dl_size;
-
- if (dl_size<task.filesize)
- {
- var progress = dl_size * 100 / task.filesize;
- progress = formatFloat(progress, 0);
- if (task.lastProgress!=progress)
- {
- listctrlfiles.SetValue(i, 3, progress);
- listctrlfiles.SetText(i,3,LanguageStr("_download"));
- task.lastProgress = progress;
- }
-
- var d_time = GetTickcount() - task.lastTimeStamp;
- var d_rate = 0;
- }
- else // Dowload finished
- {
- // if (task.info[5]=="flv") // only download but not converter, it means this tash is finished.
- //{
- listctrlfiles.SetValue(i, 3, 100);
- TaskSetItemStatus(i, "finished");
- listctrlfiles.SetText(i,3,LanguageStr("_finish"));
- utb_down_class.UTB_UnInit(task.taskid);
- TaskManager.DownThreadUsing[task.taskid] = 0;
-
- // i = 0; // Make a chance for the first waiting task
- TaskManager.RunningCount --;
- var b_auto_delete=cfgGetInt("general", "autodelete");
- if(b_auto_delete)
- {
- listctrlfiles.DeleteItem(i);
- if(listctrlfiles.GetItemCount()==0)
- {
- MainWindow.listctrlfiles.height=0;
- MainWindow.pel.height=332;
- }
- }
- b_need_update_ui_status = true;
- continue;
- //}
-
- }
- }
- }
-
- }
-
- this_total_size = this_total_size / 1024.0;
- this_total_size = this_total_size / ((GetTickcount()-TaskManager.lastTimeStamp)/10.0)
- TaskManager.lastTimeStamp = GetTickcount();
-
- var speed = formatFloat(this_total_size, 2)+"KB";
- downspeedtext.SetText(speed);
- var speedwnd=parseInt(this_total_size);
- popwin.panel1.curveline2.Add(speedwnd);
- if(this_total_size<0)speed=0+"KB";
- popwin.panel1.speed1.SetText(speed);
- popwin.panel1.task1.SetText(TaskManager.RunningCount);
-
- if(TaskManager.RunningCount>0&&bjfudong==1)
- {
- fudong_close();
- showpopup();
- var speedwnd=parseInt(this_total_size);
- if(speedwnd<=0)
- speedwnd=0;
- popwin.panel1.curveline2.Add(speedwnd);
- popwin.panel1.speed1.SetText(speed);
- popwin.panel1.task1.SetText(TaskManager.RunningCount);
- }
- else if(TaskManager.RunningCount==0&&bjfudong==2)
- {
- fudong_close();
- downspeedtext.SetText("");
- showpopup();
- }
-
-
-
- if (b_need_update_ui_status)
- UpdateUIStatus();
- }
- }
-
- function ProcessDownload(i, task)
- {
- var n = TaskManager.GetUnusing();
- if (n!=-1)
- {
- MainWindow.listctrlfiles.SetValue(i, 3, 0);
-
- TaskManager.RunningCount ++;
- utb_down_class.UTB_Init(n);
- TaskManager.DownThreadUsing[n] = 1;
- TaskManager.TaskSetItemStatus(i, "downloadling");
-
- // 0 1 2 3 4 5 6 7 8 9 10 11 12
- //task.info = [isconvert, upodurl, upodfilesize, upodprogress, upodpath, proftype, profopt, isconvert, srcfile, targetfile, realurl, bjrename, flvtmppath];
-
- utb_down_class.UTB_DownLoad(task.info[10],"", task.filename, task.info[4], 32, 5, 0, n, 0);
- task.taskid = n;
- }
- }
-
- function ProcessConvert(i, task)
- {
-
- n = TaskManager.GetUnusing();
- if (n!=-1)
- {
- var itemtmp=MainWindow.listctrlfiles.GetItem(i);
- if(itemtmp[4]=="flv")
- {
- helper.Helper_CopyFileZ(task.info[8], task.info[9]);
- MainWindow.listctrlfiles.SetValue(i,3,100);
- TaskSetItemStatus(i, "finished");
- return;
- }
-
- TaskManager.RunningCount ++;
-
- TaskManager.DownThreadUsing[n] = 1;
- TaskManager.TaskSetItemStatus(i, "converting");
- utb_down_class.UTB_Init(n);
-
- if(task.info[11]==1)
- task.info[9]=itemtmp[5]+itemtmp[1]+"."+itemtmp[4];
-
-
-
- utb_down_class.UTB_ConvertFileStart(task.info[8], task.info[9], task.info[6], task.info[5], n);
-
- task.taskid = n;
- }
- }
-
- function RunTask()
- {
- this.lastTimeStamp = GetTickcount();
- MainWindow.SetTimer(101, 1000, "TaskManagerProcess");
- }
-
- function TaskSetItemStatus(item, st)
- {
- with (MainWindow.listctrlfiles)
- {
- var pj = null;
- for (var i=0; i<ItemSatausFlag.length; i++)
- {
- if (ItemSatausFlag[i][0]==st)
- {
- pj = ItemSatausFlag[i][1];
- break;
- }
- }
- if (pj==null)
- {
- // Msg("Load image failed for item sataus:"+st, "Error", 0);
- }
-
- SetValue(item, 0, pj);
-
- var task = GetItemData(item);
- task.st = st;
- }
- }
-
- function NewTaskSetItemStatus(item, task, st)
- {
-
- with (MainWindow.listctrlfiles)
- {
- var pj = null;
- for (var i=0; i<ItemSatausFlag.length; i++)
- {
- if (ItemSatausFlag[i][0]==st)
- {
- pj = ItemSatausFlag[i][1];
-
- break;
- }
- }
- if (pj==null)
- {
- // Msg("Load image failed for item sataus:"+st, "Error", 0);
- }
-
- SetValue(item, 0, pj);
-
- task.st = st;
- }
- }
-
- function UpdateUIStatus()
- {
- var b_start = false;
- var b_pause = false;
- var b_stop = false;
- var b_delete = false;
- var b_fileinfo = false;
- var b_play = false;
- var b_delete_finished = false;
-
- var b_select_all = false;
- var bj_fileinfo=0;
-
-
- with (MainWindow)
- {
- var count = listctrlfiles.GetItemCount();
- if (count>0)
- b_select_all = true;
-
- for (var i=0; i<count; i++)
- {
- if (b_delete_finished==false)
- {
- task = listctrlfiles.GetItemData(i);
- if (task.st=="finished")
- {
- b_delete_finished = true;
- }
- }
-
- if (listctrlfiles.IsSelected(i))
- {
- ++bj_fileinfo;
- var task = listctrlfiles.GetItemData(i);
- b_delete = true;
- if (task.st=="waiting")
- {
- b_stop = true;
- }else if (task.st=="downloadling")
- {
- b_stop = true;
- }else if(task.st=="convert_paused")
- {
- b_stop=true;
- b_start=true;
- }
- else if (task.st=="converting")
- {
- b_stop = true;
- b_pause = true;
- }else if (task.st=="finished")
- {
- b_play = true;
- b_fileinfo = true;
- }else if ( task.st=="convert_paused"
- || task.st=="download_failed"
- || task.st=="convert_failed"
- || task.st=="download_paused"
- || task.st=="stopped"
- || task.st=="convert_local_stopped"
- || task.st=="convert_net_stopped"
- )
- {
- b_start = true;
- }
- }
- }
-
- if(bj_fileinfo>1)
- {
- b_play=false;
- b_fileinfo=false;
- }
-
- buttonstart.SetEnable(b_start);
- buttonstop.SetEnable(b_stop);
- buttonpre.SetEnable(b_play);
- buttonfileinfo.SetEnable(b_fileinfo);
- buttondelete.SetEnable(b_delete);
- buttonpause.SetEnable(b_pause);
-
- menubar.menuoffile.menuoffileinfo.SetEnable(b_fileinfo);
- menubar.menuofedit.menuofselall.SetEnable(b_select_all);
-
- menubar.menuofedit.menuofdeltask.SetEnable(b_delete);
- menubar.menuofedit.menuofdelfintask.SetEnable(b_delete_finished); // ???
-
- menubar.menuofaction.menuofstart.SetEnable(b_start);
- menubar.menuofaction.menuofpause.SetEnable(b_pause);
- menubar.menuofaction.menuofstop.SetEnable(b_stop);
- menubar.menuofaction.menuofplayvideo.SetEnable(b_play);
- }
- }
-
- function DoStopWorking()
- {
- with (MainWindow)
- {
- MainWindow.ShowMessageBox(LanguageStr("_flvmain_msg_stoptask"), GetProductName(), 2);
- if(b_flag==0)
- return;
-
- var count = listctrlfiles.GetItemCount();
- if (count<=0)
- {
- UpdateUIStatus();
- return 1;
- }
-
- // the variable of the for loop must be declare by var, otherwise the variable cannot be working correctly.
- for (var i=0; i<count; i++)
- {
- if (listctrlfiles.IsSelected(i))
- {
- // Msg(i, "", 0);
- //continue;
-
- task = listctrlfiles.GetItemData(i);
- StopTask(i, task);
- }
- }
- }
- UpdateUIStatus();
- }
-
- function DoPauseConverting()
- {
- with (MainWindow)
- {
- //if(ShowMessageBox(LanguageStr("_flvmain_msg_stoptask"), LanguageStr("_waring"), 4)==7)
- // return 1;
-
- var count = listctrlfiles.GetItemCount();
- if (count<=0)
- {
- UpdateUIStatus();
- return 1;
- }
-
- // the variable of the for loop must be declare by var, otherwise the variable cannot be working correctly.
- for (var i=0; i<count; i++)
- {
- if (listctrlfiles.IsSelected(i))
- {
- // Msg(i, "", 0);
- //continue;
-
- task = listctrlfiles.GetItemData(i);
- //StopTask(i, task);
- PauseTask(i,task);
- }
- }
- }
- UpdateUIStatus();
- }
-
- function DoStartWorking()
- {
- with (MainWindow)
- {
- var count = listctrlfiles.GetItemCount();
- if (count<=0)
- {
- UpdateUIStatus();
- return 1;
- }
-
- /*
- "convert_paused"
- "download_failed"
- "convert_failed"
- "download_paused"
- "stopped"
- */
-
- // the variable of the for loop must be declare by var, otherwise the variable cannot be working correctly.
- for (var i=0; i<count; i++)
- {
- if (listctrlfiles.IsSelected(i))
- {
- task = listctrlfiles.GetItemData(i);
- if (task.st=="stopped")
- {
- NewTaskSetItemStatus(i, task, "waiting");
- task.last_st = "stopped";
- }else if (task.st=="download_failed")
- {
- NewTaskSetItemStatus(i, task, "waiting");
- task.last_st = "download_failed";
- }else if (task.st=="convert_failed")
- {
- NewTaskSetItemStatus(i, task, "waiting");
- task.last_st = "convert_failed";
- }else if (task.st=="convert_paused")
- {
- //NewTaskSetItemStatus(i, task, "waiting");
- NewTaskSetItemStatus(i, task, "converting");
- utb_down_class.UTB_ConvertTheMedia(task.info[6], task.info[5], task.taskid);
-
- task.last_st = "convert_paused";
-
- }else if (task.st=="download_paused")
- {
- NewTaskSetItemStatus(i, task, "waiting");
- task.last_st = "download_paused";
- }else if(task.st=="convert_local_stopped")
- {
- NewTaskSetItemStatus(i, task, "waiting");
- task.last_st = "convert_local_stopped";
- }else if(task.st=="convert_net_stopped")
- {
- NewTaskSetItemStatus(i, task, "waiting");
- task.last_st = "convert_net_stopped";
- }
- }
- }
- }
- UpdateUIStatus();
- }
-
- function StopTask(n_item, task)
- {
- if (task.st=="waiting")
- {
- NewTaskSetItemStatus(n_item, task, "stopped");
- task.last_st = "waiting";
- }else if (task.st=="downloadling")
- {
- // var itemtmp=MainWindow.listctrlfiles.GetItem(n_item);
- utb_down_class.UTB_Stop(task.taskid);
-
- // Call UTB_UnInit after UTB_Stop will arouse the main program crashed. So it must be fixed. ???
- utb_down_class.UTB_UnInit(task.taskid); //delete obj;
- NewTaskSetItemStatus(n_item, task, "stopped");
- task.last_st = "downloadling";
-
- TaskManager.RunningCount --;
- TaskManager.DownThreadUsing[task.taskid] = 0;
- }else if (task.st=="converting")
- {
-
- if(task.info[8]!="")//local file
- {
- //delete obj;
-
- NewTaskSetItemStatus(n_item, task, "convert_local_stopped");
- utb_down_class.UTB_ConvertStop(task.taskid);
- utb_down_class.UTB_UnInit(task.taskid);
- }else
- {
-
-
- var itemtmp=MainWindow.listctrlfiles.GetItem(n_item);
- task.info[8]=itemtmp[5]+itemtmp[1]+"."+"flv";
- task.info[9]=itemtmp[5]+itemtmp[1]+"."+itemtmp[4];
-
- NewTaskSetItemStatus(n_item, task, "convert_net_stopped");
- utb_down_class.UTB_ConvertStop(task.taskid);
- utb_down_class.UTB_UnInit(task.taskid);
- }
-
- task.last_st = "converting";
- TaskManager.RunningCount --;
- TaskManager.DownThreadUsing[task.taskid] = 0;
-
- //Msg("hello");
- }else if (task.st=="convert_paused")
- {
- if(task.info[8]=="")
- {
- NewTaskSetItemStatus(n_item, task, "convert_net_stopped");
- utb_down_class.UTB_ConvertStop(task.taskid);
- utb_down_class.UTB_UnInit(task.taskid); //delete obj;
-
- task.last_st = "convert_paused";
- }else
- {
- NewTaskSetItemStatus(n_item, task, "convert_local_stopped");
- utb_down_class.UTB_ConvertStop(task.taskid);
- utb_down_class.UTB_UnInit(task.taskid); //delete obj;
- task.last_st = "convert_paused";
- }
-
- TaskManager.RunningCount --;
- TaskManager.DownThreadUsing[task.taskid] = 0;
- }else if (task.st=="download_failed")
- {
- /*
- utb_down_class.UTB_Stop(task.taskid);
- utb_down_class.UTB_UnInit(task.taskid); //delete obj;
- NewTaskSetItemStatus(n_item, task, "stopped");
- task.last_st = "download_failed";
-
- TaskManager.RunningCount --;
- TaskManager.DownThreadUsing[task.taskid] = 0;
- */
- }
-
- if (task.st!="finished" && task.st!="download_failed")
- {
- MainWindow.listctrlfiles.SetText(n_item,3,LanguageStr("_stop"));
- }
-
- if(task.st!="finished")
- {
- task.lastDownSize = 0;
- task.lastTimeStamp = 0;
- }
- }
-
- function PauseTask(n_item, task)
- {
- if(task.st=="converting")
- {
- if(task.info[9]=="")//net file
- {
- utb_down_class.UTB_ConvertPause(task.taskid);
- }else
- {
- utb_down_class.UTB_ConvertFilePause(task.taskid);
-
- }
- NewTaskSetItemStatus(n_item, task, "convert_paused");
- task.last_st = "converting";
- }
- }
-
- function DoDeleteTask()
- {
- with (MainWindow)
- {
- var count = listctrlfiles.GetItemCount();
- if (count<=0)
- {
- UpdateUIStatus();
- return 1;
- }
-
- MainWindow.ShowMessageBox(LanguageStr("_flvmain_msg_deltask"), GetProductName(), 2);
- if(b_flag==0)
- return;
-
- SetWindowRedraw(listctrlfiles, false);
-
- for (var i=count-1; i>=0; i--)
- {
- if (listctrlfiles.IsSelected(i))
- {
- task = listctrlfiles.GetItemData(i);
- var itemtmp=listctrlfiles.GetItem(i);
-
- if(task.st=="downloadling")
- {
- StopTask(i, task);
- if(helper.Helper_IsFileExist(itemtmp[4]+"\\"+itemtmp[1]+".flv")==1)
- {
- helper.Helper_DeleteFile(itemtmp[4]+"\\"+itemtmp[1]+".flv");
- }
- listctrlfiles.DeleteItem(i);
- }else if(task.st=="download_failed"||task.st=="stopped")
- {
- if(helper.Helper_IsFileExist(itemtmp[4]+"\\"+itemtmp[1]+".flv")==1)
- {
- helper.Helper_DeleteFile(itemtmp[4]+"\\"+itemtmp[1]+".flv");
- }
- listctrlfiles.DeleteItem(i);
- }else
- {
- listctrlfiles.DeleteItem(i);
- }
-
- }
- }
- if(TaskManager.RunningCount==0&&bjfudong==2)
- {
- fudong_close();
- showpopup();
- }
- if(listctrlfiles.GetItemCount()==0)
- {
- MainWindow.listctrlfiles.height=0;
- MainWindow.pel.height=332;
- }
-
-
- SetWindowRedraw(listctrlfiles, true);
-
- UpdateUIStatus();
- }
- }
-
- function DoDeleteFinishedTask()
- {
- with (MainWindow)
- {
- var count = listctrlfiles.GetItemCount();
- if (count<=0)
- {
- UpdateUIStatus();
- return 1;
- }
-
- SetWindowRedraw(listctrlfiles, false);
- for (var i=count-1; i>=0; i--)
- {
- task = listctrlfiles.GetItemData(i);
- //ShowMessageBox(task);
- if (task.st=="finished")
- {
- listctrlfiles.DeleteItem(i);
- }
- }
- if(listctrlfiles.GetItemCount()==0)
- {
- MainWindow.listctrlfiles.height=0;
- MainWindow.pel.height=332;
- }
- SetWindowRedraw(listctrlfiles, true);
- UpdateUIStatus();
- }
- return 0;
- }
-
- function TaskCanStart(task)
- {
- if ( task.st=="convert_paused"
- || task.st=="download_failed"
- || task.st=="convert_failed"
- || task.st=="download_paused"
- || task.st=="stopped"
- || task.st=="convert_local_stopped"
- || task.st=="convert_net_stopped"
- )
- {
- return true;
- }
-
- return false;
- }
-
- function TaskCanPause(task)
- {
- if (task.st=="converting")
- {
- return true;
- }
-
- return false;
- }
-
- function TaskCanStop(task)
- {
- if (task.st=="waiting")
- {
- return true;
- }
-
- if (task.st=="downloadling")
- {
- return true;
- }
-
- if (task.st=="converting")
- {
- return true;
- }
- if(task.st=="convert_paused")
- {
- return true;
- }
- return false;
- }
-
-
- ///////
-
- function SaveTask(cfg, task, nIndex,filename,filesize,fileprogress)
- {
- //Msg(task.info[1]+" "+task.info[2]+" "+task.info[3]+" "+task.info[4]);
- //cfg.WriteString("Tasks", nIndex, task.info[1]+","+task.info[2]+","+task.info[3]);
- //cfg.SetValue("task",nIndex,task.info[0]+","+task.info[1]+","+task.info[2]+","+task.info[3]+","+task.info[4]+","+task.info[8]+","+task.info[9]+
- //","+filename+","+filesize+","+fileprogress);
- //Msg("sadfasdf");
- //Msg(filename+" "+filesize+" "+fileprogress);
- cfg.SetValue("task",nIndex,task.info[0]+",/"+task.info[1]+",/"+task.info[2]+",/"+task.info[3]+",/"+task.info[4]+",/"+task.info[5]+",/"+task.info[6]+",/"+task.info[7]+",/"+task.info[8]+",/"+task.info[9]+",/"+task.info[10]+",/"+task.info[11]+",/"+task.info[12]+",/"+task.st+",/"+filename+",/"+filesize+",/"+fileprogress);
-
-
-
- }
-
- function SaveAllTasks()
- {
- //var s_TaskSavedFile = GetPrivateConfigFolder() + "\\savedtask.ini";
- //g_upodutil.DeleteFile(s_TaskSavedFile);
-
- var s_TaskSavedFile ="upod.ini";
- g_upodutil.DeleteFile(s_TaskSavedFile);
-
- var TaskConfig = new JSIniFile();
- TaskConfig.SetPath(s_TaskSavedFile);
-
-
- var nCount = 0;
-
- with (MainWindow.listctrlfiles)
- {
- for (var i=0; i<GetItemCount(); i++)
- {
- var Task = GetItemData(i);
- if (Task.st=="downloadling"||Task.st=="converting")
- {
- if(Task.info[9]!="")
- {
- StopTask(i,Task);
- var itemtmp=GetItem(i);
- SaveTask(TaskConfig, Task, nCount,itemtmp[1],itemtmp[2],itemtmp[3]);
- nCount ++;
- }else
- {
- StopTask(i,Task);
- var itemtmp=GetItem(i);
- var tmppath=cfgGetString("general","tempfolder","c:\\");
- Task.info[8]=tmppath+"\\"+itemtmp[1]+"."+"flv";
- Task.info[9]=itemtmp[5]+"\\"+itemtmp[1]+"."+itemtmp[4];
- SaveTask(TaskConfig, Task, nCount,itemtmp[1],itemtmp[2],itemtmp[3]);
- nCount ++;
- }
- }
- else if(Task.st=="stopped"||Task.st=="download_failed")
- {
- var itemtmp=GetItem(i);
- SaveTask(TaskConfig, Task, nCount,itemtmp[1],itemtmp[2],itemtmp[3]);
- nCount ++;
- }else if(Task.st=="convert_paused")
- {
- StopTask(i,Task);
- var itemtmp=GetItem(i);
- SaveTask(TaskConfig, Task, nCount,itemtmp[1],itemtmp[2],itemtmp[3]);
- nCount ++;
- }else if(Task.st=="convert_local_stopped"||Task.st=="convert_net_stopped")
- {
- var itemtmp=GetItem(i);
- SaveTask(TaskConfig, Task, nCount,itemtmp[1],itemtmp[2],itemtmp[3]);
- nCount ++;
- }else if(Task.st=="finished")
- { var itemtmp=GetItem(i);
- SaveTask(TaskConfig, Task, nCount,itemtmp[1],itemtmp[2],itemtmp[3]);
- nCount ++;
- }
-
- }
- }
-
- TaskConfig.SetValue("General", "TaskCount", nCount);
-
- TaskConfig.WriteFile();
-
- TaskConfig = null;
- }