コード例 #1
0
ファイル: BuilderUtility.cs プロジェクト: tvandijck/Frustel
        public static string HTMLChar(int CharCode, bool SpaceToNBSP = false)
        {
            switch (CharCode)
            {
            case 10:
                return("<br/>");

            case 13:
                return("");

            case 0x20:
                return(Conversions.ToString(Interaction.IIf(SpaceToNBSP, "&nbsp;", " ")));

            case 0x22:
                return("&quot;");

            case 60:
                return("&lt;");

            case 0x3e:
                return("&gt;");

            case 0x26:
                return("&amp;");

            case 0x95:
                return("&middot;");

            case 160:
                return("&nbsp;");
            }
            if (CharCode > 0xff)
            {
                return("&#" + Conversions.ToString(CharCode) + ";");
            }
            return(Conversions.ToString(Strings.ChrW(CharCode)));
        }
コード例 #2
0
ファイル: BuilderUtility.cs プロジェクト: tvandijck/Frustel
        public static string ToIdentifier(string Label, IDTypeCase TypeCase = IDTypeCase.Propercase, string ConvertSpaceChar = "", bool RemoveDashes = false)
        {
            string source = "";
            string str3   = Label.Trim();

            if (str3 == "")
            {
                source = "";
            }
            else
            {
                char   ch;
                string text = Conversions.ToString(str3[0]);
                if (IsAlphaNumeric(text))
                {
                    source = text;
                }
                else
                {
                    ch     = Conversions.ToChar(text);
                    text   = Conversions.ToString(ch);
                    source = CharNameShort(ch);
                }
                short num2 = (short)(str3.Length - 1);
                for (short i = 1; i <= num2; i = (short)(i + 1))
                {
                    text = Conversions.ToString(str3[i]);
                    if (IsAlphaNumeric(text) | (text == "_"))
                    {
                        source = source + text;
                    }
                    else if (!((text == "-") & RemoveDashes))
                    {
                        if (text == " ")
                        {
                            source = source + ConvertSpaceChar;
                        }
                        else
                        {
                            ch     = Conversions.ToChar(text);
                            text   = Conversions.ToString(ch);
                            source = source + CharNameShort(ch);
                        }
                    }
                }
            }
            switch (((int)TypeCase))
            {
            case 1:
                return(source.ToUpper());

            case 2:
                return(source.ToLower());

            case 3:
                return(IdentifierCase(source, true));

            case 4:
                return(IdentifierCase(source, false));
            }
            return(source);
        }
コード例 #3
0
ファイル: BuilderUtility.cs プロジェクト: tvandijck/Frustel
 public static string TimeDiffString(DateTime StartTime, DateTime EndTime)
 {
     return(Conversions.ToString(Conversion.Int((double)(((double)DateTime.DateDiff(DateInterval.Minute, StartTime, EndTime, FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1)) / 60.0))) + " Hours " + Conversions.ToString(Conversion.Int((long)(DateTime.DateDiff(DateInterval.Minute, StartTime, EndTime, FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1) % 60L))) + " Minutes " + Conversions.ToString(Conversion.Int((long)(DateTime.DateDiff(DateInterval.Second, StartTime, EndTime, FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1) % 60L))) + " Seconds");
 }
コード例 #4
0
ファイル: BuilderUtility.cs プロジェクト: tvandijck/Frustel
        public static int OpenWebsite(int hwndOwner, string URL)
        {
            int    num;
            string lpOperation = "Open";
            int    num2        = ShellExecute(hwndOwner, lpOperation, URL, Conversions.ToString(0), Conversions.ToString(0), 1);

            return(num);

            Information.Err().Clear();
            return(0);
        }
コード例 #5
0
ファイル: BuilderUtility.cs プロジェクト: tvandijck/Frustel
        // Methods
        public static string CharNameShort(char TheChar)
        {
            switch ((TheChar - ' '))
            {
            case '\0':
                return("Space");

            case '\x0001':
                return("Exclam");

            case '\x0002':
                return("Quote");

            case '\x0003':
                return("Num");

            case '\x0004':
                return("Dollar");

            case '\x0005':
                return("Percent");

            case '\x0006':
                return("Amp");

            case '\a':
                return("Apost");

            case '\b':
                return("LParen");

            case '\t':
                return("RParen");

            case '\n':
                return("Times");

            case '\v':
                return("Plus");

            case '\f':
                return("Comma");

            case '\r':
                return("Minus");

            case '\x000e':
                return("Dot");

            case '\x000f':
                return("Div");

            case '\x001a':
                return("Colon");

            case '\x001b':
                return("Semi");

            case '\x001c':
                return("Lt");

            case '\x001d':
                return("Eq");

            case '\x001e':
                return("Gt");

            case '\x001f':
                return("Question");

            case ' ':
                return("At");

            case ';':
                return("LBracket");

            case '<':
                return("Backslash");

            case '=':
                return("RBracket");

            case '>':
                return("Caret");

            case '?':
                return("UScore");

            case '@':
                return("Accent");

            case '[':
                return("LBrace");

            case '\\':
                return("Pipe");

            case ']':
                return("RBrace");

            case '^':
                return("Tilde");
            }
            return(Conversions.ToString((char)TheChar));
        }
