当前位置: 首页>>代码示例>>C#>>正文


C# Request.Debug方法代码示例

本文整理汇总了C#中Request.Debug方法的典型用法代码示例。如果您正苦于以下问题:C# Request.Debug方法的具体用法?C# Request.Debug怎么用?C# Request.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


在下文中一共展示了Request.Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeProvider

 /// <summary>
 ///     Performs one-time initialization of the PROVIDER.
 /// </summary>
 /// <param name="request">
 ///     An object passed in from the CORE that contains functions that can be used to interact with
 ///     the CORE and HOST
 /// </param>
 public void InitializeProvider(Request request) {
     if( request == null ) {
         throw new ArgumentNullException("request");
     }
     // Nice-to-have put a debug message in that tells what's going on.
     request.Debug("Calling '{0}::InitializeProvider'", ProviderName);
 }
开发者ID:vairam-svs,项目名称:oneget,代码行数:14,代码来源:MsiProvider.cs

示例2: FindPackageByFile

        /// <summary>
        ///     Finds packages given a locally-accessible filename
        ///     Package information must be returned using <c>request.YieldPackage(...)</c> function.
        /// </summary>
        /// <param name="file">the full path to the file to determine if it is a package</param>
        /// <param name="id">
        ///     if this is greater than zero (and the number should have been generated using <c>StartFind(...)</c>,
        ///     the core is calling this multiple times to do a batch search request. The operation can be delayed until
        ///     <c>CompleteFind(...)</c> is called
        /// </param>
        /// <param name="request">
        ///     An object passed in from the CORE that contains functions that can be used to interact with
        ///     the CORE and HOST
        /// </param>
        public void FindPackageByFile(string file, int id, Request request)
        {
            if( request == null ) {
                throw new ArgumentNullException("request");
            }
            if( string.IsNullOrWhiteSpace(file) ) {
                throw new ArgumentNullException("file");
            }

            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::FindPackageByFile' '{1}','{2}'", ProviderName, file, id);

            if (!file.FileExists()) {
                request.Error(ErrorCategory.ObjectNotFound, file, Constants.Messages.UnableToResolvePackage, file);
                return;
            }
            try {
                var package = new InstallPackage(file, DatabaseOpenMode.ReadOnly);
                YieldPackage(package, file, request);
                package.Close();
            } catch (Exception e) {
                e.Dump();
                // any exception at this point really just means that
                request.Error(ErrorCategory.OpenError, file, Constants.Messages.UnableToResolvePackage, file);
            }
        }
开发者ID:notgerry,项目名称:oneget,代码行数:40,代码来源:MsiProvider.cs

示例3: GetDynamicOptions

        /// <summary>
        ///     Returns dynamic option definitions to the HOST
        /// </summary>
        /// <param name="category">The category of dynamic options that the HOST is interested in</param>
        /// <param name="request">
        ///     An object passed in from the CORE that contains functions that can be used to interact with
        ///     the CORE and HOST
        /// </param>
        public void GetDynamicOptions(string category, Request request)
        {
            if( request == null ) {
                throw new ArgumentNullException("request");
            }

            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::GetDynamicOptions' '{1}'", ProviderName, category);

            switch ((category ?? string.Empty).ToLowerInvariant()) {
                case "install":
                    // options required for install/uninstall/getinstalledpackages
                    request.YieldDynamicOption("IncludeWindowsInstaller", "Switch", false);
                    request.YieldDynamicOption("IncludeSystemComponent", "Switch", false);
                    break;

                case "provider":
                    // options used with this provider. Not currently used.
                    break;

                case "source":
                    // options for package sources
                    break;

                case "package":
                    // options used when searching for packages
                    break;
            }
        }
开发者ID:notgerry,项目名称:oneget,代码行数:37,代码来源:ProgramsProvider.cs

示例4: GetFeatures

        /// <summary>
        ///     Returns a collection of strings to the client advertizing features this provider supports.
        /// </summary>
        /// <param name="request">
        ///     An object passed in from the CORE that contains functions that can be used to interact with
        ///     the CORE and HOST
        /// </param>
        public void GetFeatures(Request request) {
            if( request == null ) {
                throw new ArgumentNullException("request");
            }
            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::GetFeatures' ", ProviderName);

            foreach (var feature in _features) {
                request.Yield(feature);
            }
        }
