LBackup   |   About   |   Screenshots


Programmname$="BeSly Backup Tool"

Version$="0.8"

Versionsdatum$="10.06.2007"

Entwickler$="Christian Albrecht"

Nickname$="Lelldorin"

Url_Label$="BeSly Projects"

Url_Text$="http://www.besly.de"

Hpt_Fenster$="besly_backup"

B_Breite = peek("desktopwidth")

B_Hoehe = peek("desktopheight")

F_Hoehe1=((B_Hoehe/2)-300)

F_Hoehe2=((B_Hoehe/2)+300)

F_Breite1=((B_Breite/2)-215)

F_Breite2=((B_Breite/2)+215)

F_minBreite=425

F_maxBreite=425

F_minHoehe=600

F_maxHoehe=600

range=10

zaehlwert=0

range=100

CheckProgramFolders()

dim part$(1)

inloop = true

while(inloop)

	msg$ = message$

	if (split(msg$, part$(), ":|") > 2) then

		PartOne$=part$(1)

		PartTwo$=part$(2)

		PartThree$=part$(3)

	fi

	if (split(msg$, part$(), ":|") > 3) then

		PartFour$ = part$(4)

	fi

	if (msg$ <> "") if (msg$ <> "")

	switch msg$

		case Hpt_Fenster$+":_QuitRequested|"

			window close Hpt_Fenster$

			break

		case Hpt_Fenster$+":"+translate$("Program")+":"+translate$("Quit")+"|"

			window close Hpt_Fenster$

			break

		case Hpt_Fenster$+":"+translate$("Program")+":"+translate$("About")+"|"

			about()

			break

		case PartOne$+":ON|"

			zaehlwert_all=zaehlwert_all+1

			dim SplitCb$(1)

			eintaege = split(PartOne$, SplitCb$(), "_")

			nr=val(SplitCb$(2))

			TEXTCONTROL SET "cbstatus_"+str$(nr), "on"

			break

		case PartOne$+":OFF|"

			zaehlwert_all=zaehlwert_all-1

			dim SplitCb$(1)

			eintaege = split(PartOne$, SplitCb$(), "_")

			nr=val(SplitCb$(2))

			TEXTCONTROL SET "cbstatus_"+str$(nr), "off"

			break

		case Hpt_Fenster$+":"+translate$("Settings")+":"+translate$("Edit")+":"+PartFour$+"|"

			Output$=system$("open /boot/apps/System/LBackup/info/"+"\""+PartFour$+"\"")

			break

		case Hpt_Fenster$+":"+translate$("Settings")+":"+translate$("Set default")+":"+PartFour$+"|"

			backupinfo$=PartFour$

			Output$=system$("rm -r /boot/home/config/settings/.LBackup/config")

			Output$=system$("rm -r /boot/home/config/settings/.LBackup/temp")

			anlegen = open("/boot/home/config/settings/.LBackup/config", "a")

			print #anlegen backupinfo$

			close(anlegen)

			ALERT translate$("Restarting LBackup")+"!!!", "Ok", "none"

			window close Hpt_Fenster$

			wait 1

			CheckProgramFolders()

			break

		case "selectall|"

			bereich$="select"

			SelectAll()

			break

		case "deselectall|"

			bereich$="deselect"

			SelectAll()

			break

		case "backup|"

			zipping$="zip File"

			window open (B_Breite/2)-200, (B_Hoehe/2)-60 to (B_Breite/2)+200, (B_Hoehe/2)+60, "statusbar", "statusbar"

			WINDOW SET "statusbar", "Look", "Modal"

			WINDOW SET "statusbar", "Flags", "Not-Zoomable, Not-H-Resizable, Not-V-Resizable, Not-Resizable"

			VIEW 0, 0 to 400, 120, "bar", "statusbar"

			STATUSBAR 10, 20 to 390, 30, "statusanzeige", translate$(zipping$)+": ", "", "bar"

			Check_Entrys()

			ZipFiles()

			BUTTON 60,80 TO 170,90, "export", translate$("Export Files"), "bar"

			BUTTON 230,80 TO 340,90, "iso", translate$("create ISO image"), "bar"

			break

		case "export|"

			dim Dat$(1)

			datum = split(date$, Dat$(), "-")

			Month$ = Dat$(2)

			Day$ = Dat$(3)

			Year$ = Dat$(4)

			BackupFolder$ = FILEPANEL "Load-Directory", translate$("Select Folder to save Backup Files"), ""

			Output$=system$("cp -ua /boot/apps/System/LBackup/temp/backup "+"\""+BackupFolder$+"\""+"/LBackup_"+Day$+"-"+Month$+"-"+Year$)

			Output$=system$("rm -r /boot/apps/System/LBackup/temp/backup")

			Output$=system$("mkdir /boot/apps/System/LBackup/temp/backup")

			window close "statusbar"

			break

		case "close_about|"

			window close "View_About"

			break

		case "iso|"

			VIEW REMOVE "bar"

			VIEW 0, 0 to 400, 120, "iso", "statusbar"

			ablauf=0

			STATUSBAR 10, 20 to 390, 30, "statusanzeige", translate$("create ISO image"), "", "iso"

			system("/boot/apps/System/LBackup/bin/mkhybrid -arJ -o /boot/apps/System/LBackup/temp/Backup.iso /boot/apps/System/LBackup/temp/backup&")

			Size=0

			for CS = 1 to 8

				if(CS=7)then

					CS=1

				fi

				wait 0.1

				CheckSize$=system$("ls -sh /boot/apps/System/LBackup/temp/Backup.iso")

				CheckSize=val(CheckSize$)

				if(Size=CheckSize)then

					STATUSBAR SET "statusanzeige", translate$("create ISO image"), str$(Size)+" MB", 100

					break

				else

					ablauf=ablauf+10

					if(ablauf=120)then

						STATUSBAR SET "statusanzeige", translate$("create ISO image"), str$(Size)+" MB", 100

						ablauf=0

					fi

					Size=CheckSize

					STATUSBAR SET "statusanzeige", translate$("create ISO image"), str$(Size)+" MB", ablauf

				fi

			next CS

			dim Dat$(1)

			datum = split(date$, Dat$(), "-")

			Month$ = Dat$(2)

			Day$ = Dat$(3)

			Year$ = Dat$(4)

			ISOFile$ = FILEPANEL "Save-File", translate$("Select Folder to save ISO Image"), "/boot/home/", "LBackup_"+Day$+"-"+Month$+"-"+Year$+".iso"

			Output$=system$("cp /boot/apps/System/LBackup/temp/Backup.iso "+ISOFile$)

			Output$=system$("rm /boot/apps/System/LBackup/temp/Backup.iso")

			Output$=system$("rm -r /boot/apps/System/LBackup/temp/backup")

			Output$=system$("mkdir /boot/apps/System/LBackup/temp/backup")

			window close "statusbar"

			break

		default:

	end switch

	if(window count<1) inloop = false

	sleep 0.1

