internal AutopackageModel(PackageSource source, AtomFeed feed)
 {
     Source = source;
     DestinationDirectoryFiles = Enumerable.Empty<FileEntry>();
     Assemblies = new List<PackageAssembly>();
     foreach( var sheet in Source.PropertySheets ) {
         sheet.GetMacroValue += GetMacroValue;
     }
     AtomFeed = feed;
 }
        public RulesViewModel()
        {
            _ruleNames = new ObservableCollection<string>();

                PackageSource packageSource = new PackageSource(new AutopackageMain());
                //expect to obtain form packageSource.AllRules - pakackage rule, metadata rule, provides rule ...
                foreach (Rule rule in  packageSource.AllRules)
                {
                    _ruleNames.Add(rule.Name);

                }
        }
Beispiel #3
0
 internal WixDocument(PackageSource source, AutopackageModel model, AtomFeed feed)
 {
     Source = source;
     Model = model;
     Feed = feed;
 }
        /// <summary>
        ///   The (non-static) startup method
        /// </summary>
        /// <param name = "args">
        ///   The command line arguments.
        /// </param>
        /// <returns>
        ///   Process return code.
        /// </returns>
        protected override int Main(IEnumerable<string> args)
        {
            // force temporary folder to be where we want it to be.
            CurrentTask.Events += new DownloadProgress((remoteLocation, location, progress) => {
                "Downloading {0}".format(remoteLocation.UrlDecode()).PrintProgressBar(progress);
            });

            CurrentTask.Events += new DownloadCompleted((remoteLocation, locallocation) => {
                Console.WriteLine();
            });

            PackageManager.AddSessionFeed(Environment.CurrentDirectory).Wait();

            var macrovals = new XDictionary<string, string>();

            try {
                // default:
                var options = args.Where(each => each.StartsWith("--")).Switches();
                var parameters = args.Where(each => !each.StartsWith("--")).Parameters();

                foreach (var arg in options.Keys) {
                    var argumentParameters = options[arg];
                    var last = argumentParameters.LastOrDefault();
                    var lastAsBool = string.IsNullOrEmpty(last) || last.IsTrue();

                    switch (arg) {
                            /* options  */

                            /* global switches */
                        case "verbose":
                            _verbose = lastAsBool;
                            Logger.Messages = true;
                            Logger.Warnings = true;
                            Logger.Errors = true;
                            break;

                        case "load-config":
                            // all ready done, but don't get too picky.
                            break;

                        case "nologo":
                            this.Assembly().SetLogo(string.Empty);
                            break;

                        case "show-tools":
                            Tools.ShowTools = lastAsBool;
                            break;

                        case "certificate-path":
                            _signingCertPath = Path.GetFullPath(last);
                            break;

                        case "password":
                            _signingCertPassword = last;
                            break;

                        case "remember":
                            _remember = lastAsBool;
                            break;

                        case "override":
                            Override = true;
                            break;

                        case "help":
                            return Help();

                        case "no-toolkit-dependency":
                            break;

                        default:
                            macrovals.Add(arg, last);
                            break;
                    }
                }

                // set up the stuff to catch our errors and warnings

                CurrentTask.Events += new Error(HandleErrors);
                CurrentTask.Events += new Warning(HandleWarnings);
                CurrentTask.Events += new Verbose(Verbose);
                CurrentTask.Events += new Message(HandleMessage);

                // find all the command line tools that we're gonna need.
                Tools.LocateCommandlineTools();

                if (!parameters.Any()) {
                    throw new ConsoleException("Missing .autopkg script.");
                    // throw new ConsoleException(Resources.NoConfigFileLoaded);
                }

                Logo();

                var allFiles = parameters.FindFilesSmarter().ToArray();
                foreach (var file in allFiles) {
                    FilesystemExtensions.ResetTempFolder();
                    using (var popd = new PushDirectory(Path.GetDirectoryName(file.GetFullPath()))) {
                        Binary.UnloadAndResetAll();

                        PackageManager.AddSessionFeed(Path.GetDirectoryName(file.GetFullPath())).Wait();

                        PackageSource = new PackageSource(file, macrovals );

                        var template = PropertySheet.Parse(Resources.template_autopkg,null);

                        PackageSource.ImportedSheets.Add("template", template);

                        FindCertificate();

                        SigningCertPath = _signingCertPath;
                        SigningCertPassword = _signingCertPassword;
                        Remember = _remember;

                        // ------- Create data model for package
                        CreatePackageModel();

                        // ------ Generate package MSI from model
                        CreatePackageFile();
                    }
                }

            } catch (PackageException) {
                return Fail("Autopackage encountered errors.\r\n");
            } catch (ConsoleException failure) {
                return Fail("{0}\r\n\r\n    {1}", failure.Message, Resources.ForCommandLineHelp);
            } catch (Exception failure) {
                if( failure.InnerException != null ) {
                    Fail("Exception Caught: {0}\r\n{1}\r\n\r\n    {2}", failure.InnerException.Message, failure.InnerException.StackTrace, Resources.ForCommandLineHelp);
                }

                return Fail("Exception Caught: {0}\r\n{1}\r\n\r\n    {2}", failure.Message, failure.StackTrace, Resources.ForCommandLineHelp);
            }
            return 0;
        }
 public PackageViewModel()
 {
     PackageSource packageSource = new PackageSource(new AutopackageMain());
     //how to set?
     Architecture=  packageSource.AllRules.GetRulesByName("package").GetPropertyValue("Architecture");
 }
Beispiel #6
0
 internal AutopackageModel(PackageSource source, AtomFeed feed)
     : this()
 {
     Source = source;
     foreach( var sheet in Source.PropertySheets ) {
         sheet.GetMacroValue += GetMacroValue;
     }
     AtomFeed = feed;
 }
 public AutopackageModel(PackageSource source, AtomFeed feed)
     : this()
 {
     Source = source;
     Source.GetMacroValue += GetMacroValue;
     AtomFeed = feed;
 }