当前位置: 首页>>代码示例>>C#>>正文


C# VsaEngine.GetOriginalArrayConstructor方法代码示例

本文整理汇总了C#中Microsoft.JScript.Vsa.VsaEngine.GetOriginalArrayConstructor方法的典型用法代码示例。如果您正苦于以下问题:C# VsaEngine.GetOriginalArrayConstructor方法的具体用法?C# VsaEngine.GetOriginalArrayConstructor怎么用?C# VsaEngine.GetOriginalArrayConstructor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.JScript.Vsa.VsaEngine的用法示例。


在下文中一共展示了VsaEngine.GetOriginalArrayConstructor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: concat

 public static ArrayObject concat(object thisob, VsaEngine engine, params object[] args)
 {
     ArrayObject obj2 = engine.GetOriginalArrayConstructor().Construct();
     if (thisob is ArrayObject)
     {
         obj2.Concat((ArrayObject) thisob);
     }
     else
     {
         obj2.Concat(thisob);
     }
     for (int i = 0; i < args.Length; i++)
     {
         object obj3 = args[i];
         if (obj3 is ArrayObject)
         {
             obj2.Concat((ArrayObject) obj3);
         }
         else
         {
             obj2.Concat(obj3);
         }
     }
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:ArrayPrototype.cs

示例2: toArray

 internal virtual ArrayObject toArray(VsaEngine engine){
   IList aList = this.array;
   ArrayObject result = engine.GetOriginalArrayConstructor().Construct();
   uint i = 0;
   int n = aList.Count;
   IEnumerator e = aList.GetEnumerator();
   result.length = n;
   while (e.MoveNext())
     result.SetValueAtIndex(i++, e.Current);
   return result;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:11,代码来源:vbarrayobject.cs

示例3: toArray

 internal virtual ArrayObject toArray(VsaEngine engine)
 {
     IList array = this.array;
     ArrayObject obj2 = engine.GetOriginalArrayConstructor().Construct();
     uint num = 0;
     int count = array.Count;
     IEnumerator enumerator = array.GetEnumerator();
     obj2.length = count;
     while (enumerator.MoveNext())
     {
         obj2.SetValueAtIndex(num++, enumerator.Current);
     }
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:VBArrayObject.cs

示例4: concat

 public static ArrayObject concat(Object thisob, VsaEngine engine, params Object[] args){
   ArrayObject arrayObj = engine.GetOriginalArrayConstructor().Construct();
   if (thisob is ArrayObject)
     arrayObj.Concat((ArrayObject)thisob);
   else 
     arrayObj.Concat(thisob);
   for (int i = 0; i < args.Length; i++){
     Object arg = args[i];
     if (arg is ArrayObject)
       arrayObj.Concat((ArrayObject)arg);
     else 
       arrayObj.Concat(arg);
   }
   return arrayObj;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:15,代码来源:arrayprototype.cs

示例5: splice

 public static ArrayObject splice(object thisob, VsaEngine engine, double start, double deleteCnt, params object[] args)
 {
     uint oldLength = Microsoft.JScript.Convert.ToUint32(LateBinding.GetMemberValue(thisob, "length"));
     long num2 = Runtime.DoubleToInt64(Microsoft.JScript.Convert.ToInteger(start));
     if (num2 < 0L)
     {
         num2 = oldLength + num2;
         if (num2 < 0L)
         {
             num2 = 0L;
         }
     }
     else if (num2 > oldLength)
     {
         num2 = oldLength;
     }
     long num3 = Runtime.DoubleToInt64(Microsoft.JScript.Convert.ToInteger(deleteCnt));
     if (num3 < 0L)
     {
         num3 = 0L;
     }
     else if (num3 > (oldLength - num2))
     {
         num3 = oldLength - num2;
     }
     long num4 = (oldLength + args.Length) - num3;
     ArrayObject outArray = engine.GetOriginalArrayConstructor().Construct();
     outArray.length = num3;
     if (thisob is ArrayObject)
     {
         ((ArrayObject) thisob).Splice((uint) num2, (uint) num3, args, outArray, oldLength, (uint) num4);
         return outArray;
     }
     for (ulong i = 0L; i < num3; i += (ulong) 1L)
     {
         outArray.SetValueAtIndex((uint) i, LateBinding.GetValueAtIndex(thisob, i + ((ulong) num2)));
     }
     long num6 = (oldLength - num2) - num3;
     if (num4 < oldLength)
     {
         for (long k = 0L; k < num6; k += 1L)
         {
             LateBinding.SetValueAtIndex(thisob, (ulong) ((k + num2) + args.Length), LateBinding.GetValueAtIndex(thisob, (ulong) ((k + num2) + num3)));
         }
         LateBinding.SetMemberValue(thisob, "length", num4);
     }
     else
     {
         LateBinding.SetMemberValue(thisob, "length", num4);
         for (long m = num6 - 1L; m >= 0L; m -= 1L)
         {
             LateBinding.SetValueAtIndex(thisob, (ulong) ((m + num2) + args.Length), LateBinding.GetValueAtIndex(thisob, (ulong) ((m + num2) + num3)));
         }
     }
     int num9 = (args == null) ? 0 : args.Length;
     for (uint j = 0; j < num9; j++)
     {
         LateBinding.SetValueAtIndex(thisob, (ulong) (j + num2), args[j]);
     }
     return outArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:61,代码来源:ArrayPrototype.cs

示例6: slice

 public static ArrayObject slice(object thisob, VsaEngine engine, double start, object end)
 {
     ArrayObject obj2 = engine.GetOriginalArrayConstructor().Construct();
     uint num = Microsoft.JScript.Convert.ToUint32(LateBinding.GetMemberValue(thisob, "length"));
     long num2 = Runtime.DoubleToInt64(Microsoft.JScript.Convert.ToInteger(start));
     if (num2 < 0L)
     {
         num2 = num + num2;
         if (num2 < 0L)
         {
             num2 = 0L;
         }
     }
     else if (num2 > num)
     {
         num2 = num;
     }
     long num3 = num;
     if ((end != null) && !(end is Missing))
     {
         num3 = Runtime.DoubleToInt64(Microsoft.JScript.Convert.ToInteger(end));
         if (num3 < 0L)
         {
             num3 = num + num3;
             if (num3 < 0L)
             {
                 num3 = 0L;
             }
         }
         else if (num3 > num)
         {
             num3 = num;
         }
     }
     if (num3 > num2)
     {
         obj2.length = num3 - num2;
         ulong index = (ulong) num2;
         for (ulong i = 0L; index < num3; i += (ulong) 1L)
         {
             object valueAtIndex = LateBinding.GetValueAtIndex(thisob, index);
             if (!(valueAtIndex is Missing))
             {
                 LateBinding.SetValueAtIndex(obj2, i, valueAtIndex);
             }
             index += (ulong) 1L;
         }
     }
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:50,代码来源:ArrayPrototype.cs

示例7: SplitWithString

 private static ArrayObject SplitWithString(string thisob, VsaEngine engine, string separator, uint limit)
 {
     int num4;
     ArrayObject obj2 = engine.GetOriginalArrayConstructor().Construct();
     if (separator.Length == 0)
     {
         if (limit > thisob.Length)
         {
             limit = (uint) thisob.Length;
         }
         for (int i = 0; i < limit; i++)
         {
             obj2.SetValueAtIndex((uint) i, thisob[i].ToString());
         }
         return obj2;
     }
     int startIndex = 0;
     uint index = 0;
     while ((num4 = thisob.IndexOf(separator, startIndex)) >= 0)
     {
         obj2.SetValueAtIndex(index++, thisob.Substring(startIndex, num4 - startIndex));
         if (index >= limit)
         {
             return obj2;
         }
         startIndex = num4 + separator.Length;
     }
     if (index == 0)
     {
         obj2.SetValueAtIndex(0, thisob);
         return obj2;
     }
     obj2.SetValueAtIndex(index, thisob.Substring(startIndex));
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:StringPrototype.cs

示例8: SplitWithRegExp

 private static ArrayObject SplitWithRegExp(string thisob, VsaEngine engine, RegExpObject regExpObject, uint limit)
 {
     Match match2;
     ArrayObject obj2 = engine.GetOriginalArrayConstructor().Construct();
     Match match = regExpObject.regex.Match(thisob);
     if (!match.Success)
     {
         obj2.SetValueAtIndex(0, thisob);
         regExpObject.lastIndexInt = 0;
         return obj2;
     }
     int startIndex = 0;
     uint index = 0;
     do
     {
         int length = match.Index - startIndex;
         if (length > 0)
         {
             obj2.SetValueAtIndex(index++, thisob.Substring(startIndex, length));
             if ((limit > 0) && (index >= limit))
             {
                 regExpObject.lastIndexInt = regExpObject.regExpConst.UpdateConstructor(regExpObject.regex, match, thisob);
                 return obj2;
             }
         }
         startIndex = match.Index + match.Length;
         match2 = match;
         match = match.NextMatch();
     }
     while (match.Success);
     if (startIndex < thisob.Length)
     {
         obj2.SetValueAtIndex(index, thisob.Substring(startIndex));
     }
     regExpObject.lastIndexInt = regExpObject.regExpConst.UpdateConstructor(regExpObject.regex, match2, thisob);
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:37,代码来源:StringPrototype.cs

示例9: split

 public static ArrayObject split(object thisob, VsaEngine engine, object separator, object limit)
 {
     string str = Microsoft.JScript.Convert.ToString(thisob);
     uint maxValue = uint.MaxValue;
     if (((limit != null) && !(limit is Missing)) && (limit != DBNull.Value))
     {
         double num2 = Microsoft.JScript.Convert.ToInteger(limit);
         if ((num2 >= 0.0) && (num2 < 4294967295))
         {
             maxValue = (uint) num2;
         }
     }
     if (maxValue == 0)
     {
         return engine.GetOriginalArrayConstructor().Construct();
     }
     if ((separator == null) || (separator is Missing))
     {
         ArrayObject obj2 = engine.GetOriginalArrayConstructor().Construct();
         obj2.SetValueAtIndex(0, thisob);
         return obj2;
     }
     RegExpObject regExpObject = separator as RegExpObject;
     if (regExpObject != null)
     {
         return SplitWithRegExp(str, engine, regExpObject, maxValue);
     }
     Regex regex = separator as Regex;
     if (regex != null)
     {
         return SplitWithRegExp(str, engine, new RegExpObject(regex), maxValue);
     }
     return SplitWithString(str, engine, Microsoft.JScript.Convert.ToString(separator), maxValue);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:StringPrototype.cs

示例10: SplitWithString

 private static ArrayObject SplitWithString(String thisob, VsaEngine engine, String separator, uint limit){
   ArrayObject array = (ArrayObject)engine.GetOriginalArrayConstructor().Construct();
   if (separator.Length == 0){
     if (limit > thisob.Length)
       limit = (uint)thisob.Length;
     for (int i = 0; i < limit; i++)
       array.SetValueAtIndex((uint)i, thisob[i].ToString());
   }else{
     int prevIndex = 0;
     uint i = 0;
     int index;
     while ((index = thisob.IndexOf(separator, prevIndex)) >= 0){
       array.SetValueAtIndex(i++, thisob.Substring(prevIndex, index-prevIndex));
       if (i >= limit)
         return array;
       prevIndex = index + separator.Length;
     }
     if (i == 0)
       array.SetValueAtIndex(0, thisob);
     else
       array.SetValueAtIndex(i, thisob.Substring(prevIndex));
   }
   return array;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:24,代码来源:stringprototype.cs

示例11: SplitWithRegExp

      private static ArrayObject SplitWithRegExp(String thisob, VsaEngine engine, RegExpObject regExpObject, uint limit){
        ArrayObject array = (ArrayObject)engine.GetOriginalArrayConstructor().Construct();
        Match match = regExpObject.regex.Match(thisob);

        if (!match.Success){
          array.SetValueAtIndex(0, thisob);
          regExpObject.lastIndexInt = 0;
          return array;
        }


        Match lastMatch;
        int prevIndex = 0;
        uint i = 0;

        do{
          int len = match.Index - prevIndex;
          if (len > 0)
          {
            array.SetValueAtIndex(i++, thisob.Substring(prevIndex, len));
            if (limit > 0 && i >= limit){
              regExpObject.lastIndexInt = regExpObject.regExpConst.UpdateConstructor(regExpObject.regex, match, thisob);
              return array;
            }
          }


          prevIndex = match.Index + match.Length;
          lastMatch = match;
          match = match.NextMatch();
        }while(match.Success);

        if (prevIndex < thisob.Length)
          array.SetValueAtIndex(i, thisob.Substring(prevIndex));
        regExpObject.lastIndexInt = regExpObject.regExpConst.UpdateConstructor(regExpObject.regex, lastMatch, thisob);

        return array;
      }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:38,代码来源:stringprototype.cs

示例12: split

 public static ArrayObject split(Object thisob, VsaEngine engine, Object separator, Object limit){
   String thisStr = Convert.ToString(thisob);
   uint limitValue = UInt32.MaxValue;
   if (limit != null && !(limit is Missing) && limit != DBNull.Value){
     double lmt = Convert.ToInteger(limit);
     if (lmt >= 0 && lmt < UInt32.MaxValue)
       limitValue = (uint)lmt;
   }
   if (limitValue == 0)
     return (ArrayObject)engine.GetOriginalArrayConstructor().Construct();
   if (separator == null || separator is Missing){
     ArrayObject array = (ArrayObject)engine.GetOriginalArrayConstructor().Construct();
     array.SetValueAtIndex(0, thisob);
     return array;
   }
   RegExpObject regExpObject = separator as RegExpObject;
   if (regExpObject != null) return StringPrototype.SplitWithRegExp(thisStr, engine, regExpObject, limitValue);
   Regex regex = separator as Regex;
   if (regex != null) return StringPrototype.SplitWithRegExp(thisStr, engine, new RegExpObject(regex), limitValue);
   return StringPrototype.SplitWithString(thisStr, engine, Convert.ToString(separator), limitValue);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:21,代码来源:stringprototype.cs

示例13: splice

 public static ArrayObject splice(Object thisob, VsaEngine engine, double start, double deleteCnt, params Object[] args){
   uint oldLength = Convert.ToUint32(LateBinding.GetMemberValue(thisob, "length"));
   // compute the start index
   long startIndex = Runtime.DoubleToInt64(Convert.ToInteger(start));
   if (startIndex < 0){
     startIndex = oldLength + startIndex;
     if (startIndex < 0)
       startIndex = 0;
   }else if (startIndex > oldLength)
     startIndex = oldLength;
   
   // compute the number of items to delete
   long deleteCount = Runtime.DoubleToInt64(Convert.ToInteger(deleteCnt));
   if (deleteCount < 0)
     deleteCount = 0;
   else if (deleteCount > oldLength - startIndex)
     deleteCount = oldLength - startIndex;
   long newLength = oldLength + args.Length - deleteCount;
   
   // create an array for the result
   ArrayObject result = engine.GetOriginalArrayConstructor().Construct();
   result.length = deleteCount;
   
   // special case array objects (nice speedup if dense)
   if (thisob is ArrayObject){
     ((ArrayObject)thisob).Splice((uint)startIndex, (uint)deleteCount, args, result, (uint)oldLength, (uint)newLength);
     return result;
   }
   
   // copy the deleted items to the result array
   for (ulong i = 0; i < (ulong)deleteCount; i++)
     result.SetValueAtIndex((uint)i, LateBinding.GetValueAtIndex(thisob, i+(ulong)startIndex));
   
   // shift the remaining elements left or right
   long n = oldLength-startIndex-deleteCount;
   if (newLength < oldLength){
     for (long i = 0; i < n; i++)
       LateBinding.SetValueAtIndex(thisob, (ulong)(i+startIndex+args.Length), LateBinding.GetValueAtIndex(thisob, (ulong)(i+startIndex+deleteCount)));
     LateBinding.SetMemberValue(thisob, "length", newLength);
   }else{
     LateBinding.SetMemberValue(thisob, "length", newLength);
     for (long i = n-1; i >= 0; i--)
       LateBinding.SetValueAtIndex(thisob, (ulong)(i+startIndex+args.Length), LateBinding.GetValueAtIndex(thisob, (ulong)(i+startIndex+deleteCount)));
   }
   
   // splice in the arguments
   int m = args == null ? 0 : args.Length;
   for (uint i = 0; i < m; i++)
     LateBinding.SetValueAtIndex(thisob, i+(ulong)startIndex, args[i]);
   
   return result;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:52,代码来源:arrayprototype.cs

示例14: slice

 public static ArrayObject slice(Object thisob, VsaEngine engine, double start, Object end){
   ArrayObject array = engine.GetOriginalArrayConstructor().Construct();
   uint length = Convert.ToUint32(LateBinding.GetMemberValue(thisob, "length"));
   // compute the start index
   long startIndex = Runtime.DoubleToInt64(Convert.ToInteger(start));
   if (startIndex < 0){
     startIndex = length + startIndex;
     if (startIndex < 0)
       startIndex = 0;
   }else if (startIndex > length)
     startIndex = length;
   // compute the end index
   long endIndex = length;
   if (end != null && !(end is Missing)){
     endIndex = Runtime.DoubleToInt64(Convert.ToInteger(end));
     if (endIndex < 0){
       endIndex = length + endIndex;
       if (endIndex < 0)
         endIndex = 0;
     }else if (endIndex > length)
       endIndex = length;
   }
   // slice
   if (endIndex > startIndex){    
     array.length = endIndex - startIndex;
     for (ulong i = (ulong)startIndex, j = 0; i < (ulong)endIndex; i++, j++){
       Object val = LateBinding.GetValueAtIndex(thisob, i);
       if (!(val is Missing))
         LateBinding.SetValueAtIndex(array, j, val);
     }
   }
   return array;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:33,代码来源:arrayprototype.cs


注:本文中的Microsoft.JScript.Vsa.VsaEngine.GetOriginalArrayConstructor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。