Exemplo n.º 1
0
        static public List <SMILE> FindSmiles(string sText, string sWorkFolder)
        {
            List <SMILE> aRetVal = new List <SMILE>();
            int          nPos    = 0;

            if (null == _ahSmilesBinds)
            {
                InitSmiles();
            }
            //if (null == _ahSmilesAnimationBinds)     // временно не актуально. сейчас на каждую даже одинаковую анимашку загружаем
            //    InitSmilesAnimations(sWorkFolder);
            foreach (string sSml in _ahSmilesBinds.Keys)
            {
                POSITION stPos;
                string   sTex     = sText.ToLower();
                string   sSm      = sSml.ToLower();
                int      nPosText = 0;
                while (-1 < (nPos = sTex.Substring(nPosText).IndexOf(sSm)))
                {
                    stPos = new POSITION(nPos + nPosText, sSml.Length);
                    aRetVal.Add(new SMILE(sSml, sWorkFolder, stPos));
                    nPosText = stPos.End;
                }
            }
            if (1 < aRetVal.Count)
            {
                aRetVal.Sort(delegate(SMILE a, SMILE b) { return(a.stPosition.Start - b.stPosition.Start); });
            }
            return(aRetVal);
        }
Exemplo n.º 2
0
 public SMILE(string sSml, string sWorkFolder, POSITION stPos)
 {
     this.sWorkFolder = sWorkFolder;
     sText            = sSml;
     stPosition       = stPos;
     if (null == _ahSmilesBinds)
     {
         InitSmiles();
     }
     cAnimation = GetAnimation(sText, sWorkFolder);
 }
Exemplo n.º 3
0
        static public POSITION IsSmilePersist(string sText)
        {
            POSITION stRetVal = POSITION.Empty;
            int      nPos     = -1;

            if (null == _ahSmilesBinds)
            {
                InitSmiles();
            }
            foreach (string sSml in _ahSmilesBinds.Keys)
            {
                nPos = sText.ToLower().IndexOf(sSml.ToLower());
                if (-1 < nPos)
                {
                    if (stRetVal.Start > nPos || POSITION.Empty == stRetVal)
                    {
                        stRetVal.Start  = nPos;
                        stRetVal.Length = sSml.Length;
                    }
                }
            }
            return(stRetVal);
        }
Exemplo n.º 4
0
 static public List<SMILE> FindSmiles(string sText, string sWorkFolder)
 {
     List<SMILE> aRetVal = new List<SMILE>();
     int nPos = 0;
     if (null == _ahSmilesBinds)
         InitSmiles();
     //if (null == _ahSmilesAnimationBinds)     // временно не актуально. сейчас на каждую даже одинаковую анимашку загружаем 
     //    InitSmilesAnimations(sWorkFolder);
     foreach (string sSml in _ahSmilesBinds.Keys)
     {
         POSITION stPos;
         string sTex = sText.ToLower();
         string sSm = sSml.ToLower();
         int nPosText = 0;
         while (-1 < (nPos = sTex.Substring(nPosText).IndexOf(sSm)))
         {
             stPos = new POSITION(nPos + nPosText, sSml.Length);
             aRetVal.Add(new SMILE(sSml, sWorkFolder, stPos));
             nPosText = stPos.End;
         }
     }
     if (1 < aRetVal.Count)
         aRetVal.Sort(delegate(SMILE a, SMILE b) { return a.stPosition.Start - b.stPosition.Start; });
     return aRetVal;
 }
Exemplo n.º 5
0
 public SMILE(string sSml, string sWorkFolder, POSITION stPos)
 {
     this.sWorkFolder = sWorkFolder;
     sText = sSml;
     stPosition = stPos;
     if (null == _ahSmilesBinds)
         InitSmiles();
     cAnimation = GetAnimation(sText, sWorkFolder);
 }