当前位置: 首页>>代码示例>>C#>>正文


C# ResourceManager.GetTypeMap方法代码示例

本文整理汇总了C#中ResourceManager.GetTypeMap方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceManager.GetTypeMap方法的具体用法?C# ResourceManager.GetTypeMap怎么用?C# ResourceManager.GetTypeMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ResourceManager的用法示例。


在下文中一共展示了ResourceManager.GetTypeMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: processClientCode

        private void processClientCode(NameValueCollection queryString, HttpContext context)
        {
            IProxyGenerator generator = null;
            ResourceManager resMan = new ResourceManager();
            string platform = queryString["platform"];
            if (string.IsNullOrEmpty(platform))
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("No Platform is Specified");
                return;
            }
            platform = platform.ToLower();
            if (platform == "csharp")
            {
                TypeMap tm = resMan.GetTypeMap("dotnet-csharp.typemap");
                generator = new CSharpGenerator(tm);
            }
            else if (platform == "java")
            {
                TypeMap tm = resMan.GetTypeMap("dotnet-java.typemap");
                generator = new JavaGenerator(tm);
            }
            else if (platform == "js-angularjs")
            {
                generator = new AngularGenerator();
            }
            else if (platform == "js-dojo")
            {
                generator = new JavaScriptGenerator();
            }
            else if (platform == "js-dojo-amd")
            {
                generator = new JavaScriptDojoAMDGenerator();
            }
            else if (platform == "flex")
            {
                generator = new FlexGenerator();
            }
            else if (platform == "objc")
            {
                TypeMap tm = resMan.GetTypeMap("dotnet-objc.typemap");
                generator = new ObjectiveCGenerator(tm);
            }

            if (generator == null)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("Unknown Platform");
                return;
            }

            string format = queryString["format"];
            format = format == null ? "zip" : format.ToLower();


            Service svc = createService();
            IDictionary<string, string> files = generator.Generate(svc);

            if (format == "zip")
            {
                byte[] buffer = ZipExporter.Export(files);
                MemoryStream ms = new MemoryStream(buffer);
                //context.Response.ContentType = "application/zip";
                context.Response.ContentType = "application/octet-stream";
                string fileName = string.Format("{0}_{1}.zip", svc.Name, platform);
                context.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
                ms.CopyTo(context.Response.OutputStream);
                context.Response.OutputStream.Close();
            }
            else if (format == "json")
            {
                string s = JsonConvert.SerializeObject(files);
                context.Response.ContentType = "text/json";
                context.Response.Write(s);
            }
            else if (format == "xml")
            {

            }
            
        }
开发者ID:kumait,项目名称:HXF.net,代码行数:81,代码来源:HxfHandler.cs


注:本文中的ResourceManager.GetTypeMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。