Skip to content
Jacob edited this page Feb 1, 2024 · 4 revisions

Please Read

These instructions only work with Chill v0.1.0, later versions do not support this.

Guide

To set UC up with Chill Updater.

  1. First download the latest version of Chill Updater.

  2. Next create a new folder called Chill in your application

1

  1. In the chill folder place the chill application with no sub folders

2

  1. In the main directory (the one the Chill folder is in) create a new file called _config.json

Set the _config.json as seen below

{
   "URL": ""
}

Set the URL object to the Github URL of the application. Below is a valid example

{
   "URL": "https://github.com/ChobbyCode/Update-Checker"
}
  1. Setting up Chill in your project

Below is a basic UC program that says "There is an update" if there is an update.

using Update_Checker;

namespace Test { 
    public class Program
    {
        public static void Main(string[] args)
        {
            UpdateApp();
            Console.Read();
        }

        public static async void UpdateApp()
        {
            UpdateChecker updateChecker = new UpdateChecker();

            updateChecker.OWNERNAME = "ChobbyCode";
            updateChecker.REPONAME = "Update-Checker";

            if(await updateChecker.CheckForUpdates("v0.1.0"))
            {
                Console.WriteLine("There is an update");
            }
        }
    }
}

We can modify this application to download the latest update by using the new class "Download Manager".

We can create an instance on the Download Manager class as seen below

DownloadManager manager = new DownloadManager();

Then we can start a download with the function below

manager.Download();

We can then use this in the application as below:

Running the Download() function closes the application. So make sure there is no unsaved data

using Update_Checker;

namespace Test { 
    public class Program
    {
        public static void Main(string[] args)
        {
            UpdateApp();
            Console.Read();
        }

        public static async void UpdateApp()
        {
            UpdateChecker updateChecker = new UpdateChecker();

            updateChecker.OWNERNAME = "ChobbyCode";
            updateChecker.REPONAME = "Update-Checker";

            if(await updateChecker.CheckForUpdates("v0.1.0"))
            {
                DownloadManager manager = new DownloadManager();

                manager.Download();
            }
        }
    }
}
  1. Setting the repo up for Chill support

You can read the full chill Documentation here.

Create a new branch in your Github repo. This branch has to be called "Download", in this download branch put the download files. WOW!!

In the "Download" branch create a new file UC_config.json, this is the last thing we need to do to setup Chill.

The basic JSON template is listed below:

{
    "ExtractInfo": {
        "Data": [
            {
                "FileName": "README.md",
                "From": "*/README.md",
                "To": "../"
            }
        ],
        "Delete": [
            {
                "Location": "../AnOldExe.exe"
            }
        ]
    }
}

Using this JSON file we can specify what happens to files when they are downloaded. We can say where files are supposed to be moved, what files are to be deleted.

Below is a example of a peice from the data part.

"Data": [
  {
      "FileName": "README.md",
      "From": "*/README.md",
      "To": "../"
  }
]

In the file name part we specify what the name of the file is. In the "from" we specify where the file is moving from and then in "to" we specify where the files will be moving to.

To get files out of the download we use '*'

To get files out of the main application folder we use '..'

For example if we want to move the README file from the downloads to the main application folder we set the JSON up as below:

{
    "ExtractInfo": {
        "Data": [
            {
                "FileName": "README.md",
                "From": "*/README.md",
                "To": "../"
            }
        ]
    }
}

The JSON above takes the README file in the downloads and puts it the main program.

We can create new folders by just putting a new directory before where we access.

{
    "ExtractInfo": {
        "Data": [
            {
                "FileName": "README.md",
                "From": "*/README.md",
                "To": "../Important/"
            }
        ]
    }
}

The JSON above takes the README.md and puts it in a new folder called Important.

If there is a file in the main directory and we want to move it into a new folder we can do this as seen below:

{
    "ExtractInfo": {
        "Data": [
            {
                "FileName": "README.md",
                "From": "../README.md",
                "To": "../UsefulInformation/"
            }
        ]
    }
}

Above takes the README file in the main directory and puts it in a new folder called UsefulInformation

Deleting Old Files

We can delete files by just specifying the location of the file.

"Delete": [
  {
    "Location": "../README.md"
  }
]

The code above deletes the file README.md in the main program directory