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


C# TextWriter.ToString方法代码示例

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


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

示例1: OpenForCollaboration

    public void OpenForCollaboration(TextWriter x)
    {
        try
            {
                StringReader y = new StringReader(x.ToString());

                doc = MagicDocument.LoadDocument(y);
                doc.Ink.Dirty = false;

                HookupOverlayToNewInk();
            }
           		catch (IOException ex)
            {
                MessageBox.Show(
                    ex.Message,
                    Application.ProductName,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
    }
开发者ID:pichiliani,项目名称:CoPhysicsSimulator,代码行数:20,代码来源:MainForm.cs

示例2: Process

    public string Process(string s)
    {
        fmtfolder = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath;
        fmtfolder = Path.Combine(Path.GetDirectoryName(fmtfolder), "LPfmt");

        using (sw = new StringWriter())
        {
            int length;
            List<LpItem> items = LpParser.Parse(s, 0, out length);

            var templates = from item in items
                            where item is LpTemplate
                            select item as LpTemplate;
            foreach (LpTemplate template in templates)
            {
                if (template.Name == "MatchList")
                {
                    int matchno = 1;
                    while (true)
                    {
                        List<LpItem> contents;
                        if (!template.Params.TryGetValue("match" + matchno.ToString(), out contents))
                            break;

                        if (contents.Count == 1 && contents[0] is LpTemplate)
                            TryProcessMatchMaps(contents[0] as LpTemplate);
                        matchno++;
                    }
                    sw.WriteLine();
                    continue;
                }

                if (TryProcessMatchMaps(template))
                {
                    sw.WriteLine();
                    continue;
                }

                if (TryProcessBracket(template))
                {
                    sw.WriteLine();
                    continue;
                }

                // if we ended up here, we don't support this template
                //sw.WriteLine("; -- Unsupported template: {0} --", template.Name);
            }

            string header;
            using (StringWriter headerWriter = new StringWriter())
            {
                if (maps.Count > 0)
                {
                    headerWriter.WriteLine("; maps");
                    int maxlength = (from map in maps select map.Length).Max();
                    foreach (string map in maps)
                        headerWriter.WriteLine("$map {0} = {1}", map.PadRight(maxlength, ' '), map);
                    headerWriter.WriteLine();
                }

                if (players.Count > 0)
                {
                    headerWriter.WriteLine("; players");
                    int maxlength = (from player in players select player.Length).Max();
                    foreach (string player in players)
                        headerWriter.WriteLine("$player {0} = {1}", player.PadRight(maxlength, ' '), player);
                    headerWriter.WriteLine();
                }

                header = headerWriter.ToString();
            }
            return header + sw.ToString();
        }
    }
开发者ID:xpaperclip,项目名称:tlpdtools,代码行数:74,代码来源:LpProcessor.cs

示例3: GetMemberCode

 private static string GetMemberCode(CodeTypeMember member, TextWriter writer)
 {
     CodeTypeDeclaration dummyType = new CodeTypeDeclaration();
     dummyType.Members.Add(member);
     Provider.GenerateCodeFromType(dummyType, writer, null);
     string propertyCode = writer.ToString();
     StringBuilder propertyCodeBuilder = new StringBuilder(propertyCode);
     propertyCodeBuilder.Remove(0, propertyCode.IndexOf('{') + 1);
     propertyCodeBuilder.Length -= propertyCode.Length - propertyCode.LastIndexOf('}');
     propertyCode = propertyCodeBuilder.ToString();
     return propertyCode;
 }
开发者ID:KDE,项目名称:assemblygen,代码行数:12,代码来源:MethodsGenerator.cs


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