Ejemplo n.º 1
0
        public void StartGetMeaning(string word)
        {
            GetMeaningArgs arg = new GetMeaningArgs(word, allDict);

            thread = new Thread(threadStart);
            thread.Start(arg);
        }
Ejemplo n.º 2
0
        private static void GetMeaning(object arg)
        {
            if (arg is GetMeaningArgs)
            {
                GetMeaningArgs         arg2 = arg as GetMeaningArgs;
                GetMeaningCompleteArgs arg3 = new GetMeaningCompleteArgs();
                arg3.Meaning = string.Empty;

                if ((arg2.Word == null) || (arg2.AllDicts == null))
                {
                    arg3.GetMeaningArgs = arg2;
                    OnGetMeaningComplete(arg3);
                    return;
                }

                foreach (DictFileInfo dict in arg2.AllDicts)
                {
                    IndexEntry index;
                    if ((index = dict.IndexFile[arg2.Word]) != null)
                    {
                        int offset = GetDecValue(index.Offset);
                        int length = GetDecValue(index.Length);

                        string mean = GetWordMeaning(offset, length, dict.Path);

                        if (OnGetMeaningComplete != null)
                        {
                            arg3.Meaning        = arg3.Meaning + mean;
                            arg3.GetMeaningArgs = arg2;
                        }
                    }
                    else
                    {
                        arg3.GetMeaningArgs = arg2;
                    }
                    OnGetMeaningComplete(arg3);
                }
            }
        }