コード例 #1
0
ファイル: Expander.cs プロジェクト: bschau/Portfolio
        Dictionary <string, string> ExpandTokens(Dictionary <string, string> tokens)
        {
            var result = new Dictionary <string, string>();

            foreach (var token in tokens)
            {
                var key = token.Key;
                key = key.Substring(2, key.Length - 4);

                if (key[0] == '$')
                {
                    result[token.Key] = _getVariable.Execute(key.Substring(1).ToLower());
                }
                else if ("now".Equals(key, StringComparison.CurrentCultureIgnoreCase))
                {
                    result[token.Key] = _getVariable.Execute("now");
                }
                else if (key.StartsWith("now:", StringComparison.CurrentCultureIgnoreCase))
                {
                    result[token.Key] = _dateExpander.Execute(key.Substring(4));
                }
                else if (key.StartsWith("file:", StringComparison.CurrentCultureIgnoreCase))
                {
                    result[token.Key] = ExpandFile(key.Substring(5));
                }
                else if (key.StartsWith("base64:", StringComparison.CurrentCultureIgnoreCase))
                {
                    result[token.Key] = ExpandBase64(key.Substring(7));
                }
                else
                {
                    throw new ArgumentException(string.Format("Unknown token: {0}", token.Key));
                }
            }

            return(result);
        }
コード例 #2
0
ファイル: HttpApiBase.cs プロジェクト: bschau/Portfolio
        string GetEndpoint(string request)
        {
            var endpoint = _getVariable.Execute("endpoint");

            return(string.Format("{0}/{1}", endpoint, request));
        }