本文整理汇总了C#中INakoFuncCallInfo.StackPopAsString方法的典型用法代码示例。如果您正苦于以下问题:C# INakoFuncCallInfo.StackPopAsString方法的具体用法?C# INakoFuncCallInfo.StackPopAsString怎么用?C# INakoFuncCallInfo.StackPopAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INakoFuncCallInfo
的用法示例。
在下文中一共展示了INakoFuncCallInfo.StackPopAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _abort
// Define Method
public object _abort(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
foreach(System.Diagnostics.Process p in System.Diagnostics.Process.GetProcessesByName(s)){
p.Kill();
}
return null;
}
示例2: _decode
public object _decode(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
var json = fastJSON.JSON.Instance.Parse(s);
NakoVarArray a = ArrayToNakoVarArray(json);
return a;
// System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
// object json = serializer.Deserialize<object>(s);
}
示例3: _eval
// Define Method
public Object _eval(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
NakoCompiler compiler = new NakoCompiler();
compiler.DirectSource = s;
NakoInterpreter runner = new NakoInterpreter(compiler.Codes);
runner.Run();
Console.WriteLine("EVALLOG=" + runner.PrintLog);
return runner.globalVar.GetValue(0);
}
示例4: _directoryDialog
public Object _directoryDialog(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
FolderBrowserDialog fbd = new FolderBrowserDialog();
//RootFolderには特殊フォルダしか指定できないのでとりあえずSelectedPathで代用
fbd.SelectedPath = s;
//ダイアログを表示する
if (fbd.ShowDialog() == DialogResult.OK)
{
//OKボタンがクリックされたとき
return fbd.SelectedPath;
}
return null;
}
示例5: _uppercase
private object _uppercase(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
return s.ToUpper();
}
示例6: _toKana
private object _toKana(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
if(NWEnviroment.isWindows()){
return Strings.StrConv(s, VbStrConv.Hiragana, 0);
}else{
return LinuxCommand.execute("echo '"+s+"' | nkf --hiragana").Replace("\n","");
}
}
示例7: _search
/// <summary>
/// 文字列検索
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _search(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
string needle = info.StackPopAsString();
return s.IndexOf(needle) + 1;
}
示例8: _replace_a
/// <summary>
/// 単置換
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _replace_a(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
string search = info.StackPopAsString();
string replace = info.StackPopAsString();
int index = s.IndexOf(search);
string pre = s.Substring(0,index);
string post = s.Substring(index+search.Length);
return pre + replace + post;
}
示例9: _occurrence
private object _occurrence(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
string search = info.StackPopAsString();
return (int)((s.Length - s.Replace(search,"").Length)/search.Length);
}
示例10: _length
// Define Method
/// <summary>
/// 文字列の長さを調べる
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _length(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
return s.Length;
}
示例11: _append
/// <summary>
/// 文字列に追加する
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _append(INakoFuncCallInfo info)
{
object sr = info.StackPop();
object s = ((NakoVariable)sr).Body;
string a = info.StackPopAsString();
string ret = (string)s + a;
((NakoVariable)sr).SetBodyAutoType(ret);
return null;
}
示例12: _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();
}
示例13: _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;
}
示例14: _open
// Define Method
public object _open(INakoFuncCallInfo info)
{
string fileName = info.StackPopAsString();
string mode = info.StackPopAsString();
switch (mode) {
case "作":
return new FileStream(fileName,FileMode.Create);
case "読":
return new StreamReader(fileName);
case "書":
return new StreamWriter(fileName);
default:
return new StreamReader(fileName);
}
}
示例15: _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;
}