Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Processes a URL or command-line argument represented by the given name and value pair.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        /// ------------------------------------------------------------------------------------
        private void ProcessArg(string name, string value)
        {
            Debug.Assert(value != null || name == kHelp);
            switch (name)
            {
            case kProject:
            case kProjectUri: m_database = value; break;

            case "c":                     // For historical purposes (even though it will probably never work)
            case kServer:
            case kServerUri: m_server = value; break;

            case kApp: SetAppNameAndAbbrev(value); break;

            case kDbType: m_dbType = value; break;

            case kLocale: m_locale = value; break;

            case kHelp: ShowHelp = true; break;

            case kChooseProject: m_chooseProjectFile = value; break;

            case kFlexConfigFile: m_configFile = value; break;

            case kRestoreFile: m_backupFile = value; break;

            case kRestoreOptions: m_restoreOptions = value; break;

            case kNoUserInterface: NoUserInterface = true; break;

            case kAppServerMode: AppServerMode = true; break;

            case kTag: m_tag = value; break;

            case kTool: m_toolName = value; break;

            case kGuid:
                if (value != "null")
                {
                    TargetGuid = new Guid(value);
                }
                break;

            default:
                PropertyTableEntries.Add(new Property(name, Decode(value)));
                break;
            }
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:FwLinkArgs"/> class.
        /// </summary>
        /// <param name="url">a URL string like that produced by ToString().</param>
        /// ------------------------------------------------------------------------------------
        public FwLinkArgs(string url)
        {
            if (!url.StartsWith(kFwUrlPrefix))
            {
                throw new ArgumentException(String.Format("unrecognized FwLinkArgs URL string: {0}", url));
            }
            string query = HttpUtility.UrlDecode(url.Substring(23));

            string[] rgsProps = query.Split('&');
            foreach (string prop in rgsProps)
            {
                string[] propPair = prop.Split('=');
                if (propPair.Length != 2)
                {
                    throw new ArgumentException(String.Format("invalid FwLinkArgs URL string: {0}", url));
                }
                switch (propPair[0])
                {
                case kTool:
                    m_toolName = propPair[1];
                    break;

                case kGuid:
                    TargetGuid = new Guid(propPair[1]);
                    break;

                case kTag:
                    m_tag = propPair[1];
                    break;

                default:
                    PropertyTableEntries.Add(new Property(propPair[0], propPair[1]));
                    break;
                }
            }
            if (String.IsNullOrEmpty(m_toolName) || TargetGuid == Guid.Empty || m_tag == null)
            {
                throw new ArgumentException(String.Format("invalid FwLinkArgs URL string: {0}", url));
            }
        }
Exemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Processes a URL or command-line argument represented by the given name and value pair.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        /// ------------------------------------------------------------------------------------
        private void ProcessArg(string name, string value)
        {
            Debug.Assert(value != null || name == kHelp);
            switch (name)
            {
            case kProject:
            case kProjectUri: m_database = value; break;

            case kLocale: m_locale = value; break;

            case kHelp: ShowHelp = true; break;

            case kChooseProject: m_chooseProjectFile = value; break;

            case kFlexConfigFile: m_configFile = value; break;

            case kRestoreFile: m_backupFile = value; break;

            case kRestoreOptions: m_restoreOptions = value; break;

            case kNoUserInterface: NoUserInterface = true; break;

            case kAppServerMode: AppServerMode = true; break;

            case kTag: m_tag = value; break;

            case kTool: m_toolName = value; break;

            case kGuid:
                if (value != "null")
                {
                    TargetGuid = new Guid(value);
                }
                break;

            default:
                PropertyTableEntries.Add(new Property(name, Decode(value)));
                break;
            }
        }
Exemplo n.º 4
0
 public void AddProperty(string name, string val)
 {
     PropertyTableEntries.Add(new Property {
         Name = name, Value = val
     });
 }