• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CodeType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CodeType的典型用法代码示例。如果您正苦于以下问题:C# CodeType类的具体用法?C# CodeType怎么用?C# CodeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CodeType类属于命名空间,在下文中一共展示了CodeType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CodeExpression

        /// <summary>
        /// Initializes a new instance of the <see cref="CodeExpression"/> class.
        /// </summary>
        /// <param name="codeSpan">The literal code to be contained by this expression.</param>
        /// <param name="codeType">The semantic usage of this expression.</param>
        public CodeExpression(CodeSpan codeSpan, CodeType codeType)
        {
            if (codeSpan == null)
            {
                throw new ArgumentNullException("codeSpan");
            }

            this.codeSpan = codeSpan;
            this.codeType = codeType;
        }
开发者ID:KevinKelley,项目名称:Pegasus,代码行数:15,代码来源:CodeExpression.cs


示例2: btnGenerate_Click

        private void btnGenerate_Click(object sender, EventArgs e)
        {
            lbOutputs.Items.Clear();
            ListItem[] items = new ListItem[clbTables.CheckedItems.Count + clbViews.CheckedItems.Count];
            int itemIndex = 0;
            foreach (object item in clbTables.CheckedItems)
            {
                items[itemIndex] = item as ListItem;
                itemIndex++;
            }
            foreach (object item in clbViews.CheckedItems)
            {
                items[itemIndex] = item as ListItem;
                itemIndex++;
            }
            _SelectedItems = items;

            _CodeType = rbEntities.Checked ? CodeType.Entities : CodeType.DbContext;
            _DbContextName = tbDbContextName.Text;
            _DefaultNamespace = tbDefaultNamespace.Text;
            _OutputPath = tbPath.Text.EndsWith("\\") ? tbPath.Text : tbPath.Text + "\\";
            if (Directory.Exists(_OutputPath) == false)
                Directory.CreateDirectory(_OutputPath);

            Task.Factory.StartNew(StartToGenerate);
        }
开发者ID:RickyLin,项目名称:DotNetUtilities,代码行数:26,代码来源:MainForm.cs


示例3: GenerateCode

        public void GenerateCode(string modelName,
                                 CodeType baseClassType,
                                 Dictionary<string, string> propertiesCollection,
                                 bool overwriteViews = true)
        {
            Project project = Project;

            string modelNamespace = baseClassType == null ? project.Name + ".Models" : baseClassType.Namespace.FullName;

            List<string> properties = propertiesCollection.Keys.ToList<string>();

            List<string> propertyTypes = propertiesCollection.Values.ToList<string>();

            string outputPath = Path.Combine("Models", "MyModel");

            AddProjectItemViaTemplate(outputPath,
                    templateName: "MyModel",
                    templateModel: new Hashtable() 
                    {
                        {"ModelName" , modelName},
                        {"Namespace" , modelNamespace},
                        {"BaseClassTypeName", baseClassType == null ? "" : baseClassType.Name},
                        {"PropertiesCollection",properties},
                        {"PropertiesTypeCollection",propertyTypes}
                    }, overwrite: false);
        }
开发者ID:suhasj,项目名称:MyScaffolder.ModelScaffolder,代码行数:26,代码来源:ModelScaffolder.cs


示例4: PrepareCode

        private string PrepareCode( CodeType codeType, string source )
        {
            if (CommonHelper.IsNullOrEmptyOrBlank(source))
                return null;

            string ret = string.Empty;
            string[] lines = source.Trim().Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string line in lines) {
                string temp = line.Trim();
                if (temp.StartsWith("'"))
                    continue;
                ret += temp + Environment.NewLine;
            }

            switch (codeType) {
            case CodeType.VBasicCodeBlock:

                {
                    break;
                }

            }
            return ret;
        }
开发者ID:Jodan-pz,项目名称:spoolpad,代码行数:25,代码来源:VBasicSimpleExecutableCodeGenerator.cs


示例5: CodeFile

 public CodeFile(CodeType type, string path, byte[] data, bool missingHeader = false)
 {
     Type = type;
     Path = path;
     Data = data;
     MissingHeader = missingHeader;
 }
开发者ID:Reve,项目名称:everadix,代码行数:7,代码来源:CodeFile.cs


示例6: AddStorageContexts

        // Generates all of the Web Forms Pages (Default Insert, Edit, Delete),
        private void AddStorageContexts(
            Project project,
            string selectionRelativePath,
            string dbContextNamespace,
            string dbContextTypeName,
            CodeType modelType,
            bool useMasterPage,
            string masterPage = null,
            bool overwriteViews = true
        )
        {
            if (modelType == null)
            {
                throw new ArgumentNullException("modelType");
            }

            var webForms = new[] { "StorageContext", "StorageContext.KeyHelpers" };

            // Now add each view
            foreach (string webForm in webForms)
            {
                AddStorageContextTemplates(
                    selectionRelativePath: selectionRelativePath,
                    modelType: modelType,
                    dbContextNamespace: dbContextNamespace,
                    dbContextTypeName: dbContextTypeName,
                    webFormsName: webForm,
                    overwrite: overwriteViews);
            }
        }
