コード例 #1
0
        IDictionary<String, String> parseContent(String content)
        {
            using (Stream data = GenerateStreamFromString(content))
            {

                if (content.StartsWith("multipart/form-data"))
                {
                    HttpMultipartParser parser = new HttpMultipartParser(data, "image");
                    if (parser.Success)
                    {
                        return parser.Parameters;
                    }
                    else
                    {
                        return new Dictionary<String, String>();
                    }
                }
                else
                {
                    HttpContentParser parser = new HttpContentParser(data);
                    if (parser.Success)
                    {
                        return parser.Parameters;
                    }
                    else
                    {
                        return new Dictionary<String, String>();
                    }
                }
            }
        }
コード例 #2
0
ファイル: Server.cs プロジェクト: johniak/FeintFramework
        IDictionary<String, String> parseContent(String content)
        {
            using (Stream data = GenerateStreamFromString(content))
            {

                if (content.StartsWith("multipart/form-data"))
                {
                    HttpMultipartParser parser = new HttpMultipartParser(data, "image");
                    if (parser.Success)
                    {
                        return parser.Parameters;
                    }
                    else
                    {
                        return new Dictionary<String, String>();
                    }
                }
                else
                {
                    HttpContentParser parser = new HttpContentParser(data);
                    if (parser.Success)
                    {
                        Dictionary<string, string> decodedParameters = new Dictionary<string, string>();
                        foreach (var p in parser.Parameters)
                        {
                            decodedParameters.Add(p.Key,HttpUtility.UrlDecode(p.Value));
                        }
                        return decodedParameters;
                    }
                    else
                    {
                        return new Dictionary<String, String>();
                    }
                }
            }
        }