コード例 #6
0
ファイル: BuilderUtility.cs プロジェクト: tvandijck/Frustel
        public static string CleanString(string Text, bool ReplaceSpaceChar = true)
        {
            long num2;
            bool flag2 = ReplaceSpaceChar;

            if (!flag2)
            {
                bool flag = false;
                for (num2 = 1L; !((num2 > Strings.Len(Text)) | flag); num2 += 1L)
                {
                    if (Strings.Mid(Text, (int)num2, 1) != " ")
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    flag2 = true;
                }
            }
            string str4 = "";
            long   num3 = Strings.Len(Text);

            for (num2 = 1L; num2 <= num3; num2 += 1L)
            {
                string str3;
                string str  = Strings.Mid(Text, (int)num2, 1);
                long   num  = Strings.AscW(str);
                long   num4 = num;
                switch (num4)
                {
                case 9L:
                    str3 = "{HT}";
                    break;

                case 10L:
                    str3 = "{LF}";
                    break;

                case 11L:
                    str3 = "{VT}";
                    break;

                case 12L:
                    str3 = "{FF}";
                    break;

                case 13L:
                    str3 = "{CR}";
                    break;

                case 0x20L:
                    if (flag2)
                    {
                        str3 = "{Space}";
                    }
                    else
                    {
                        str3 = " ";
                    }
                    break;

                default:
                    if (num4 == 160L)
                    {
                        str3 = "{NBSP}";
                    }
                    else if (num4 == 0x20acL)
                    {
                        str3 = "{Euro Sign}";
                    }
                    else if (((num >= 0x20L) & (num <= 0x7eL)) | ((num >= 160L) & (num <= 0xffL)))
                    {
                        str3 = str;
                    }
                    else
                    {
                        str3 = "{#" + Conversions.ToString(num) + "}";
                    }
                    break;
                }
                str4 = str4 + str3;
            }
            return(str4);
        }
