public PackageCompositionViewModel(PackageReader reader)
 {
     //  List<string> parameters = reader.ReadPackageCompositionParameters();
      //   string a = reader.GetRulesPropertyValuesByNameForSigning("package-composition", "symlinks", "exes");
     //        Symlinks = reader.GetRulesPropertyValuesByNameForSigning("package-composition", "symlinks", "exes");
     SourceString = reader.GetRulesSourceStringPropertyValueByName("package-composition");
 }
        public MetadataViewModel(PackageReader reader)
        {
            _reader = reader;

                Summary = reader.GetRulesPropertyValueByName(Metadata, "summary");
                Description = reader.GetRulesPropertyValueByName(Metadata, "description");
                AuthorVersion = reader.GetRulesPropertyValueByName(Metadata, "author-version");
                BugTracker = reader.GetRulesPropertyValueByName(Metadata, "bug-tracker");
                Stability = reader.GetRulesPropertyValueByName(Metadata, "stability");
                Licenses = reader.GetRulesPropertyValueByName(Metadata, "licenses");
                IsEditable = false;

            SourceMetadataViewModel = new MetadataViewModel()
                                          {
                                              Summary = reader.GetRulesSourcePropertyValueByName(Metadata, "summary"),
                                              Description = reader.GetRulesSourcePropertyValueByName(Metadata, "description"),
                                              AuthorVersion = reader.GetRulesSourcePropertyValueByName(Metadata, "author-version"),
                                              BugTracker = reader.GetRulesSourcePropertyValueByName(Metadata, "bug-tracker"),
                                              Stability = reader.GetRulesSourcePropertyValueByName(Metadata, "stability"),
                                              Licenses = reader.GetRulesSourcePropertyValueByName(Metadata, "licenses"),
                                              IsEditable = true,
                                              IsSource = true,
                                          };

            SourceString = reader.GetRulesSourceStringPropertyValueByName(Metadata);
            SourceMetadataViewModel.PropertyChanged += EvaluatedChanged;
        }
        //withparam name?
        public AssemblyRoleViewModel(PackageReader reader)
            : base()
        {
            // Root = root;

            ApplicationCollection = new ObservableCollection<ApplicationItemViewModel>();

            foreach (string parameter in reader.ReadParameters("assembly"))
            {
                ObservableCollection<ItemViewModel> includeCollection = new ObservableCollection<ItemViewModel>(reader.ApplicationIncludeList("assembly", parameter, "include"));

                ApplicationItemViewModel model = new ApplicationItemViewModel()
                {
                   Label = "Assembly",
                    EditCollectionViewModel = new EditCollectionViewModel(reader,  includeCollection),
                    Name = parameter,
                   // Root = root,

                };
                ApplicationCollection.Add(model);
            }

            SourceString = reader.GetRulesSourceStringPropertyValueByName("assembly");
               ApplicationCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(base.FilesCollectionCollectionChanged);
        }
        public PackageViewModel(PackageReader reader)
        {
            _reader = reader;
            SourcePackageViewModel=new PackageViewModel()
                                     {
            Name = reader.GetRulesSourcePropertyValueByName(Package, "name"),
            DisplayName = reader.GetRulesSourcePropertyValueByName(Package, "display-name"),
            Architecture = reader.GetRulesSourcePropertyValueByName(Package, "arch"),
            Feed = reader.GetRulesSourcePropertyValueByName(Package, "feed"),
            Location = reader.GetRulesSourcePropertyValueByName(Package, "location"),
            Publisher = reader.GetRulesSourcePropertyValueByName(Package, "publisher"),
            Version = reader.GetRulesSourcePropertyValueByName(Package, "version"),
            IsEditable = true,
            IsSource = true,
                                     };

            Name = reader.GetRulesPropertyValueByName(Package, "name");
            DisplayName = reader.GetRulesPropertyValueByName(Package, "display-name");
            Architecture = reader.GetRulesPropertyValueByName(Package, "arch");
            Feed = reader.GetRulesPropertyValueByName(Package, "feed");
            Location = reader.GetRulesPropertyValueByName(Package, "location");
            Publisher = reader.GetRulesPropertyValueByName(Package, "publisher");
            Version = reader.GetRulesPropertyValueByName(Package, "version");
            IsEditable = false;

            SourceString = reader.GetRulesSourceStringPropertyValueByName(Package);
            SourcePackageViewModel.PropertyChanged += EvaluatedChanged;
        }
        public RequiresViewModel(PackageReader reader)
        {
            EditCollectionViewModel = new EditCollectionViewModel(reader,
                                                                  reader.GetRulesSourceValuesByNameForEditableCollections(
                                                                      "requires", "package"));

            SourceString = reader.GetRulesSourceStringPropertyValueByName("requires");
        }
        public SigningViewModel(PackageReader reader)
        {
            _reader = reader;
            ReplaceSignature = _reader.GetRulesPropertyValueByName(Signing, "replace-signature") == "true";
            CompanyAttribute = reader.GetRulesByNameForSigning(Signing, "attributes", "company",false);
            DescriptionAttribute = reader.GetRulesByNameForSigning(Signing, "attributes", "description",false);
            ProductNameAttribute = reader.GetRulesByNameForSigning(Signing, "attributes", "product-name",false);
            ProductVersion = reader.GetRulesByNameForSigning(Signing, "attributes", "product-version",false);
            FileVersionAttribute = reader.GetRulesByNameForSigning(Signing, "attributes", "file-version",false);
            EditCollectionViewModel = new EditCollectionViewModel(reader, reader.GetRulesSourceValuesByNameForEditableCollections(Signing, "include"));
            IsEditable = false;
            IsReadOnly = true;

            SourceSigningViewModel = new SigningViewModel()
                                         {
                                             ReplaceSignature =
                                                 _reader.GetRulesSourcePropertyValueByName(Signing, "replace-signature") ==
                                                 "true",
                                             CompanyAttribute =
                                                 reader.GetRulesByNameForSigning(Signing,
                                                                                 "attributes",
                                                                                 "company", true),
                                             DescriptionAttribute =
                                                 reader.GetRulesByNameForSigning(Signing,
                                                                                 "attributes",
                                                                                 "description", true),
                                             ProductNameAttribute =
                                                 reader.GetRulesByNameForSigning(Signing,
                                                                                 "attributes",
                                                                                 "product-name", true),
                                             ProductVersion =
                                                 reader.GetRulesByNameForSigning(Signing,
                                                                                 "attributes",
                                                                                 "product-version", true),
                                             FileVersionAttribute =
                                                 reader.GetRulesByNameForSigning(Signing,
                                                                                 "attributes",
                                                                                 "file-version", true),
                                             EditCollectionViewModel = this.EditCollectionViewModel,
                                             IsEditable = true,
                                             IsReadOnly = false,
                                             IsSource = true,

                                         };

            SourceString = reader.GetRulesSourceStringPropertyValueByName(Signing);
            SourceSigningViewModel.PropertyChanged += EvaluatedChanged;
        }
        public ManifestViewModel(PackageReader reader)
        {
            _manifestCollection = new ObservableCollection<ManifestItemViewModel>();
            foreach (string parameter in reader.ReadParameters("manifest"))
            {
                var includeCollection = new ObservableCollection<ItemViewModel>(reader.GetRulesSourceValuesByParameterForEditableCollections("manifest", parameter, "include"));
                var assemblyCollection = new ObservableCollection<ItemViewModel>(reader.GetRulesSourceValuesByParameterForEditableCollections("manifest", parameter, "assembly"));
                var model = new ManifestItemViewModel()
                {
                    AssemblyCollection = new EditCollectionViewModel(reader, assemblyCollection),
                    IncludeCollection = new EditCollectionViewModel(reader, includeCollection),
                    Name = parameter,
                };
                _manifestCollection.Add(model);

            }

             SourceString = reader.GetRulesSourceStringPropertyValueByName("manifest");
             _manifestCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(FilesCollectionCollectionChanged);
        }
        public FilesViewModel(PackageReader reader)
        {
            _filesCollection = new ObservableCollection<FilesItemViewModel>();
            foreach (string parameter in reader.ReadParameters("files"))
            {
                ObservableCollection<ItemViewModel> includeCollection = new ObservableCollection<ItemViewModel>(reader.GetRulesSourceValuesByParameterForEditableCollections("files", parameter, "include"));
                FilesItemViewModel model = new FilesItemViewModel()
                {
                    FilesRoot = reader.GetFilesRulesPropertyValueByParameterAndName(parameter, "root"),
                    TrimPath = reader.GetFilesRulesPropertyValueByParameterAndName(parameter, "trim-path"),
                    EditCollectionViewModel = new EditCollectionViewModel(reader,  includeCollection),
                    Name = parameter,
                };

                _filesCollection.Add(model);
            }

            SourceString = reader.GetRulesSourceStringPropertyValueByName("files");
            _filesCollection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(FilesCollectionCollectionChanged);
        }
        public CompatibilityPolicyViewModel(PackageReader reader)
        {
            _reader = reader;

               Minimum = reader.GetRulesPropertyValueByName(CompatibilityPolicy, "minimum");
               Maximum = reader.GetRulesPropertyValueByName(CompatibilityPolicy, "maximum");
               Versions = reader.GetRulesPropertyValueByName(CompatibilityPolicy, "versions");
               IsEditable = false;

               SourceValueCompatibilityPolicyViewModel = new CompatibilityPolicyViewModel()
                                                       {
                                                            Minimum = reader.GetRulesSourcePropertyValueByName(CompatibilityPolicy, "minimum"),
                                                            Maximum = reader.GetRulesSourcePropertyValueByName(CompatibilityPolicy, "maximum"),
                                                            Versions = reader.GetRulesSourcePropertyValueByName(CompatibilityPolicy, "versions"),
                                                            IsEditable = true,
                                                            IsSource = true,
                                                       };

               SourceString = reader.GetRulesSourceStringPropertyValueByName(CompatibilityPolicy);
               SourceValueCompatibilityPolicyViewModel.PropertyChanged += EvaluatedChanged;
        }
        public LicenseViewModel(PackageReader reader)
        {
            _reader = reader;
            License = reader.GetRulesPropertyValueByName(LicenseString, "license");
            LicenseType = reader.GetRulesPropertyValueByName(LicenseString, "license-type");
            LicenseUrl = reader.GetRulesPropertyValueByName(LicenseString, "license-url");

            _sourceValueLicenseViewModel = new LicenseViewModel()
                                               {
                                                   License =
                                                       reader.GetRulesSourcePropertyValueByName(LicenseString, "license"),
                                                   LicenseType =
                                                       reader.GetRulesSourcePropertyValueByName(LicenseString, "license-type"),
                                                   LicenseUrl =
                                                       reader.GetRulesSourcePropertyValueByName(LicenseString, "license-url"),
                                                   IsEditable = true,
                                                   IsSource = true,
                                               };

            SourceString = reader.GetRulesSourceStringPropertyValueByName(LicenseString);
            SourceValueLicenseViewModel.PropertyChanged += EvaluatedChanged;
        }
        public ApplicationRoleViewModel(PackageReader reader)
        {
            _applicationCollection = new ObservableCollection<RoleItemViewModel>();

            foreach (string parameter in reader.ReadParameters("application"))
            {
                var includeCollection =
                    new ObservableCollection<ItemViewModel>(reader.ApplicationIncludeList("application", parameter,
                                                                                          "include"));

                var model = new RoleItemViewModel()
                                                     {
                                                         Label = "Application",
                                                         EditCollectionViewModel =
                                                             new EditCollectionViewModel(reader, includeCollection),
                                                         Name = parameter,
                                                     };
                _applicationCollection.Add(model);
            }

            SourceString = reader.GetRulesSourceStringPropertyValueByName("application");
            _applicationCollection.CollectionChanged +=
                new System.Collections.Specialized.NotifyCollectionChangedEventHandler(FilesCollectionCollectionChanged);
        }
 public DefineViewModel(PackageReader reader)
 {
     EditCollectionViewModel = new EditCollectionViewModel(reader,  reader.GetDefineRules());
     SourceString = reader.GetRulesSourceStringPropertyValueByName("*");
 }