예제 #1
0
        private static void InitStage1()
        {
            Tools.SetThread_enUS();
            UpdateTeslalogger.Chmod("nohup.out", 666, false);
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            Logfile.Log("TeslaLogger Version: " + Assembly.GetExecutingAssembly().GetName().Version);
            Logfile.Log("Teslalogger Online Version: " + WebHelper.GetOnlineTeslaloggerVersion());
            Logfile.Log("Logfile Version: " + Assembly.GetAssembly(typeof(Logfile)).GetName().Version);
            Logfile.Log("SRTM Version: " + Assembly.GetAssembly(typeof(SRTM.SRTMData)).GetName().Version);
            try
            {
                string versionpath = Path.Combine(FileManager.GetExecutingPath(), "VERSION");
                File.WriteAllText(versionpath, Assembly.GetExecutingAssembly().GetName().Version.ToString());
            }
            catch (Exception)
            { }
        }
예제 #2
0
        private static void InitStage1()
        {
            Tools.SetThreadEnUS();
            UpdateTeslalogger.Chmod("nohup.out", 666, false);
            UpdateTeslalogger.Chmod("backup.sh", 777, false);
            UpdateTeslalogger.Chmod("TeslaLogger.exe", 755, false);

#pragma warning disable CA5364 // Verwenden Sie keine veralteten Sicherheitsprotokolle.
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
#pragma warning restore CA5364 // Verwenden Sie keine veralteten Sicherheitsprotokolle.

            Logfile.Log("TeslaLogger Version: " + Assembly.GetExecutingAssembly().GetName().Version);
            Logfile.Log("Teslalogger Online Version: " + WebHelper.GetOnlineTeslaloggerVersion());
            Logfile.Log("Logfile Version: " + Assembly.GetAssembly(typeof(Logfile)).GetName().Version);
            Logfile.Log("SRTM Version: " + Assembly.GetAssembly(typeof(SRTM.SRTMData)).GetName().Version);
            try
            {
                string versionpath = Path.Combine(FileManager.GetExecutingPath(), "VERSION");
                File.WriteAllText(versionpath, Assembly.GetExecutingAssembly().GetName().Version.ToString());
            }
            catch (Exception)
            { }
            try
            {
                if (File.Exists("BRANCH"))
                {
                    var branch = File.ReadAllText("BRANCH").Trim();
                    Logfile.Log($"YOU ARE USING BRANCH: " + branch);

                    ExceptionlessClient.Default.Configuration.DefaultData.Add("Branch", branch);
                    ExceptionlessClient.Default.CreateLog("Program", "BRANCH: " + branch, Exceptionless.Logging.LogLevel.Warn).FirstCarUserID().Submit();;
                }
            }
            catch (Exception ex)
            {
                Logfile.Log(ex.ToString());
                ex.ToExceptionless().FirstCarUserID().Submit();
            }
        }
예제 #3
0
        private static void InitStage1()
        {
            Tools.SetThreadEnUS();
            UpdateTeslalogger.Chmod("nohup.out", 666, false);
            UpdateTeslalogger.Chmod("backup.sh", 777, false);
            UpdateTeslalogger.Chmod("TeslaLogger.exe", 755, false);

#pragma warning disable CA5364 // Verwenden Sie keine veralteten Sicherheitsprotokolle.
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
#pragma warning restore CA5364 // Verwenden Sie keine veralteten Sicherheitsprotokolle.

            Logfile.Log("TeslaLogger Version: " + Assembly.GetExecutingAssembly().GetName().Version);
            Logfile.Log("Teslalogger Online Version: " + WebHelper.GetOnlineTeslaloggerVersion());
            Logfile.Log("Logfile Version: " + Assembly.GetAssembly(typeof(Logfile)).GetName().Version);
            Logfile.Log("SRTM Version: " + Assembly.GetAssembly(typeof(SRTM.SRTMData)).GetName().Version);
            try
            {
                string versionpath = Path.Combine(FileManager.GetExecutingPath(), "VERSION");
                File.WriteAllText(versionpath, Assembly.GetExecutingAssembly().GetName().Version.ToString());
            }
            catch (Exception)
            { }
        }
예제 #4
0
        public static void CheckForNewVersion()
        {
            try
            {
                TimeSpan ts = DateTime.UtcNow - lastVersionCheck;
                if (ts.TotalMinutes > 120)
                {
                    Logfile.Log(" *** Check new Version ***");

                    string online_version = WebHelper.GetOnlineTeslaloggerVersion();
                    if (string.IsNullOrEmpty(online_version))
                    {
                        // recheck in 10 Minutes
                        Logfile.Log("Empty Version String - recheck in 10 minutes");
                        lastVersionCheck = lastVersionCheck.AddMinutes(10);
                        return;
                    }

                    lastVersionCheck = DateTime.UtcNow;

                    string           currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                    Tools.UpdateType updateType     = Tools.UpdateSettings();

                    if (UpdateNeeded(currentVersion, online_version, updateType))
                    {
                        // if update doesn't work, it will retry tomorrow
                        lastVersionCheck = DateTime.UtcNow.AddDays(1);

                        Logfile.Log("---------------------------------------------");
                        Logfile.Log(" *** New Version Detected *** ");
                        Logfile.Log("Current Version: " + currentVersion);
                        Logfile.Log("Online Version: " + online_version);
                        Logfile.Log("Start update!");

                        string cmd_updated = "/etc/teslalogger/cmd_updated.txt";

                        if (File.Exists(cmd_updated))
                        {
                            File.Delete(cmd_updated);
                        }

                        if (Tools.IsDocker())
                        {
                            Logfile.Log("  Docker detected!");
                            File.WriteAllText("/tmp/teslalogger-cmd-restart.txt", "update");
                        }
                        else
                        {
                            Logfile.Log("Rebooting");
                            Exec_mono("reboot", "");
                        }
                    }

                    return;
                }
            }
            catch (Exception ex)
            {
                Logfile.Log(ex.ToString());
            }
        }