public ChartData AddRaw(object raw)
 {
     if (Raw == null)
     {
         Raw = new List <object>();
     }
     Raw.Add(raw);
     return(this);
 }
Beispiel #2
0
        private void InvarientVibhajana2(string s)
        {
            #region Null Check...
            IndicAkshar[] ICS = this.Split(s);
            if (ICS == null)
            {
                return;
            }
            #endregion

            #region Trim the Spaces at the begenning  Each Line
            ICS = this.LeftTrimLines(ICS);
            #endregion


            #region Prepare & White Listing
            List <IndicAkshar> L = new List <IndicAkshar>();
            int    c             = 0;
            string prev          = "";
            foreach (IndicAkshar A2 in ICS)
            {
                string curr   = A2.ToString2();
                bool   bypass = false;
                if (A2.Chars.Length == 1)
                {
                    if (StringPlus.Contains(Accept, curr))
                    {
                        Raw.Add(curr);
                        curr   = " ";
                        bypass = true;
                    }
                    if (StringPlus.Contains("-", curr))
                    {
                        Raw.Add(curr);
                        curr   = "";                      //Samasam
                        bypass = false;
                    }
                }
                if (!bypass)
                {
                    if (!A2.IsValid || A2.Length == 0)
                    {
                        continue;
                    }
                }
                #region Remove Redundnat Spaces and New Lines
                if (curr == prev && (curr == Constants.Space || curr == Constants.NewLine))
                {
                    continue;
                }
                #endregion

                IndicAkshar T = new IndicAkshar();
                T.SetChars(curr, this.CharSet);

                if (T.IsPolluEnder)
                {
                    if (c - 1 >= 0)
                    {
                        Raw[Raw.Count - 1] = L[c - 1].ToString2() + curr;

                        T = GetLangAkshar();
                        T.SetChars(L[c - 1].ToString2() + curr, this.CharSet);
                        L[c - 1] = T;
                        continue;
                    }
                }

                Raw.Add(curr);
                L.Add(T);
                prev = curr;
                c++;
            }
            #endregion

            bool   NL       = false;
            string lastSym  = "";
            string lastChar = "";

            bool flg = false;
            foreach (IndicAkshar T in L)
            {
                string currSym = T.GetSymbol();
                if (currSym == Constants.NewLine)
                {
                    NL = true;
                    continue;
                }
                #region Manipulate Prev Item
                if (T.IsCompoundChar && !T.IsPolluEnder)
                {
                    if (lastChar != Constants.Blank && lastChar != Constants.Space)
                    {
                        if (T.ChangePrev)
                        {
                            lastSym = Symbols.GURUVU;
                        }
                        if (!T.AlwaysGuruvu)
                        {
                            currSym = Symbols.LAGHUVU;
                        }
                    }
                }
                else if (T.IsPolluEnder)
                {
                    if (T.IsCompoundChar && lastChar != Constants.Blank && lastChar != Constants.Space)
                    {
                        if (T.ChangePrev)
                        {
                            lastSym = Symbols.GURUVU;
                        }
                        if (!T.AlwaysGuruvu)
                        {
                            currSym = Symbols.LAGHUVU;
                        }
                    }
                    currSym = Symbols.GURUVU;
                }
                #endregion

                _SymbStream   = _SymbStream + lastSym;
                _StrStream    = _StrStream + lastChar + (flg ? Constants.Space : Constants.Blank);
                _RawStrStream = _RawStrStream + lastChar;

                if (lastChar != "")
                {
                    _GSplit.Add(lastChar);
                }
                if (NL)
                {
                    _StrStream    = _StrStream + Constants.NewLine;
                    _SymbStream   = _SymbStream + Constants.NewLine;
                    _RawStrStream = _RawStrStream + lastChar + Constants.NewLine;
                    _GSplit.Add(Constants.NewLine);
                    NL = false;

                    lastChar = T.ToString2();
                    lastSym  = currSym;
                    continue;
                }

                lastSym  = currSym;
                lastChar = T.ToString2();
                flg      = T.IsPolluEnder;
            }

            if (lastSym != Constants.Blank || lastChar != Constants.Blank)
            {
                _SymbStream   = _SymbStream + lastSym;
                _StrStream    = _StrStream + lastChar + (flg ? Constants.Space : Constants.Blank);
                _RawStrStream = _RawStrStream + lastChar;
                _GSplit.Add(lastChar);
            }

            int _prel = 0;
            foreach (string l in _SymbStream.Replace(" ", "").Split('\n'))
            {
                if (l.Length > 1)
                {
                    _prel++;
                }
            }
            PreLines = _prel;
        }