Пример #1
0
        /// <summary>
        /// Parses a stringified entry point into an EntryPoint instance that can be queried
        /// </summary>
        /// <param name="uri"></param>
        /// <returns></returns>
        public static EntryPoint Parse(String uri)
        {
            var ep = new EntryPoint("");

            if (uri.Contains("?")) {
                ep._name = uri.Substring(0, uri.IndexOf("?"));
                string[] parambits = uri.Substring(uri.IndexOf("?") + 1).Split('&');
                foreach (String param in parambits) {
                    if (param.Contains("=")) {
                        string key = param.Substring(0, param.IndexOf("="));
                        string value = param.Substring(param.IndexOf("=") + 1);
                        var kvp = new KeyValuePair<string, string>(key, value);
                        ep._parameters.Add(kvp);
                    } else {
                        var kvp = new KeyValuePair<string, string>(param, param);
                        ep._parameters.Add(kvp);
                    }
                }
            } else {
                ep._name = uri;
            }

            return ep;
        }
Пример #2
0
 protected override void ReadEntryPoint(EntryPoint ep)
 {
     _options = new BVPImportOptions();
     _options.Filename = ep["Filename"];
 }
Пример #3
0
 protected override void WriteEntryPoint(EntryPoint ep)
 {
     ep.AddParameter("Filename", _options.Filename);
 }
Пример #4
0
 public string CreateProfileString()
 {
     var ep = new EntryPoint("ImportProfile");
     WriteEntryPoint(ep);
     return ep.ToString();
 }
Пример #5
0
 protected abstract void WriteEntryPoint(EntryPoint ep);
Пример #6
0
 protected abstract void ReadEntryPoint(EntryPoint ep);
Пример #7
0
 protected override void WriteEntryPoint(EntryPoint ep)
 {
     ep.AddParameter("Filename", _options.Filename);
     ep.AddParameter("FirstRowHeaders", _options.FirstRowContainsNames.ToString());
     ep.AddParameter("Delimiter", HttpUtility.HtmlEncode(_options.Delimiter));
 }
Пример #8
0
 protected override void ReadEntryPoint(EntryPoint ep)
 {
     _options = new CSVImporterOptions();
     _options.Filename = ep["Filename"];
     _options.FirstRowContainsNames = Boolean.Parse(ep["FirstRowHeaders", "true"]);
     _options.Delimiter = HttpUtility.HtmlDecode(ep["Delimiter"]);
 }