Jump to content

Ams Kodları Ayırma


prototype
 Share

Recommended Posts

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 by prototype
Link to comment
Share on other sites

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 by prototype
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

[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 by pilgetir
Link to comment
Share on other sites

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 by prototype
Link to comment
Share on other sites

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 by prototype
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...