Skip to content

Instantly share code, notes, and snippets.

@sifex
Created July 17, 2016 06:58
Show Gist options
  • Select an option

  • Save sifex/4f675726662714a12d0565ce79200e8a to your computer and use it in GitHub Desktop.

Select an option

Save sifex/4f675726662714a12d0565ce79200e8a to your computer and use it in GitHub Desktop.
ws.OnMessage += (sender, e) =>
{
// Scarlet WS API
// Words = (Browser/Updater)|(IP/*)|(Command)|(Perameters)
string[] words = e.Data.Split('|');
if (words[0] == "Updater")
{
if (words[1] == IP || words[1] == "*")
{
if (words[2] == "browserConnect")
{
ws.Send("Browser|" + IP + "|browserConfirmation");
}
if (words[2] == "startDownload")
{
installDirectory = words[3];
if (backgroundWorker1.IsBusy == false)
{
backgroundWorker1.RunWorkerAsync();
}
}
if (words[2] == "locationChange")
{
ChooseFolder();
}
if (words[2] == "updateInstallLocation")
{
installDirectory = words[3];
}
if (words[2] == "Broadcast")
{
MessageBox.Show(words[3], "Scarlet Updater", MessageBoxButtons.OK);
}
if (words[2] == "FetchAll")
{
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment