예제 #1
0
 public override object EXECUTE(params object[] po)
 {
     if (_print)
     {
         return(MiMFa_IOService.FileToString(MCL.Address.Constructor));
     }
     else if (_delete && _all)
     {
         MiMFa_IOService.ClearFileContent(MCL.Address.Constructor);
     }
     else if (po != null && po.Length > 0)
     {
         string cmd = MCL.CrudeText(Normalization(po[0].ToString()).Replace("  ", " ")) + ";";
         if (_delete)
         {
             MiMFa_IOService.StringRemoveFromFile(MCL.Address.Constructor, cmd + ";");
         }
         else
         {
             MiMFa_IOService.StringNewLineAppendFile(MCL.Address.Constructor, cmd);
             MCL.Parse(cmd);
         }
     }
     return(Null);
 }
예제 #2
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);
        }