Example #1
0
        public string GetString(ArrayInstance array, object index, object count)
        {
            if (array != null && (index is Undefined || count is Undefined))
            {
                return(encoding.GetString(array.ToArray <byte>(encoding)));
            }

            else if (array != null && (index is int && count is int))
            {
                return(encoding.GetString(array.ToArray <byte>(encoding), (int)index, (int)count));
            }

            return(string.Empty);
        }
Example #2
0
        public bool AppendLines(object a, ArrayInstance b)
        {
            if (b != null && (a is String || a is ConcatenatedString))
            {
                string path = Path.Combine(script.Directory, a.ToString());

                System.IO.File.AppendAllLines(path, b.ToArray <string>());
                return(true);
            }

            return(false);
        }
Example #3
0
        public bool WriteLines(object a, ArrayInstance b)
        {
            if (b != null && (a is String || a is ConcatenatedString))
            {
                string path = Path.Combine(Jurassic.Self.Directory, "Scripts", script.Name, a.ToString());

                System.IO.File.WriteAllLines(path, b.ToArray <string>());
                return(true);
            }

            return(false);
        }
Example #4
0
        public bool AppendLines(object a, ArrayInstance b)
        {
            if (b != null && (a is String || a is ConcatenatedString))
            {
                string path = Path.Combine(Jurassic.Self.Directory, "Scripts", script.Name, a.ToString());

                if (!System.IO.File.Exists(path))
                {
                    System.IO.File.Create(path).Dispose();
                }

                System.IO.File.AppendAllLines(path, b.ToArray <string>());
                return(true);
            }

            return(false);
        }