Пример #1
0
        public async static Task Update(Package package, Validator val, PackageOverview overview)
        {
            //Create tmp dir so files are gone after execution.
            using (TmpDir dir = new TmpDir("."))
                using (WebClient client = new WebClient())
                {
                    //Check if it exists
                    if (PackageUtil.DoesPackageExist(package))
                    {
                        string filename = Path.GetFileName(package.downloadLocation);
                        Console.WriteLine("Getting newest version of package " + package.name);
                        //Setup loading bar
                        client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(LoadingBar.DownloadProgressCallback);
                        //Get latest version
                        await client.DownloadFileTaskAsync(package.downloadLink, dir.dirName + filename);

                        Console.Write("\n\r");
                        //Compare. The && ! will make it so that it will always go to 2nd case if val.forceUpdate is ture.
                        if (FileCompare.CompareFiles(dir.dirName + filename, "../sm_plugins/" + package.downloadLocation) && !val.forceUpdate)
                        {
                            Console.WriteLine(package.name + " is up to date.");
                        }
                        else
                        {
                            File.Move(dir.dirName + filename, "../sm_plugins/" + package.downloadLocation, true);
                            Console.WriteLine(package.name + " was updated.");
                        }
                    }
                    else
                    {
                        Console.WriteLine(("WARNING: Package " + package.name + " is not installed. Skipping.").Pastel("ffff00"));
                    }
                }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine(FileCompare.CompareDirectories("PATH1", "PATH2", true));

            Console.WriteLine(FileCompare.CompareFiles("FILENAME1", "FILENAME2"));
        }