Ejemplo n.º 1
0
        public static bool Init(string[] args)
        {
            InstallDir    = RegistrySettings.ReadString("INSTALLDIR");
            DeleteCompany = true;

            ParseCommandLine(args);

            if (!string.IsNullOrEmpty(InstallDir))
            {
                InstallDir = InstallDir.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
            }

            InstallDirWeb = Path.Combine(InstallDir, @"Code\_Source\Web");

            bool result = false;

            switch (Action)
            {
            case "INSTALL":
            case "REMOVE":
                result = (InstallDir != null);
                break;
            }

            return(result);
        }
 public void registry_points_to_correct_file()
 {
     CodeBase <TemporaryComAddIn>().ShouldBe(
         InstallDir.GetDirectory("1.0.0.0").GetFile(FileName <TemporaryComAddIn>()).Path.ToFileUri());
     CodeBase <TemporaryComAddIn2>().ShouldBe(
         InstallDir.GetDirectory("1.0.0.0").GetFile(FileName <TemporaryComAddIn>()).Path.ToFileUri());
 }
        string GetTargetPathForGeneratedPath(string path)
        {
            var subpath = (InstallDir.Contains("Xamarin.iOS.framework")) ? "native" : "full";
            var pos     = path.IndexOf(subpath, StringComparison.InvariantCulture);

            if (pos >= 0)
            {
                var relativePath = path.Remove(0, pos + subpath.Length + 1);
                return(Path.Combine(DestinationDir, "src", FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.InvariantCulture)), relativePath));
            }
            return(null);
        }
Ejemplo n.º 4
0
        public string GetTargetPath(string path)
        {
            var relativePath = path.Substring(OpenTKSourcePath.Length);

            if (relativePath.StartsWith("/", StringComparison.Ordinal))
            {
                relativePath = relativePath.Remove(0, 1);
            }
            var target = Path.Combine(DestinationDir, "src", (InstallDir.Contains("Xamarin.iOS") ? "Xamarin.iOS" : "Xamarin.Mac"), relativePath);

            return(target);
        }
        public bool IsMonoPath(string path)
        {
            // remove the intall dir and append the mono source path
            if (path.StartsWith(InstallDir, StringComparison.Ordinal))
            {
                // dealing with the jenkins paths
                if (Verbose)
                {
                    Console.WriteLine($"Install dir is {InstallDir}");
                    Console.WriteLine($"Original path os {path}");
                }

                var srcDir = Path.Combine(InstallDir, srcSubPath,
                                          (InstallDir.Contains(xamariniOSDir) ? xamariniOSDir : xamarinMacDir));
                if (Verbose)
                {
                    Console.WriteLine($"Src path to remove {srcDir}");
                }
                var relative = path.Remove(0, srcDir.Length);
                if (Verbose)
                {
                    Console.WriteLine($"Relative path is {relative}");
                }
                if (relative.StartsWith("/", StringComparison.Ordinal))
                {
                    relative = relative.Remove(0, 1);
                }
                var monoPath = Path.Combine(MonoSourcePath, relative);
                if (Verbose)
                {
                    Console.WriteLine($"Mono path is {monoPath}");
                }
                return(File.Exists(monoPath));
            }
            if (path.StartsWith(XamarinSourcePath, StringComparison.Ordinal))
            {
                return(false);
            }
            var xamarinRuntimePath = XamarinSourcePath.Replace($"/{srcSubPath}/", $"/{runtimeSubPath}/");

            if (path.StartsWith(xamarinRuntimePath, StringComparison.Ordinal))
            {
                return(false);
            }
            return(path.StartsWith(MonoSourcePath, StringComparison.Ordinal));
        }
Ejemplo n.º 6
0
        private void Pack()
        {
            log.Info(Resources.CompilePackage_Packing_Fmt, packageVersion, packageVersion);
            string installDirTmp = InstallDir.Replace('\\', '/'); // NB: TarArchive requires forward slashes

            using (var fs = File.OpenWrite(CompiledPackage))
            {
                using (var gzipStream = new GZipOutputStream(fs))
                {
                    using (var tarArchive = TarArchive.CreateOutputTarArchive(gzipStream))
                    {
                        tarArchive.RootPath = installDirTmp;
                        var tarEntry = TarEntry.CreateEntryFromFile(installDirTmp);
                        tarArchive.WriteEntry(tarEntry, true);
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public bool IsOpenTKPath(string path)
 {
     if (path.StartsWith(InstallDir, StringComparison.Ordinal))
     {
         // dealing with the jenkins paths
         var srcDir = Path.Combine(InstallDir, srcSubPath,
                                   (InstallDir.Contains(xamariniOSDir) ? xamariniOSDir : xamarinMacDir));
         var relative = path.Remove(0, srcDir.Length);
         if (relative.StartsWith("/", StringComparison.Ordinal))
         {
             relative = relative.Remove(0, 1);
         }
         var openTKPath = Path.Combine(OpenTKSourcePath, relative);
         return(File.Exists(openTKPath));
     }
     else
     {
         return(path.Contains(OpenTKSourcePath));
     }
 }
Ejemplo n.º 8
0
        public SteamBundle(IEnumerable <ILocalSteamApplication> apps)
        {
            var includedBundles = apps.OfType <SteamBundle>();
            var nonBundles      = apps.Except(includedBundles);
            var appsToBundle    = nonBundles.Concat(includedBundles.SelectMany(x => x.AppsInBundle));

            try
            {
                _AppsInBundle = appsToBundle.OrderBy(x => Convert.ToInt32(x.AppId)).ToArray();
            }
            catch (Exception)
            {
                _AppsInBundle = appsToBundle.OrderBy(x => x.AppId).ToArray();
            }
            if (_AppsInBundle.Any(x => x.InstallDir.ToLower() != InstallDir.ToLower()))
            {
                throw new ArgumentException("Not all apps have the same install dir");
            }

            UpdateAppId();
        }
        /// <summary>
        /// Returns the source path for a generated file.
        /// </summary>
        /// <returns>The source path for native type.</returns>
        /// <param name="path">Path.</param>
        string GetSourcePathForGeneratedPath(string path)
        {
            var frameworkPrefix = FrameworkPath.Remove(FrameworkPath.IndexOf(".framework", StringComparison.Ordinal));
            var installPath     = Path.Combine(InstallDir, "src", frameworkPrefix);

            // we might be looking at a mdb that was already gone thorugh mdb rebase, if that is the case, do find the path for the final target
            if (path.StartsWith(InstallDir, StringComparison.InvariantCulture))
            {
                var src = path.Substring(installPath.Length + 1);
                if (src.StartsWith("/", StringComparison.Ordinal))
                {
                    src = src.Remove(0, 1);
                }
                src = Path.Combine(XamarinSourcePath, (InstallDir.Contains("Xamarin.iOS.framework")) ? "build/ios/native/" : "build/mac/full/", src);
                return(src);
            }
            else
            {
                var pos = path.IndexOf($"/{frameworkPrefix}/", StringComparison.InvariantCulture);
                var src = path.Remove(0, pos + $"/{frameworkPrefix}/".Length);                  // 3 for src and 1  for /
                src = Path.Combine(XamarinSourcePath, src);
                return(src);
            }
        }
 public void versioned_directory_is_added()
 {
     InstallDir.GetDirectory("1.0.0.0").Exists.ShouldBeTrue();
 }
 public void file_is_copied()
 {
     InstallDir.GetDirectory("1.0.0.0").GetFile(FileName <TemporaryComAddIn>())
     .Exists.ShouldBeTrue();
 }
Ejemplo n.º 12
0
 public void versioned_directory_for_old_version_not_created()
 {
     InstallDir.GetDirectory("1.0.0.0").Exists.ShouldBeFalse();
 }
Ejemplo n.º 13
0
        private static void CreateMSI(string LicensePath, string PathToBuild, string VersionText, string ResultBuildPath, string WixPath)
        {
            List <WixEntity> files = new List <WixEntity>();

            var paths = System.IO.Directory.GetFiles(PathToBuild);


            foreach (var path in paths)
            {
                files.Add(new File(path));

                if (path.EndsWith("MemcardRex.exe"))
                {
                    (files[files.Count - 1] as File).Shortcuts = new FileShortcut[] { new FileShortcut("MemcardRex", "INSTALLDIR"),
                                                                                      new FileShortcut("MemcardRex", @"%Desktop%"), new FileShortcut("MemcardRex", @"%ProgramMenu%/MemcardRex")
                                                                                      {
                                                                                          WorkingDirectory = "%Temp%", Arguments = "777"
                                                                                      } };
                    (files[files.Count - 1] as File).Id      = AppId;
                    (files[files.Count - 1] as File).Feature = Feature;
                }
            }


            List <WixEntity> InnerDirs = GetInnerDirs(PathToBuild);

            files.AddRange(InnerDirs);


            files.Add(new RemoveFolderEx {
                On = InstallEvent.uninstall, Property = "DIR_PATH_PROPERTY_NAME"
            });
            files.Add(new ExeFileShortcut("Uninstall MemcardRex",
                                          "[System64Folder]msiexec.exe",
                                          "/x [ProductCode]"));

            var dir = new InstallDir(@"%ProgramFiles%\MemcardRex",
                                     files.ToArray());

            var dirStartMenu = new Dir("%ProgramMenu%/MemcardRex", new ExeFileShortcut("Uninstall MemcardRex",
                                                                                       "[System64Folder]msiexec.exe",
                                                                                       "/x [ProductCode]"), new RemoveFolderEx {
                On = InstallEvent.uninstall, Property = "DIR_PATH_PROPERTY_NAME"
            });



            var project = new Project("MemcardRex",
                                      dir, dirStartMenu);

            project.Version = Version.Parse(VersionText);
            project.GUID    = new Guid("6f332b47-1434-42bd-9195-1362ba35889b");

            project.MajorUpgradeStrategy = new MajorUpgradeStrategy()
            {
                UpgradeVersions                   = VersionRange.OlderThanThis,
                PreventDowngradingVersions        = VersionRange.NewerThanThis,
                NewerProductInstalledErrorMessage = "Newer version already installed"
            };
            project.UI                  = WUI.WixUI_InstallDir;
            project.LicenceFile         = LicensePath;
            project.WixSourceGenerated += (document) => {
                var productElement = document.Root.Select("Product");

                productElement.Add(new XElement("WixVariable",
                                                new XAttribute("Id", "WixUIDialogBmp"),
                                                new XAttribute("Value", "setup_background.bmp")));



                productElement.Add(new XElement("WixVariable",
                                                new XAttribute("Id", "WixUIBannerBmp"),
                                                new XAttribute("Value", "setup_icon.bmp")));
            };

            Environment.SetEnvironmentVariable("WIXSHARP_WIXDIR", WixPath);
            Compiler.WixLocation  = WixPath;
            Compiler.LightOptions = "-sval -sh";
            Console.WriteLine("Starting building MSI.");
            Compiler.BuildMsi(project, ResultBuildPath);
        }