Example #1
0
            public string homedir()
            {
                string script = ScriptBuilder.Build(
                    "return {0}.homedir();",
                    Script.GetObject(API.id)
                    );

                return(SocketronClient.ExecuteBlocking <string>(script));
            }
Example #2
0
            public long freemem()
            {
                string script = ScriptBuilder.Build(
                    "return {0}.freemem();",
                    Script.GetObject(API.id)
                    );

                return(SocketronClient.ExecuteBlocking <long>(script));
            }
Example #3
0
            public JsonObject userInfo()
            {
                string script = ScriptBuilder.Build(
                    "return {0}.userInfo();",
                    Script.GetObject(API.id)
                    );
                object result = SocketronClient.ExecuteBlocking <object>(script);

                return(new JsonObject(result));
            }
Example #4
0
        public static bool isEncoding(string encoding)
        {
            string script = ScriptBuilder.Build(
                ScriptBuilder.Script(
                    "return Buffer.isEncoding({0});"
                    ),
                encoding.Escape()
                );

            return(SocketronClient.ExecuteBlocking <bool>(script));
        }
Example #5
0
        public static bool isBuffer(JSObject obj)
        {
            string script = ScriptBuilder.Build(
                ScriptBuilder.Script(
                    "return Buffer.isBuffer({0});"
                    ),
                Script.GetObject(obj.API.id)
                );

            return(SocketronClient.ExecuteBlocking <bool>(script));
        }
Example #6
0
        public static long byteLength(Buffer value)
        {
            string script = ScriptBuilder.Build(
                ScriptBuilder.Script(
                    "return Buffer.byteLength({0});"
                    ),
                Script.GetObject(value.API.id)
                );

            return(SocketronClient.ExecuteBlocking <long>(script));
        }
Example #7
0
        public static long compare(Buffer buf1, Buffer buf2)
        {
            string script = ScriptBuilder.Build(
                ScriptBuilder.Script(
                    "return Buffer.compare({0},{1});"
                    ),
                Script.GetObject(buf1.API.id),
                Script.GetObject(buf2.API.id)
                );

            return(SocketronClient.ExecuteBlocking <long>(script));
        }
Example #8
0
        public static long byteLength(string value, string encoding = "utf8")
        {
            string script = ScriptBuilder.Build(
                ScriptBuilder.Script(
                    "return Buffer.byteLength({0},{1});"
                    ),
                value.Escape(),
                encoding
                );

            return(SocketronClient.ExecuteBlocking <long>(script));
        }
Example #9
0
            public string extname(string path)
            {
                string script = ScriptBuilder.Build(
                    ScriptBuilder.Script(
                        "var path = {0};",
                        "return path.extname({1});"
                        ),
                    Script.GetObject(API.id),
                    path.Escape()
                    );

                return(SocketronClient.ExecuteBlocking <string>(script));
            }
Example #10
0
            public string resolve(params string[] paths)
            {
                string script = ScriptBuilder.Build(
                    ScriptBuilder.Script(
                        "var path = {0};",
                        "return path.resolve({1});"
                        ),
                    Script.GetObject(API.id),
                    paths.Escape()
                    );

                return(SocketronClient.ExecuteBlocking <string>(script));
            }
Example #11
0
            public string format(JsonObject pathObject)
            {
                string script = ScriptBuilder.Build(
                    ScriptBuilder.Script(
                        "var path = {0};",
                        "return path.format({1});"
                        ),
                    Script.GetObject(API.id),
                    pathObject.Stringify()
                    );

                return(SocketronClient.ExecuteBlocking <string>(script));
            }
Example #12
0
            /*
             * public JsonObject posix {
             *      get {
             *              string script = ScriptBuilder.Build(
             *                      ScriptBuilder.Script(
             *                              "var path = {0};",
             *                              "return path.posix;"
             *                      ),
             *                      Script.GetObject(id)
             *              );
             *              object result = SocketronClient.ExecuteBlocking<object>(script);
             *              return new JsonObject(result);
             *      }
             * }
             * //*/

            public string relative(string from, string to)
            {
                string script = ScriptBuilder.Build(
                    ScriptBuilder.Script(
                        "var path = {0};",
                        "return path.relative({1},{2});"
                        ),
                    Script.GetObject(API.id),
                    from.Escape(),
                    to.Escape()
                    );

                return(SocketronClient.ExecuteBlocking <string>(script));
            }
Example #13
0
            public JsonObject parse(string path)
            {
                string script = ScriptBuilder.Build(
                    ScriptBuilder.Script(
                        "var path = {0};",
                        "return path.parse({1});"
                        ),
                    Script.GetObject(API.id),
                    path.Escape()
                    );
                object result = SocketronClient.ExecuteBlocking <object>(script);

                return(new JsonObject(result));
            }
Example #14
0
        public static Buffer transcode(Buffer source, string fromEnc, string toEnc)
        {
            if (source == null)
            {
                return(null);
            }
            string script = ScriptBuilder.Build(
                "return this.require('buffer').transcode({0},{1},{2});",
                Script.GetObject(source.API.id),
                fromEnc.Escape(),
                toEnc.Escape()
                );
            int result = SocketronClient.ExecuteBlocking <int>(script);

            return(new Buffer(SocketronClient.GetCurrent(), result));
        }