// Token: 0x06000187 RID: 391 RVA: 0x0000757C File Offset: 0x0000577C
        public async Task <string> CheckForUpgradeAsync(bool overrideDisabledCheck = false)
        {
            string result;

            if (!overrideDisabledCheck && !this.IsUpdateCheckEnabled)
            {
                result = null;
            }
            else
            {
                string installerLink = null;
                try
                {
                    Version devVersion     = Version.Parse("0.0.0.0");
                    Version currentVersion = Assembly.GetEntryAssembly().GetName().Version;
                    if (!(currentVersion == devVersion) && NetworkInterface.GetIsNetworkAvailable())
                    {
                        this.webClient = new WebClient();
                        this.webClient.Headers[HttpRequestHeader.CacheControl] = "no-cache";
                        string text = await this.webClient.DownloadStringTaskAsync(this.VersionLink);

                        XmlDocument xmlDoc      = this.LoadAsXml(text);
                        XmlNode     productNode = xmlDoc.SelectSingleNode(string.Format("/AppInfo/LatestVersion[@Edition='{0}' and @Platform = '{1}']", this.productInfo.Edition, this.productInfo.Platform));
                        XmlNode     versionNode = (productNode != null) ? productNode.SelectSingleNode("VersionNumber") : null;
                        XmlNode     linkNode    = (productNode != null) ? productNode.SelectSingleNode("InstallerLink") : null;
                        Version     v;
                        if (versionNode != null && linkNode != null && Version.TryParse(versionNode.InnerText.Trim(), out v) && currentVersion < v)
                        {
                            installerLink = linkNode.InnerText;
                        }
                    }
                }
                catch (Exception value)
                {
                    LoggerExtensionMethods.LogWarning <UpdateChecker>(this, "Update check failed", new Dictionary <string, object>
                    {
                        {
                            "Exception",
                            value
                        }
                    }, "CheckForUpgradeAsync", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Update\\UpdateChecker.cs", 99);
                }
                this.webClient = null;
                result         = installerLink;
            }
            return(result);
        }
 // Token: 0x0600017B RID: 379 RVA: 0x00007094 File Offset: 0x00005294
 private void CheckDirectoryIsWriteable(string directory)
 {
     try
     {
         string path = Path.Combine(directory, Path.GetRandomFileName());
         File.WriteAllText(path, string.Empty);
         File.Delete(path);
     }
     catch (Exception value)
     {
         LoggerExtensionMethods.LogWarning <ScratchManager>(this, "Coludn't write to scratch directory", new Dictionary <string, object>
         {
             {
                 "Exception",
                 value
             }
         }, "CheckDirectoryIsWriteable", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Scratch\\ScratchManager.cs", 214);
         throw new Exception("Directory is not writeable");
     }
 }
 // Token: 0x0600017C RID: 380 RVA: 0x0000710C File Offset: 0x0000530C
 private void EnsureDirectoryExists(string directory)
 {
     if (!Directory.Exists(directory))
     {
         try
         {
             Directory.CreateDirectory(directory);
         }
         catch (Exception value)
         {
             LoggerExtensionMethods.LogWarning <ScratchManager>(this, "Coludn't make scratch directory", new Dictionary <string, object>
             {
                 {
                     "Exception",
                     value
                 }
             }, "EnsureDirectoryExists", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Scratch\\ScratchManager.cs", 229);
             throw new Exception("Couldn't create directory");
         }
     }
 }
        // Token: 0x06000177 RID: 375 RVA: 0x00006E70 File Offset: 0x00005070
        private void DetectAndHandleUncleanShutdown()
        {
            string cacheDirectory = this.GetCacheDirectory();

            if (Directory.Exists(cacheDirectory))
            {
                string    processName     = Process.GetCurrentProcess().ProcessName;
                Process[] processesByName = Process.GetProcessesByName(processName);
                string[]  directories     = Directory.GetDirectories(cacheDirectory);
                string[]  array           = directories;
                for (int i = 0; i < array.Length; i++)
                {
                    string text = array[i];
                    string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
                    int    pid = -1;
                    if (int.TryParse(fileNameWithoutExtension, out pid))
                    {
                        if (!processesByName.Any((Process p) => p.Id == pid && !p.HasExited))
                        {
                            string path  = Path.Combine(text, this.SessionIdFileName);
                            string value = "No Session File Found";
                            if (File.Exists(path))
                            {
                                value = File.ReadAllText(path);
                            }
                            LoggerExtensionMethods.LogWarning <ScratchManager>(this, "Unclean shutdown detected", new Dictionary <string, object>
                            {
                                {
                                    "PreviousSessionId",
                                    value
                                }
                            }, "DetectAndHandleUncleanShutdown", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Scratch\\ScratchManager.cs", 149);
                            this.TeardownScratchSpace(text);
                        }
                    }
                }
            }
        }
Exemple #5
0
        // Token: 0x06000252 RID: 594 RVA: 0x0000AD84 File Offset: 0x00008F84
        public bool Activate(string key)
        {
            try
            {
                if (!Directory.Exists(this.productInfo.ActivationRegistrationFolder))
                {
                    Directory.CreateDirectory(this.productInfo.ActivationRegistrationFolder);
                }
                if (Directory.Exists(this.productInfo.ActivationRegistrationFile))
                {
                    Directory.Delete(this.productInfo.ActivationRegistrationFile);
                    LoggerExtensionMethods.LogWarning <ActivationManager>(this, "Registration file was directory", null, "Activate", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Activation\\ActivationManager.cs", 57);
                }
            }
            catch (Exception value)
            {
                LoggerExtensionMethods.LogError <ActivationManager>(this, "Couldn't create directory for registration file", new Dictionary <string, object>
                {
                    {
                        "Exception",
                        value
                    }
                }, "Activate", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Activation\\ActivationManager.cs", 62);
                return(false);
            }
            int  num  = 0;
            bool flag = ActivationManager.ProductKeyValidator_Activate(this.instanceId, key, out num);

            if (flag)
            {
                string value2;
                string value3;
                string value4;
                this.GetActivationInfo(out value2, out value3, out value4);
                LoggerExtensionMethods.LogEvent <ActivationManager>(this, "Activated Product", new Dictionary <string, object>
                {
                    {
                        "ProductKey",
                        value2
                    },
                    {
                        "Pid2",
                        value4
                    },
                    {
                        "MPC",
                        value3
                    },
                    {
                        "FirstRun",
                        this.firstRunExperience.FirstRunTime.ToString()
                    },
                    {
                        "DaysToActivation",
                        DateTime.Now.Subtract(this.firstRunExperience.FirstRunTime).TotalDays
                    },
                    {
                        "VideosProcessedToActivation",
                        (double)this.firstRunExperience.VideosProcessed
                    }
                }, "Activate", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Activation\\ActivationManager.cs", 77);
            }
            else
            {
                LoggerExtensionMethods.LogEvent <ActivationManager>(this, "Couldn't activate product", new Dictionary <string, object>
                {
                    {
                        "Step",
                        num
                    }
                }, "Activate", "C:\\OxBuild\\30\\s\\hyperlapse_gui\\Hyperlapse\\Hyperlapse\\Model\\Activation\\ActivationManager.cs", 81);
            }
            return(flag);
        }