prototype Posted September 13, 2011 Share Posted September 13, 2011 (edited) Arkadaşlar başlık biraz uymamış olabilir ancak problem şu bir oyun indirme aracı üzerinde çalışıyorum program üzerinde yaklaşık 15 tane oyun olacak ancak kodları aynı yere iki kire yapıştırdığımda 2. oyunu indir butonuna tıklayınca 1. oyunu indiriyor. Kodlar şöyle açıklık getireyim. Şimdilik 2 oyun ekledim. [b]Global Functions Kodları [/b] [quote] session = 0; strURL = "http://setup.gamersfirst.com/live/current/GamersFirst_LIVE!_Setup_TR.exe" DestFile = "C:\\Wtr\\GamersFirst_LIVE!_Setup_TR.exe" function Download.OnProgress(tblData) if ( tblData ~= nil) then Progress.SetCurrentPos("Progress1", tblData.Percent); Progress.SetText("Progress1", tblData.Percent.." %"); Input.SetText("Input1", tblData.Percent); local strinfo = string.format("İndiriliyor .. %s / %s - Hız : %d Kb/s",String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true),String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true), tblData.CurrentSpeed); Label.SetText("Label1", strinfo); end end function Download.OnComplete(tblData) Download.Delete(tblData.Session); Label.SetText("Label1", "Download Completed.."); xButton.SetEnabled("xButton2", true); end function Download.OnError(tblData) Download.Delete(tblData.Session); -- Important !! - do not forget to call this first Label.SetText("Label1", "İndirme Hatası.."); end [b]------ Kod bitişi ------ Yeni Kod[/b] session = 0; strURL = "http://setup.gamersfirst.com/live/current/GamersFirst_LIVE!_Setup_TR.exe" DestFile = "C:\\Wtr\\GamersFirst_LIVE!_Setup_TR.exe" function Download.OnProgress(tblData) if ( tblData ~= nil) then Progress.SetCurrentPos("Progress2", tblData.Percent); Progress.SetText("Progress2", tblData.Percent.." %"); Input.SetText("Input2", tblData.Percent); local strinfo = string.format("İndiriliyor .. %s / %s - Hız : %d Kb/s",String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true),String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true), tblData.CurrentSpeed); Label.SetText("Label2", strinfo); end end function Download.OnComplete(tblData) Download.Delete(tblData.Session); Label.SetText("Label1", "Download Completed.."); xButton.SetEnabled("xButton2", true); end function Download.OnError(tblData) Download.Delete(tblData.Session); -- Important !! - do not forget to call this first Label.SetText("Label1", "İndirme Hatası.."); end [/quote] [b]İndir butonundaki kodlar[/b] [codebox] nSize = HTTP.GetFileSize(strURL, MODE_BINARY, 20, 80, nil, nil, nil); bResume = (File.DoesExist(DestFile) and File.GetSize(DestFile) < nSize) session = Download.Start(Application.GetWndHandle(), strURL, DestFile, "", "", bResume, nil, 0, "", ""); [/codebox] Arkadaşlar Global Functions taki kodları ayırdığı yeri belirtmek için [b]------ Kod bitişi ------ Yeni Kod[/b] şeklinde yazı yazdım bundan sonra yeni kod başlıyor ancak 2. indir butonuna tıklayınca bu kodu çalıştıramıyorum. Yardım edeceklere sonsuz teşekkürler.. Arkadaşlar apz dosyasını vereyim üzerinde denerseniz. Eğer olmazsa bu programın mantığında yeni bir proje hazırlarsanız çok sevinirim.. [code] http://www.fileden.com/files/2011/1/25/3066694//downloadlive.rar [/code] Not: Gerekli tüm pluginler içindedir. Edited September 13, 2011 by prototype Quote Link to comment Share on other sites More sharing options...
pilgetir Posted September 14, 2011 Share Posted September 14, 2011 farklı fonksiyon ve değişken isimleri vermelisin. Quote Link to comment Share on other sites More sharing options...
prototype Posted September 14, 2011 Author Share Posted September 14, 2011 (edited) Global Functions'ta bulunan [b]session = 0;[/b] kodunu değiştirip 1. ye [b]session = 0;[/b] 2.ye [b]session = 1;[/b] yazıyorum indir butonlarına [b]1. Butona[/b] [code] nSize = HTTP.GetFileSize(strURL, MODE_BINARY, 20, 80, nil, nil, nil); bResume = (File.DoesExist(DestFile) and File.GetSize(DestFile) < nSize) session = Download.Start(Application.GetWndHandle(), strURL, DestFile, "", "", bResume, nil, 0, "", ""); [/code] [b]2. Butona[/b] [code] nSize = HTTP.GetFileSize(strURL, MODE_BINARY, 20, 80, nil, nil, nil); bResume = (File.DoesExist(DestFile) and File.GetSize(DestFile) < nSize) session = Download.Start(Application.GetWndHandle(), strURL, DestFile, "", "", bResume, nil, 1, "", ""); [/code] yazıyorum yinede olmuyor Bu değişkeni veya fonksiyonu nasıl kullanabiliriz örnek verebilir misin acaba ? Edited September 14, 2011 by prototype Quote Link to comment Share on other sites More sharing options...
pilgetir Posted September 14, 2011 Share Posted September 14, 2011 2 buton ve 2 labelimiz varsayalım. global function bölumune; [quote]fuction deneme () Label.SetText ("Label1","deneme bir"); end[/quote] -- [quote]fuction deneme2 () Label.SetText ("Label2","deneme iki"); end [/quote] buton1 onclick; [quote]deneme ()[/quote] buton2 onclick; [quote]deneme2 ()[/quote] Quote Link to comment Share on other sites More sharing options...
prototype Posted September 14, 2011 Author Share Posted September 14, 2011 Deniyordum ancak şöyle bir hata verdi. "Line=1: "=" expected near "deneme" Kodlar şöyle; [codebox] fuction deneme () session = 0; strURL = "http://setup.gamersfirst.com/live/current/GamersFirst_LIVE!_Setup_TR.exe" DestFile = "C:\\Wtr\\GamersFirst_LIVE!_Setup_TR.exe" function Download.OnProgress(tblData) if ( tblData ~= nil) then Progress.SetCurrentPos("Progress1", tblData.Percent); Progress.SetText("Progress1", tblData.Percent.." %"); Input.SetText("Input1", tblData.Percent); local strinfo = string.format("İndiriliyor .. %s / %s - Hız : %d Kb/s",String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true),String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true), tblData.CurrentSpeed); Label.SetText("Label1", strinfo); end end function Download.OnComplete(tblData) Download.Delete(tblData.Session); Label.SetText("Label1", "Download Completed.."); xButton.SetEnabled("xButton2", true); end function Download.OnError(tblData) Download.Delete(tblData.Session); -- Important !! - do not forget to call this first Label.SetText("Label1", "İndirme Hatası.."); end end [/codebox] Quote Link to comment Share on other sites More sharing options...
pilgetir Posted September 14, 2011 Share Posted September 14, 2011 (edited) [b]al buyur;[/b] [codebox]function deneme () session = 0; strURL = "http://setup.gamersfirst.com/live/current/GamersFirst_LIVE!_Setup_TR.exe" DestFile = "C:\\Wtr\\GamersFirst_LIVE!_Setup_TR.exe" function Download.OnProgress(tblData) if ( tblData ~= nil) then Progress.SetCurrentPos("Progress1", tblData.Percent); Progress.SetText("Progress1", tblData.Percent.." %"); Input.SetText("Input1", tblData.Percent); local strinfo = string.format("İndiriliyor .. %s / %s - Hız : %d Kb/s",String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true),String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true), tblData.CurrentSpeed); Label.SetText("Label1", strinfo); end end function Download.OnComplete(tblData) Download.Delete(tblData.Session); Label.SetText("Label1", "Download Completed.."); xButton.SetEnabled("xButton2", true); end function Download.OnError(tblData) Download.Delete(tblData.Session); -- Important !! - do not forget to call this first Label.SetText("Label1", "İndirme Hatası.."); end end [/codebox] Edited September 14, 2011 by pilgetir Quote Link to comment Share on other sites More sharing options...
prototype Posted September 14, 2011 Author Share Posted September 14, 2011 (edited) Pardon indir butonunu değiştirdim aşağıdaki gibi yaptım oldu [codebox] deneme () nSize = HTTP.GetFileSize(strURL, MODE_BINARY, 20, 80, nil, nil, nil); bResume = (File.DoesExist(DestFile) and File.GetSize(DestFile) < nSize) session = Download.Start(Application.GetWndHandle(), strURL, DestFile, "", "", bResume, nil, 0, "", ""); [/codebox] ancak böyle yaptım 2.yede deneme2 () yazdım. 1. indir butonuna basınca çalışıyor 1. indirme işlemini yaparken 2. indir butonuna tıkladığında 1.yi durduruyor 2. devam ediyor. Edited September 14, 2011 by prototype Quote Link to comment Share on other sites More sharing options...
prototype Posted September 15, 2011 Author Share Posted September 15, 2011 (edited) 1. indir butonuna basınca çalışıyor 1. indirme işlemini yaparken 2. indir butonuna tıkladığında 1.yi durduruyor 2. devam ediyor. Arkadaşlar güncel projem bu yardım edebilir misiniz ? [center][code]http://www.fileden.com/files/2011/1/25/3066694//WTRLive.rar[/code][/center] Edited September 15, 2011 by prototype Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.