Esempio n. 1
0
        private static unsafe SemanticMeaning[] MarshalSemanticMeaning(IntPtr keys, IntPtr values, IntPtr valueSizes, int valueCount)
        {
            var result     = new SemanticMeaning[valueCount];
            int valueIndex = 0;

            for (int i = 0; i < valueCount; i++)
            {
                var ithValueSize    = ((uint *)valueSizes)[i];
                var semanticMeaning = new SemanticMeaning
                {
                    key    = new string(((char **)keys)[i]),
                    values = new string[ithValueSize]
                };

                for (int j = 0; j < ithValueSize; j++)
                {
                    semanticMeaning.values[j] = new string(((char **)values)[valueIndex + j]);
                }

                result[i]   = semanticMeaning;
                valueIndex += (int)ithValueSize;
            }

            return(result);
        }
        private unsafe static SemanticMeaning[] MarshalSemanticMeaning(IntPtr keys, IntPtr values, IntPtr valueSizes, int valueCount)
        {
            SemanticMeaning[] array = new SemanticMeaning[valueCount];
            int num = 0;

            for (int i = 0; i < valueCount; i++)
            {
                /*
                 * uint num2 = *(uint*)((byte*)((void*)valueSizes) + (IntPtr)i * 4);
                 * SemanticMeaning semanticMeaning = new SemanticMeaning
                 * {
                 *      key = new string(*(IntPtr*)((byte*)((void*)keys) + (IntPtr)i * (IntPtr)sizeof(char*))),
                 *      values = new string[num2]
                 * };
                 * int num3 = 0;
                 * while ((long)num3 < (long)((ulong)num2))
                 * {
                 *      semanticMeaning.values[num3] = new string(*(IntPtr*)((byte*)((void*)values) + (IntPtr)(num + num3) * (IntPtr)sizeof(char*)));
                 *      num3++;
                 * }
                 * array[i] = semanticMeaning;
                 * num += (int)num2;
                 */
            }
            return(array);
        }
 private void InvokePhraseRecognizedEvent(string text, ConfidenceLevel confidence, SemanticMeaning[] semanticMeanings, long phraseStartFileTime, long phraseDurationTicks)
 {
     PhraseRecognizedDelegate onPhraseRecognized = this.OnPhraseRecognized;
     if (onPhraseRecognized != null)
     {
         onPhraseRecognized(new PhraseRecognizedEventArgs(text, confidence, semanticMeanings, DateTime.FromFileTime(phraseStartFileTime), TimeSpan.FromTicks(phraseDurationTicks)));
     }
 }
 internal PhraseRecognizedEventArgs(string text, ConfidenceLevel confidence, SemanticMeaning[] semanticMeanings, DateTime phraseStartTime, TimeSpan phraseDuration)
 {
     this.text = text;
     this.confidence = confidence;
     this.semanticMeanings = semanticMeanings;
     this.phraseStartTime = phraseStartTime;
     this.phraseDuration = phraseDuration;
 }
Esempio n. 5
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Windows.Speech.SemanticMeaning o;
         o = new UnityEngine.Windows.Speech.SemanticMeaning();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 private static unsafe SemanticMeaning[] MarshalSemanticMeaning(IntPtr keys, IntPtr values, IntPtr valueSizes, int valueCount)
 {
     SemanticMeaning[] meaningArray = new SemanticMeaning[valueCount];
     int num = 0;
     for (int i = 0; i < valueCount; i++)
     {
         uint num3 = *((uint*) (((void*) valueSizes) + (i * 4)));
         SemanticMeaning meaning = new SemanticMeaning {
             key = new string(*((char**) (((void*) keys) + (i * sizeof(char*))))),
             values = new string[num3]
         };
         for (int j = 0; j < num3; j++)
         {
             meaning.values[j] = new string(*((char**) (((void*) values) + ((num + j) * sizeof(char*)))));
         }
         meaningArray[i] = meaning;
         num += (int) num3;
     }
     return meaningArray;
 }
Esempio n. 7
0
        private static unsafe SemanticMeaning[] MarshalSemanticMeaning(IntPtr keys, IntPtr values, IntPtr valueSizes, int valueCount)
        {
            SemanticMeaning[] meaningArray = new SemanticMeaning[valueCount];
            int num = 0;

            for (int i = 0; i < valueCount; i++)
            {
                uint            num3    = *((uint *)(((void *)valueSizes) + (i * 4)));
                SemanticMeaning meaning = new SemanticMeaning {
                    key    = new string(*((char **)(((void *)keys) + (i * sizeof(char *))))),
                    values = new string[num3]
                };
                for (int j = 0; j < num3; j++)
                {
                    meaning.values[j] = new string(*((char **)(((void *)values) + ((num + j) * sizeof(char *)))));
                }
                meaningArray[i] = meaning;
                num            += (int)num3;
            }
            return(meaningArray);
        }
Esempio n. 8
0
        private unsafe static SemanticMeaning[] MarshalSemanticMeaning(IntPtr keys, IntPtr values, IntPtr valueSizes, int valueCount)
        {
            SemanticMeaning[] array = new SemanticMeaning[valueCount];
            int num = 0;

            for (int i = 0; i < valueCount; i++)
            {
                uint            num2            = *(uint *)((byte *)(void *)valueSizes + (long)i * 4L);
                SemanticMeaning semanticMeaning = default(SemanticMeaning);
                semanticMeaning.key    = new string((char *)(long)(*(IntPtr *)((byte *)(void *)keys + (long)i * (long)sizeof(char *))));
                semanticMeaning.values = new string[num2];
                SemanticMeaning semanticMeaning2 = semanticMeaning;
                for (int j = 0; j < num2; j++)
                {
                    semanticMeaning2.values[j] = new string((char *)(long)(*(IntPtr *)((byte *)(void *)values + (long)(num + j) * (long)sizeof(char *))));
                }
                array[i] = semanticMeaning2;
                num     += (int)num2;
            }
            return(array);
        }
        private unsafe static SemanticMeaning[] MarshalSemanticMeaning(IntPtr keys, IntPtr values, IntPtr valueSizes, int valueCount)
        {
            SemanticMeaning[] array = new SemanticMeaning[valueCount];
            int num = 0;

            for (int i = 0; i < valueCount; i++)
            {
                uint            num2            = *(uint *)((byte *)((void *)valueSizes) + i * 4);
                SemanticMeaning semanticMeaning = new SemanticMeaning
                {
                    key    = new string(*(IntPtr *)((byte *)((void *)keys) + i * sizeof(char *))),
                    values = new string[num2]
                };
                int num3 = 0;
                while ((long)num3 < (long)((ulong)num2))
                {
                    semanticMeaning.values[num3] = new string(*(IntPtr *)((byte *)((void *)values) + (num + num3) * sizeof(char *)));
                    num3++;
                }
                array[i] = semanticMeaning;
                num     += (int)num2;
            }
            return(array);
        }