开发者ID:vairam-svs,项目名称:oneget,代码行数:18,代码来源:MsiProvider.cs

示例5: FindPackageByFile

        /// <summary>
        ///     Finds packages given a locally-accessible filename
        ///     Package information must be returned using <c>request.YieldPackage(...)</c> function.
        /// </summary>
        /// <param name="file">the full path to the file to determine if it is a package</param>
        /// <param name="id">
        ///     if this is greater than zero (and the number should have been generated using <c>StartFind(...)</c>,
        ///     the core is calling this multiple times to do a batch search request. The operation can be delayed until
        ///     <c>CompleteFind(...)</c> is called
        /// </param>
        /// <param name="request">
        ///     An object passed in from the CORE that contains functions that can be used to interact with
        ///     the CORE and HOST
        /// </param>
        public void FindPackageByFile(string file, int id, Request request)
        {
            if( request == null ) {
                throw new ArgumentNullException("request");
            }
            if( string.IsNullOrWhiteSpace(file) ) {
                throw new ArgumentNullException("file");
            }

            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::FindPackageByFile' '{1}','{2}'", ProviderName, file, id);

            if (file.FileExists())
            {
                var info = new CabInfo(file);

                request.YieldSoftwareIdentity(file, info.Name, null, null, null, null, null, file, info.Name);

                var files = info.GetFiles();
                foreach (var i in files) {
                    // read the properties file
                    if (i.FullNameExtension == ".txt")
                    {
                        request.Debug("Reading properties file {0}", i.FullName);
                        using (var reader = i.OpenText())
                        {
                            var contents = reader.ReadToEnd();
                            Dictionary<string, string> keyValuePairs = contents.Split('\n').Select(line => line.Split('=')).Where(v => v.Count() == 2).ToDictionary(pair => pair[0], pair => pair[1]);

                            foreach (var pair in keyValuePairs)
                            {
                                request.AddMetadata(pair.Key.Replace(' ', '_'), pair.Value.Replace("\"", "").Replace("\r", ""));
                            }
                        }
                    }
                }
            }
        }
开发者ID:notgerry,项目名称:oneget,代码行数:52,代码来源:MsuProvider.cs

示例6: UninstallPackage

        /// <summary>
        /// Uninstalls a package 
        /// </summary>
        /// <param name="fastPackageReference"></param>
        /// <param name="request">An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST</param>
        public void UninstallPackage(string fastPackageReference, Request request)
        {
            // TODO: improve this debug message that tells us what's going on (what about the dynamic parameters)
            var parts = fastPackageReference.Split(RequestHelper.NullChar);
            request.Debug("Entering '{0}::UninstallPackage' '{1}'", PackageProviderName, [email protected]("' '"));

            // TODO: add dynamic parameters for AllVersions and ForceDependencies
            foreach (var package in _chocolatey.Set(conf =>
            {
                conf.CommandName = "Uninstall";
                //conf.Sources = parts[0];
                conf.PackageNames = parts[1];
                conf.Version = parts[2];
            }).List<PackageResult>())
            {
                request.YieldSoftwareIdentity(package);
            }
        }
开发者ID:eeevans,项目名称:ChocolateyProvider,代码行数:23,代码来源:ChocolateyPackageProvider.cs

示例7: RemovePackageSource

        /// <summary>
        /// Removes/Unregisters a package source
        /// </summary>
        /// <param name="name">The name or location of a package source to remove.</param>
        /// <param name="request">An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST</param>
        public void RemovePackageSource(string name, Request request)
        {
            request.Debug("Entering {0} source remove -n={1})", PackageProviderName, name);

            _chocolatey.Set(conf =>
            {
                conf.CommandName = "Source";
                conf.SourceCommand.Command = SourceCommandType.remove;
                conf.SourceCommand.Name = name;
                conf.AllowUnofficialBuild = true;
            }).Run();
            // TODO: support user-defined package sources OR remove this method
        }
