Exemplo n.º 1
0
        /// <summary>
        /// Actually copy a tree; to be called by derived class
        /// </summary>
        protected void DoCopyTree(SyncDirectoryInfo from, SyncFileDirName toFullPath)
        {
            Actioner.CreateDirectory(toFullPath.FullName);
            var toCopy = new Stack <string>();

            toCopy.Push("");
            while (toCopy.Count() > 0)
            {
                string path     = toCopy.Pop();
                string fromPath = Path.Combine(from.FullName, path);
                string toPath   = Path.Combine(toFullPath.FullName, path);
                foreach (var fileName in Directory.EnumerateFiles(fromPath))
                {
                    // fileName contains full path, so need to extract filename!
                    string name = Path.GetFileName(fileName);
                    Actioner.Copy(Path.Combine(fromPath, name), Path.Combine(toPath, name));
                }
                foreach (var dirName in Directory.EnumerateDirectories(fromPath))
                {
                    var fullDirName = Path.Combine(path, Path.GetFileName(dirName));
                    Actioner.CreateDirectory(Path.Combine(toPath, fullDirName));
                    toCopy.Push(fullDirName);
                }
            }
        }
Exemplo n.º 2
0
 public override void Remove(SyncFileInfo file)
 {
     if (Responder.SeekYes(String.Format("Delete {0}", file.FullName)))
     {
         Actioner.DeleteFile(file.FullName);
     }
 }
Exemplo n.º 3
0
        // Useful helper functions
        /// <summary>
        /// Unconditionally delete a tree; to be called by derived class after, presumably, some sort
        /// of checking code.
        /// </summary>
        protected void DoDeleteTree(SyncDirectoryInfo dir)
        {
            var toDelete = new Stack <string>();

            toDelete.Push(dir.FullName);
            var emptyDirs = new List <string>();

            while (toDelete.Count() > 0)
            {
                string path = toDelete.Pop();
                foreach (var fileName in Directory.EnumerateFiles(path))
                {
                    Actioner.DeleteFile(fileName);
                }
                foreach (var dirName in Directory.EnumerateDirectories(path))
                {
                    toDelete.Push(Path.Combine(path, dirName));
                }
                emptyDirs.Add(path);
            }
            foreach (var dirName in emptyDirs)
            {
                Actioner.DeleteDirectory(dirName);
            }
        }
Exemplo n.º 4
0
        public void ActionInstanceRights()
        {
            //Get and iterate through Action Instance Rights
            ActionInstanceRights actionInstanceRights = ManagementServer.GetActionInstanceRights();

            foreach (ActionInstanceRight right in actionInstanceRights)
            {
                string actionName = right.Name;
            }

            //Prepare Action Instance Right for saving
            ActionInstanceRight actionInstanceRight = new ActionInstanceRight();

            actionInstanceRight.Name          = "Finish"; //name must correlate directly to the name of the Action as determined in DB/Process designer
            actionInstanceRight.ActID         = 1;        //Action ID;
            actionInstanceRight.ActInstDestID = 1;        //Action Instance Destination ID
            actionInstanceRight.ActInstID     = 1;        //Action Instance ID

            // Create an actioner
            Actioner act = new Actioner();

            act.Name         = "K2:Domain\\User";
            act.ActionerType = ActionerType.User; //Or Role

            actionInstanceRight.Actioner = act;

            actionInstanceRight.EventID    = 1;    //Event ID
            actionInstanceRight.Execute    = true; //Can execute the Action;
            actionInstanceRight.ProcInstID = 1;    //Process Instance ID

            actionInstanceRights.Add(actionInstanceRight);

            //Save new Action Instance Rights
            ManagementServer.SaveActionInstanceRights(actionInstanceRights);
        }
Exemplo n.º 5
0
 public override void Replace(SyncFileInfo from, SyncFileInfo to)
 {
     if (Responder.SeekYes(String.Format("Replace {0}", to.FullName)))
     {
         Actioner.DeleteFile(to.FullName);
         Actioner.Copy(from.FullName, to.FullName);
     }
 }
Exemplo n.º 6
0
 public override void Replace(SyncFileInfo from, SyncFileInfo to)
 {
     if ((to.Origin != OriginEnum.Local) ||
         (to.Origin == OriginEnum.Local && Responder.SeekYes(String.Format("Replace {0}", to.FullName))))
     {
         Actioner.DeleteFile(to.FullName);
         Actioner.Copy(from.FullName, to.FullName);
     }
 }
Exemplo n.º 7
0
 public override void Copy(SyncFileInfo from, SyncFileDirName toFullName)
 {
     Actioner.Copy(from.FullName, toFullName.FullName);
 }
Exemplo n.º 8
0
 public override void Replace(SyncFileInfo from, SyncFileInfo to)
 {
     Actioner.DeleteFile(to.FullName);
     Actioner.Copy(from.FullName, to.FullName);
 }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            //Actioner.crearInit();

            int id = Parser.parse(args);

            switch (id)
            {
            case -6:
                Actioner.printError("reftp pull <name_remote>");
                break;

            case -5:
                Actioner.printError("reftp push <name_remote>");
                break;

            case -4:
                Actioner.printError("reftp remove <path>");
                break;

            case -3:
                Actioner.printError("reftp add <path>");
                break;

            case -2:
                Actioner.printError("reftp remote <subcommand> <name_remote>");
                break;

            case -1:
                Actioner.printError("Use 'reftp help' for a list of all commands");
                break;

            case 0:
                Actioner.printError("That command doesn't exist. Use 'reftp help' for a list of all commands");
                break;

            case 1:
                Actioner.getHelp();
                break;

            case 2:
                Actioner.crearInit();
                break;

            case 3:
                Actioner.getStatus();
                break;

            case 4:
                Actioner.remoteAdd(args[2]);
                break;

            case 5:
                Actioner.remoteRemove(args[2]);
                break;

            case 6:
                Actioner.remoteList(args[2]);
                break;

            default:
                Actioner.printError("Command not defined");
                break;
            }

            Console.ReadLine();
        }
Exemplo n.º 10
0
 public Actioner_Should()
 {
     _service      = Substitute.For <IProcessService>();
     _commandClass = Substitute.For <Actioner>(_service);
 }