本文整理汇总了C#中INakoFuncCallInfo.StackPop方法的典型用法代码示例。如果您正苦于以下问题:C# INakoFuncCallInfo.StackPop方法的具体用法?C# INakoFuncCallInfo.StackPop怎么用?C# INakoFuncCallInfo.StackPop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INakoFuncCallInfo
的用法示例。
在下文中一共展示了INakoFuncCallInfo.StackPop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _append
private object _append(INakoFuncCallInfo info)
{
object ary = info.StackPop(); // 参照渡しなので変数への参照が得られる
object s = info.StackPop();
if (!(ary is NakoVariable))
{
throw new NakoPluginRuntimeException("『追加』の引数がvariableではありません");
}
NakoVariable ary_link = (NakoVariable)ary;
if (ary_link.Body is NakoVarArray)
{
NakoVarArray arr = (NakoVarArray)ary_link.Body;
NakoVariable new_item = new NakoVariable();
new_item.SetBodyAutoType(s);
arr.Add(new_item);
}else if(ary_link.Body is string && (string)ary_link.Body==""){
NakoVarArray arr = new NakoVarArray();
NakoVariable new_item = new NakoVariable();
new_item.SetBodyAutoType(s);
arr.Add(new_item);
ary_link.SetBody(arr,NakoVarType.Array);
}
// 結果をセット
return null;
}
示例2: _sample_addEx
public Object _sample_addEx(INakoFuncCallInfo info)
{
Object ar = info.StackPop();
Object b = info.StackPop();
if (!(ar is NakoVariable))
{
throw new ApplicationException("『接続!』の引数が変数ではありません");
}
Object a = ((NakoVariable)ar).Body;
Object c;
if (a is string && b is string)
{
c = (string)a + (string)b;
}
else
{
c = null;
}
// 結果をセット
((NakoVariable)ar).SetBodyAutoType(c);
return (c);
}
示例3: _encode
//Dictionary<string,object> objects = new Dictionary<string, object>();
public object _encode(INakoFuncCallInfo info)
{
object v = info.StackPop();
if(v is NakoVarArray){
NakoVarArray arr = (NakoVarArray)v;
object objects = NakoVarArrayToArray(arr);
return fastJSON.JSON.Instance.ToJSON(objects);
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// string s = serializer.Serialize(objects);
}
return null;
}
示例4: _close
public object _close(INakoFuncCallInfo info)
{
object c = info.StackPop();
if(!(c is NpgsqlConnection)){
throw new NakoPluginArgmentException("connection not found");
}
NpgsqlConnection con = (NpgsqlConnection)c;
con.Close();
return null;
/* if(!(c is ADODB.Connection)){
throw new NakoPluginArgmentException("connection not found");
}
ADODB.Connection con = (ADODB.Connection)c;
con.Close();
return null;*/
}
示例5: _close
public object _close(INakoFuncCallInfo info)
{
object stream = info.StackPop();
if(stream is FileStream){
FileStream filestream = (FileStream)stream;
filestream.Close();
filestream.Dispose();
}
else if(stream is StreamReader){
StreamReader filestream = (StreamReader)stream;
filestream.Close();
filestream.Dispose();
}
else if(stream is StreamWriter){
StreamWriter filestream = (StreamWriter)stream;
filestream.Close();
filestream.Dispose();
}
return null;
}
示例6: _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;
}
示例7: _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;
}
示例8: _insertArray
private object _insertArray(INakoFuncCallInfo info)
{
object obj_base = info.StackPop(); // 参照渡しなので変数への参照が得られる
int i = (int)info.StackPopAsInt();
object obj_insert = info.StackPop();
if (!(obj_base is NakoVariable))
{
throw new NakoPluginRuntimeException("『配列一括挿入』の元配列がvariableではありません");
}
NakoVarArray array_insert = new NakoVarArray();
if (obj_insert is NakoVariable)
{
NakoVariable var_insert = (NakoVariable)obj_insert;
if(var_insert.Body is NakoVarArray){
array_insert = (NakoVarArray)var_insert.Body;
}
}else if(obj_insert is string){
array_insert.SetValuesFromString((string)obj_insert);
}else{
throw new NakoPluginRuntimeException("『配列一括挿入』の挿入配列がvariableではありません");
}
NakoVariable var_base = (NakoVariable)obj_base;
if(var_base.Body is NakoVarArray){
NakoVarArray array_base = (NakoVarArray)var_base.Body;
while(array_insert.Count>0){
NakoVariable variable = array_insert.Pop();
array_base.Insert(i,variable);
}
}
return null;
}
示例9: _pop
private object _pop(INakoFuncCallInfo info)
{
object ary = info.StackPop(); // 参照渡しなので変数への参照が得られる
if (!(ary is NakoVariable))
{
throw new NakoPluginRuntimeException("『ポップ』の引数がvariableではありません");
}
NakoVariable ary_link = (NakoVariable)ary;
if (ary_link.Body is NakoVarArray)
{
NakoVarArray arr = (NakoVarArray)ary_link.Body;
return arr.Pop();
}
// 結果をセット
return null;
}
示例10: _say
/*
public object _say(NakoFuncCallInfo info)
{
object s = info.StackPop();
if (s == null) s = "";
string msg = s.ToString();
MessageBox.Show(msg);
return null;
}
*/
//private use
private object __getEnumerator(INakoFuncCallInfo info)
{
var a = info.StackPop();
if(a is NakoVariable){
a = ((NakoVariable)a).Body;
}
Type t = a.GetType();
MethodInfo mi = t.GetMethod("GetEnumerator",new Type[0]);
return mi.Invoke(a,null);
}
示例11: __dispose
private object __dispose(INakoFuncCallInfo info)
{
object e = info.StackPop();
if(e is NakoVariable){
e = ((NakoVariable)e).Body;
}
if(e is IDisposable){
((IDisposable)e).Dispose();
}
return null;
}
示例12: _cut
/// <summary>
/// 切り取る
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _cut(INakoFuncCallInfo info)
{
object sr = info.StackPop();
string a = info.StackPopAsString();
string[] delim = {a};
if(!(sr is NakoVariable)){
throw new ApplicationException("『切り取る』に変数が設定されていません");
}
object s = ((NakoVariable)sr).Body;
object ret;
if(s is string){
string[] split_s = ((string)s).Split(delim,2,StringSplitOptions.None);
if(split_s.Length==2){
ret = split_s[1];
((NakoVariable)sr).SetBodyAutoType(ret);
return split_s[0];
}
}
return null;
}
示例13: _next
//TODO:booleanにする?
public object _next(INakoFuncCallInfo info)
{
object c = info.StackPop();
if(!(c is NpgsqlConnection)){
throw new NakoPluginArgmentException("connection not found");
}
NpgsqlConnection con = (NpgsqlConnection)c;
int key = con.GetHashCode();
bool e = _rs[key].Read();
if(e==false){
_rs[key].Close();
_cmd[key].Dispose();
return 0;
}
return 1;
}
示例14: _writeLine
public object _writeLine(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
object stream = info.StackPop();
if(stream is StreamWriter){
StreamWriter filestream = (StreamWriter)stream;
filestream.WriteLine(s);
}
return null;
}
示例15: _concat
private object _concat(INakoFuncCallInfo info)
{
object ar = info.StackPop();
string s = info.StackPopAsString();
if (!(ar is NakoVarArray))
{
throw new NakoPluginRuntimeException("『結合』の引数が配列ではありません");
}
StringBuilder sb = new StringBuilder();
NakoVarArray arr = (NakoVarArray)ar;
int index = 0;
while(arr.GetValue(index)!=null){
if(index > 0) sb.Append(s);
object var = arr.GetValue(index);
if (var != null)
{
sb.Append(var.ToString());
}
index++;
}
return sb.ToString();
}