ProtocolBuffers.ProtoCode.ReadCode C# (CSharp) Method

ReadCode() private static method

Read c# code from sourcePath and write it on code without the initial using statements.
private static ReadCode ( TextWriter code, string name, bool includeUsing ) : void
code System.IO.TextWriter
name string
includeUsing bool
return void
        private static void ReadCode(TextWriter code, string name, bool includeUsing)
        {
            code.WriteLine ("#region " + name);

            using (TextReader tr = new StreamReader(Assembly.GetExecutingAssembly ().GetManifestResourceStream (name), Encoding.UTF8)) {
                while (true) {
                    string line = tr.ReadLine ();
                    if (line == null)
                        break;
                    if (includeUsing == false && line.StartsWith ("using"))
                        continue;

                    code.WriteLine (line);
                }
            }
            code.WriteLine ("#endregion");
        }