Exemple #1
0
        public virtual object line(params object[] po)
        {
            object obj = po[0];

            if (obj == null)
            {
                return(Null);
            }
            string     str = "";
            List <int> li  = new List <int>();

            for (int i = 1; i < po.Length; i++)
            {
                try { li.Add(Convert.ToInt32(PATH.getpath(po[i].ToString()))); } catch { }
            }
            if (l || h)
            {
                str = MiMFa_IOService.FileToString(PATH.getpath(obj.ToString()), li.ToArray());
            }
            else
            {
                str = MiMFa_IOService.FileToTrimedString(PATH.getpath(obj.ToString()), li.ToArray());
            }
            if (!_concatwords)
            {
                return(str + SeparateText);
            }
            return(str);
        }
Exemple #2
0
        public virtual object block(params object[] po)
        {
            object obj = po[0];

            if (obj == null)
            {
                return(Null);
            }
            string str   = "";
            int    index = Convert.ToInt32(po[1]);
            int    count = Convert.ToInt32(po[2]);

            if (l || h)
            {
                str = MiMFa_IOService.FileToString(PATH.getpath((obj.ToString())), index, count);
            }
            else
            {
                str = MiMFa_IOService.FileToTrimedString(PATH.getpath(obj.ToString()), index, count);
            }
            if (!_concatwords)
            {
                return(str + SeparateText);
            }
            return(str);
        }
Exemple #3
0
        public override object execute(object obj, int index, int length)
        {
            if (obj == null)
            {
                return(Null);
            }
            string str = "";

            if (_serialize)
            {
                return(MiMFa_IOService.OpenDeserializeFile(PATH.getpath(obj.ToString())));
            }
            else if (_longview || _humanreadable)
            {
                return(MiMFa_IOService.FileToStringArray(PATH.getpath(obj.ToString())));
            }
            else
            {
                str = MiMFa_IOService.FileToTrimedString(PATH.getpath(obj.ToString()));
            }
            if (!_concatwords && index < length - 1)
            {
                return(str + SeparateText);
            }
            return(str);
        }
Exemple #4
0
        public static object file(object address)
        {
            string addr = PATH.getpath(address);

            try
            {
                if (MCL.UserInterface is WebBrowser)
                {
                    ((WebBrowser)MCL.UserInterface).Navigate(addr);
                }
                else if (MCL.UserInterface is System.Windows.Controls.WebBrowser)
                {
                    ((System.Windows.Controls.WebBrowser)MCL.UserInterface).Navigate(addr);
                }
                else
                {
                    throw new InvalidProgramException();
                }
                HERE.current = addr;
            }
            catch
            {
                try
                { System.Diagnostics.Process.Start(addr); }
                catch { }
            }
            return(Null);
        }
Exemple #5
0
        public override object EXECUTE(params object[] po)
        {
            var copy = new COPY();

            copy._append                       = _append;
            copy._copysubdirectory             = _copysubdirectory;
            copy._create                       = _create;
            copy._nocreatedestinationdirectory = _nocreatedestinationdirectory;
            copy._serialize                    = _serialize;
            copy.main(po);
            if (po != null && po.Length > 0)
            {
                try
                {
                    string s  = PATH.getpath(source.ToString().Trim());
                    bool   sf = PATH.isfile(s);
                    if (!sf)
                    {
                        Directory.Delete(s, _copysubdirectory);//delete directory to directory
                    }
                    else
                    {
                        File.Delete(s);
                    }
                }
                catch { }
            }
            return(po);
        }
Exemple #6
0
 public virtual object file(params object[] po)
 {
     if (po == null || po.Length < 0)
     {
         return(Null);
     }
     wc.DownloadFile(po[0].ToString(), PATH.getpath(po.Last().ToString()));
     return(Null);
 }
Exemple #7
0
 public override object EXECUTE(params object[] po)
 {
     if (po != null && po.Length > 0)
     {
         var sa = MiMFa_StringService.FirstFindAndSplit(po[0].ToString(), ",");
         if (_open || o)
         {
             return(MCL.Compile(MiMFa_IOService.FileToString(PATH.getpath(MCL.Compile(sa[0])))));
         }
         else if (_save || s || sa.Length == 2)
         {
             MiMFa_IOService.StringToFile(MCL.Parse(PATH.getpath(sa[0] + extention)), MCL.CrudeText(sa[1]));
         }
     }
     return(Null);
 }
