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


C# Stack.And方法代码示例

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


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

示例1: PreprocessorCommand

        private void PreprocessorCommand(string line, ref int lineNumber, Stack<bool> include, TextReader reader, 
            IDefineCollection defcol, string currentFile)
        {
            string newLine;
            while (line.EndsWith("/") && (newLine = reader.ReadLine()) != null)
            {
                line = line.Substring(0, line.Length - 1) + newLine.Trim();
            }

            if (line.StartsWith(ifDefined))
            {

            }
            else if (line.StartsWith(ifNotDefined))
            {

            }
            else if (line.StartsWith(ifElse))
            {

            }
            else if (line.StartsWith(ifEnd))
            {

            }
            else if (include.And())
            {

            }
        }
开发者ID:Diegoisawesome,项目名称:AwesomeMapEditor-old,代码行数:30,代码来源:OldPreprocessor2.cs

示例2: Preprocess

        private void Preprocess(TextReader reader, string file, DefineCollection defCol, 
            ICollection<string> lines, Stack<bool> ifStack)
        {
            int stackDepth = ifStack.Count;
            string line;
            bool include = ifStack.And();

            while ((line = reader.ReadLine()) != null)
            {
                line = line.Trim();
                if (line.Length > 0)
                {
                    if (line[0] == '#')
                    {
                        string[] splitLine = StringExtensions.Split(line,
                            parameterSplitCharacters, parameterUniterCharacters);
                        //string[] splitLine = StringHelper.DivideLine(line);

                        switch (splitLine[0].ToLower())
                        {
                            case define:
                                if (include)
                                {
                                    if (splitLine.Length > 1)
                                    {
                                        if (splitLine[1].Equals(defineFile))
                                        {
                                            string path = IOHelpers.FindFile(file, splitLine[2]);
                                            if (!string.IsNullOrEmpty(path))
                                            {
                                                IOHelpers.DefineFile(path, defCol);
                                            }
                                            else
                                            {
                                                messageHandler.AddFileNotFoundError(file, line, splitLine[2]);
                                            }
                                        }
                                        else
                                        {
                                            int indexBeg = splitLine[1].IndexOf('(');
                                            int indexEnd = splitLine[1].IndexOf(')');
                                            if (indexBeg >= 0 && indexEnd >= 0 && indexBeg < indexEnd)
                                            {
                                                string parametersList = splitLine[1].Substring(indexBeg + 1, indexEnd - indexBeg - 1);
                                                string[] parameters = parametersList.Split(',');
                                                string original = splitLine[1].Substring(0, indexBeg);
                                                for (int i = 0; i < parameters.Length; i++)
                                                {
                                                    parameters[i] = parameters[i].Trim();
                                                }
                                                defCol.Add(original, splitLine[2], parameters);
                                            }
                                            else if (indexBeg == -1 && indexEnd == -1)
                                            {
                                                if (splitLine.Length > 2)
                                                {
                                                    defCol.Add(splitLine[1], splitLine[2]);
                                                }
                                                else
                                                {
                                                    defCol.Add(splitLine[1], "");
                                                }
                                            }
                                            else
                                            {
                                                messageHandler.AddError(define + " is improperly defined: " + line);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        messageHandler.AddNotEnoughParametersError(file, line, define, 1);
                                    }
                                }
                                break;
                            case unDefine:
                                if (include)
                                {
                                    if (splitLine.Length > 1)
                                    {
                                        defCol.Remove(splitLine[1]);
                                    }
                                    else
                                    {
                                        messageHandler.AddNotEnoughParametersError(file, line, unDefine, 1);
                                    }
                                }
                                break;
                            case includeFile:
                                if (include)
                                {
                                    if (splitLine.Length > 1)
                                    {
                                        string path = IOHelpers.FindFile(file, splitLine[1]);
                                        if (!string.IsNullOrEmpty(path))
                                        {
                                            string moreText = File.ReadAllText(path);
                                            moreText = this.RemoveComments(moreText);
                                            lines.Add("{");
                                            using (StringReader newReader = new StringReader(moreText))
//.........这里部分代码省略.........
开发者ID:Diegoisawesome,项目名称:AwesomeMapEditor-old,代码行数:101,代码来源:OldPreprocessor.cs

示例3: Preprocess

        private void Preprocess(TextReader reader, StringBuilder output, 
            IDefineCollection defcol, string currentFile, Stack<bool> includeStack)
        {
            int lineNumber = 1;
            string line;
            bool blockComment = true;

            while ((line = reader.ReadLine()) != null)
            {
                line = line.Trim();
                if (line.Length > 0)
                {
                    //TOFIX?: Handling comments in unincluded lines is extra work.
                    HandleComments(ref line, ref blockComment);
                    if (line.Length > 0)
                    {
                        if (line[0] == '#')
                        {
                            PreprocessorCommand(line, ref lineNumber, includeStack, reader, defcol, currentFile);
                        }
                        else if (includeStack.And())
                        {
                            ApplyDefines(ref line, lineNumber, currentFile, defcol);
                            output.AppendLine(line);
                        }
                    }
                }
                lineNumber++;
            }

            throw new NotImplementedException();
        }
开发者ID:Diegoisawesome,项目名称:AwesomeMapEditor-old,代码行数:32,代码来源:OldPreprocessor2.cs


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