Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use local cache instead of syncing #2

Open
zeruth opened this issue Nov 9, 2020 · 0 comments
Open

use local cache instead of syncing #2

zeruth opened this issue Nov 9, 2020 · 0 comments

Comments

@zeruth
Copy link

zeruth commented Nov 9, 2020

I suggest using the cache module of runelite itself.

Something along the lines of:

	public void dumpCache() throws IOException
	{
		Store store = new Store(DEFAULT_CACHE_DIR);
		store.load();
		Storage storage = store.getStorage();
		store.getIndexes().forEach(index ->
		{
			log.debug("Dumping index " + (index.getId() + 1) + "/20");
			index.getArchives().forEach(archive ->
			{
				try
				{
					byte[] archiveData = storage.loadArchive(archive);
					if (index.getId() == 5)
					CacheFiles.write(index.getId(), archive.getArchiveId(), archiveData);
					else
					{
						archive.getFiles(archiveData).getFiles().forEach(fsFile ->
							CacheFiles.write(index.getId(), archive.getArchiveId(), fsFile.getContents()));
					}
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			});
		});
	}

And maybe detect an incomplete cache or wait until LOGIN_SCREEN as you have a full cache by that time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant