/// <summary>
        /// Gets all available data values for the specifed APPLICATION field.  In this case we need to know
        /// for each asset whether or not the application is installed.
        /// </summary>
        /// <param name="reportColumn"></param>
        protected void GetApplicationFieldValues(AssetList cachedAssetList, AuditDataReportColumn reportColumn)
        {
            try
            {
                List <string> fieldParts      = Utility.ListFromString(reportColumn.FieldName, '|', true);
                string        publisherName   = fieldParts[1];
                string        applicationName = fieldParts[2];

                // The application name is formatted as Applications | Publisher | Application - we need to find this specific
                // application in our internal cached list
                ApplicationPublisher publisher   = _cachedApplicationsList.FindPublisher(publisherName);
                InstalledApplication application = publisher.FindApplication(applicationName);

                // Now loop through the Assets and determine which does have the application and which does not
                // We store the value 'Installed' or 'Not Installed' for the value for each asset
                foreach (Asset asset in cachedAssetList)
                {
                    string value = (application.FindInstance(asset.AssetID) == null) ? AuditDataReportColumn.ApplicationNotInstalled : AuditDataReportColumn.ApplicationInstalled;
                    reportColumn.Values.Add(new AuditDataReportColumnValue(value, asset.Name, asset.AssetID, asset.Location));
                }
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// Expand the Children for an ASSET DETAILS based field
        /// </summary>
        /// <param name="field"></param>
        /// <param name="returnDictionary"></param>
        protected void ExpandApplicationFieldChildren(string field)
        {
            // Split the field into its parts again
            List <string> listParts = Utility.ListFromString(field, '|', true);

            // If we have not already done so populate the cached list of Applications
            if (_cachedApplicationsList == null)
            {
                _cachedApplicationsList = new ApplicationPublisherList(_publisherFilter, _showIncluded, _showIgnored);
            }

            // OK - the string is formatted as Applications | Publisher | Application
            // Therefore we know if we have 1 part include all applications, 2 parts then this is a Publisher
            // 3 parts it is an application
            if (listParts.Count == 1)
            {
                // get a list of ALL Publishers and applications first
                AddApplications(_cachedApplicationsList);
            }

            else if (listParts.Count == 2)
            {
                string publisher = listParts[1];
                ApplicationPublisher     thisPublisher  = _cachedApplicationsList.FindPublisher(publisher);
                ApplicationPublisherList listPublishers = new ApplicationPublisherList();
                listPublishers.Add(thisPublisher);
                AddApplications(listPublishers);
            }

            else
            {
                this.Add(new AuditDataReportColumn(AuditDataReportColumn.eFieldType.applications, field, GetLabelForField(field)));
            }
        }
示例#3
0
 public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, DeploymentParameters baseParameters)
 {
     return(new IISDeploymentParameters(baseParameters)
     {
         ApplicationPublisher = publisher,
         PublishApplicationBeforeDeployment = true
     });
 }
 public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, DeploymentParameters baseParameters, bool publish = false)
 {
     return(new IISDeploymentParameters(baseParameters)
     {
         ApplicationPublisher = publisher,
         ApplicationPath = publisher.ApplicationPath,
         PublishApplicationBeforeDeployment = publish
     });
 }
 public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, HostingModel hostingModel = HostingModel.InProcess, bool publish = false)
 {
     return(GetBaseDeploymentParameters(
                publisher,
                new DeploymentParameters(publisher.ApplicationPath, DeployerSelector.ServerType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
     {
         HostingModel = hostingModel
     },
                publish));
 }
 public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, DeploymentParameters baseParameters, bool publish = false)
 {
     return(new IISDeploymentParameters(baseParameters)
     {
         ApplicationPublisher = publisher,
         ApplicationPath = publisher.ApplicationPath,
         TargetFramework = Tfm.NetCoreApp22,
         ApplicationType = ApplicationType.Portable,
         AncmVersion = AncmVersion.AspNetCoreModuleV2,
         PublishApplicationBeforeDeployment = publish,
     });
 }
 public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, HostingModel hostingModel = HostingModel.InProcess, bool publish = false)
 {
     return(GetBaseDeploymentParameters(
                publisher,
                new DeploymentParameters(publisher.ApplicationPath, DeployerSelector.ServerType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
     {
         HostingModel = hostingModel,
         TargetFramework = "netcoreapp2.2",
         AncmVersion = AncmVersion.AspNetCoreModuleV2
     },
                publish));
 }
 public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, HostingModel hostingModel = HostingModel.InProcess)
 {
     return(GetBaseDeploymentParameters(
                publisher,
                new DeploymentParameters()
     {
         ServerType = DeployerSelector.ServerType,
         RuntimeFlavor = RuntimeFlavor.CoreClr,
         RuntimeArchitecture = RuntimeArchitecture.x64,
         HostingModel = hostingModel,
         TargetFramework = Tfm.Default
     }));
 }
示例#9
0
        private async Task PublishAgent()
        {
            var binPath = Path.Combine(Context.ContentDirectory, "Photon.Agent", "bin", "Release");

            var publisher = new ApplicationPublisher(Context)
            {
                VersionUrl       = NetPath.Combine(apiUrl, "agent/version"),
                UploadPath       = NetPath.Combine(ftpUrl, "agent"),
                AssemblyFilename = Path.Combine(binPath, "PhotonAgent.exe"),
                MsiFilename      = Path.Combine(Context.ContentDirectory, "Installers", "Photon.Agent.Installer", "bin", "Release", "Photon.Agent.Installer.msi"),
                BinPath          = binPath,
                PackagePath      = nugetPackageDir,
                FtpUsername      = ftpUser,
                FtpPassword      = ftpPass,
            };

            await publisher.PublishAsync("Photon Agent", "Photon.Agent");
        }
        /// <summary>
        /// Called after we select a different node in the Explorer Tree
        /// This function deals with the firing of the appropriate event to inform interested parties
        /// of the change in selection so that they may update themselves accordingly.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void applicationTree_AfterSelect(object sender, SelectEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (e.NewSelections.Count > 0)
            {
                UltraTreeNode node = e.NewSelections[0];

                // check if the 'All Publishers' node is selected and fire the PublisherSelectedChanged event
                // to inform other interested parties
                if (node.Key == MiscStrings.AllPublishers)
                {
                    List <ApplicationPublisher> allPublishers = new List <ApplicationPublisher>();
                    //allPublishers.Add(_presenter.FindPublisher(node.Key));

                    ApplicationPublisher thePublisher = new ApplicationPublisher(node.Key, 0);
                    //thePublisher.Populate(true, false);
                    allPublishers.Add(thePublisher);

                    if (PublisherSelectionChanged != null)
                    {
                        PublisherSelectionChanged(this, new PublishersEventArgs(allPublishers));
                    }
                }

                // If we have clicked on the Operating systems node and fire the OperatingSystemSelecyionChanged
                // event to inform other interested parties
                else if (node.Key == MiscStrings.OperatingSystems)
                {
                    List <InstalledOS> allPublishers = new List <InstalledOS>();
                    allPublishers.Add(null);

                    if (OperatingSystemSelectionChanged != null)
                    {
                        OperatingSystemSelectionChanged(this, new OperatingSystemEventArgs(allPublishers));
                    }
                }

                // If we have clicked on the Actions node and fire the ActionsSelectionChanged
                // event to inform other interestted parties
                else if (node.Key == MiscStrings.Actions)
                {
                    if (ActionsSelectionChanged != null)
                    {
                        ActionsSelectionChanged(this, new ActionsEventArgs());
                    }
                }

                // If the parent is the 'All Publishers' node, then we have selected a publisher in the tree
                // - populate the list of publishers in the tree and fire the PublisherSelectionChanged
                // event.
                else if (node.Parent == AllPublishersNode)
                {
                    // fire PublisherSelectionChanged event
                    List <ApplicationPublisher> allPublishers = new List <ApplicationPublisher>();
                    foreach (UltraTreeNode publisherNode in e.NewSelections)
                    {
                        ApplicationPublisher thePublisher = new ApplicationPublisher(publisherNode.Key, 0);
                        //thePublisher.Populate(true, false);
                        allPublishers.Add(thePublisher);
                    }

                    if (PublisherSelectionChanged != null)
                    {
                        PublisherSelectionChanged(this, new PublishersEventArgs(allPublishers));
                    }
                }

                // If the parent is the 'All Operating Systems' node, then we have selected an OS in the tree
                // Fire the OperatingSystemSelectionChanged event passing the selected OS.
                else if (node.Parent == AllOperatingSystemsNode)
                {
                    List <InstalledOS> listOSs = new List <InstalledOS>();
                    foreach (UltraTreeNode osNode in e.NewSelections)
                    {
                        InstalledOS thisOS = osNode.Tag as InstalledOS;
                        thisOS.LoadData();
                        listOSs.Add(thisOS);
                    }

                    if (OperatingSystemSelectionChanged != null)
                    {
                        OperatingSystemSelectionChanged(this, new OperatingSystemEventArgs(listOSs));
                    }

                    //UltraTreeNode OSNode = e.NewSelections[0] as UltraTreeNode;
                    //InstalledOS thisOS = OSNode.Tag as InstalledOS;
                    //if (OperatingSystemSelectionChanged != null)
                    //    OperatingSystemSelectionChanged(this, new OperatingSystemEventArgs(thisOS));
                }


                // Applications have a parent of publisher and grand-parent of the root node
                // So if our grand parent is the root node we know that we are an application
                else if (node.Parent.Parent == AllPublishersNode)
                {
                    List <InstalledApplication> listApplications = new List <InstalledApplication>();
                    foreach (UltraTreeNode applicationNode in e.NewSelections)
                    {
                        InstalledApplication thisApplication = applicationNode.Tag as InstalledApplication;
                        thisApplication.LoadData();
                        listApplications.Add(thisApplication);
                    }

                    // fire ApplicationSelectionChanged event
                    if (ApplicationSelectionChanged != null)
                    {
                        ApplicationSelectionChanged(this, new ApplicationsEventArgs(listApplications));
                    }
                }

                // OK we must be right at the bottom of the heirarchy displaying application/OS instances
                // and licenses nodes - determine which by checking the last entry in the key
                // If we have selected the 'licenses' node beneath an application/OS then we fire the
                // 'ApplicationLicenseSelectionChanged' event
                else if (node.Key.EndsWith(MiscStrings.ApplicationLicenseNode))
                {
                    Object nodeTag = node.Tag;

                    // fire ApplicationLicenseSelectionChanged event
                    if (ApplicationLicenseSelectionChanged != null)
                    {
                        ApplicationLicenseSelectionChanged(this, new ApplicationLicenseEventArgs(nodeTag));
                    }
                }

                else if (node.Key.EndsWith(MiscStrings.ApplicationInstanceNode))
                {
                    Object nodeTag = node.Tag;

                    // fire ApplicationLicenseSelectionChanged event
                    if (ApplicationInstallsSelectionChanged != null)
                    {
                        ApplicationInstallsSelectionChanged(this, new ApplicationInstallsEventArgs(nodeTag));
                    }
                }
            }

            Cursor.Current = Cursors.Default;
        }