コード例 #7
0
ファイル: ParseTables.cs プロジェクト: tvandijck/Frustel
        private bool LoadVer1(SimpleDB.Reader CGT)
        {
            bool flag2 = true;

            while (!(CGT.EndOfFile() | !flag2))
            {
                int num7;
                int num8;
                int num10;
                int num14;
                int num15;
                CGT.GetNextRecord();
                switch (CGT.RetrieveByte())
                {
                case 0x43:
                {
                    int          num5 = CGT.RetrieveInt16();
                    CharacterSet set  = new CharacterSet(CGT.RetrieveString())
                    {
                        TableIndex = num5
                    };
                    this.m_CharSet[num5] = set;
                    continue;
                }

                case 0x44:
                {
                    FAState state = new FAState();
                    num10 = CGT.RetrieveInt16();
                    bool flag3 = CGT.RetrieveBoolean();
                    int  num9  = CGT.RetrieveInt16();
                    CGT.RetrieveEntry();
                    if (!flag3)
                    {
                        goto Label_02D3;
                    }
                    this.m_DFA[num10] = new FAState(this.m_Symbol[num9]);
                    goto Label_0329;
                }

                case 0x49:
                {
                    this.m_DFA.InitialState  = (short)CGT.RetrieveInt16();
                    this.m_LALR.InitialState = (short)CGT.RetrieveInt16();
                    continue;
                }

                case 0x4c:
                    num14 = CGT.RetrieveInt16();
                    CGT.RetrieveEntry();
                    this.m_LALR[num14] = new LRState();
                    goto Label_03AC;

                case 80:
                {
                    this.m_Properties["Name"].Value           = CGT.RetrieveString();
                    this.m_Properties["Version"].Value        = CGT.RetrieveString();
                    this.m_Properties["Author"].Value         = CGT.RetrieveString();
                    this.m_Properties["About"].Value          = CGT.RetrieveString();
                    this.m_Properties["Case Sensitive"].Value = Conversions.ToString(CGT.RetrieveBoolean());
                    int num3 = CGT.RetrieveInt16();
                    continue;
                }

                case 0x52:
                {
                    num7 = CGT.RetrieveInt16();
                    int num6 = CGT.RetrieveInt16();
                    CGT.RetrieveEntry();
                    this.m_Production[num7] = new Production(this.m_Symbol[num6], (short)num7);
                    goto Label_026E;
                }

                case 0x53:
                {
                    int        num4 = CGT.RetrieveInt16();
                    string     name = CGT.RetrieveString();
                    SymbolType type = (SymbolType)CGT.RetrieveInt16();
                    this.m_Symbol[num4] = new Symbol(name, type, (short)num4);
                    continue;
                }

                case 0x54:
                {
                    this.m_Symbol     = new SymbolList(CGT.RetrieveInt16());
                    this.m_CharSet    = new CharacterSetList(CGT.RetrieveInt16());
                    this.m_Production = new ProductionList(CGT.RetrieveInt16());
                    this.m_DFA        = new FAStateList(CGT.RetrieveInt16());
                    this.m_LALR       = new LRStateList(CGT.RetrieveInt16());
                    continue;
                }

                default:
                    goto Label_03BD;
                }
Label_0240:
                num8 = CGT.RetrieveInt16();
                this.m_Production[num7].Handle().Add(this.m_Symbol[num8]);
Label_026E:
                if (!CGT.RecordComplete())
                {
                    goto Label_0240;
                }
                continue;
Label_02D3:
                this.m_DFA[num10] = new FAState();
Label_0329:
                while (!CGT.RecordComplete())
                {
                    int num11  = CGT.RetrieveInt16();
                    int target = CGT.RetrieveInt16();
                    CGT.RetrieveEntry();
                    this.m_DFA[num10].AddEdge(new FAEdge(this.m_CharSet[num11], target));
                }
                continue;
Label_0362:
                num15 = CGT.RetrieveInt16();
                int num13 = CGT.RetrieveInt16();
                int num16 = CGT.RetrieveInt16();
                CGT.RetrieveEntry();
                this.m_LALR[num14].Add(new LRAction(this.m_Symbol[num15], (LRActionType)num13, (short)num16));
Label_03AC:
                if (!CGT.RecordComplete())
                {
                    goto Label_0362;
                }
                continue;
Label_03BD:
                flag2 = false;
            }
            Symbol symbol3 = null;
            Symbol symbol2 = null;
            Symbol symbol  = null;
            int    num19   = this.m_Symbol.Count() - 1;

            for (int i = 0; i <= num19; i++)
            {
                Symbol symbol4 = this.m_Symbol[i];
                switch (((int)symbol4.Type))
                {
                case 2:
                    if (symbol == null)
                    {
                        symbol = symbol4;
                    }
                    break;

                case 4:
                    symbol3 = symbol4;
                    break;

                case 5:
                    symbol2 = symbol4;
                    break;
                }
            }
            if (symbol3 != null)
            {
                Group item  = new Group();
                int   num17 = this.m_Group.Add(item);
                item.TableIndex = 0;
                item.Name       = "Comment Block";
                item.Container  = symbol;
                item.Nesting.Add(item.TableIndex);
                item.Advance     = AdvanceMode.Token;
                item.Ending      = EndingMode.Closed;
                item.Start       = symbol3;
                item.End         = symbol2;
                item.Start.Group = item;
                item.End.Group   = item;
            }
            return(flag2);
        }
