Jump to content

Dosya Indirme Işleminde Iptal Butonu Hatası


PColik
 Share

Recommended Posts

Arkadaşlar yine bi hata ile karşınızdayım maalesef :):)

Kullandığım kod şu:

Spoiler

	--ShowStatusWindow shows the status window, and sets the dialogs icon
function ShowStatusWindow()
    -- Show the Status Dialog
    StatusDlg.Show(MB_ICONNONE, false);
    -- Show the cancel button
    StatusDlg.ShowCancelButton(true, "İptal et");
    -- Başlığı değiştir
    StatusDlg.SetTitle("İndiriliyor...");
end



	--DownloadStatus is the callback function to be used.
function DownloadStatus (BytesRead, FileSize, TransferRate, SecondsLeft, SecondsLeftFormat, Message)
    -- Set the status meters range
    StatusDlg.SetMeterRange(0, Math.Floor(FileSize/1024));
    -- Set the meter position
    StatusDlg.SetMeterPos(Math.Floor(BytesRead/1024));

    -- Check if the cancel button was pressed
    if StatusDlg.IsCancelled() then
    	-- Cancel button was pressed.  Hide status dialog and terminate download
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        File.Delete(_TempFolder.."\\vst.exe", false, false, true, nil);
			if (Application.GetLastError() ~= 0) then
			Dialog.Message("Hata!", "Bir hata meydana geldi! Lütfen programı yönetici olarak çalıştırıp tekrar deneyin.", MB_OK, MB_ICONSTOP);
			end
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        StatusDlg.Hide();
        Dialog.Message("İptal edildi", "İndirme işlemi iptal edildi!", MB_OK, MB_ICONINFORMATION);
        return false;      
    else
        -- Cancel button was not pressed, determine message to be displayed
        if FileSize == 0 then
            -- Display size unknown message
            StatusDlg.SetStatusText("Boyutu bilinmeyen dosyanın (" .. Math.Floor(BytesRead/1024) .. "KB kadarı indirildi)");
        elseif FileSize > 0 then
            -- Display downloaded of total message
            StatusDlg.SetStatusText("İndirilen: " .. Math.Floor(BytesRead/1024) .. " KB / " .. Math.Floor(FileSize/1024) .. " KB");
        end
    
        -- Determine if end of download was reached:
        --   Message will = "", the end of the download is a busy state
        --   BytesRead will be > 0, because more than 1 byte will have been transferred
        --   BytesRead will = FileSize, unless FileSize is unknown (0)
        if (Message == "") and (BytesRead > 0) and (BytesRead == FileSize or FileSize == 0) then
           -- The download has completed, hide the status dialog and display complete message
           StatusDlg.Hide();
           Dialog.Message("İndirme tamamlandı!", Math.Floor(BytesRead/1024) .. " KB indirildi");
           return false;
        else
            -- The download has not ended, continue to download
            return true;
        end
    end
end




-- Call the ShowStatusWindow() function
ShowStatusWindow();

		
		
		
		
	HTTP.Download(dllink, _TempFolder.."\\vst.exe", MODE_BINARY, 10, 80, nil, nil, DownloadStatus);
		if (Application.GetLastError()~= 0) then
		HTTP_Error = HTTP.GetHTTPErrorInfo();
			if HTTP_Error.Number ~= 0 then
			Dialog.Message("Hata oluştu!", "Hata kodu: "..HTTP_Error.Number.."\r".."Hata mesajı: "..HTTP_Error.Message, MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
			end
		end

 

Arkadaşlar bu kodu AMS'nin kendi yardım dosyasında buldum. Sadece oradaki File.Delete kısmını ben ekledim dosyaya. Anlamanız için baya boşluk bıraktım. Arkadaşlar diyelim bir dosya indiriyoruz, dosya 10 MB olsun, henüz 5 MB'lık kısmı indiği zaman İptal et butonuna tıklayıp indirme işlemini iptal ettik. İndirme işlemi gerçekten iptal oluyor fakat indirdiği 5MB'lık yarım dosyayı bilgisayardan silmiyor. Ben onun için File.Delete kısmını ekledim ama dosyayı silmiyor ve hata veriyor. Tam olarak nerede hata yapıyorum acaba?

Tekrar yardımcı olur musunuz size zahmet? :):)

Edited by PColik
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...