Example #1
0
 private void ShowDocument(ActiveDocument doc)
 {
     docShow = doc;
     OpenCode.Document.SetText(Windows.UI.Text.TextSetOptions.FormatRtf, docShow.Text);
     UpdateVisibleFilesTab();
     UpdateAllLines();
 }
Example #2
0
        public MainPage()
        {
            cmdList = new AutoCompleteList();
            docList = new ActiveDocumentList();

            this.InitializeComponent();

            OpenCode.CustomKeyDown += OpenCode_KeyDown;

            docShow = new ActiveDocument("");

            //test
            //docShow.Text = "variable + \"string\"";
            //docShow.Text = "PRINT \"hello\" + \" world\" AT(0, 1).";
            //cmdList.Instructions.Add(new InstructionFramework("variable", "variable", "<INT.GET>", Colors.Linen));
            //ShowDocument(docShow);
            //CodePiece cp = cmdList.FindMatchingFramework(docShow.Text, "<STR.GET>");
            //CodePiece cp = cmdList.FindMatchingFramework(docShow.Text, null);
            //cp.Framework = cp.Framework;//breakpoint
        }
Example #3
0
 public void Remove(ActiveDocument Document)
 {
     activeDocuments.Remove(Document);
     //refresh stuff...
 }
Example #4
0
 public void Add(ActiveDocument Document)
 {
     activeDocuments.Add(Document);
     //refresh stuff...
 }
Example #5
0
        private async void Open_Tapped(object sender, TappedRoutedEventArgs e)
        {
            // Open a text file.
            var open = new Windows.Storage.Pickers.FileOpenPicker();
            open.SuggestedStartLocation =
                Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
            open.FileTypeFilter.Add(".ks");

            Windows.Storage.StorageFile file = await open.PickSingleFileAsync();
            //File.SetAttributes(file.Path, FileAttributes.Normal);

            if (file != null)
            {
                try
                {
                    var doc = new ActiveDocument(await Windows.Storage.FileIO.ReadTextAsync(file));
                    doc.Visible = true;
                    doc.FilePath = file.Path;
                    docList.Add(doc);
                    ShowDocument(doc);
                }
                catch (Exception ex)
                {
                    ContentDialog errorDialog = new ContentDialog()
                    {
                        Title = ex.ToString(),//"File open error",
                        Content = "Sorry, I can't do that...",
                        PrimaryButtonText = "Ok"
                    };

                    await errorDialog.ShowAsync();
                }
            }
        }
Example #6
0
        public List<AutoCheckError> CheckAutoCompleteErrors(ActiveDocument doc)
        {
            var returning = new List<AutoCheckError>();

            List<CodePiece> instructions = doc.GetInstructionStrings();

            //check for framework
            for (int instNum = 0; instNum < instructions.Count; instNum++)
            {
                //CodePiece code = FindMatchingFramework(instructions[instNum].Text, null);
                //instructions[instNum].Framework = (code == null ? null : code.Framework);
            }

            //check for labels not implemented
            int startError = 0;
            for (int instNum = 0; instNum < instructions.Count; instNum++)
            {
                string text = instructions[instNum].Text;
                if (text != "" && text[text.Length - 1] == '\r') text = text.Remove(text.Length - 1, 1);
                if (text != "" && text[text.Length - 1] == '\t') text = text.Remove(text.Length - 1, 1);
                string[] strs = text.Split(stringSeparatorsCheckLabels);
                for (int i = 0; i < strs.Length; i++)
                {
                    if (strs[i].Length > 0 && (strs[i][0] == '<'))
                    {
                        if (strs[i].Length > 4 && strs[i][strs[i].Length - 1] == '>')
                        {
                            returning.Add(new AutoCheckError(doc.FilePath,
                                instNum, startError, startError + strs[i].Length,
                                "Not set : " + strs[i], ErrorSeverity.none));
                        }
                        if (strs[i].Length > 5 && strs[i].Substring(strs[i].Length - 2, 2) == ">.")
                        {
                            returning.Add(new AutoCheckError(doc.FilePath,
                                instNum, startError, startError + strs[i].Length - 1,
                                "Not set : " + strs[i], ErrorSeverity.none));
                        }
                    }
                    startError += strs[i].Length + 1;
                }
            }

            //check for variable not existing

            //check funcion implementation errors

            return returning;
        }