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


C# INakoFuncCallInfo.CreateArray方法代码示例

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


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

示例1: _explode

 private object _explode(INakoFuncCallInfo info)
 {
     string s = info.StackPopAsString();
     string a = info.StackPopAsString();
     string[] splitted = s.Split(new string[]{a},StringSplitOptions.None);
     NakoVarArray arr = info.CreateArray();
     for(int i=0;i<splitted.Length;i++){
         arr.SetValue(i,splitted[i]);
     }
     return arr;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:11,代码来源:NakoPluginString.cs

示例2: _reverse

 private object _reverse(INakoFuncCallInfo info)
 {
     object ar = info.StackPop();
     if (!(ar is NakoVariable))
     {
         throw new NakoPluginRuntimeException("『逆順』の引数が変数ではありません");
     }
     object a = ((NakoVariable)ar).Body;
     if (a is NakoVarArray)
     {
         ((NakoVarArray)a).Reverse();
     }
     else
     {
         NakoVarArray a2 = info.CreateArray();
         a2.SetValuesFromString(a.ToString());
         a2.Reverse();
         ((NakoVariable)ar).SetBody(a2, NakoVarType.Array);
     }
     // 結果をセット
     return null;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:22,代码来源:NakoPluginArray.cs

示例3: _degrade

 private object _degrade(INakoFuncCallInfo info)
 {
     string s = info.StackPopAsString();
     char[] splitted = s.ToCharArray();
      NakoVarArray arr = info.CreateArray();
     for(int i=0;i<splitted.Length;i++){
         arr.SetValue(i,splitted[i]);
     }
     return arr;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:10,代码来源:NakoPluginString.cs

示例4: _hasKey

 /// <summary>
 /// 配列キー存在?
 /// </summary>
 /// <param name="array"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 private object _hasKey(INakoFuncCallInfo info)
 {
     object ar = info.StackPop();
     NakoVarArray arv = (NakoVarArray)ar;
     string searchKey = info.StackPopAsString ();
     if (arv.Type != NakoVarType.Array)
     {
         throw new NakoPluginArgmentException("『存在』の引数が配列ではありません。");
     }
     string[] keys = arv.GetKeys();
     NakoVarArray res = info.CreateArray();
     foreach (string key in keys)
     {
         if (key == searchKey)
             return 1;
     }
     return 0;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:24,代码来源:NakoPluginArray.cs

示例5: _removeAt

        private object _removeAt(INakoFuncCallInfo info)
        {
            object a = info.StackPop();
            long   i = info.StackPopAsInt();
            if (!(a is NakoVariable))
            {
                throw new NakoPluginRuntimeException("『削除』の引数が変数ではありません");
            }

            NakoVariable av = (NakoVariable)a;
            NakoVarArray a_body = null;
            // 配列でなければ配列に強制変換する
            if (!(av.Body is NakoVarArray))
            {
                a_body = info.CreateArray();
                a_body.SetValuesFromString(av.Body.ToString());
                av.SetBody(a_body, NakoVarType.Array);
            }
            else
            {
                a_body = (NakoVarArray)av.Body;
            }
            // 要素を削除する
            a_body.RemoveAt((int)i);

            // 結果をセット
            return null;
        }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:28,代码来源:NakoPluginArray.cs

示例6: _attr

 public Object _attr(INakoFuncCallInfo info)
 {
     string s = info.StackPopAsString();
     string a = info.StackPopAsString();
     string b = info.StackPopAsString();
     HtmlDocument doc = new HtmlDocument();
     doc.LoadHtml(s);
     HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(String.Format(@"//{0}",a));
     NakoVarArray res = info.CreateArray();
     if(nodes!=null){
         for(int i=0;i<nodes.Count;i++){
             HtmlNode node = nodes[i];
             res.SetValue(i,node.GetAttributeValue(b,""));
         }
     }
     return res;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:17,代码来源:NakoPluginTag.cs

示例7: _enumKeys

 /// <summary>
 /// 配列のキー列挙
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 private object _enumKeys(INakoFuncCallInfo info)
 {
     object ar = info.StackPop();
     NakoVarArray arv = (NakoVarArray)ar;
     if (arv.Type != NakoVarType.Array)
     {
         throw new NakoPluginArgmentException("『ハッシュキー列挙』の引数が配列ではありません。");
     }
     string[] keys = arv.GetKeys();
     NakoVarArray res = info.CreateArray();
     int i = 0;
     foreach (string key in keys)
     {
         res.SetValue(i++, key);
     }
     return res;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:22,代码来源:NakoPluginArray.cs

示例8: _enumFiles

 public Object _enumFiles(INakoFuncCallInfo info)
 {
     string path = info.StackPopAsString();
     string[] files = Directory.GetFiles(path);
     NakoVarArray res = info.CreateArray();
     for (int i = 0; i < files.Length; i++)
     {
         string f = Path.GetFileName(files[i]);
         res.SetValue(i, f);
     }
     return res;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:12,代码来源:NakoPluginFile.cs

示例9: _attrlist

 public Object _attrlist(INakoFuncCallInfo info)
 {
     string s = info.StackPopAsString();
     string a = info.StackPopAsString();
     HtmlDocument doc = new HtmlDocument();
     doc.LoadHtml(s);
     HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(String.Format(@"//{0}",a));
     NakoVarArray res = info.CreateArray();
     if(nodes!=null){
         foreach(HtmlNode node in nodes){
             foreach(HtmlAttribute attr in node.Attributes){
                res.SetValueFromKey(attr.Name,attr.Value);
             }
         }
     }
     return res;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:17,代码来源:NakoPluginTag.cs

示例10: _enumAllFiles

 public Object _enumAllFiles(INakoFuncCallInfo info)
 {
     string path = info.StackPopAsString();
     string[] files = Directory.GetFiles(path,"*",System.IO.SearchOption.AllDirectories);
     NakoVarArray res = info.CreateArray();
     for (int i = 0; i < files.Length; i++)
     {
         //string f = Path.GetFileName(files[i]);
         string f = files[i];
         res.SetValue(i, f);
     }
     return res;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:13,代码来源:NakoPluginFile.cs

示例11: _getPlugins

 private object _getPlugins(INakoFuncCallInfo info)
 {
     NakoVarArray a = info.CreateArray();
     foreach (KeyValuePair<string, INakoPlugin> pair in NakoAPIFuncBank.Instance.PluginList)
     {
         NakoVariable v = new NakoVariable();
         v.SetBodyAutoType(pair.Key);
         a.Add(v);
     }
     return a;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:11,代码来源:NakoBaseSystem.cs

示例12: _match

 // Define Method
 public Object _match(INakoFuncCallInfo info)
 {
     string s = info.StackPopAsString();
     string pattern = info.StackPopAsString();
     m = Regex.Match(s,pattern);
     NakoVarArray groups = info.CreateArray();
     if(m.Success){
         for(int i = 0;i < m.Groups.Count;i++){
             groups.SetValue(i,m.Groups[i].Value);
         }
         info.SetVariableValue("抽出文字列", groups);
         return m.Value;
     }
     return null;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:16,代码来源:NakoPluginRegex.cs

示例13: _split

 public Object _split(INakoFuncCallInfo info)
 {
     string s = info.StackPopAsString();
     string pattern = info.StackPopAsString();
     string[] splitted = Regex.Split(s,pattern);
     NakoVarArray arr = info.CreateArray();
     for(int i=0;i<splitted.Length;i++){
         arr.SetValue(i,splitted[i]);
     }
     return arr;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:11,代码来源:NakoPluginRegex.cs

示例14: _matchAll

 public Object _matchAll(INakoFuncCallInfo info)
 {
     string s = info.StackPopAsString();
     string pattern = info.StackPopAsString();
     m = Regex.Match(s,pattern);
     NakoVarArray res = info.CreateArray();
     int index = 0;
     NakoVarArray groups = new NakoVarArray();
     //        	NakoVariable ret = new NakoVariable();
     while(m.Success){
         res.SetValue(index,m.Value);
         NakoVarArray subgroups = new NakoVarArray();
         for (int i = 0; i < m.Groups.Count; i++)
         {
             subgroups.SetValue(i,m.Groups[i].Value);
         }
         groups.Add(subgroups);
     //        	    for(int i = 0;i < m.Groups.Count;i++){
     //        	        groups.SetValue(i,m.Groups[i].Value);
     //        	    }
     //        	    ret.Type = NakoVarType.Array;
     //        	    ret.Body = groups;
         index++;
         m = m.NextMatch();
     }
     info.SetVariableValue("抽出文字列", groups);
      	    return res;
 }
开发者ID:wnoguchi,项目名称:nadesiko2,代码行数:28,代码来源:NakoPluginRegex.cs


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