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


C# Feature.Count方法代码示例

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


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

示例1: ParseToolScript

        bool ParseToolScript( string s )
        {
            int linecounter = -1;

            try
            {

                //_toolpaths.Clear();
                //_rawElements.Clear();

                //_toolpaths.Clear();
                //_features.Clear();

                tabWidth = eval(tbTabWidth.Text);

                float fRotation = eval(tbRotateDegrees.Text);
                PointF pRotationCenter = evalPoint(tbRotateCenter.Text);

                Color currentColor = Color.Green;

                Feature currentFeature = new Feature( FeatureType.Reference );

                Dictionary<string, string> variables = new Dictionary<string, string>();

                PointF pOffset = new PointF(0, 0);
                float fScale = 1.0f;

                float.TryParse(tbScale.Text, out fScale);
                string[] offsets = tbOffset.Text.Split(new char[] { ',' });
                if (offsets.Length > 1)
                {
                    pOffset.X = float.Parse(offsets[0]);
                    pOffset.Y = float.Parse(offsets[1]);
                }

                // grab the text
                //string s = editor.Text;

                // comments: C++, C, perl

                // FIXME: deal with the c++ comment differently so we can match
                // up line numbers below (for errors)

                s = new Regex(@"/\*..*?\*/", RegexOptions.Singleline).Replace(s, "\r\n");
                s = new Regex(@"//.*$", RegexOptions.Multiline).Replace(s, "");
                s = new Regex(@"#.*$", RegexOptions.Multiline).Replace(s, "");

                // split into single lines... ?
                s = s.Replace("\r\n", "\n");
                string[] lines = s.Split(new char[] { '\n' });//, StringSplitOptions.RemoveEmptyEntries);

                foreach (string baseline in lines)
                {
                    linecounter++;

                    string line = baseline.Trim();
                    if (line.Equals("")) continue;

                    string keyword = new Regex(@"(?:\W|\s).*$", RegexOptions.Singleline).Replace(line, "").ToUpper();
                    string parmstring = new Regex(@"^\S+\s+", RegexOptions.Singleline).Replace( line + " ", "").ToUpper();

                    foreach (string key in variables.Keys)
                    {
                        parmstring = new Regex(@"(?<=^|\s|\W)\$" + key + @"(?=$|\s|\W)").Replace(parmstring, variables[key]);
                    }

                    bool handled = false;

                    if (keyword.Equals("SET"))
                    {
                        // problem: variable could be an expression.  either
                        // (1) evaluate before setting here; or (2) wrap in
                        // parens.  each is equally valid, should be no difference
                        // in effects because we replace variables _before_ this
                        // point.  if we were replacing variables _after_ this,
                        // then the parens would be a no brainer.

                        // CHANGEME? for now, eval.

                        string[] parms = parmstring.Split(new char[] { '=' });
                        parms[0] = parms[0].Trim().ToUpper();
                        float evar = eval(parms[1]);
                        if (variables.ContainsKey(parms[0])) variables[parms[0]] = evar.ToString();
                        else variables.Add(parms[0], evar.ToString());
                        logMessage(string.Format("Set {0} = {1:0.00}", parms[0], evar ));
                        handled = true;
                    }

                    if (!handled)
                    {
                        string[] parms = parmstring.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                        for (int i = 0; i < parms.Length; i++) parms[i] = new Regex(@"\W").Replace(parms[i], "");

                        handled = true;
                        switch (keyword)
                        {
                            // feature definitions

                            case "PROFILE":
                                if (null != currentFeature && currentFeature.Count() > 0)
//.........这里部分代码省略.........
开发者ID:duncanwerner,项目名称:chopper,代码行数:101,代码来源:ChopperForm.cs


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