开发者ID:eeevans,项目名称:ChocolateyProvider,代码行数:18,代码来源:ChocolateyPackageProvider.cs

示例8: InitializeProvider

 /// <summary>
 /// Performs one-time initialization of the $provider.
 /// </summary>
 /// <param name="request">An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST</param>
 public void InitializeProvider(Request request)
 {
     request.Debug("Entering '{0}::InitializeProvider' to set up a chocolatey with custom logging", PackageProviderName);
     _chocolatey = Lets.GetChocolatey().SetCustomLogging(new RequestLogger(request));
 }
开发者ID:eeevans,项目名称:ChocolateyProvider,代码行数:9,代码来源:ChocolateyPackageProvider.cs

示例9: GetFeatures

        /// <summary>
        /// Returns a collection of strings to the client advertizing features this provider supports.
        /// </summary>
        /// <param name="request">An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST</param>
        public void GetFeatures(Request request)
        {
            request.Debug("Entering '{0}::GetFeatures' ", PackageProviderName);

            foreach (var feature in Features)
            {
                request.Yield(feature);
            }
        }
开发者ID:eeevans,项目名称:ChocolateyProvider,代码行数:13,代码来源:ChocolateyPackageProvider.cs

示例10: FindPackage

        /// <summary>
        /// Searches package sources given name and version information 
        /// 
        /// Package information must be returned using <c>request.YieldPackage(...)</c> function.
        /// </summary>
        /// <param name="name">a name or partial name of the package(s) requested</param>
        /// <param name="requiredVersion">A specific version of the package. Null or empty if the user did not specify</param>
        /// <param name="minimumVersion">A minimum version of the package. Null or empty if the user did not specify</param>
        /// <param name="maximumVersion">A maximum version of the package. Null or empty if the user did not specify</param>
        /// <param name="id">if this is greater than zero (and the number should have been generated using <c>StartFind(...)</c>, the core is calling this multiple times to do a batch search request. The operation can be delayed until <c>CompleteFind(...)</c> is called</param>
        /// <param name="request">An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST</param>
        public void FindPackage(string name, string requiredVersion, string minimumVersion, string maximumVersion, int id, Request request)
        {
            request.Debug("Entering '{0}::FindPackage' '{1}','{2}','{3}','{4}', '{5}'", PackageProviderName, name, requiredVersion, minimumVersion, maximumVersion, id);
            request.Debug("FindPackage:: " + [email protected]("|"));
            var versions = ParseVersion(requiredVersion, minimumVersion, maximumVersion);

            var sources = GetSource(request.PackageSources.ToArray());
            // TODO: need to support URLs for sources ...
            foreach(var package in _chocolatey.Set(conf =>
                {
                    conf.CommandName = "List";
                    conf.Input = name;
                    conf.Sources = sources.Select(cs => cs.Value)[email protected](";");
                    conf.Version = requiredVersion;
                    conf.AllowUnofficialBuild = true;
                }).List<PackageResult>())
            {
                SemanticVersion actual;
                if (SemanticVersion.TryParse(package.Version, out actual) && (actual < versions.Item1 || actual > versions.Item2))
                {
                    continue;
                }
                request.YieldSoftwareIdentity(package);
            }
        }
开发者ID:eeevans,项目名称:ChocolateyProvider,代码行数:36,代码来源:ChocolateyPackageProvider.cs

示例11: StartFind

        public int StartFind(Request request)
        {
            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::StartFind'", PackageProviderName);

            return default(int);
        }
开发者ID:notgerry,项目名称:oneget,代码行数:7,代码来源:Happy1.cs

示例12: DownloadPackage

 public void DownloadPackage(string fastPackageReference, string location, Request request)
 {
     // Nice-to-have put a debug message in that tells what's going on.
     request.Debug("Calling '{0}::DownloadPackage' '{1}','{2}'", PackageProviderName, fastPackageReference, location);
 }
开发者ID:notgerry,项目名称:oneget,代码行数:5,代码来源:Happy1.cs

示例13: CompleteFind

 public void CompleteFind(int id, Request request)
 {
     // Nice-to-have put a debug message in that tells what's going on.
     request.Debug("Calling '{0}::CompleteFind' '{1}'", PackageProviderName, id);
 }
