示例#1
0
 public CredProviderManager()
 {
     CpInfo = new Settings();
 }
示例#2
0
文件: Program.cs 项目: hellyhe/pgina
        public static Settings ParseClArgs(string[] args, Settings settings)
        {
            int nArgs = args.Count();

            // Process options
            int idx = 0;
            while (idx < nArgs)
            {
                // Long form args
                if (args[idx].StartsWith("--"))
                {
                    string opt = args[idx++].Substring(2);
                    string value = null;
                    if (idx < nArgs)
                    {
                        value = args[idx++];
                    }

                    switch (opt)
                    {
                        case "guid":
                            settings.ProviderGuid = new Guid(value);
                            break;
                        case "path":
                            settings.Path = value;
                            break;
                        case "mode":
                            {
                                switch (value)
                                {
                                    case "install":
                                        settings.OpMode = OperationMode.INSTALL;
                                        break;
                                    case "uninstall":
                                        settings.OpMode = OperationMode.UNINSTALL;
                                        break;
                                    case "enable":
                                        settings.OpMode = OperationMode.ENABLE;
                                        break;
                                    case "disable":
                                        settings.OpMode = OperationMode.DISABLE;
                                        break;
                                }
                            }
                            break;
                        case "dll":
                            settings.ShortName = value;
                            break;
                        default:
                            throw new Exception("Unknown option: " + opt);
                    }
                }
                // Short form arguments
                else if (args[idx].StartsWith("-"))
                {
                    string opt = args[idx++].Substring(1);
                    switch (opt)
                    {
                        case "h":
                        case "?":
                            throw new Exception("pGina Registration App Help");
                        default:
                            throw new Exception("Unknown option: " + opt);
                    }
                }
                else
                {
                    break;
                }
            }

            return settings;
        }