Esempio n. 1
0
        public JsonWriter()
        {
            _instStringBuilder = new System.Text.StringBuilder();
            _writer = new System.IO.StringWriter(_instStringBuilder);

            Init();
        }
Esempio n. 2
0
    public override void BeginAssembly()
    {
      if (_consoleOnly)
      {
        base.BeginAssembly();
        Init = System.IO.TextWriter.Null; //This is a publi member that other classes may use!
        return;
      }

      OpenOutput(Filename + ".cpp");
      base.BeginAssembly();

      Init = new System.IO.StringWriter();

      var execDir = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(System.Reflection.Assembly.GetExecutingAssembly().Location));
      if (execDir.EndsWith("Debug"))
        execDir = execDir.Replace("Debug", "Release");

      WriteOutput(@"
#using <System.dll>
//#using <{0}/MCDynamicRuntime.dll>
//#using <{0}/mjr.exe>

using namespace System;
using namespace mjr;

namespace MDRSrcGen 
{{
	ref class Program 
	{{
", execDir.Replace('\\', '/'));
    }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            nick = "SecureIRC";
            owner = "SecureIRC";
            server = "irc.entalyan.com";
            port = 6999;
            chan = "#SecureIRC";
            pass = ""; //Enter just the password

            //Connect to irc server and get input and output text streams from TcpClient.
            sock.Connect(server, port);
            if (!sock.Connected)
            {
                Console.WriteLine("Failed to connect!");
                return;
            }
            input = new System.IO.StreamReader(sock.GetStream());
            output = new System.IO.StreamWriter(sock.GetStream());

            //Starting USER and NICK login commands 
            output.Write(
                "PASS " + nick + ":" + pass + "\r\n" +
                "USER " + nick + " 0 * :" + owner + "\r\n" +
                "NICK " + nick + "\r\n" +
                "PRIVMSG #SecureIRC Successful login at: " + DateTime.Now.ToString() + "\r\n"
            );
            output.Flush();

            Listen();

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();

        }
Esempio n. 4
0
        public static void zombolize(string[] args)
        {
            if(args.Length!=6)
            {
                ConsoleLog.WriteLine("Usage: zombolize loginlist dictionary proxylist threadcount outfile");
                return;
            }
            m_NickNameList=new NerZul.Core.Utils.StringHolder(args[1]);
            m_Dictionary=System.IO.File.ReadAllLines(args[2]);
            m_ProxyList=new NerZul.Core.Utils.StringSelector(args[3]);
            int ThreadCount=int.Parse(args[4]);
            m_OutS=new System.IO.StreamWriter(args[5]);
            m_List=new System.Collections.Generic.List<Engine.Zomboloid.LoginPassword>();

            for(int i=0; i<ThreadCount;i++)
            {
                new System.Threading.Thread(zombolize_thread).Start();
            }
            while(true)
            {
                System.Threading.Thread.Sleep(500);
                lock(m_ThreadCountLock)
                {
                    if(m_ThreadCount<=0) return;
                }
            }
        }
        public TextWriterErrorListener(TextWriter writer)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");

            _writer = writer;
        }
Esempio n. 6
0
 public CommandBase()
 {
     //by default, read from/write to standard streams
     this.In = System.Console.In;
     this.Out = System.Console.Out;
     this.Error = System.Console.Error;
 }
Esempio n. 7
0
 protected void Initializer(string FeatureName)
 {
     this.In = System.Console.In;
     this.Out = System.Console.Out;
     this.Error = System.Console.Out;
     Name = FeatureName;
 }
Esempio n. 8
0
 public IndentPrinter(TW Out, string IndentString, string PrefixString, bool FreshLine)
 {
     this.Out = Out;
     this.IndentString = IndentString;
     this.PrefixString = PrefixString;
     this.nl = FreshLine;
 }
Esempio n. 9
0
        public void Dispose()
        {
            if (mFile != null)
                mFile.Close();

            mFile = null;
        }
Esempio n. 10
0
        /// <summary>
        /// Formats a complete HTML document describing the given 
        /// <see cref="Error"/> instance.
        /// </summary>

        public override void Format(TextWriter writer, Error error)
        {
            if (writer == null) throw new ArgumentNullException("writer");
            if (error == null) throw new ArgumentNullException("error");

            var page = new ErrorMailHtmlPage(error);
            writer.Write(page.TransformText());
        }
Esempio n. 11
0
 // This method is OPTIONAL, you may choose to implement Write and WriteLiteral without use of __razor_writer
 // and provide another means of invoking Execute.
 //
 /// <summary>Executes the template, writing to the provided text writer.</summary>
 /// <param name=""writer"">The TextWriter to which to write the template output.</param>
 public void Generate(System.IO.TextWriter writer)
 {
     Html = new HtmlHelper (writer);
     Url = new UrlHelper ();
     __razor_writer = writer;
     Execute ();
     __razor_writer = null;
 }
Esempio n. 12
0
        public HtmlTextWriter(System.IO.TextWriter inner)
        {
            this._inner = inner;

            var nl = inner.NewLine;
            this.CoreNewLine = nl.ToCharArray();
            this._windowsNewLine = nl == "\r\n";
        }
 public TextFileWriter(String fileNameBase, String directory = null, String nameExtension = ".txt")
 {
     textWriter = null;
     FileNameBase = fileNameBase;
     NameExtension = nameExtension;
     Directory = directory;
     FileAccessMutex = new Mutex();
 }
Esempio n. 14
0
        void WriteLine(string level, string text)
        {
            if (m_writer == null && MyAPIGateway.Utilities != null)
                m_writer = MyAPIGateway.Utilities.WriteFileInLocalStorage(m_filename, typeof(Log));

            m_cache.AppendLine(string.Format("{0}\t {1}\t {2}", DateTime.Now.ToString("[HH:mm:ss]"), level, text));
            Flush();
        }
Esempio n. 15
0
        public static ITemplateWriter GetStringTemplateWriter(this TemplateGroup group, TextWriter writer)
        {
            if (group == null)
                throw new ArgumentNullException("group");
            if (writer == null)
                throw new ArgumentNullException("writer");

            return new AutoIndentWriter(writer);
        }
Esempio n. 16
0
 protected override void DumpChildren(TextWriter Out, uint Depth)
 {
     foreach (VEntry e in Fields.Values) {
     Indent(Out, Depth);
     Out.Write(e.Name);
     Out.WriteLine(" =");
     e.Value.Dump(Out, Depth+1);
     }
 }
Esempio n. 17
0
 public Game(int players, System.IO.TextWriter log)
 {
     this.Log = log;
     this.Deck = new Deck();
     this.Players = Enumerable.Range(0, players).Select(i => new Player(this, i)).ToList();
     this.Fails = FAILS;
     this.Hints = HINTS;
     this.FinalTurns = players;
 }
Esempio n. 18
0
 internal static void PrintStackTrace(this Exception e, TextWriter writer)
 {
     writer.WriteLine(e.ToString());
     string trace = e.StackTrace ?? string.Empty;
     foreach (string line in trace.Split('\n', '\r'))
     {
         if (!string.IsNullOrEmpty(line))
             writer.WriteLine("        " + line);
     }
 }
Esempio n. 19
0
 protected override bool CloseHelper()
 {
     bool result;
     if (result = this.writer.NotNull())
     {
         this.writer.Close();
         this.writer = null;
     }
     return result;
 }
Esempio n. 20
0
 /// <summary>
 /// Writes flow state that is true on exit from the basic block.
 /// </summary>
 /// <param name="arch"></param>
 /// <param name="writer"></param>
 public void WriteAfter(IProcessorArchitecture arch, TextWriter writer)
 {
     EmitRegisters(arch, "// DataOut:", DataOut, writer);
     writer.WriteLine();
     EmitFlagGroup(arch, "// DataOut (flags):", grfOut, writer);
     writer.WriteLine();
     EmitLocals("// LocalsOut:", writer);
     if (TerminatesProcess)
         writer.WriteLine("// Terminates process");
 }
Esempio n. 21
0
        public bool Open(string filename)
        {
            mFilename = filename;
            mFile = new System.IO.StreamWriter(mFilename);

            if (mFile != null)
                return true;
            else
                return false;
        }
Esempio n. 22
0
 protected override void DumpChildren(TextWriter Out, uint Depth)
 {
     foreach (Element e in Elements) {
     e.First.Dump(Out, Depth);
     if (e.ArrowPos != null) {
         Indent(Out, Depth+1);
         Out.WriteLine("->");
         e.Second.Dump(Out, Depth+1);
     }
     }
 }
Esempio n. 23
0
 internal void Close()
 {
     Flush(true);
     m_cache.Clear();
     m_cache = null;
     if (m_writer == null)
         return;
     m_writer.Flush();
     m_writer.Close();
     m_writer = null;
 }
Esempio n. 24
0
 internal ImmutableRepositoryStartSettings(RepositoryStartSettings settings)
 {
     _startLuceneManager = settings.StartLuceneManager;
     _backupIndexAtTheEnd = settings.BackupIndexAtTheEnd;
     var configRestoreIndex = RepositoryStartSettings.ConfigRestoreIndex;
     _restoreIndex = configRestoreIndex.HasValue ? configRestoreIndex.Value : settings.RestoreIndex;
     _startWorkflowEngine = settings.StartWorkflowEngine;
     _console = settings.Console;
     _pluginsPath = settings.PluginsPath;
     _indexPath = settings.IndexPath;
 }
 public void Main(string[] args, 
     System.IO.TextReader In,
     System.IO.TextWriter Out,
     System.IO.TextWriter Error)
 {
     //this version of Main allows alternate streams
     this.In = In;
     this.Out = Out;
     this.Error = Error;
     this.Main(args);
 }
Esempio n. 26
0
        public static void Close()
        {
            if (writer != null)
            {
                writer.Flush();
                writer.Close();
                writer = null;
            }

            indent = 0;
            cache.Clear();
        }
Esempio n. 27
0
 public override void Emit(IProcessorArchitecture arch, TextWriter writer)
 {
     EmitRegisters(arch, "// DataOut:", DataOut, writer);
     writer.WriteLine();
     EmitFlagGroup(arch, "// DataOut (flags):", grfOut, writer);
     writer.WriteLine();
     SymbolicIn.Emit(arch, "// SymbolicIn:", writer);
     writer.WriteLine();
     EmitLocals("// LocalsOut:", writer);
     if (TerminatesProcess)
         writer.WriteLine("// Terminates process");
 }
        /// <summary>
        /// Initializes a new instance of the RunStyleCopHandler class.
        /// </summary>
        public RunStyleCopHandler()
        {
            Pad tmpPad = IdeApp.Workbench.Pads.Find(
                  delegate(Pad toCheck)
                  {
                    return toCheck.Id.Equals("MonoDevelop.Ide.Gui.Pads.ErrorListPad");
                  });
            if (tmpPad != null)
            {
                this.errorPad = tmpPad.Content as ErrorListPad;
            }

            this.logger = this.errorPad.GetBuildProgressMonitor().Log;
        }
Esempio n. 29
0
        public ComponentSelectionForm(IMgaModel component, IMgaModel alternativeContainer, System.IO.TextWriter errorWriter=null, System.IO.TextWriter infoWriter=null)
        {
            InitializeComponent();

            #region Initialize Class Variables
            this.component = component;
            this.alternativeContainer = alternativeContainer;
            this.dataSource = new List<ComponentListItem>();
            this.ErrorWriter = (errorWriter == null) ? Console.Error : errorWriter;
            this.InfoWriter = (infoWriter == null) ? Console.Out : infoWriter;
            this.clm = new ClmLib.Clm(this.component);
            #endregion

            this.filterParameters = this.clm.GenerateFilter(alternativeContainer, this.ErrorWriter, this.InfoWriter);

            RefreshLocalComponentList();
        }
Esempio n. 30
0
        public void Assign(string s, AssignType type)
        {
            _type = type;

            if (s != string.Empty)
            {
                if (type == AssignType.Read)
                {
                    reader = new System.IO.StreamReader(s);
                }
                else
                {
                    writer = new System.IO.StreamWriter(s);
                }
            }

            field_2 = 0xD7B0;
        }
Esempio n. 31
0
        public void Generate(SqlNode node, System.IO.TextWriter writer)
        {
            bool writeWhitespace = false;

            Generate(node, writer, ref writeWhitespace);
        }
Esempio n. 32
0
 // This method is OPTIONAL, you may choose to implement Write and WriteLiteral without use of __razor_writer
 // and provide another means of invoking Execute.
 //
 /// <summary>Executes the template, writing to the provided text writer.</summary>
 /// <param name="writer">The TextWriter to which to write the template output.</param>
 public void Generate(System.IO.TextWriter writer)
 {
     __razor_writer = writer;
     Execute();
     __razor_writer = null;
 }
Esempio n. 33
0
 public void Save(System.IO.TextWriter textWriter)
 {
 }
 public IndentedTextWriter(System.IO.TextWriter textWriter)
 {
     this.textWriter = textWriter;
 }
Esempio n. 35
0
 public void Save(System.IO.TextWriter textWriter, System.Xml.Linq.SaveOptions options)
 {
 }
Esempio n. 36
0
 public void Write(ContentItem item, string propertyName, System.IO.TextWriter writer)
 {
     writer.Write(item[propertyName]);
 }
Esempio n. 37
0
 public void Encode(System.IO.TextWriter output, string value)
 {
 }
 public override void Encode(System.IO.TextWriter output, char[] value, int startIndex, int characterCount)
 {
 }
Esempio n. 39
0
 public override void WriteCommand(System.IO.TextWriter writer)
 {
     writer.WriteLine("Drop {0}", _Amount);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RewriteFormHtmlTextWriter"/> class.
 /// </summary>
 /// <param name="writer">The writer.</param>
 public RewriteFormHtmlTextWriter(System.IO.TextWriter writer)
     : base(writer)
 {
     this.InnerWriter = writer;
 }
 public abstract void WriteTo(System.IO.TextWriter writer, System.Text.Encodings.Web.HtmlEncoder encoder);
Esempio n. 42
0
        public static void RunWithController(TestHelper helper, IControllerPrx controller)
        {
            Communicator?communicator = helper.Communicator;

            TestHelper.Assert(communicator != null);
            bool ice1 = TestHelper.GetTestProtocol(communicator.GetProperties()) == Protocol.Ice1;

            var timeout = ITimeoutPrx.Parse(helper.GetTestProxy("timeout", 0), communicator);

            System.IO.TextWriter output = helper.Output;
            output.Write("testing connect timeout... ");
            output.Flush();
            {
                Dictionary <string, string>?properties = communicator.GetProperties();
                properties["Ice.ConnectTimeout"] = "100ms";
                using var comm = new Communicator(properties);

                var to = ITimeoutPrx.Parse(helper.GetTestProxy("timeout", 0), comm);

                // Expect ConnectTimeoutException.
                controller.HoldAdapter(-1);
                try
                {
                    to.Op();
                    TestHelper.Assert(false);
                }
                catch (ConnectTimeoutException)
                {
                    // Expected.
                }
                controller.ResumeAdapter();
                timeout.Op(); // Ensure adapter is active.
            }
            {
                // Expect success.
                controller.HoldAdapter(100);
                timeout.Op();
            }
            output.WriteLine("ok");

            // The sequence needs to be large enough to fill the write/recv buffers
            byte[] seq = new byte[2000000];

            output.Write("testing connection timeout... ");
            output.Flush();
            {
                // Expect TimeoutException.
                controller.HoldAdapter(-1);
                timeout.GetConnection().Acm = new Acm(TimeSpan.FromMilliseconds(50),
                                                      AcmClose.OnInvocationAndIdle,
                                                      AcmHeartbeat.Off);
                try
                {
                    timeout.SendData(seq);
                    TestHelper.Assert(false);
                }
                catch (ConnectionClosedException)
                {
                    // Expected.
                }
                controller.ResumeAdapter();
                timeout.Op(); // Ensure adapter is active.
            }
            {
                // Expect success.
                controller.HoldAdapter(100);
                try
                {
                    timeout.SendData(new byte[1000000]);
                }
                catch (ConnectionClosedException)
                {
                    TestHelper.Assert(false);
                }
            }
            output.WriteLine("ok");

            output.Write("testing invocation timeout... ");
            output.Flush();
            {
                timeout.IcePing(); // Makes sure a working connection is associated with the proxy
                Connection?connection = timeout.GetConnection();
                try
                {
                    timeout.Clone(invocationTimeout: TimeSpan.FromMilliseconds(100)).SleepAsync(1000).Wait();
                    TestHelper.Assert(false);
                }
                catch (AggregateException ex) when(ex.InnerException is OperationCanceledException)
                {
                }
                timeout.IcePing();

                TestHelper.Assert(connection == timeout.GetConnection());
                try
                {
                    timeout.Clone(invocationTimeout: TimeSpan.FromMilliseconds(1000)).SleepAsync(100).Wait();
                }
                catch (AggregateException ex) when(ex.InnerException is OperationCanceledException)
                {
                    TestHelper.Assert(false);
                }
                TestHelper.Assert(connection == timeout.GetConnection());
            }
            output.WriteLine("ok");

            output.Write("testing close timeout... ");
            output.Flush();
            {
                Dictionary <string, string> properties = communicator.GetProperties();
                properties["Ice.CloseTimeout"] = "100ms";
                using var comm = new Communicator(properties);

                var to = ITimeoutPrx.Parse(helper.GetTestProxy("timeout", 0), comm);

                Connection?connection  = to.GetConnection();
                Connection?connection2 = timeout.GetConnection();  // No close timeout

                TestHelper.Assert(connection != null && connection2 != null);

                controller.HoldAdapter(-1);

                // Make sure there's no ReadAsync pending
                _ = to.IcePingAsync();
                _ = timeout.IcePingAsync();

                var semaphore = new System.Threading.SemaphoreSlim(0);
                connection.Closed += (sender, args) => semaphore.Release();
                connection.GoAwayAsync();
                TestHelper.Assert(semaphore.Wait(500));

                connection2.Closed += (sender, args) => semaphore.Release();
                connection2.GoAwayAsync();
                TestHelper.Assert(!semaphore.Wait(500));

                controller.ResumeAdapter();
                timeout.Op(); // Ensure adapter is active.
            }
            output.WriteLine("ok");

            output.Write("testing invocation timeouts with collocated calls... ");
            output.Flush();
            {
                communicator.SetProperty("TimeoutCollocated.AdapterId", "timeoutAdapter");

                ObjectAdapter adapter = communicator.CreateObjectAdapter("TimeoutCollocated");
                adapter.Activate();

                ITimeoutPrx proxy = adapter.AddWithUUID(new Timeout(), ITimeoutPrx.Factory);
                try
                {
                    proxy.Clone(invocationTimeout: TimeSpan.FromMilliseconds(100)).SleepAsync(500).Wait();
                    TestHelper.Assert(false);
                }
                catch (AggregateException ex) when(ex.InnerException is OperationCanceledException)
                {
                }

                adapter.Dispose();
            }
            output.WriteLine("ok");

            if (!ice1)
            {
                output.Write("testing deadlines... ");
                output.Flush();
                {
                    var comm1 = new Communicator(
                        communicator.GetProperties(),
                        invocationInterceptors: new InvocationInterceptor[]
                    {
                        (target, request, next, cancel) =>
                        {
                            request.AddBinaryContextEntry(10, request.Deadline, (ostr, value) =>
                            {
                                var deadline = (value - DateTime.UnixEpoch).TotalMilliseconds;
                                ostr.WriteVarLong((long)deadline);
                            });
                            return(next(target, request, cancel));
                        }
                    });

                    for (int i = 1000; i < 5000;)
                    {
                        i += 33;
                        ITimeoutPrx to = ITimeoutPrx.Parse(helper.GetTestProxy("timeout", 0), comm1).Clone(
                            invocationTimeout: TimeSpan.FromMilliseconds(i));
                        TestHelper.Assert(to.CheckDeadline());
                    }
                }
                output.WriteLine("ok");
            }
            controller.Shutdown();
        }
Esempio n. 43
0
 public void WriteAsJSON(System.IO.TextWriter wri, int nestingLevel, JSONWritingOptions options = null)
 {
     JSONWriter.WriteMap(wri, m_Data, nestingLevel, options);
 }
Esempio n. 44
0
 // This method is REQUIRED if the template contains any Razor helpers, but you may choose to implement it differently
 //
 /// <summary>Writes a literal value to the TextWriter without HTML escaping it.</summary>
 /// <param name="writer">The TextWriter to which to write the literal.</param>
 /// <param name="value">The literal value.</param>
 protected static void WriteLiteralTo(System.IO.TextWriter writer, string value)
 {
     writer.Write(value);
 }
Esempio n. 45
0
 public virtual void Encode(System.IO.TextWriter output, string value, int startIndex, int characterCount)
 {
 }
Esempio n. 46
0
            /// <summary>
            /// Writes fielddef as JSON. Do not call this method directly, instead call rowset.ToJSON() or use JSONWriter class
            /// </summary>
            public void WriteAsJSON(System.IO.TextWriter wri, int nestingLevel, JSONWritingOptions options = null)
            {
                var attr = this[null];

                if (attr.NonUI)
                {
                    wri.Write("{}");
                    return;  //nothing to write for NONUI
                }

                bool   typeIsNullable;
                string tp = JSONMappings.MapCLRTypeToJSON(m_Type, out typeIsNullable);

                var map = new Dictionary <string, object>
                {
                    { "Name", m_Name },
                    { "Order", m_Order },
                    { "Type", tp },
                    { "Nullable", typeIsNullable }
                };

                if (attr != null)
                {
                    map.Add("IsKey", attr.Key);
                    map.Add("IsRequired", attr.Required);
                    map.Add("Visible", attr.Visible);
                    if (attr.Default != null)
                    {
                        map.Add("Default", attr.Default);
                    }
                    if (attr.CharCase != CharCase.AsIs)
                    {
                        map.Add("CharCase", attr.CharCase);
                    }
                    if (attr.Kind != DataKind.Text)
                    {
                        map.Add("Kind", attr.Kind);
                    }
                    if (attr.MinLength != 0)
                    {
                        map.Add("MinLen", attr.MinLength);
                    }
                    if (attr.MaxLength != 0)
                    {
                        map.Add("MaxLen", attr.MaxLength);
                    }
                    if (attr.Min != null)
                    {
                        map.Add("Min", attr.Min);
                    }
                    if (attr.Max != null)
                    {
                        map.Add("Max", attr.Max);
                    }
                    if (attr.ValueList != null)
                    {
                        map.Add("ValueList", attr.ValueList);
                    }
                    if (attr.Description != null)
                    {
                        map.Add("Description", attr.Description);
                    }
                    //metadata content is in the internal format and not dumped
                }

                JSONWriter.WriteMap(wri, map, nestingLevel, options);
            }
Esempio n. 47
0
        public void Write(System.IO.TextWriter writer, string destFileName)
        {
            writer.NewLine = "\n";
            writer.WriteLine("#define POST_ACTOR_COMPILER 1");
            int outLine = 1;

            if (LineNumbersEnabled)
            {
                writer.WriteLine("#line {0} \"{1}\"", tokens[0].SourceLine, sourceFile);
                outLine++;
            }
            int inBlocks = 0;

            for (int i = 0; i < tokens.Length; i++)
            {
                if (tokens[0].SourceLine == 0)
                {
                    throw new Exception("Internal error: Invalid source line (0)");
                }
                if (tokens[i].Value == "ACTOR" || tokens[i].Value == "TEST_CASE")
                {
                    int end;
                    var actor       = ParseActor(i, out end);
                    var actorWriter = new System.IO.StringWriter();
                    actorWriter.NewLine = "\n";
                    new ActorCompiler(actor, sourceFile, inBlocks == 0, LineNumbersEnabled).Write(actorWriter);
                    string[] actorLines = actorWriter.ToString().Split('\n');

                    bool hasLineNumber = false;
                    bool hadLineNumber = true;
                    foreach (var line in actorLines)
                    {
                        if (LineNumbersEnabled)
                        {
                            bool isLineNumber = line.Contains("#line");
                            if (isLineNumber)
                            {
                                hadLineNumber = true;
                            }
                            if (!isLineNumber && !hasLineNumber && hadLineNumber)
                            {
                                writer.WriteLine("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#line {0} \"{1}\"", outLine + 1, destFileName);
                                outLine++;
                                hadLineNumber = false;
                            }
                            hasLineNumber = isLineNumber;
                        }
                        writer.WriteLine(line.TrimEnd('\n', '\r'));
                        outLine++;
                    }

                    i = end;
                    if (i != tokens.Length && LineNumbersEnabled)
                    {
                        writer.WriteLine("#line {0} \"{1}\"", tokens[i].SourceLine, sourceFile);
                        outLine++;
                    }
                }
                else if (tokens[i].Value == "DESCR")
                {
                    int end;
                    var descr = ParseDescr(i, out end);
                    int lines;
                    new DescrCompiler(descr, sourceFile, inBlocks == 0, tokens[i].BraceDepth).Write(writer, out lines);
                    i        = end;
                    outLine += lines;
                    if (i != tokens.Length && LineNumbersEnabled)
                    {
                        writer.WriteLine("#line {0} \"{1}\"", tokens[i].SourceLine, sourceFile);
                        outLine++;
                    }
                }
                else
                {
                    if (tokens[i].Value == "{")
                    {
                        inBlocks++;
                    }
                    else if (tokens[i].Value == "}")
                    {
                        inBlocks--;
                    }
                    writer.Write(tokens[i].Value);
                    outLine += tokens[i].Value.Count(c => c == '\n');
                }
            }
        }
Esempio n. 48
0
 public void Serialize(System.IO.TextWriter textWriter, object o, System.Xml.Serialization.XmlSerializerNamespaces namespaces)
 {
 }
Esempio n. 49
0
 public void WriteTo(System.IO.TextWriter writer)
 {
 }
Esempio n. 50
0
 private void DisplayHelp(TextWriter stdout)
 {
     this.DisplayVersion(stdout);
     this.options.WriteOptionDescriptions(stdout);
 }
Esempio n. 51
0
 public void Write(System.IO.TextWriter writer, Span span)
 {
     throw new NotImplementedException();
 }
Esempio n. 52
0
 /// <summary>
 /// Instantiates.
 /// </summary>
 public TextWriterLogger(System.IO.TextWriter writer)
 {
     _writer = writer;
 }
Esempio n. 53
0
 private void DisplayVersion(TextWriter stdout)
 {
     stdout.WriteLine("Pickles version {0}", Assembly.GetExecutingAssembly().GetName().Version);
 }
Esempio n. 54
0
 public void Serialize(System.IO.TextWriter textWriter, object o)
 {
 }
Esempio n. 55
0
        private void Generate(SqlNode node, System.IO.TextWriter writer, ref bool writeWhitespace)
        {
            switch (node.Type)
            {
            case SqlNodeType.AscDesc:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.ColumnList:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.ColumnListTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.ComparisonOperator:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.From:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.FunctionParameterList:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.FunctionParameterListTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.GroupByClause:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.GroupByTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.JoinList:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.LogicalOperator:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.OrderByClause:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.OrderByTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.Predicate:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.PredicateIdentifierTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.PredicateTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.Select:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.SelectItem:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.SelectItemAlias:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.SelectItemTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.SelectList:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.SelectListTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.SetList:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.SetListTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.Statement:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.StatementTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.TableList:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.TableListTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.TableTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.Union:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.VALUE:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.ValueList:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.ValueListTail:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.WhereClause:
            {
                for (int i = 0; i < node.Nodes.Count; i++)
                {
                    Generate(node.Nodes[i], writer, ref writeWhitespace);
                }
                break;
            }

            case SqlNodeType.AND:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.AS:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.ASC:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.BETWEEN:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.BY:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.COMMA:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.DATE:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.DELETE:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.DESC:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.EPSILON:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.EQUALS:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.FLOAT:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.FROM:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.GREATER_THAN:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.GREATER_THAN_OR_EQUAL:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.GROUP:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.IDENTIFIER:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.INNER:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.INSERT:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.INTEGER:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.INTO:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.JOIN:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.LEFT:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.LEFT_PAREN:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.LESS_THAN:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.LESS_THAN_OR_EQUAL:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.LIKE:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.NOT:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.NOT_EQUALS:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.ON:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.OR:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.ORDER:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.OUTER:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.QUOTED_STRING:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.REPLACE:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.RIGHT:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.RIGHT_PAREN:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.SELECT:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.SEMICOLON:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.SET:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.UNION:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.UPDATE:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.VALUES:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            case SqlNodeType.WHERE:
            {
                if (writeWhitespace)
                {
                    writer.Write(" ");
                }
                writer.Write(node.Value);
                writeWhitespace = true;
                break;
            }

            default:
            {
                throw new System.Exception("Invalid node type.");
            }
            }
        }
Esempio n. 56
0
        public bool Parse(string[] args, Configuration configuration, TextWriter stdout)
        {
            var currentDirectory = this.fileSystem.DirectoryInfo.FromDirectoryName(this.fileSystem.Directory.GetCurrentDirectory());

            configuration.FeatureFolder = currentDirectory;
            configuration.OutputFolder  = currentDirectory;

            List <string> extra = this.options.Parse(args);

            if (this.versionRequested)
            {
                this.DisplayVersion(stdout);
                return(false);
            }
            else if (this.helpRequested)
            {
                this.DisplayHelp(stdout);
                return(false);
            }

            if (!string.IsNullOrEmpty(this.featureDirectory))
            {
                configuration.FeatureFolder = this.fileSystem.DirectoryInfo.FromDirectoryName(this.featureDirectory);
            }
            if (!string.IsNullOrEmpty(this.outputDirectory))
            {
                configuration.OutputFolder = this.fileSystem.DirectoryInfo.FromDirectoryName(this.outputDirectory);
            }
            if (!string.IsNullOrEmpty(this.testResultsFormat))
            {
                configuration.TestResultsFormat =
                    (TestResultsFormat)Enum.Parse(typeof(TestResultsFormat), this.testResultsFormat, true);
            }

            if (!string.IsNullOrEmpty(this.testResultsFile))
            {
                var files = this.testResultsFile.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                configuration.AddTestResultFiles(files.Select(f => this.fileSystem.FileInfo.FromFileName(f)));
            }

            if (!string.IsNullOrEmpty(this.systemUnderTestName))
            {
                configuration.SystemUnderTestName = this.systemUnderTestName;
            }
            if (!string.IsNullOrEmpty(this.systemUnderTestVersion))
            {
                configuration.SystemUnderTestVersion = this.systemUnderTestVersion;
            }
            if (!string.IsNullOrEmpty(this.language))
            {
                configuration.Language = this.language;
            }
            if (!string.IsNullOrEmpty(this.documentationFormat))
            {
                configuration.DocumentationFormat =
                    (DocumentationFormat)Enum.Parse(typeof(DocumentationFormat), this.documentationFormat, true);
            }

            return(true);
        }
Esempio n. 57
0
 public static void SetOut(System.IO.TextWriter newOut)
 {
 }
Esempio n. 58
0
        // This method is REQUIRED if the template contains any Razor helpers, but you may choose to implement it differently
        //
        /// <summary>
        /// Conditionally writes an attribute to a TextWriter.
        /// </summary>
        /// <param name="writer">The TextWriter to which to write the attribute.</param>
        /// <param name="name">The name of the attribute.</param>
        /// <param name="prefix">The prefix of the attribute.</param>
        /// <param name="suffix">The suffix of the attribute.</param>
        /// <param name="values">Attribute values, each specifying a prefix, value and whether it's a literal.</param>
        ///<remarks>Used by Razor helpers to write attributes.</remarks>
        protected static void WriteAttributeTo(System.IO.TextWriter writer, string name, string prefix, string suffix, params Tuple <string, object, bool>[] values)
        {
            // this is based on System.Web.WebPages.WebPageExecutingBase
            // Copyright (c) Microsoft Open Technologies, Inc.
            // Licensed under the Apache License, Version 2.0
            if (values.Length == 0)
            {
                // Explicitly empty attribute, so write the prefix and suffix
                writer.Write(prefix);
                writer.Write(suffix);
                return;
            }

            bool first          = true;
            bool wroteSomething = false;

            for (int i = 0; i < values.Length; i++)
            {
                Tuple <string, object, bool> attrVal = values [i];
                string attPrefix = attrVal.Item1;
                object value     = attrVal.Item2;
                bool   isLiteral = attrVal.Item3;

                if (value == null)
                {
                    // Nothing to write
                    continue;
                }

                // The special cases here are that the value we're writing might already be a string, or that the
                // value might be a bool. If the value is the bool 'true' we want to write the attribute name instead
                // of the string 'true'. If the value is the bool 'false' we don't want to write anything.
                //
                // Otherwise the value is another object (perhaps an IHtmlString), and we'll ask it to format itself.
                string stringValue;
                bool?  boolValue = value as bool?;
                if (boolValue == true)
                {
                    stringValue = name;
                }
                else if (boolValue == false)
                {
                    continue;
                }
                else
                {
                    stringValue = value as string;
                }

                if (first)
                {
                    writer.Write(prefix);
                    first = false;
                }
                else
                {
                    writer.Write(attPrefix);
                }

                if (isLiteral)
                {
                    writer.Write(stringValue ?? value);
                }
                else
                {
                    WriteTo(writer, stringValue ?? value);
                }
                wroteSomething = true;
            }
            if (wroteSomething)
            {
                writer.Write(suffix);
            }
        }
 public override void WriteText(Assembler aAssembler, System.IO.TextWriter aOutput)
 {
     aOutput.Write(Code);
 }
 public override void WriteTo(System.IO.TextWriter writer, System.Text.Encodings.Web.HtmlEncoder encoder)
 {
 }