Jump to content

Ams Güncelleme


mafiacarles
 Share

Recommended Posts

GÜNCELLEME İŞLEMİNİ BİLEN ARKADASLAR LUTFEN RESIMLI ANLATIMLI YADA METIN SEKLINDEDE OLUR BI ANLATIM YAPSANIZ COK FAYDALI OLACAK.



Arkadaslar Yorumcu arkadasımızın apz dosyasından bu kodları aldım Dropbox uyelık de aldım

[code]HTTP.Download("http://dl.dropbox.com/u/40216345/softtv", _TempFolder .. "\\update.xml", 80, 20, nil, nil) -- xml i indir
XML.Load(_TempFolder .. "\\update.xml") -- xml i hafizaya yükle
xml_version = XML.GetValue("program_adi/version"); -- xml deki version noyu al
ini_version = INIFile.GetValue("Autoplay\\Docs\\update.ini", "PROGRAMADI", "version") -- ini deki version noyu al
nmbXml = String.ToNumber(xml_version) -- alinan degeri sayıya cevir
nmbIni = String.ToNumber(ini_version) -- alinan degeri sayiya cevir
if nmbIni < nmbXml then -- eger inideki xml den kucukse
StatusDlg.Show() -- ilerleme cubugunu goster
HTTP.Download("http://dl.dropbox.com/u/40216345/softtv", _SourceFolder, 80, 20, nil, nil) -- guncelleme dosyasini indir
StatusDlg.Hide() -- ilerleme cubugunu gizle
Dialog.Message("Tebrikler", "Güncelleme başarılı") -- basarili mesajini ver
else -- surumler aynı ise
Dialog.Message("Tebrikler", "Güncellemeye gerek yok") -- guncel mesajini ver
end[/code]


sımdı soyle bısey var update.ini ve update.xml dosyaları elımde olmadıgı ıcın ftp ıle eslestıremedım.
Link to comment
Share on other sites

Bir program güncellemek için xml ve iniye gerek yok.Onu çoklu programı güncellemek için kullanırız.Sitenizde bir yere update.txt atın içinde de 100 yazsın.Projenizde globalde update adlı bi değişken oluşturun onu da değer olarak 100'e eşitleyin.Güncellemek istediğiniz zaman txt değiştirip 101 yapacaksınız tabi programın içindeki değeri de 101 yapacaksınız.Sonra isterseniz açılışa (açılışı yavaşlatır) veya bir butona güncelleme kodlarını şöyle yazın.

updatetxt=_TempFolder .. "\\~softupdate~.txt"
File.Delete(updatetxt) --daha önce varsa işimize karışmasın
HTTP.Download("http://dl.dropbox.com/u/40216345/softtv/update.txt", updatetxt, 80, 20, nil, nil) -- nerden indirteceksen ona göre ayarlayacaksın
-- hata var mı diye kontrol edelim
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Hata!", "Dosya indirilirken hata oluştu.\r\nHata Kodu:"..error, MB_OK, MB_ICONSTOP);
else
--sorun yoksa işleme devam
guncelversiyon=String.ToNumber(TextFile.ReadToString(updatetxt))
if guncelversiyon > update then
--güncelleme yapılır.Artık httpdownload ile nere indirirsin bilinmez.
else
Dialog.Message("Güncel!", "En güncel sürümü kullanıyorsunuz.", MB_OK, MB_ICONINFORMATION);
end
end

Edited by MostWanted
Link to comment
Share on other sites

MostWanted Hocam sızın kodlarla beceremedım olayı bende soyle bırseyle yapmaya karar verdım . ancak bundada dosya ınıyor uzerıne yazmıyor. softtv klasor oldugu ıcın oda Install_To_Path diye bı klasor acıp onun ıcıne atıyor. dosyaların uzerıne nasıl yazdırabılırım ?


[codeBOX]-- VARIABLES THAT SHOULD BE CHANGED: THESE ARE THE THINGS YOU SHOULD CHANGE TO MAKE THIS WORK AS YOU WANT IT TO
sURL = "http://www.softwarena.net/update.zip"; -- where you'll download from
sDestination = "C:\\Softtv"; -- Where the files should be 'installed' to
sZipPassword = ""; -- the password to your zip file (or "" for no password)

-- VARIABLES THAT PROBABLY SHOULDN'T BE CHANGED
-- HTTP Action Variables
sDownloadFolder = _TempFolder .. "\\TempZipInstall"; -- temp location to download to
sDownloadFileName = "update.zip"; -- Temp filename to use
nDownloadMode = MODE_BINARY; -- The download mode to use
nTimeout = 20; -- The timeout in seconds for your http server
nPort = 80; -- The port your http server uses
tProxyData = nil; -- a table of proxy data (nil for none)
tAuthData = nil; -- A table of http auth data (nil for none)