开发者ID:debbievermaak,项目名称:azure-scaffolder,代码行数:31,代码来源:RazorScaffolder.StorageContext.cs


示例7: IsProductNamespaceImported

        /// <summary>
        /// This function is used to verify if the specified <see cref="CodeType"/> is a valid class and if the class 
        /// contains an import statement for the specified namespace.
        /// </summary>
        /// <param name="codeType">The specified <see cref="CodeType"/>.</param>
        /// <param name="productNamespace">The specified namespace value.</param>
        /// <returns><see langword="true" /> if the <see cref="CodeType"/> contains the specified namespace import statement; 
        /// otherwise, <see langword="false" />
        /// </returns>
        /// <remarks>
        // The function will not identify imports using the type aliases. For example, the function would return false for "System.Web.Mvc"
        // if the imports are used as below:
        // using A1 = System;
        // using A1.Web.Mvc;
        /// </remarks>
        public static bool IsProductNamespaceImported(CodeType codeType, string productNamespace)
        {
            if (codeType == null)
            {
                throw new ArgumentNullException("codeType");
            }

            if (productNamespace == null)
            {
                throw new ArgumentNullException("productNamespace");
            }

            FileCodeModel codeModel = codeType.ProjectItem.FileCodeModel;
            if (codeModel != null)
            {
                foreach (CodeElement codeElement in codeModel.CodeElements)
                {
                    // This is needed to verify if the namespace import is present at the file level.
                    if (IsNamespaceImportPresent(codeElement, productNamespace))
                    {
                        return true;
                    }
                    // This is needed to verify if the import is present at the namespace level.
                    if (codeElement.Kind.Equals(vsCMElement.vsCMElementNamespace) && IsImportPresentUnderNamespace(codeElement, productNamespace))
                    {
                        return true;
                    }
                }
            }
            return false;
        }
开发者ID:TomDu,项目名称:lab,代码行数:46,代码来源:CodeTypeFilter.cs


示例8: CodeDomTypeMetadata

 protected CodeDomTypeMetadata(CodeType codeType, bool isNullable, bool isTask, CodeDomFileMetadata file)
 {
     this.codeType = codeType;
     this.isNullable = isNullable;
     this.isTask = isTask;
     this.file = file;
 }
开发者ID:FreeFrags,项目名称:Typewriter,代码行数:7,代码来源:CodeDomTypeMetadata.cs


