Пример #1
0
        void RunTestSourcesPackage(string solFile)
        {
            solFile = Util.GetSampleProject(solFile);
            Solution sol = (Solution)Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            SourcesZipPackageBuilder pb = new SourcesZipPackageBuilder();

            pb.FileFormat = sol.FileFormat;
            pb.SetSolutionItem(sol.RootFolder, sol.GetAllSolutionItems <SolutionItem> ());

            pb.TargetFile = GetTempTarFile("sourceszip");

            if (!DeployService.BuildPackage(Util.GetMonitor(), pb))
            {
                Assert.Fail("Package generation failed");
            }

            List <string> files = new List <string> ();

            foreach (string f in sol.GetItemFiles(true))
            {
                files.Add(sol.GetRelativeChildPath(f));
            }
            CheckTarContents(pb.TargetFile, files.ToArray(), true);
        }
Пример #2
0
        public SourcesZipEditorWidget(PackageBuilder target, FileFormat selectedFormat)
        {
            this.Build();
            this.target = (SourcesZipPackageBuilder)target;
            loading     = true;

            if (target.RootSolutionItem is SolutionFolder)
            {
                formats = Services.ProjectService.FileFormats.GetFileFormatsForObject(target.Solution);
            }
            else
            {
                formats = Services.ProjectService.FileFormats.GetFileFormatsForObject(target.RootSolutionItem);
            }

            if (selectedFormat == null)
            {
                selectedFormat = this.target.FileFormat;
            }
            if (selectedFormat == null)
            {
                selectedFormat = formats [0];
            }

            int sel = 0;

            for (int n = 0; n < formats.Length; n++)
            {
                comboFormat.AppendText(formats[n].Name);
                if (formats[n].Name == selectedFormat.Name)
                {
                    sel = n;
                }
            }

            comboFormat.Active     = sel;
            this.target.FileFormat = formats [sel];

            string[] archiveFormats = DeployService.SupportedArchiveFormats;
            int      zel            = 1;

            for (int n = 0; n < archiveFormats.Length; n++)
            {
                comboZip.AppendText(archiveFormats [n]);
                if (this.target.TargetFile.EndsWith(archiveFormats [n]))
                {
                    zel = n;
                }
            }

            if (!string.IsNullOrEmpty(this.target.TargetFile))
            {
                string ext = archiveFormats [zel];
                folderEntry.Path = System.IO.Path.GetDirectoryName(this.target.TargetFile);
                entryZip.Text    = System.IO.Path.GetFileName(this.target.TargetFile.Substring(0, this.target.TargetFile.Length - ext.Length));
                comboZip.Active  = zel;
            }
            loading = false;
        }