home *** CD-ROM | disk | FTP | other *** search
-
- LoadLib("upodutil.dll");
- var g_upodutil = new upodutil();
- function BringWindowToTop(hWnd)
- {
- return g_upodutil.BringWindowToTop(hWnd);
- }
-
- function GetTickcount()
- {
- return g_upodutil.GetTickcount();
- }
-
- function ShowMessageBox(s_msg, s_title, flag)
- {
- //return this.Msg(s_msg, s_title, flag);
- if(flag==1)
- {
- normal.normaltitle.SetText(s_title);
- normal.msginfo.SetText(s_msg);
- normal.ShowModal();
- }else if(flag==2)
- {
- special.specialtitle.SetText(s_title);
- special.msginfo.SetText(s_msg);
- special.ShowModal();
- }
- }
-
- function SetForegroundWindow(hwnd)
- {
- if (typeof(hwnd)=="object")
- return g_upodutil.SetForegroundWindow(hwnd.GetHandle());
- else if (typeof(hwnd)=="number")
- return g_upodutil.SetForegroundWindow(hwnd);
-
- return null;
- }
-
- function IsWindowVisible(hwnd)
- {
- if (typeof(hwnd)=="object")
- return g_upodutil.IsWindowVisible(hwnd.GetHandle());
- else if (typeof(hwnd)=="number")
- return g_upodutil.IsWindowVisible(hwnd);
-
- return false;
- }
-
- function SetWindowRedraw(hwnd, redraw)
- {
- if (typeof(hwnd)=="object")
- return g_upodutil.SetWindowRedraw(hwnd.GetHandle(), redraw);
- else if (typeof(hwnd)=="number")
- return g_upodutil.SetWindowRedraw(hwnd, redraw);
-
- return false;
- }
-
- function StringToInt(string, defValue)
- {
- for (var i=0; i<string.length; i++)
- {
- Msg(string[i]);
- }
- }
-
- function IsValidLanguage(s_language)
- {
- var s_lang_file = GetLanguagePath() + "\\" + s_language + ".lang";
- if (g_upodutil.FileCanRead(s_lang_file))
- {
- return true;
- }
-
- return false;
- }
-
- var LanguageMap =
- [
- [0, "Chinese (PRC)", "Chinese(Simplified)"],
- [0, "Chinese (Taiwan)", "Chinese(Taiwan)"],
- [1, "English", "English"],
- [2, "Deutsch", "Deutsch"],
- [3, "Japanese" , "Japanese"],
-
- ["", ""]
- ];
-
-
- function GetDefaultLanguage()
- {
- var s_default_lang = g_Register.GetDefaultLanguage();
- for (var i=0; i<LanguageMap.length; i++)
- {
- if (LanguageMap[i][0]==0)
- {
- if (LanguageMap[i][1]==s_default_lang)
- {
- return LanguageMap[i][2];
- }
- }else
- {
- if (LanguageMap[i][1]==s_default_lang.substr(0, LanguageMap[i][1].length))
- {
- return LanguageMap[i][2];
- }
- }
- }
- return "English";
- }
-
- function GetLanguage()
- {
- var s_lang = cfgGetString("general", "language");
-
- if (s_lang=="" || IsValidLanguage(s_lang)==false)
- {
- s_lang = GetDefaultLanguage();
- if (IsValidLanguage(s_lang)==false)
- s_lang = "English";
- cfgSetString("general", "language", s_lang);
- }
-
-
- return s_lang;
- }
-
- var ValidSkin = ["newskin", "upod_green"];
-
- function LoadSkinStartup()
- {
- var s_temp = "";
- skinstr = cfgGetString("general", "skin");
-
- for (var i=0; i<ValidSkin.length; i++)
- {
- if (skinstr==ValidSkin[i])
- {
- s_temp = skinstr;
- break;
- }
- }
-
- if (s_temp=="")
- {
- skinstr = ValidSkin[0];
- cfgSetString("general", "skin", skinstr);
- }
-
- if(skinstr=="newskin")
- {
- MainWindow.menubar.menuoftools.menuofchangeskin.defaultskin.SetCheck(true);
- MainWindow.menubar.menuoftools.menuofchangeskin.zidingyi.SetCheck(false);
- }
- else
- {
- MainWindow.menubar.menuoftools.menuofchangeskin.zidingyi.SetCheck(true);
- MainWindow.menubar.menuoftools.menuofchangeskin.defaultskin.SetCheck(false);
- }
-
-
- LoadSkin(skinstr);
- }
-
- function ChangeSkin(s_skin)
- {
- LoadSkin(s_skin);
- if(s_skin=="newskin")
- {
- MainWindow.menubar.menuoftools.menuofchangeskin.defaultskin.SetCheck(true);
- MainWindow.menubar.menuoftools.menuofchangeskin.zidingyi.SetCheck(false);
- }
- else
- {
- MainWindow.menubar.menuoftools.menuofchangeskin.zidingyi.SetCheck(true);
- MainWindow.menubar.menuoftools.menuofchangeskin.defaultskin.SetCheck(false);
- }
-
- cfgSetString("general", "skin", s_skin);
- }
-
- function ChangeLanguage(s_language)
- {
- if (IsValidLanguage(s_language))
- {
- __RefreshLanguage(s_language);
-
- MainWindow.title.maintitle.SetText(GetProductName()); // ???
-
- cfgSetString("general", "language", s_language);
- }
-
- if(s_language=="Chinese(Simplified)")
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofchinese.SetCheck(true);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofenglish.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofgerman.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofjapan.SetCheck(false);
- }else if(s_language=="English")
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofchinese.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofenglish.SetCheck(true);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofgerman.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofjapan.SetCheck(false);
- }else if(s_language=="Deutsch")
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofchinese.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofenglish.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofgerman.SetCheck(true);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofjapan.SetCheck(false);
- }else
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofchinese.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofenglish.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofgerman.SetCheck(false);
- MainWindow.menubar.menuoftools.menuoflanguage.menuofjapan.SetCheck(true);
- }
- }
-
- function LoadLanguageStartup()
- {
-
-
- var s_lang = cfgGetString("general", "language","English");
- if(s_lang=="")
- s_lang = GetLanguage();
- if(s_lang=="Chinese(Simplified)")
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofchinese.SetCheck(true);
- }else if(s_lang=="English")
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofenglish.SetCheck(true);
- }else if(s_lang=="Deutsch")
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofgerman.SetCheck(true);
- }else
- {
- MainWindow.menubar.menuoftools.menuoflanguage.menuofjapan.SetCheck(true);
- }
- __RefreshLanguage(s_lang);
- }
-
- /*
-
- g_upodutil.GetSpecialFolder
- 5 My Documents
- 26 Application Data
-
- */
-
- var MYDOCUMENT_FOLDER = 5;
- var APPLICATION_DATA_FOLDER = 26;
-
- function DumpSpecialFolder()
- {
- for (var i=0; i<100; i++)
- {
- Msg(g_upodutil.GetSpecialFolder(i), i);
- }
- }
-
-
- function GetDefaultOutputFolder()
- {
- var s_folder = cfgGetString("general", "defaultfolder");
- do
- {
- if (s_folder=="")
- {
- s_folder = g_upodutil.GetSpecialFolder(MYDOCUMENT_FOLDER) + "\\" + GetCompanyName() + "\\" + GetProductRegname();
- cfgSetString("general", "defaultfolder", s_folder);
- g_upodutil.CreateDirectory(s_folder);
- }else
- {
- if (!g_upodutil.CreateDirectory(s_folder))
- s_folder = "";
- }
- }while (s_folder=="");
- return s_folder;
- }
-
-
- function GetTempFolder()
- {
- var s_folder = cfgGetString("general", "tempfolder");
-
- do
- {
- if (s_folder=="")
- {
- s_folder = g_upodutil.GetSpecialFolder(APPLICATION_DATA_FOLDER) + "\\" + GetCompanyName() + "\\" + GetProductRegname();
- cfgSetString("general", "tempfolder", s_folder);
- g_upodutil.CreateDirectory(s_folder);
- }else
- {
- if (!g_upodutil.CreateDirectory(s_folder))
- {
- s_folder = "";
- }
- }
- }while (s_folder=="");
- return s_folder;
- }
-
- function GetPrivateConfigFolder()
- {
- var s_folder = g_upodutil.GetSpecialFolder(APPLICATION_DATA_FOLDER) + "\\" + GetCompanyName() + "\\" + GetProductRegname();
- g_upodutil.CreateDirectory(s_folder);
- return s_folder;
- }
-
- function GetMainWindowTitle()
- {
-
-
- return GetProductName();
- }
-
-
- function __RefreshLanguage(lang)
- {
- RefreshLanguage(lang);
- MainWindow.menubar.menuofhelp.menuofbuyproduct1.SetText(LanguageStr("_flvmain_menu_buy1"));
- MainWindow.menubar.menuofhelp.menuofbuyproduct2.SetText(LanguageStr("_flvmain_menu_buy2"));
- MainWindow.menubar.menuofhelp.menuabout.SetText(LanguageStr("_flvmain_menu_about")+" "+GetProductName());
- droppopup.dropmenupopupbar.dropmenupopup.menuhidemainwnd.SetText(LanguageStr("_flvmain_droprkmenu_openhide")+" "+GetProductName());
- // droppopup.dropmenupopupbar.dropmenupopup.menubuyvidoconverter.SetText(LanguageStr("_flvmain_droprkmenu_buy")+GetProductName());
- droppopup.dropmenupopupbar.dropmenupopup.menuaboutvideoconverter.SetText(LanguageStr("_flvmain_droprkmenu_about")+" "+GetProductName());
-
- for(var i=0;i<MainWindow.listctrlfiles.GetItemCount();i++)
- {
- var task = MainWindow.listctrlfiles.GetItemData(i);
- if(task.st=="downloadling")
- {
- MainWindow.listctrlfiles.SetText(i,3,LanguageStr("_download"));
- }else if(task.st=="stopped")
- {
- MainWindow.listctrlfiles.SetText(i,3,LanguageStr("_stop"));
- }else if(task.st=="finished")
- {
- MainWindow.listctrlfiles.SetText(i,3,LanguageStr("_finish"));
- }else if(task.st=="waiting")
- {
- MainWindow.listctrlfiles.SetText(i,3,LanguageStr("_wait"));
- }
-
- }
-
- }