Ejemplo n.º 1
0
        public int ConvertValueToSyntaxIndex(int valueIndex)
        {
            if (valueIndex < 0 || valueIndex >= ValueText.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(valueIndex));
            }

            var valueCursor = 0;
            int syntaxCursor;

            if (
                !IsVerbatim &&
                SyntaxText.Length != 0 &&
                SyntaxText[0] == '"' &&
                (ValueText.Length == 0 || ValueText[0] != '"')
                )
            {
                syntaxCursor = 1;
            }
            else if (
                IsVerbatim &&
                SyntaxText.Length > 1 &&
                SyntaxText.StartsWith("@\"") &&
                !ValueText.StartsWith("@\"")
                )
            {
                syntaxCursor = 2;
            }
            else
            {
                syntaxCursor = 0;
            }

            for (; valueCursor < valueIndex; valueCursor++)
            {
                var valueChar  = ValueText[valueCursor];
                var syntaxChar = SyntaxText[syntaxCursor];

                syntaxCursor++;
                if (IsVerbatim && syntaxChar == '"')
                {
                    syntaxChar = SyntaxText[syntaxCursor];
                    if (syntaxChar == '"')
                    {
                        syntaxCursor++;
                    }
                }
                else if (valueChar == syntaxChar)
                {
                    continue;
                }
                else if (!IsVerbatim && syntaxChar == '\\')
                {
                    ReadEscape(ref syntaxCursor);
                }
            }

            return(syntaxCursor);
        }
Ejemplo n.º 2
0
        private void CalendarClick(object sender, EventArgs e)
        {
            CalendarEditor calendare = new CalendarEditor
            {
                Text = "Calendar",
                Date = DateTime.Now
            };

            dock.Put(calendare);
            return;

            SyntaxText st = new SyntaxText();

            st.Text = @"using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DataWF.Common;
using DataWF.Gui;
using System.IO;

namespace ais.test
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main ()
        {
            Application.EnableVisualStyles ();
            Application.SetCompatibleTextRenderingDefault (false);
            Environment.CurrentDirectory = Path.GetDirectoryName (Application.ExecutablePath);
            Load();
            Application.Run (new FormTest ());
            Save();
        }

        static void Load ()
        {    
            Localize.Load ();
            CtrlEnvir.Load (Environment.CurrentDirectory);
        }

        static void Save ()
        {
            Localize.Save ();
            CtrlEnvir.Save (Environment.CurrentDirectory);
        }
    }
}
";
            dock.Put(st);
        }