コード例 #8
0
ファイル: ParseTables.cs プロジェクト: tvandijck/Frustel
        private bool LoadVer5(SimpleDB.Reader EGT)
        {
            bool flag2;

            try
            {
                flag2 = true;
                while (!(EGT.EndOfFile() | !flag2))
                {
                    Group        group;
                    int          num3;
                    int          num4;
                    CharacterSet set;
                    int          num5;
                    int          num7;
                    int          num8;
                    int          num10;
                    int          num14;
                    int          num15;
                    Group        group2;
                    int          num17;
                    EGT.GetNextRecord();
                    EGTRecord record = (EGTRecord)EGT.RetrieveByte();
                    switch (((byte)(((int)record) - 0x44)))
                    {
                    case 0:
                    {
                        num10 = EGT.RetrieveInt16();
                        bool flag3 = EGT.RetrieveBoolean();
                        int  num9  = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        if (!flag3)
                        {
                            goto Label_041A;
                        }
                        this.m_DFA[num10] = new FAState(this.m_Symbol[num9]);
                        goto Label_0475;
                    }

                    case 5:
                    {
                        this.m_DFA.InitialState  = (short)EGT.RetrieveInt16();
                        this.m_LALR.InitialState = (short)EGT.RetrieveInt16();
                        continue;
                    }

                    case 8:
                        num14 = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        this.m_LALR[num14] = new LRState();
                        goto Label_04F8;

                    case 14:
                    {
                        num7 = EGT.RetrieveInt16();
                        int num6 = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        this.m_Production[num7] = new Production(this.m_Symbol[num6], (short)num7);
                        goto Label_03BC;
                    }

                    case 15:
                    {
                        int        num  = EGT.RetrieveInt16();
                        string     name = EGT.RetrieveString();
                        SymbolType type = (SymbolType)EGT.RetrieveInt16();
                        this.m_Symbol[num] = new Symbol(name, type, (short)num);
                        continue;
                    }

                    case 0x1f:
                        set  = new CharacterSet();
                        num5 = EGT.RetrieveInt16();
                        EGT.RetrieveInt16();
                        EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        goto Label_0324;

                    case 0x23:
                        group            = new Group();
                        group2           = group;
                        num3             = EGT.RetrieveInt16();
                        group2.Name      = EGT.RetrieveString();
                        group2.Container = this.m_Symbol[EGT.RetrieveInt16()];
                        group2.Start     = this.m_Symbol[EGT.RetrieveInt16()];
                        group2.End       = this.m_Symbol[EGT.RetrieveInt16()];
                        group2.Advance   = (AdvanceMode)EGT.RetrieveInt16();
                        group2.Ending    = (EndingMode)EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        num17 = EGT.RetrieveInt16();
                        num4  = 1;
                        goto Label_029C;

                    case 0x2c:
                    {
                        EGT.RetrieveInt16();
                        string str  = EGT.RetrieveString();
                        string str2 = EGT.RetrieveString();
                        this.m_Properties.Add(str, str2);
                        continue;
                    }

                    case 0x30:
                    {
                        this.m_Symbol     = new SymbolList(EGT.RetrieveInt16());
                        this.m_CharSet    = new CharacterSetList(EGT.RetrieveInt16());
                        this.m_Production = new ProductionList(EGT.RetrieveInt16());
                        this.m_DFA        = new FAStateList(EGT.RetrieveInt16());
                        this.m_LALR       = new LRStateList(EGT.RetrieveInt16());
                        this.m_Group      = new GroupList(EGT.RetrieveInt16());
                        continue;
                    }

                    default:
                        goto Label_0509;
                    }
Label_0282:
                    group2.Nesting.Add(EGT.RetrieveInt16());
                    num4++;
Label_029C:
                    if (num4 <= num17)
                    {
                        goto Label_0282;
                    }
                    group2 = null;
                    group.Container.Group = group;
                    group.Start.Group     = group;
                    group.End.Group       = group;
                    this.m_Group[num3]    = group;
                    continue;
Label_030F:
                    set.AddRange(EGT.RetrieveInt16(), EGT.RetrieveInt16());
Label_0324:
                    if (!EGT.RecordComplete())
                    {
                        goto Label_030F;
                    }
                    set.TableIndex       = num5;
                    this.m_CharSet[num5] = set;
                    continue;
Label_038E:
                    num8 = EGT.RetrieveInt16();
                    this.m_Production[num7].Handle().Add(this.m_Symbol[num8]);
Label_03BC:
                    if (!EGT.RecordComplete())
                    {
                        goto Label_038E;
                    }
                    continue;
Label_041A:
                    this.m_DFA[num10] = new FAState();
Label_0475:
                    while (!EGT.RecordComplete())
                    {
                        int num11  = EGT.RetrieveInt16();
                        int target = EGT.RetrieveInt16();
                        EGT.RetrieveEntry();
                        this.m_DFA[num10].Edges().Add(new FAEdge(this.m_CharSet[num11], target));
                    }
                    continue;
Label_04AE:
                    num15 = EGT.RetrieveInt16();
                    int num13 = EGT.RetrieveInt16();
                    int num16 = EGT.RetrieveInt16();
                    EGT.RetrieveEntry();
                    this.m_LALR[num14].Add(new LRAction(this.m_Symbol[num15], (LRActionType)num13, (short)num16));
Label_04F8:
                    if (!EGT.RecordComplete())
                    {
                        goto Label_04AE;
                    }
                    continue;
Label_0509:
                    flag2 = false;
                    throw new Exception("File Error. A record of type '" + Conversions.ToString(Strings.ChrW((int)record)) + "' was read. This is not a valid code.");
                }
                EGT.Close();
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                throw exception;
            }
            return(flag2);
        }