开发者ID:notgerry,项目名称:oneget,代码行数:5,代码来源:Happy1.cs

示例14: AddPackageSource

        public void AddPackageSource(string name, string location, bool trusted, Request request)
        {
            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::AddPackageSource' '{1}','{2}','{3}'", PackageProviderName, name, location, trusted);

            var pkgSource = packageSources.FirstOrDefault(each => each.name.EqualsIgnoreCase(name));
            if (pkgSource != null && !request.GetOptionValue(Constants.Parameters.IsUpdate).IsTrue()) {
                // pkgSource already exists.
                // this is an error.
                request.Error(ErrorCategory.ResourceExists, name, Constants.Messages.PackageSourceExists, name);
                return;
            }

            if (pkgSource != null) {
                //update
                pkgSource.location = location;
                pkgSource.isTrusted = trusted;
            } else {
                // add new
                pkgSource = new PkgSource {
                    name = name,
                    location = location,
                    isTrusted = trusted,
                    isValidated = true
                };
                // add to the array.
                packageSources = packageSources.ConcatSingleItem(pkgSource).ToArray();
            }

            request.YieldPackageSource(pkgSource.name, pkgSource.location, pkgSource.isTrusted, true, pkgSource.isValidated);
        }
开发者ID:notgerry,项目名称:oneget,代码行数:31,代码来源:Happy1.cs

示例15: UninstallPackage

        /// <summary>
        ///     Uninstalls a package
        /// </summary>
        /// <param name="fastPackageReference"></param>
        /// <param name="request">
        ///     An object passed in from the CORE that contains functions that can be used to interact with
        ///     the CORE and HOST
        /// </param>
        public void UninstallPackage(string fastPackageReference, Request request) {
            if( request == null ) {
                throw new ArgumentNullException("request");
            }
            if( string.IsNullOrWhiteSpace(fastPackageReference) ) {
                throw new ArgumentNullException("fastPackageReference");
            }
            // Nice-to-have put a debug message in that tells what's going on.
            request.Debug("Calling '{0}::UninstallPackage' '{1}'", ProviderName, fastPackageReference);

            try {
                Guid guid;
                if (!Guid.TryParse(fastPackageReference, out guid)) {
                    request.Error(ErrorCategory.InvalidArgument, fastPackageReference, Constants.Messages.UnableToResolvePackage, fastPackageReference);
                    return;
                }
                var product = ProductInstallation.GetProducts(fastPackageReference, null, UserContexts.All).FirstOrDefault();
                if (product == null) {
                    request.Error(ErrorCategory.InvalidArgument, fastPackageReference, Constants.Messages.UnableToResolvePackage, fastPackageReference);
                    return;
                }
                var productVersion = product.ProductVersion.ToString();
                var productName = product.ProductName;
                var summary = product["Summary"];

                Installer.SetInternalUI(InstallUIOptions.UacOnly | InstallUIOptions.Silent);
                _progressId = request.StartProgress(0, "Uninstalling MSI '{0}'", productName);
                var handler = CreateProgressHandler(request);

                Installer.SetExternalUI(handler, InstallLogModes.Progress | InstallLogModes.Info);
                Installer.InstallProduct(product.LocalPackage, "REMOVE=ALL REBOOT=REALLYSUPPRESS");
                Installer.SetInternalUI(InstallUIOptions.Default);

                Installer.SetExternalUI(handler, InstallLogModes.None);

                // YieldPackage(product,fastPackageReference, request);
                if (request.YieldSoftwareIdentity(fastPackageReference, productName, productVersion, "multipartnumeric", summary, "", fastPackageReference, "", "") != null) {
                    request.AddMetadata(fastPackageReference, "ProductCode", fastPackageReference);
                }

                request.Warning("Reboot is required to complete uninstallation.");
            } catch (Exception e) {
                e.Dump();
            }
            request.CompleteProgress(_progressId, true);
            _progressId = 0;
        }
开发者ID:vairam-svs,项目名称:oneget,代码行数:55,代码来源:MsiProvider.cs


注:本文中的Request.Debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。