wend

sub CheckProgramFolders()

	ceck1$="temp\n"

	ceck1_check$=system$("find /boot/apps/System/LBackup/temp")

	ceck1_ready$=system$("basename "+ceck1_check$)

	if(ceck1$=ceck1_ready$)then

		Output$=system$("rm -r /boot/apps/System/LBackup/temp")

		Output$=system$("mkdir /boot/apps/System/LBackup/temp")

	else

		Output$=system$("mkdir /boot/apps/System/LBackup/temp")

	fi

	check2$="backup"

	ceck2_check$=system$("find /boot/apps/System/LBackup/temp/backup")

	ceck2_ready$=system$("basename "+ceck2_check$)

	if(ceck2$=ceck2_ready$)then

		Output$=system$("rm -r /boot/apps/System/LBackup/temp/backup")

		Output$=system$("mkdir /boot/apps/System/LBackup/temp/backup")

	else

		Output$=system$("mkdir /boot/apps/System/LBackup/temp/backup")

	fi

	ceck3$=".LBackup\n"

	ceck3_check$=system$("find /boot/home/config/settings/.LBackup")

	ceck3_ready$=system$("basename "+ceck3_check$)

	if(ceck3$=ceck3_ready$)then

	else

		Output$=system$("mkdir /boot/home/config/settings/.LBackup")

	fi

	ceck4$="temp\n"

	ceck4_check$=system$("find /boot/home/config/settings/.LBackup/temp")

	ceck4_ready$=system$("basename "+ceck4_check$)

	if(ceck4$=ceck4_ready$)then

		Output$=system$("rm /boot/home/config/settings/.LBackup/temp")

	else

	fi

	ceck5$="config\n"

	ceck5_check$=system$("find /boot/home/config/settings/.LBackup/config")

	ceck5_ready$=system$("basename "+ceck5_check$)

	if(ceck5$=ceck5_ready$)then

	else

		anlegen_config = open("/boot/home/config/settings/.LBackup/config", "a")

		print #anlegen_config "Zeta 1.21"

		close(anlegen_config)

	fi

	ceck6$="mkhybrid\n"

	ceck6_check$=system$("find /boot/apps/System/LBackup/bin/mkhybrid")

	ceck6_ready$=system$("basename "+ceck6_check$)

	if(ceck6$=ceck6_ready$)then

		Prg_Fenster()

	else

		ALERT translate$("Your LBackup installation are broken, please reinstall it")+"!!!", "Ok", "none"

	fi

end sub

