コード例 #1
0
        private bool CheckFamiliesVersion(DownloadLink link)
        {
            var checkResult = false;

            using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Building360", true))
            {
                if (key != null)
                {
                    var v1 = key.GetValue(link.keyName).ToString();
                    var versionInstalled = new Version(v1);
                    var v2             = link.version;
                    var versionCurrent = new Version(v2);

                    var result = versionInstalled.CompareTo(versionCurrent);

                    if (result > 0)
                    {
                        checkResult = false;
                    }

                    else if (result < 0)
                    {
                        checkResult = true;
                    }

                    else
                    {
                        checkResult = false;
                    }
                }
            }

            return(checkResult);
        }
コード例 #2
0
 private static void RemoveExistingTemplate(DownloadLink item, string destinationPath, Exception e)
 {
     if (e.GetType() == typeof(System.IO.IOException))
     {
         foreach (var file in Directory.GetFiles(destinationPath))
         {
             if (file.Contains("BUILDing360_PROJEKTVORLAGE"))
             {
                 File.Delete(file);
                 System.IO.Compression.ZipFile.ExtractToDirectory(Path.Combine(destinationPath, "temp.zip"), destinationPath, Encoding.GetEncoding(850));
                 Console.WriteLine("Unzip " + item.packageName);
                 File.Delete(Path.Combine(destinationPath, "temp.zip"));
             }
         }
     }
 }