示例#1
0
        /// <summary>
        /// Formating of data into text file
        /// </summary>
        /// <param name="str">Output string builder</param>
        /// <param name="df">Requested data format</param>
        public override string formatText(string df)
        {
            GSScript script = new GSScript();

            switch (df)
            {
            case GCDataFormat.PlainText:
                script.readTextTemplate(Properties.Resources.TplTodayPlain);
                break;

            case GCDataFormat.Rtf:
                script.readTextTemplate(Properties.Resources.TplTodayRtf);
                break;

            case GCDataFormat.HTML:
                script.readTextTemplate(Properties.Resources.TplTodayHtml);
                break;

            default:
                break;
            }

            GSExecutor engine = new GSExecutor();

            engine.SetVariable("today", GetCurrentDay());
            engine.SetVariable("location", calendar.m_Location);
            engine.SetVariable("app", GCUserInterface.Shared);
            engine.ExecuteElement(script);

            return(engine.getOutput());
        }
示例#2
0
        public override string formatText(string df)
        {
            GSScript script = new GSScript();

            switch (df)
            {
            case GCDataFormat.PlainText:
                script.readTextTemplate(Properties.Resources.TplCalendarPlain);
                break;

            case GCDataFormat.Rtf:
                script.readTextTemplate(Properties.Resources.TplCalendarRtf);
                break;

            case GCDataFormat.HTML:
                script.readTextTemplate(Properties.Resources.TplCalendarHtml);
                break;

            case GCDataFormat.XML:
                script.readTextTemplate(Properties.Resources.TplCalendarXml);
                break;

            case GCDataFormat.CSV:
                script.readTextTemplate(Properties.Resources.TplCalendarCsv);
                break;

            case GCDataFormat.ICAL:
                script.readTextTemplate(Properties.Resources.TplCalendarICAL);
                break;

            case GCDataFormat.VCAL:
                script.readTextTemplate(Properties.Resources.TplCalendarVCAL);
                break;

            case "htmlTable":
                script.readTextTemplate(Properties.Resources.TplCalendarHtmlTable);
                break;

            case "htmlSadhana":
                script.readTextTemplate(Properties.Resources.TplCalendarSadhana);
                break;

            default:
                break;
            }


            GSExecutor engine = new GSExecutor();

            engine.SetVariable("calendar", this);
            engine.SetVariable("location", this.m_Location);
            engine.SetVariable("app", GCUserInterface.Shared);
            engine.ExecuteElement(script);

            return(engine.getOutput());
        }
示例#3
0
        /// <summary>
        /// If newText is changed during the processing of this method
        /// then running of this method is aborted and new search starts in backSearch_DoWork
        /// by assigning newText value into currentText
        /// </summary>
        private void doSearch(string text, CancellationTokenSource tokenSource)
        {
            TResultCalendar cal = new TResultCalendar();
            string          dayText;

            cal.CalculateCalendar(EarthLocation, new GregorianDateTime(), 700);

            StringBuilder results3 = new StringBuilder();

            GSScript script = new GSScript();

            script.readTextTemplate(TResultCalendar.getPlainDayTemplate());

            GSExecutor exec = new GSExecutor();


            for (int i = 0; i < cal.m_PureCount; i++)
            {
                VAISNAVADAY vd = cal.GetDay(i);

                exec.SetVariable("app", GCUserInterface.Shared);
                exec.SetVariable("location", EarthLocation);
                exec.SetVariable("pvd", vd);

                //dayText = TResultCalendar.formatPlainTextDay(vd);
                exec.resetOutput();
                exec.ExecuteElement(script);
                dayText = exec.getOutput();
                //Debugger.Log(0, "", "SEARCH IN TEXT: " + dayText + "\n\n");
                if (dayText.IndexOf(text, 0, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    results3.AppendLine();
                    results3.AppendLine(dayText);
                }
                if (tokenSource.IsCancellationRequested)
                {
                    return;
                }
            }

            if (!tokenSource.IsCancellationRequested)
            {
                FinalizeDelegate dlg = new FinalizeDelegate(setRichText);
                richTextBox1.BeginInvoke(dlg, results3.ToString());
                ctTask = null;
                ctPrev = null;
            }
        }
示例#4
0
        public override string formatText(string templateName)
        {
            GSScript script = new GSScript();

            switch (templateName)
            {
            case GCDataFormat.PlainText:
                script.readTextTemplate(Properties.Resources.TplRatedPlain);
                break;

            case GCDataFormat.Rtf:
                script.readTextTemplate(Properties.Resources.TplRatedRtf);
                break;

            case GCDataFormat.HTML:
                script.readTextTemplate(Properties.Resources.TplRatedHtml);
                break;

            case GCDataFormat.XML:
                script.readTextTemplate(Properties.Resources.TplRatedXml);
                break;

            case GCDataFormat.CSV:
                script.readTextTemplate(Properties.Resources.TplRatedCsv);
                break;

            default:
                break;
            }


            GSExecutor engine = new GSExecutor();

            engine.SetVariable("events", this);
            engine.SetVariable("location", this.EarthLocation);
            engine.SetVariable("app", GCUserInterface.Shared);
            engine.ExecuteElement(script);


            return(engine.getOutput());
        }
示例#5
0
        /// <summary>
        /// Generates text file based on given data format template
        /// </summary>
        /// <param name="str">Output stream</param>
        /// <param name="df">Requested data format</param>
        /// <returns></returns>
        public override string formatText(string df)
        {
            GSScript script = new GSScript();

            switch (df)
            {
            case GCDataFormat.PlainText:
                script.readTextTemplate(Properties.Resources.TplMasaListPlain);
                break;

            case GCDataFormat.Rtf:
                script.readTextTemplate(Properties.Resources.TplMasaListRtf);
                break;

            case GCDataFormat.HTML:
                script.readTextTemplate(Properties.Resources.TplMasaListHtml);
                break;

            case GCDataFormat.XML:
                script.readTextTemplate(Properties.Resources.TplMasaListXml);
                break;

            case GCDataFormat.CSV:
                script.readTextTemplate(Properties.Resources.TplMasaListCsv);
                break;

            default:
                break;
            }


            GSExecutor engine = new GSExecutor();

            engine.SetVariable("mlist", this);
            engine.SetVariable("location", this.m_location);
            engine.SetVariable("app", GCUserInterface.Shared);
            engine.ExecuteElement(script);

            return(engine.getOutput());
        }
示例#6
0
        private static void TestScripting1()
        {
            GSExecutor es = new GSExecutor();

            GSScript scr = new GSScript();

            es.SetVariable("alg1", new GSNumber()
            {
                IntegerValue = 67
            });
            es.SetVariable("alg2", new GSString()
            {
                Value = "This is string"
            });
            es.SetVariable("alg3", new GSNumber()
            {
                DoubleValue = 18.29893
            });

            scr.readTextTemplate("[alg1:08d] [alg2:-18s] [alg3:5.3f]");
            es.ExecuteElement(scr);
            scr.Parts.Clear();
        }
示例#7
0
 public MNDocumentExecutor(GSCore vc)
 {
     ViewController = vc;
     CurrentPage    = null;
     Executor       = new GSExecutor();
 }