sub about()

	window open ((B_Breite/2)-130), ((B_Hoehe/2)-100) to ((B_Breite/2)+130), ((B_Hoehe/2)+100), "View_About", "About"

	window set "View_About", "MinimumTo", 260,200

	window set "View_About", "MaximumTo", 260,200

	window set "View_About", "look", "modal"

	draw text 15, 25, "Lelldorins Backup Tool", "View_About"

	draw text 15, 60, translate$("Version")+":      ", "View_About"

	draw text 130, 60, Version$+" / "+Versionsdatum$, "View_About"

	draw text 15, 80, translate$("Developer")+":      ", "View_About"

	draw text 130,80, "Christian Albrecht", "View_About"

	draw text 15, 100, translate$("Nickname")+":      ", "View_About"

	draw text 130, 100, "Lelldorin", "View_About"

	draw text 15, 120, translate$("Homepage")+":      ", "View_About"

	texturl 130,112, "Homepage", "http://www.besly.de", "http://www.besly.de", "View_About"

	BUTTON 90,160 TO 170,180, "close_about", translate$("Close"), "View_About"

end sub

sub Prg_Fenster()

	window open F_Breite1,F_Hoehe1 to F_Breite2,F_Hoehe2, Hpt_Fenster$, Programmname$

	window set Hpt_Fenster$, "flags", "not-zoomable, not-h-resizable, not-v-resizable"

	window set Hpt_Fenster$, "MinimumTo", F_minBreite,F_minHoehe

	window set Hpt_Fenster$, "MaximumTo", F_maxBreite,F_maxHoehe

	menu translate$("Program"), translate$("About"), "", Hpt_Fenster$

	menu translate$("Program"), translate$("Quit"), "", Hpt_Fenster$

	ReadSettings()

	ReadConfig()

	view 0,22 to 410,550, "Auswahlmaske", Hpt_Fenster$

	SCROLLBAR "GeneratorBar", 1, "Auswahlmaske"

	BUTTON 15,565 TO 115,575, "backup", translate$("Backup!"), Hpt_Fenster$

	BUTTON 200,565 TO 300,575, "selectall", translate$("Select All"), Hpt_Fenster$

	BUTTON 310,565 TO 410,575, "deselectall", translate$("Deselect All"), Hpt_Fenster$

	Info_Auswerten()

end sub

sub SelectAll()

	tempload$="/boot/home/config/settings/.LBackup/temp"

	auslesen_temp=open(tempload$, "r")

	xtemp=0

	while (not EOF(auslesen_temp))

		xtemp=xtemp+1

		dim temp$(xtemp)

		line input #auslesen_temp btemp$

		temp$(xtemp)=btemp$

		Eintrag_Status$ = TEXTCONTROL GET$ "cbstatus_"+temp$(xtemp)

		if(bereich$="select")then

			if(Eintrag_Status$="off")then

				CHECKBOX SET "cbfile_"+temp$(xtemp), 1

				TEXTCONTROL SET "cbstatus_"+temp$(xtemp), "on"

			else

			fi

			elseif(bereich$="deselect")then

			if(Eintrag_Status$="on")then

				CHECKBOX SET "cbfile_"+temp$(xtemp), 0

				TEXTCONTROL SET "cbstatus_"+temp$(xtemp), "off"

			else

			fi

		else

		fi

	wend

	close(auslesen_temp)

end sub

sub ReadSettings()

	DirConfig$="/boot/apps/System/LBackup/info"

	InhaltConfig$=system$("ls -G -1 "+DirConfig$)

	y=0

	z=0

	dim SplitDirConfig$(1)

	y = split(InhaltConfig$, SplitDirConfig$(), "\n")

	for z = 1 to y-1

		submenu translate$("Settings"), translate$("Edit"), SplitDirConfig$(z), "", Hpt_Fenster$

		submenu translate$("Settings"), translate$("Set default"), SplitDirConfig$(z), "", Hpt_Fenster$

	next z

end sub

sub ReadConfig()

	configload$="/boot/home/config/settings/.LBackup/config"

	auslesen_config=open(configload$, "r")

	xconfig=0

	while (not EOF(auslesen_config))

		xconfig=xconfig+1

		dim dconfig$(xconfig)

		line input #auslesen_config bconfig$

		dconfig$(xconfig)=bconfig$

	wend

	backupinfo$=dconfig$(1)

	submenu set translate$("Settings"), translate$("Set default"), backupinfo$, "Disable", Hpt_Fenster$

	close(auslesen_config)

end sub

