Пример #1
0
def main():
	global channel
	done = False
	load_channel(chandefault)
	while not done:
		print("\n\tBinary Ninja Version Switcher")
		print("\t\tCurrent Channel:\t%s" % channel.name)
		print("\t\tCurrent Version:\t%s" % core_version())
		print("\t\tAuto-Updates On:\t%s\n" % are_auto_updates_enabled())
		for index, version in enumerate(versions):
			date = datetime.datetime.fromtimestamp(version.time).strftime('%c')
			print("\t%d)\t%s (%s)" % (index + 1, version.version, date))
		print("\t%d)\t%s" % (len(versions) + 1, "Switch Channel"))
		print("\t%d)\t%s" % (len(versions) + 2, "Toggle Auto Updates"))
		print("\t%d)\t%s" % (len(versions) + 3, "Exit"))
		selection = input('Choice: ')
		if selection.isdigit():
			selection = int(selection)
		else:
			selection = 0
		if (selection <= 0 or selection > len(versions) + 3):
			print("%d is an invalid choice.\n\n" % selection)
		else:
			if (selection == len(versions) + 3):
				done = True
			elif (selection == len(versions) + 2):
				toggle_updates()
			elif (selection == len(versions) + 1):
				list_channels()
			else:
				select(versions[selection - 1])
def main():
	global channel
	done = False
	load_channel(chandefault)
	while not done:
		print("\n\tBinary Ninja Version Switcher")
		print("\t\tCurrent Channel:\t%s" % channel.name)
		print("\t\tCurrent Version:\t%s" % core_version())
		print("\t\tAuto-Updates On:\t%s\n" % are_auto_updates_enabled())
		for index, version in enumerate(versions):
			date = datetime.datetime.fromtimestamp(version.time).strftime('%c')
			print("\t%d)\t%s (%s)" % (index + 1, version.version, date))
		print("\t%d)\t%s" % (len(versions) + 1, "Switch Channel"))
		print("\t%d)\t%s" % (len(versions) + 2, "Toggle Auto Updates"))
		print("\t%d)\t%s" % (len(versions) + 3, "Exit"))
		selection = input('Choice: ')
		if selection.isdigit():
			selection = int(selection)
		else:
			selection = 0
		if (selection <= 0 or selection > len(versions) + 3):
			print("%d is an invalid choice.\n\n" % selection)
		else:
			if (selection == len(versions) + 3):
				done = True
			elif (selection == len(versions) + 2):
				toggle_updates()
			elif (selection == len(versions) + 1):
				list_channels()
			else:
				select(versions[selection - 1])
Пример #3
0
def select(version):
	done = False
	date = datetime.datetime.fromtimestamp(version.time).strftime('%c')
	while not done:
		print("Version:\t%s" % version.version)
		print("Updated:\t%s" % date)
		print("Notes:\n\n-----\n%s" % version.notes)
		print("-----")
		print("\t1)\tSwitch to version")
		print("\t2)\tMain Menu")
		selection = input('Choice: ')
		if selection.isdigit():
			selection = int(selection)
		else:
			selection = 0
		if (selection == 2):
			done = True
		elif (selection == 1):
			if (version.version == channel.latest_version.version):
				print("Requesting update to latest version.")
			else:
				print("Requesting update to prior version.")
				if are_auto_updates_enabled():
					print("Disabling automatic updates.")
					set_auto_updates_enabled(False)
			if (version.version == core_version()):
				print("Already running %s" % version.version)
			else:
				print("version.version %s" % version.version)
				print("core_version %s" % core_version())
				print("Downloading...")
				print(version.update())
				print("Installing...")
				if is_update_installation_pending:
					#note that the GUI will be launched after update but should still do the upgrade headless
					install_pending_update()
				# forward updating won't work without reloading
				sys.exit()
		else:
			print("Invalid selection")
def select(version):
	done = False
	date = datetime.datetime.fromtimestamp(version.time).strftime('%c')
	while not done:
		print("Version:\t%s" % version.version)
		print("Updated:\t%s" % date)
		print("Notes:\n\n-----\n%s" % version.notes)
		print("-----")
		print("\t1)\tSwitch to version")
		print("\t2)\tMain Menu")
		selection = input('Choice: ')
		if selection.isdigit():
			selection = int(selection)
		else:
			selection = 0
		if (selection == 2):
			done = True
		elif (selection == 1):
			if (version.version == channel.latest_version.version):
				print("Requesting update to latest version.")
			else:
				print("Requesting update to prior version.")
				if are_auto_updates_enabled():
					print("Disabling automatic updates.")
					set_auto_updates_enabled(False)
			if (version.version == core_version()):
				print("Already running %s" % version.version)
			else:
				print("version.version %s" % version.version)
				print("core_version %s" % core_version())
				print("Downloading...")
				print(version.update())
				print("Installing...")
				if is_update_installation_pending:
					#note that the GUI will be launched after update but should still do the upgrade headless
					install_pending_update()
				# forward updating won't work without reloading
				sys.exit()
		else:
			print("Invalid selection")
Пример #5
0
def toggle_updates():
	set_auto_updates_enabled(not are_auto_updates_enabled())
def toggle_updates():
	set_auto_updates_enabled(not are_auto_updates_enabled())