-- Zip Action Variables
nZipOverwrite = ZIP_OVERWRITE_ALWAYS; -- How existing files should be handled
bRecurse = true; -- How zip file recursion should be handled
bUseInternalFolderStructure = true; -- Whether the folder structure in the zip file should be used when extracting
tFilesToExtract = {"*.*"} -- A table of files to extract ({"*.*"} to extract everything




-- Callback function for zip action
function ZipCallback(sDestinationPath, nPercentage, nStatus)
Label.SetText("L_Status2", "Installing:");
-- Update progress bar if percentage is for entire zip file
if nStatus == ZIP_STATUS_MAJOR then
-- Info is for zip file as a whole, update progress
Progress.SetCurrentPos("Progress2", nPercentage);
UpdateOverallTaskProgress(2, nPercentage);
Progress.SetText("Progress2", "Installing (" .. nPercentage .. "%)");
end
-- No matter what, we want to continue extracting!
return true;
end


-- callback function for http.download action
function HTTPCallback (nBytesRead, nFileSize, nTransferRate, nSecondsLeft, sSecondsLeftFormat, sMessage)
-- check if current message is a server status message
if sMessage == "" then
-- no server message is present, update status
Label.SetText("L_Status2", "Downloading:");
nPercent = Math.Round((nBytesRead/nFileSize)*100,0);
Progress.SetCurrentPos("Progress2", nPercent);
Progress.SetText("Progress2", nPercent .. "%");
UpdateOverallTaskProgress(1, nPercent);
end
-- keep the download running!
return true;
end


-- Update the overall task progress - called from both above callback functions
function UpdateOverallTaskProgress (nTaskNumber, nTaskPercentComplete)
nTotalTasks = 2;
Progress.SetRange("Progress1", 1, 100*nTotalTasks);
Progress.SetCurrentPos("Progress1", (nTaskNumber-1)*100 + nTaskPercentComplete);
end

-- Error checking function (not needed, but it makes error checking easier)
function CheckError(sOptionalMessage)
-- get the last error
err = Application.GetLastError();
if err ~= 0 then
-- last error wasn't 'success', check it out!
if sOptionalMessage then
-- An optional message was provided, tack it on to the output
sTitle = "ERROR (" .. sOptionalMessage .. ")";
sMessage = err .. ": " .. _tblErrorMessages[err];
else
-- No optional message, just output the error
sTitle = "ERROR";
sMessage = err .. ": " .. _tblErrorMessages[err];
end
-- output to the user!
Dialog.Message(sTitle, sMessage);
end
end






-- Ensure temp destination folder exists
Folder.Create(sDownloadFolder);
CheckError("Folder.Create");

-- Download the zip file
HTTP.Download(sURL, sDownloadFolder .. "\\" .. sDownloadFileName, nDownloadMode, nTimeout, nPort, tHTTPAuth, tProxyData, HTTPCallback);
CheckError("HTTP.Download");

-- Ensure install to directory exists
Folder.Create(sDestination);
CheckError("Folder.Create");

-- Extract the contents of the zip file to the specified folder
Zip.Extract(sDownloadFolder .. "\\" .. sDownloadFileName, tFilesToExtract, sDestination, bRecurse, bUseInternalFolderStructure, sZipPassword, nZipOverwrite, ZipCallback);
CheckError("Zip.Extract");

-- Delete the temporarily downloaded file
File.Delete(sDownloadFolder .. "\\" .. sDownloadFileName, false, false, false, nil);
CheckError("File.Delete");

-- Delete the temp download folder
Folder.Delete(sDownloadFolder);
CheckError("Folder.Delete");

-- Clean up output
Progress.SetText("Progress1", "");
Progress.SetText("Progress2", "");
Progress.SetCurrentPos("Progress1", 0);
Progress.SetCurrentPos("Progress2", 0);
Label.SetText("L_Status2", "");[/codeBOX]

Link to comment
Share on other sites

[quote name='MostWanted' date='04 September 2011 - 11:08 ' timestamp='1315134481' post='1073947']
Yani daha karışık örneği başarabileceğini düşünüyosun da sana yaptığım basit örneği yapamıyorsunuz.Valla kusra bakma alıntı yaptığın yerden yardım isteyeceksin.
[/quote]

hocam bu yabancı bı sıtede download/installer dıye verılmıs bu ındırıp dırek kuruyor.

kodların cok olması karmasık oldugunu ıfade etmez sızden ıstedıgım uzerıne yazdırma koduydu yınede teskler .

Link to comment
Share on other sites

Senin böyle bir şeye ihtiyacın yok ki.Ayrıca kodların fazla olması tabiki karmaşık olduğunu ifade eder.
(Not: Çalışan programın üstüne yazamazsın.Yapman gereken programı tamamen indirip eskisi silmek olmalı.)

Edited by MostWanted
Link to comment
Share on other sites

[quote name='MostWanted' date='04 September 2011 - 11:16 ' timestamp='1315135016' post='1073954']
Senin böyle bir şeye ihtiyacın yok ki.Ayrıca kodların fazla olması tabiki karmaşık olduğunu ifade eder.
(Not: Çalışan programın üstüne yazamazsın.Yapman gereken programı tamamen indirip eskisi silmek olmalı.)
[/quote]

peki hocam sızınkı ıle tekrar yapmaya calısacagım ama sunu anlayamadım " Projenizde globalde update adlı bi değişken oluşturun onu da değer olarak 100'e eşitleyin" bunu nasıl yapacagım .

Link to comment
Share on other sites

  • 1 yıl yıl...

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...