public static void Transform(XamlReader xamlReader, XamlWriter xamlWriter, bool closeWriter) { if (xamlReader == null) { throw new ArgumentNullException("xamlReader"); } if (xamlWriter == null) { throw new ArgumentNullException("xamlWriter"); } if (xamlReader.NodeType == XamlNodeType.None) { xamlReader.Read(); } var xamlLineInfo = xamlReader as IXamlLineInfo; var xamlLineConsumer = xamlWriter as IXamlLineInfoConsumer; var shouldSetLineInfo = xamlLineInfo != null && xamlLineConsumer != null && xamlLineConsumer.ShouldProvideLineInfo && xamlLineInfo.HasLineInfo; while (!xamlReader.IsEof) { if (shouldSetLineInfo) { xamlLineConsumer.SetLineInfo(xamlLineInfo.LineNumber, xamlLineInfo.LinePosition); } xamlWriter.WriteNode(xamlReader); xamlReader.Read(); } if (closeWriter) { xamlWriter.Close(); } }
public static void Transform(XamlReader xamlReader, XamlWriter xamlWriter, bool closeWriter) { if (xamlReader == null) { throw new ArgumentNullException("xamlReader"); } if (xamlWriter == null) { throw new ArgumentNullException("xamlWriter"); } if (xamlReader.NodeType == XamlNodeType.None) { xamlReader.Read(); } while (!xamlReader.IsEof) { xamlWriter.WriteNode(xamlReader); xamlReader.Read(); } if (closeWriter) { xamlWriter.Close(); } }
public override bool Read() { if (started) { if (nest == 0) { source.Read(); return(false); // already consumed } if (!source.Read()) { return(false); } } else { started = true; } switch (source.NodeType) { case XamlNodeType.StartObject: case XamlNodeType.GetObject: case XamlNodeType.StartMember: nest++; break; case XamlNodeType.EndObject: case XamlNodeType.EndMember: nest--; break; } return(true); }
public void StartThread(string threadName) { #if PCL136 ThreadPool.QueueUserWorkItem(state => #else if (thread != null) { throw new InvalidOperationException("Thread has already started"); } thread = Task.Run(() => #endif { try { while (do_work && r.Read()) { q.Writer.WriteNode(r); wait.Set(); } } catch (Exception ex) { lastError = ex; wait.Set(); } finally { read_all_done = true; } }); }
public static void Transform (XamlReader xamlReader, XamlWriter xamlWriter, bool closeWriter) { if (xamlReader == null) throw new ArgumentNullException ("xamlReader"); if (xamlWriter == null) throw new ArgumentNullException ("xamlWriter"); if (xamlReader.NodeType == XamlNodeType.None) xamlReader.Read (); while (!xamlReader.IsEof) { xamlWriter.WriteNode (xamlReader); xamlReader.Read (); } if (closeWriter) xamlWriter.Close (); }