Exemplo n.º 1
0
        public static void Main(string[] _args)
        {
            List <string> args = new List <string>(_args);
            Dictionary <string, string> options = Duplicati.Library.Utility.CommandLineParser.ExtractOptions(args);
            Options opt = new Options();

            foreach (FieldInfo fi in opt.GetType().GetFields())
            {
                if (options.ContainsKey(fi.Name))
                {
                    fi.SetValue(opt, options[fi.Name]);
                }
            }

            opt.Fixup();

            Duplicati.Library.Utility.IFilter filter = null;
            if (!string.IsNullOrEmpty(opt.ignorefilter))
            {
                filter = new Duplicati.Library.Utility.FilterExpression(opt.ignorefilter, false);
            }

            var paths = Duplicati.Library.Utility.Utility.EnumerateFileSystemEntries(opt.sourcefolder, filter).Select(x => x.Substring(opt.sourcefolder.Length));

            //A bit backwards, but we have flattend the file list, and now we re-construct the tree,
            // but we do not care much about performance here
            RootFolderInfo rootfolder = new RootFolderInfo(opt, paths);

            new XDocument(
                new XElement(XWIX + "Wix",
                             new XElement(XWIX + "Fragment",
                                          rootfolder.GroupNode,
                                          new XElement(XWIX + "DirectoryRef",
                                                       new XAttribute("Id", opt.dirref),
                                                       rootfolder.Node
                                                       )
                                          )
                             )
                ).Save(opt.outputfile);

            WriteKeyDatabase(rootfolder.GeneratedKeys, opt.dbfilename, true);

            Console.WriteLine("Generated wxs: {0}", opt.outputfile);
        }
Exemplo n.º 2
0
		public static void Main (string[] _args)
		{			
			List<string> args = new List<string>(_args);
			Dictionary<string, string> options = Duplicati.Library.Utility.CommandLineParser.ExtractOptions(args);
			Options opt = new Options();
			
			foreach(FieldInfo fi in opt.GetType().GetFields())
				if (options.ContainsKey(fi.Name))
					fi.SetValue(opt, options[fi.Name]);
			
			opt.Fixup();			
			
            Duplicati.Library.Utility.IFilter filter = null;
			if (!string.IsNullOrEmpty(opt.ignorefilter))
                filter = new Duplicati.Library.Utility.FilterExpression(opt.ignorefilter, false);
			
            var paths = Duplicati.Library.Utility.Utility.EnumerateFileSystemEntries(opt.sourcefolder, filter).Select(x => x.Substring(opt.sourcefolder.Length));

			//A bit backwards, but we have flattend the file list, and now we re-construct the tree,
			// but we do not care much about performance here
			RootFolderInfo rootfolder = new RootFolderInfo(opt, paths);
			
			new XDocument(
				new XElement(XWIX + "Wix",
					new XElement(XWIX + "Fragment",
			            rootfolder.GroupNode,
						new XElement(XWIX + "DirectoryRef",
							new XAttribute("Id", opt.dirref),
			             	rootfolder.Node
						)
					)
				)
			).Save(opt.outputfile);

			WriteKeyDatabase(rootfolder.GeneratedKeys, opt.dbfilename, true);
			
			Console.WriteLine("Generated wxs: {0}", opt.outputfile);
			
		}