Exemple #1
0
        public void showLicenseInfo()
        {
            Console.Clear();
            licenseWatch.Reset();
            licenseWatch.Start();
            CSMarkPlatform csM = new CSMarkPlatform();

            if (csM.returnOSPlatform().ToLower().Contains("win"))
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
            }
            else if (csM.returnOSPlatform().ToLower().Contains("osx") || csM.returnOSPlatform().ToLower().Contains("linux"))
            {
                //Keep the native console forground color to ensure it remains readable.
            }
            Console.WriteLine("Copyright (C) 2017 AluminiumTech");
            Console.WriteLine("This product is licensed under the 1st Draft of the AluminiumTech v1 open source license.");
            Console.WriteLine("                                                                    ");
            Console.WriteLine("This is free software (As defined at https://www.gnu.org/philosophy/free-sw.html) :");
            Console.WriteLine("you can re-distribute it and/or modify it under the terms of the AluminiumTech License published by AluminiumTech.");
            Console.WriteLine("                                                                    ");
            Console.WriteLine("This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY;");
            Console.WriteLine("without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
            Console.WriteLine("See the AluminiumTech License for more details.");
            Console.WriteLine("                                                                    ");
            Console.WriteLine("You should have received a copy of the AluminiumTech License along with this program.");
            Console.WriteLine("If not, see http://www.github.com/CSMarkBenchmark/CSMark/blob/master/LICENSE");
            Console.WriteLine("                                                                    ");
            Console.WriteLine("By using this program, you agree to the terms and conditions outlines in this license. If you do not agree, please exit the program.");
            Console.WriteLine("                                                                    ");
            Console.ForegroundColor = ConsoleColor.Gray;

            while (licenseWatch.ElapsedMilliseconds <= 2.0 * 1000)
            {
                //Do nothing to make sure everybody sees the license.
            }
        }
Exemple #2
0
        public void createSettingsFile(string locale, string language)
        {
            csM.getPlatform();

            if (csM.returnOSPlatform() == "Win10")
            {
                try{
                    if (Directory.Exists(configDir + "\\CSMark_Config.txt"))
                    {
                        //Do nothing. Checking Locale will happen elsewhere.
                        fileExists = true;
                    }
                    else if (!Directory.Exists(configDir + "\\CSMark_Config.txt"))
                    {
                        try{
                            using (StreamWriter sw = File.CreateText(configDir + "\\CSMark_Config.txt")){
                                sw.WriteLine("CSMarkVersion_" + new Information().returnCSMarkVersionString());
                                sw.WriteLine("Date_" + DateTime.Now.ToString());
                                sw.WriteLine("ThreadCount_" + Environment.ProcessorCount.ToString());
                                sw.WriteLine("OSPlatform__" + new CSMarkPlatform().returnOSPlatform());
                                sw.WriteLine("OSArchitecture__" + new CSMarkPlatform().returnArch());
                                sw.WriteLine("Language_" + language);
                                sw.WriteLine("Locale_" + locale);
                                sw.WriteLine("-------------------------------------------------");
                            }
                            Console.WriteLine("The configuration file was saved at ... " + configDir);
                            fileExists = true;
                        }
                        catch (Exception ex) {
                            Console.WriteLine("The Configuration file was not able to be saved. Here's some details in case you need them:");
                            Console.WriteLine(ex);
                            fileExists = false;
                        }
                    }
                }
                catch {
                    Console.WriteLine("The Configuration file was not able to be saved");
                }
            }
            else if (csM.returnOSPlatform().ToLower() == "linux" || csM.returnOSPlatform().ToLower() == "osx")
            {
                try{
                    if (Directory.Exists(configDir + "/CSMark_Config.txt"))
                    {
                        //Do nothing. Checking Locale will happen elsewhere.
                        fileExists = true;
                    }
                    else if (!Directory.Exists(configDir + "/CSMark_Config.txt"))
                    {
                        try{
                            using (StreamWriter sw = File.CreateText(configDir + "/CSMark_Config.txt")){
                                sw.WriteLine("CSMarkVersion_" + new Information().returnCSMarkVersionString());
                                sw.WriteLine("Date_" + DateTime.Now.ToString());
                                sw.WriteLine("ThreadCount_" + Environment.ProcessorCount.ToString());
                                sw.WriteLine("OSPlatform__" + new CSMarkPlatform().returnOSPlatform());
                                sw.WriteLine("OSArchitecture__" + new CSMarkPlatform().returnArch());
                                sw.WriteLine("Language_" + language);
                                sw.WriteLine("Locale_" + locale);
                                sw.WriteLine("-------------------------------------------------");
                            }
                            Console.WriteLine("The configuration file was saved at ... " + configDir);
                            fileExists = true;
                        }
                        catch (Exception ex) {
                            Console.WriteLine("The Configuration file was not able to be saved. Here's some details in case you need them:");
                            Console.WriteLine(ex);
                            fileExists = false;
                        }
                    }
                }
                catch {
                    Console.WriteLine("The Configuration file was not able to be saved");
                }
            }
        }
Exemple #3
0
        public void checkForUpdate(string locale)
        {
            //This checks for updates on startup
            checkUpdateTimer.Reset();
            checkUpdateTimer.Start();
            AutoUpdaterNetStandard.AutoUpdater.Start(cSMarkPlatform.returnDownloadURL());

            Console.WriteLine(locale_EN.checkForUpdate_Notice);

            //If it takes longer than 3 seconds to check for updates then stop and tell the user it couldn't check for updates.
            while (autoUpdater.checkForUpdateCompleted() == false && checkUpdateTimer.ElapsedMilliseconds <= (3.0 * 1000))
            {
            }
            if (autoUpdater.checkForUpdateCompleted() == false)
            {
                Console.WriteLine(locale_EN.checkForUpdate_Failed);
            }
            else
            {
                Console.WriteLine(locale_EN.checkForUpdate_Took + " " + checkUpdateTimer.ElapsedMilliseconds + " " + locale_EN.checkForUpdate_Time);
            }
            if (autoUpdater.currentVersion() == "0.0.0.0")
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(locale_EN.checkForUpdate_NetworkIssues);
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine(locale_EN.starting);

                Console.WriteLine("                                     ");
            }
            if (autoUpdater.currentVersion() != "0.0.0.0" && autoUpdater.currentVersion() == autoUpdater.installedVersion())
            {
                //Do nothing
                Console.WriteLine(locale_EN.checkForUpdate_UpToDate);

                Console.WriteLine("                                     ");
            }
            else if (autoUpdater.currentVersion() != "0.0.0.0" && autoUpdater.currentVersion() != autoUpdater.installedVersion())
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("                                     ");
                Console.WriteLine(locale_EN.checkForUpdate_Available);
                Console.WriteLine(locale_EN.checkForUpdate_Latest + " " + autoUpdater.currentVersion());
                Console.WriteLine(locale_EN.checkForUpdate_Installed + " " + autoUpdater.installedVersion());
                Console.WriteLine(locale_EN.checkForUpdate_ChangeLog + " " + autoUpdater.changeLogURL());
                Console.WriteLine(locale_EN.checkForUpdate_DownloadInstruction + " " + autoUpdater.downloadURL() + csM.returnOSPlatform() + "-" + csM.returnArch() + ".zip");

                Console.WriteLine("                                     ");
                Console.ForegroundColor = ConsoleColor.Gray;
            }
            else
            {
                //Something bad happened.
            }
        }