sub Info_Auswerten()

	Check_Info()

	y=0

	hoehe=20

	hoehe2=5

	title=0

	for i = 1 to x

		y=y+1

		dim entry$(y)

		entries_check = split(config$(y), entry$(), "|")

		if(entry$(1)="title")then

			BOXVIEW 10,hoehe TO 400,(hoehe+val(entry$(3))*24+15), "Fenster_Title"+str$(title), entry$(2), 2, "Auswahlmaske"

			hoehe=hoehe+(val(entry$(3))*24)+24

			title=title+1

			hoehe2=5

		else

			zaehlwert=zaehlwert+1

			CHECKBOX 5,hoehe2, "cbfile_"+str$(y), entry$(1), 0, "Fenster_Title"+str$(title-1)

			TEXTCONTROL 600,hoehe2 TO 650,hoehe2+15, "cbstatus_"+str$(y), "", "off", "Fenster_Title"+str$(title-1)

			TEXTCONTROL 700,hoehe2 TO 750,hoehe2+15, "cbname_"+str$(y), "", entry$(1), "Fenster_Title"+str$(title-1)

			TEXTCONTROL 800,hoehe2 TO 850,hoehe2+15, "cbpath_"+str$(y), "", entry$(2), "Fenster_Title"+str$(title-1)

			hoehe2=hoehe2+24

			anlegen_temp = open("/boot/home/config/settings/.LBackup/temp", "a")

			print #anlegen_temp y

			close(anlegen_temp)

		fi

		SCROLLBAR SET "GeneratorBar", "Vertical Range", 0, hoehe-510

		SCROLLBAR SET "GeneratorBar", "Vertical Steps", 5, 20

	next i

end sub

sub Check_Info()

	config_load$="/boot/apps/System/LBackup/info/"+backupinfo$

	auslesen_config=open(config_load$, "r")

	x=0

	while (not EOF(auslesen_config))

		x=x+1

		dim config$(x)

		line input #auslesen_config b$

		config$(x)=b$

	wend

	close(auslesen_config)

end sub

sub Check_Entrys()

	tempload$="/boot/home/config/settings/.LBackup/temp"

	auslesen_temp=open(tempload$, "r")

	onare=0

	xonare=0

	zaehlwert=0

	while (not EOF(auslesen_temp))

		xonare=xonare+1

		dim onare$(xonare)

		line input #auslesen_temp bonare$

		onare$(xonare)=bonare$

		Eintrag_Status$ = TEXTCONTROL GET$ "cbstatus_"+onare$(xonare)

		if(Eintrag_Status$="on")then

			zaehlwert=zaehlwert+1

		fi

	wend

	zaehlwert_teil=100/zaehlwert

	close(auslesen_temp)

end sub

sub ZipFiles()

	tempload$="/boot/home/config/settings/.LBackup/temp"

	anzahl_eintraege=open(tempload$, "r")

	anzahlp=0

	AnzahlPakete=0

	while (not EOF(anzahl_eintraege))

		anzahlp=anzahlp+1

		dim anzahlpakete$(anzahlp)

		line input #anzahl_eintraege banzahlp$

		anzahlpakete$(anzahlp)=banzahlp$

		Eintrag_Status$ = TEXTCONTROL GET$ "cbstatus_"+anzahlpakete$(anzahlp)

		if(Eintrag_Status$="on")then

			AnzahlPakete=AnzahlPakete+1

		fi

	wend

	tempload$="/boot/home/config/settings/.LBackup/temp"

	auslesen_temp=open(tempload$, "r")

	xtemp=0

	display_packages=0

	zaehlwert=zaehlwert_teil

	while (not EOF(auslesen_temp))

		xtemp=xtemp+1

		dim temp$(xtemp)

		line input #auslesen_temp btemp$

		temp$(xtemp)=btemp$

		Eintrag_Status$ = TEXTCONTROL GET$ "cbstatus_"+temp$(xtemp)

		if(Eintrag_Status$="on")then

			display_packages=display_packages+1

			Eintrag_Name$ = TEXTCONTROL GET$ "cbname_"+temp$(xtemp)

			Eintrag_Path$ = TEXTCONTROL GET$ "cbpath_"+temp$(xtemp)

			Output$=System$("zip -r9yu /boot/apps/System/LBackup/temp/backup/"+"\""+Eintrag_Name$+"\""+".zip "+Eintrag_Path$)

			print "prnt zip -r9yu /boot/apps/System/LBackup/temp/backup/"+"\""+Eintrag_Name$+"\""+".zip "+"\""+Eintrag_Path$+"\""

			Output$=System$("setinstallpath /boot/apps/System/LBackup/temp/backup/"+"\""+Eintrag_Name$+"\""+".zip /")

			STATUSBAR SET "statusanzeige", translate$("zip File")+": "+Eintrag_Name$, str$(display_packages)+" / "+str$(AnzahlPakete), zaehlwert

			zaehlwert=zaehlwert+zaehlwert_teil

			wait 1

		fi

	wend

	close(auslesen_temp)

end sub