示例9: SetCodes

        private void SetCodes(IEnumerable<WasteCodeInfo> codes, CodeType codeType)
        {
            var newCodes = codes as WasteCodeInfo[] ?? codes.ToArray();

            if (codeType != CodeType.CustomsCode 
                && !newCodes.Any(c => c.IsNotApplicable)
                && newCodes.Select(p => p.WasteCode.Id).Distinct().Count() != newCodes.Count())
            {
                throw new InvalidOperationException(
                    string.Format("The same code cannot be entered twice for notification {0}", Id));
            }

            if (newCodes.Any(p => p.CodeType != codeType))
            {
                throw new InvalidOperationException(string.Format("All codes must be of type {0} for notification {1}", codeType, Id));
            }

            var existingCodes = GetWasteCodes(codeType).ToArray();
            foreach (var code in existingCodes)
            {
                WasteCodeInfoCollection.Remove(code);
            }

            foreach (var code in newCodes)
            {
                WasteCodeInfoCollection.Add(code);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:28,代码来源:NotificationApplication.WasteCodes.cs


示例10: PrepareCode

        private string PrepareCode( CodeType codeType, string source )
        {
            if (CommonHelper.IsNullOrEmptyOrBlank(source))
                return null;

            string ret = string.Empty;
            string[] lines = source.Trim().Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string line in lines) {
                string temp = line.Trim();
                if (temp.StartsWith("//"))
                    continue;
                ret += temp + "\n";
            }

            switch (codeType) {
                case CodeType.CSharpFastCode:{
                        if (CommonHelper.IsNullOrEmptyOrBlank(ret))
                            return string.Empty;

                        if (!ret.EndsWith("/")) {
                            if (ret.StartsWith("from") && !ret.EndsWith(")"))
                                ret = "(" + ret + ")";

                            if (!ret.Contains(".Spool("))
                                ret += ".Spool();";
                        }
                        break;
                }
            }
            return ret;
        }
开发者ID:Jodan-pz,项目名称:spoolpad,代码行数:32,代码来源:CSharpSimpleExecutableCodeGenerator.cs


示例11: btnOK_Click

 private void btnOK_Click(object sender, EventArgs e)
 {
     switch (cbxCodeType.Text)
     {
         case "拼音":
             SelectedCodeType = CodeType.Pinyin;
             break;
         case "五笔":
             SelectedCodeType = CodeType.Wubi;
             break;
         case "注音":
             SelectedCodeType = CodeType.TerraPinyin;
             break;
         case "仓颉":
             SelectedCodeType = CodeType.Cangjie;
             break;
         case "其他":
             SelectedCodeType = CodeType.Unknown;
             break;
         default:
             SelectedCodeType = CodeType.Unknown;
             break;
     }
     DialogResult = DialogResult.OK;
 }
开发者ID:hahadalin,项目名称:imewlconverter,代码行数:25,代码来源:RimeConfigForm.cs


示例12: GetExecutionCode

        public StringBuilder GetExecutionCode( IEnumerable<string> usingNamespaces, string namespaceName, string baseClassName, string className, CodeType codeType, string execCode )
        {
            string code = PrepareCode(codeType, execCode);
            string endCode = (code ?? "").TrimEnd().ToLower().EndsWith("end sub") ? code.ToLower().Contains("class") ? Environment.NewLine : Environment.NewLine + "End Sub" : Environment.NewLine + "End Sub";

            StringBuilder usingNs = new StringBuilder();
            foreach (string uns in usingNamespaces)
                usingNs.AppendFormat("Imports {0}{1}", uns, Environment.NewLine);

            StringBuilder source = new StringBuilder();
            source.AppendFormat(@"

            Imports System
            Imports System.IO
            Imports System.Collections.Generic
            Imports System.Text.RegularExpressions
            Imports System.Linq

            Imports it.jodan.SpoolPad.DataContext
            Imports it.jodan.SpoolPad.Extensions
            {0}

            namespace {1}
            Public Class {2}
            Inherits {3}
            Protected Overrides Sub InternalRun()
            {4}{5}
            End Class
            End namespace
            ", usingNs, namespaceName, className, baseClassName, code, endCode);

            return source;
        }
开发者ID:Jodan-pz,项目名称:spoolpad,代码行数:33,代码来源:VBasicSimpleExecutableCodeGenerator.cs


示例13: GetGenerater

 public static IWordCodeGenerater GetGenerater(CodeType codeType)
 {
     switch (codeType)
     {
         case CodeType.Pinyin:
             return new PinyinGenerater();
         case CodeType.Wubi:
             return new Wubi86Generater();
         case CodeType.QingsongErbi:
             return new QingsongErbiGenerater();
         case CodeType.ChaoqiangErbi:
             return new ChaoqiangErbiGenerater();
         case CodeType.XiandaiErbi:
             return new XiandaiErbiGenerater();
         case CodeType.ChaoqingYinxin:
             return new YingxinErbiGenerater();
         case CodeType.English:
             return new PinyinGenerater();
         case CodeType.Yong:
             return new PinyinGenerater();
         case CodeType.Zhengma:
             return new ZhengmaGenerater();
         case CodeType.TerraPinyin:
             return new TerraPinyinGenerater();
         case CodeType.Cangjie:
             return new Cangjie5Generater();
         case CodeType.UserDefine:
             {
                 return SelfDefiningCodeGenerater();
             }
         default:
             return new SelfDefiningCodeGenerater();
     }
 }
开发者ID:hahadalin,项目名称:imewlconverter,代码行数:34,代码来源:CodeTypeHelper.cs


示例14: btnOK_Click

 private void btnOK_Click(object sender, EventArgs e)
 {
     switch (cbxCodeType.Text)
     {
         case "拼音":
             SelectedCodeType = CodeType.Pinyin;
             break;
         case "五笔":
             SelectedCodeType = CodeType.Wubi;
             break;
         case "二笔":
             SelectedCodeType = CodeType.Erbi;
             break;
         case "英语":
             SelectedCodeType = CodeType.English;
             break;
         case "永码":
             SelectedCodeType = CodeType.Yong;
             break;
         case "郑码":
             SelectedCodeType = CodeType.Zhengma;
             break;
         case "内码":
             SelectedCodeType = CodeType.InnerCode;
             break;
         case "其他":
             SelectedCodeType = CodeType.Unknown;
             break;
         default:
             SelectedCodeType = CodeType.Unknown;
             break;
     }
     DialogResult = DialogResult.OK;
 }
开发者ID:yongsun,项目名称:imewlconverter,代码行数:34,代码来源:XiaoxiaoConfigForm.cs


示例15: AddWebFormsPages

        // Generates all of the Web Forms Pages (Default Insert, Edit, Delete),
        private void AddWebFormsPages(
            Project project,
            string selectionRelativePath,
            string dbContextNamespace,
            string dbContextTypeName,
            CodeType modelType,
            bool overwriteViews = true
        )
        {
            if (modelType == null)
            {
                throw new ArgumentNullException("modelType");
            }

            var webForms = new[] { "Index", "Create", "Edit", "Delete", "Details", "Resources" };

            // Now add each view
            foreach (string webForm in webForms)
            {
                AddWebFormsViewTemplates(
                    selectionRelativePath: selectionRelativePath,
                    modelType: modelType,
                    dbContextNamespace: dbContextNamespace,
                    dbContextTypeName: dbContextTypeName,
                    webFormsName: webForm,
                    overwrite: overwriteViews);
            }
        }
开发者ID:debbievermaak,项目名称:azure-scaffolder,代码行数:29,代码来源:RazorScaffolder.WebForms.cs


示例16: CanHaveCustomCode

 private static bool CanHaveCustomCode(CodeType codeType)
 {
     return codeType == CodeType.CustomsCode 
         || codeType == CodeType.ExportCode 
         || codeType == CodeType.ImportCode 
         || codeType == CodeType.OtherCode;
 }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:7,代码来源:WasteCodeInfo.cs


示例17: AddControllers

        // Generates all of the Web Forms Pages (Default Insert, Edit, Delete),
        private void AddControllers(
            Project project,
            string selectionRelativePath,
            string dbContextNamespace,
            string dbContextTypeName,
            CodeType modelType,
            bool overwriteViews = true
        )
        {
            if (modelType == null)
            {
                throw new ArgumentNullException("modelType");
            }

            var webForms = new[] { "Controller" };

            // Now add each view
            foreach (string webForm in webForms)
            {
                AddControllerTemplates(
                    selectionRelativePath: selectionRelativePath,
                    modelType: modelType,
                    dbContextNamespace: dbContextNamespace,
                    dbContextTypeName: dbContextTypeName,
                    webFormsName: webForm,
                    overwrite: overwriteViews);
            }
        }
开发者ID:debbievermaak,项目名称:azure-scaffolder,代码行数:29,代码来源:RazorScaffolder.Controllers.cs


示例18: Create

        public static TestableWasteCodeInfo Create(CodeType codeType,
            string code = null,
            string description = null,
            bool isNotApplicable = false)
        {
            if (isNotApplicable)
            {
                return new TestableWasteCodeInfo
                {
                    CodeType = codeType,
                    IsNotApplicable = true
                };
            }

            return new TestableWasteCodeInfo
            {
                CodeType = codeType,
                WasteCode = new TestableWasteCode
                {
                    CodeType = codeType,
                    Code = code,
                    Description = description
                }
            };
        }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:25,代码来源:TestableWasteCodeInfo.cs


示例19: GetExecutionCode

        public StringBuilder GetExecutionCode( IEnumerable<string> usingNamespaces, string namespaceName, string baseClassName, string className, CodeType codeType, string execCode )
        {
            string code = PrepareCode(codeType, execCode);
            string endCode = (code ?? "").TrimEnd().EndsWith("}") ? code.Contains("class") ? ";" : ";}" : ";}";

            StringBuilder usingNs = new StringBuilder();
            foreach (string uns in usingNamespaces)
                usingNs.AppendFormat("using {0};", uns);

            StringBuilder source = new StringBuilder();
            source.AppendFormat(@"

            using System;
            using System.IO;
            using System.Collections.Generic;
            using System.Text.RegularExpressions;
            using System.Linq;

            using it.jodan.SpoolPad.DataContext;
            using it.jodan.SpoolPad.Extensions;
            {0}

            namespace {1}{{
            public class {2} : {3} {{
            protected override void InternalRun(){{
            {4}{5}
            }}
            }}
            ", usingNs, namespaceName, className, baseClassName, code, endCode);

            return source;
        }
开发者ID:Jodan-pz,项目名称:spoolpad,代码行数:32,代码来源:CSharpSimpleExecutableCodeGenerator.cs


示例20: GetSmsCode

        public async Task<IHttpActionResult> GetSmsCode(string phoneNo, CodeType codeType = CodeType.用户注册)
        {
            if (!phoneNo.IsMobileNumber(true)) return Json(new ApiResult(OperationResultType.ValidError, "请输入正确的手机号"));
            var result = await UserContract.GetSmsValidateCode(phoneNo, codeType);

            return Json(result.ToApiResult());
        }
开发者ID:panjiyang,项目名称:Bode,代码行数:7,代码来源:AccountController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CodeTypeDeclaration类代码示例发布时间:2022-05-24
下一篇:
C# CodeProcessor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap