public static string MakeString(this IEnumerable <Character> chars, Eol eol = Eol.Lf) { var sb = new StringBuilder(chars.Count()); foreach (var c in chars) { if (c.IsNewLine) { if (eol == Eol.CrLf) { sb.Append("\r\n"); } else if (eol == Eol.Cr) { sb.Append('\r'); } else { sb.Append('\n'); } } else { sb.Append(c.Char); } } return(sb.ToString()); }
public void InsertGroup(XElement root, string group) { if (!Initialized) { throw new Exception("Detected not yet initialized, please run Load() first."); } InsertGroup(root, group, Eol.ToEolString()); }
public void RemoveNode(XElement root, string group, bool leaveBrankLine = false) { if (!Initialized) { throw new Exception("Detected not yet initialized, please run Load() first."); } RemoveGroup(root, group, Eol.ToEolString(), leaveBrankLine); }
public void InsertNode(XElement root, string group, string node, string value) { if (!Initialized) { throw new Exception("Detected not yet initialized, please run Load() first."); } InsertNode(root, group, node, value, Eol.ToEolString()); }
/// <summary> /// Insert attribute on Node /// </summary> /// <param name="group"></param> /// <param name="node"></param> /// <param name="attributes"></param> /// <param name="filterElement"></param> public void InsertAttribute(string group, string node, CsProjAttribute[] attributes, Func <XElement, bool> filterElement, bool allowDuplicate = false) { if (!Initialized) { throw new Exception("Detected not yet initialized, please run Load() first."); } InsertAttribute(Root, group, node, attributes, Eol.ToEolString(), filterElement, allowDuplicate); }
public void SetBufferEol(Eol eol) { var buf = GetBuffer(); if (buf != null) { buf.Eol = eol; } }
public static string AsString(this Eol eol) { switch (eol) { case Eol.Cr: return("\r"); case Eol.Lf: return("\n"); case Eol.CrLf: return("\r\n"); default: return(Environment.NewLine); } }
public string GetText() { var @lock = ObtainLock(); try { return(string.Join(Eol.AsString(), Document.Lines.Select(ln => ln.Text))); } finally { @lock.Release(); } }
private void InitDocument(Eol eolMode = Eol.CrLf, bool useTabs = false, int tabWidth = 4, int indentWidth = 0) { // Document.h // These properties are stored in the document object used by Scintilla and // thus will have their properties reset when changing the document. DirectMessage(NativeMethods.SCI_SETCODEPAGE, new IntPtr(NativeMethods.SC_CP_UTF8)); DirectMessage(NativeMethods.SCI_SETUNDOCOLLECTION, new IntPtr(1)); DirectMessage(NativeMethods.SCI_SETEOLMODE, new IntPtr((int)eolMode)); DirectMessage(NativeMethods.SCI_SETUSETABS, useTabs ? new IntPtr(1) : IntPtr.Zero); DirectMessage(NativeMethods.SCI_SETTABWIDTH, new IntPtr(tabWidth)); DirectMessage(NativeMethods.SCI_SETINDENT, new IntPtr(indentWidth)); }
/// <summary> /// Changes all end-of-line characters in the document to the format specified. /// </summary> /// <param name="eolMode">One of the <see cref="Eol" /> enumeration values.</param> public void ConvertEols(Eol eolMode) { var eol = (int)eolMode; DirectMessage(NativeMethods.SCI_CONVERTEOLS, new IntPtr(eol)); }
/// <summary> /// Changes all end-of-line characters in the document to the format specified. /// </summary> /// <param name="eolMode">One of the Eol enumeration values.</param> public static void ConvertEols(Eol eolMode) { var eol = (int) eolMode; Sci.Send(SciMsg.SCI_CONVERTEOLS, new IntPtr(eol)); }
private void SetEolMode(Eol eolMode) { TextEditorForm currentTextEditorForm = this.GetCurrentTextEditorForm(); if (currentTextEditorForm == null) { return; } currentTextEditorForm.Scintilla.EolMode = eolMode; currentTextEditorForm.Scintilla.ConvertEols(eolMode); }
private void InitDocument(Eol eolMode = Eol.CrLf, bool useTabs = false, int tabWidth = 4, int indentWidth = 0) { // Document.h // These properties are stored in the Scintilla document, not the control; meaning, when // a user changes documents these properties will change. If the user changes to a new // document, these properties will reset to defaults. That can cause confusion for our users // who would expect their tab settings, for example, to be unchanged based on which document // they have selected into the control. This is where we carry forward any of the user's // current settings -- and our default overrides -- to a new document. DirectMessage(NativeMethods.SCI_SETCODEPAGE, new IntPtr(NativeMethods.SC_CP_UTF8)); DirectMessage(NativeMethods.SCI_SETUNDOCOLLECTION, new IntPtr(1)); DirectMessage(NativeMethods.SCI_SETEOLMODE, new IntPtr((int)eolMode)); DirectMessage(NativeMethods.SCI_SETUSETABS, useTabs ? new IntPtr(1) : IntPtr.Zero); DirectMessage(NativeMethods.SCI_SETTABWIDTH, new IntPtr(tabWidth)); DirectMessage(NativeMethods.SCI_SETINDENT, new IntPtr(indentWidth)); }