Exemple #8
0
        public object save(params object[] po)
        {
            object[] obj = new object[3] {
                new List <object>(), new MiMFa_List <Variable>(), new MiMFa_List <Function>()
            };
            bool b = !_workspacelist && !_functionslist && !_handlerslist && !h && !f && !w;

            if (_handlerslist || h)
            {
                obj[0] = MiMFa_CommandLanguage.HandlersList;
            }
            if (b || _workspacelist || w)
            {
                obj[1] = MiMFa_CommandLanguage.WorkSpaceList;
            }
            if (b || _functionslist || f)
            {
                obj[2] = MiMFa_CommandLanguage.FunctionsList;
            }
            MiMFa_IOService.SaveSerializeFile(PATH.getpath(po[0] + extention), obj);
            return(Null);
        }
Exemple #9
0
        public object load(params object[] po)
        {
            object[] obj = null;
            MiMFa_IOService.OpenDeserializeFile <object[]>(PATH.getpath(po[0] + extention), ref obj);
            bool b = !_workspacelist && !_functionslist && !_handlerslist && !h && !f && !w;

            if (_handlerslist || h)
            {
                MiMFa_CommandLanguage.HandlersList.AddRange((List <object>)obj[0]);
                MiMFa_CommandLanguage.HandlersList = MiMFa_CollectionService.Distinct(MiMFa_CommandLanguage.HandlersList);
            }
            if (b || _workspacelist || w)
            {
                MiMFa_CommandLanguage.WorkSpaceList.AddRange((MiMFa_List <Variable>)obj[1]);
                MiMFa_CommandLanguage.WorkSpaceList = MiMFa_CollectionService.Distinct(MiMFa_CommandLanguage.WorkSpaceList);
            }
            if (b || _functionslist || f)
            {
                MiMFa_CommandLanguage.FunctionsList.AddRange((MiMFa_List <Function>)obj[2]);
                MiMFa_CommandLanguage.FunctionsList = MiMFa_CollectionService.Distinct(MiMFa_CommandLanguage.FunctionsList);
            }
            return(Null);
        }
Exemple #10
0
 public override object execute(object obj, int index, int length)
 {
     return(PATH.setpath(PATH.getpath(obj + "")));
 }
Exemple #11
0
        public override object execute(object obj, int index, int length)
        {
            FileMode f = (_create) ? FileMode.OpenOrCreate : FileMode.Open;

            if (index == 0)
            {
                source = obj;
            }
            else if (obj != null && obj is string)
            {
                if (source != null && source is string)
                {
                    string s  = PATH.getpath(source.ToString().Trim());
                    string d  = PATH.getpath(obj.ToString().Trim());
                    bool   sf = PATH.isfile(s);
                    bool   df = PATH.isfile(d);
                    if (!df && !_nocreatedestinationdirectory)
                    {
                        MiMFa_Path.CreateAllDirectories(d);
                    }
                    if (!df && !sf)
                    {
                        MiMFa_Path.DirectoryCopy(s, d, _copysubdirectory);//copy directory to directory
                    }
                    else if (!df && sf)
                    {
                        File.Copy(s, d + Path.GetFileName(s));
                    }
                    else if (df && !sf)
                    {
                        throw new ArgumentException("Can not copy a directory in file!");
                    }
                    else
                    {
                        File.Copy(s, d);
                    }
                }
                else if (source != null)
                {
                    if (_serialize)
                    {
                        MiMFa_IOService.SaveSerializeFile(obj.ToString(), source, f);
                    }
                    else if (_append)
                    {
                        MiMFa_IOService.StringNewLineAppendFile(obj.ToString(), MCL.Display.Done(source), f);
                    }
                    else
                    {
                        MiMFa_IOService.StringToFile(obj.ToString(), MCL.Display.Done(source), f);
                    }
                }
                else
                {
                    throw new ArgumentNullException("Can not be null sources!");
                }
            }
            else
            {
                obj = source;
            }
            return(Null);
        }