コード例 #1
0
        public static NeoValue Exists(NeoValue[] args)
        {
            if (args.Length != 1)
            {
                throw new NeoError("exists expects a single string argument");                              //@TODO @Untested
            }
            var path = args[0].CheckString().Value;

            return(NeoBool.ValueOf(File.Exists(Path.GetFullPath(path))));
        }
コード例 #2
0
ファイル: FFILib.cs プロジェクト: sci4me/Neo-old
 public static NeoValue ToNeo(object v)
 {
     if (v == null)
     {
         return(NeoNil.NIL);
     }
     else if (v is Int32 i)
     {
         return(NeoInt.ValueOf(i));
     }
     else if (v is Int64 l)
     {
         return(NeoInt.ValueOf((int)l));
     }
     else if (v is Single f)
     {
         return(NeoFloat.ValueOf(f));
     }
     else if (v is Double d)
     {
         return(NeoFloat.ValueOf(d));
     }
     else if (v is Boolean b)
     {
         return(NeoBool.ValueOf(b));
     }
     else if (v is String s)
     {
         return(NeoString.ValueOf(s));
     }
     else if (v is object[] a)
     {
         // @TODO: is this where we want to do this? or do we just want an FFITypeProxy?
         var r = new NeoArray();
         foreach (object o in a)
         {
             r.Insert(ToNeo(o));
         }
         return(r);
     }
     else if (v is Dictionary <object, object> m)
     {
         throw new NotImplementedException();
     }
     else
     {
         return(new FFITypeProxy(v));
     }
 }