public List <GameObject> GetUFOs(int round, ActionType type) { List <GameObject> ufos = new List <GameObject>(); var count = GetUFOCount(round); for (int i = 0; i < count; ++i) { var index = random.Next(3); var obj = factory.GetUFO(colors[index], type); obj.transform.position = GetRandomPosition(); var ufo = obj.GetComponent <UFO>(); ufo.score = GetScore(round, index); ufo.visible = true; var speed = GetSpeed(round); var direction = GetRandomDirection(type); if (type == ActionType.Kinematics) { KinematicsAction action = KinematicsAction.GetAction(direction, speed); actionManager.AddAction(obj, action); } else { PhysicsAction action = PhysicsAction.GetAction(direction, speed); actionManager.AddAction(obj, action); } ufos.Add(obj); } return(ufos); }
public void ActionSeatCustomerGroup(CustomerGroup group) { ActionSeatCustomers action = actionManager.AddAction <ActionSeatCustomers>(); if (action != null) { action.SetCustomerGroup(group); } }
/// <summary> /// Places a block if the button is being held, as long as its on the same y-axis as the first placed block. /// </summary> public void Place() { //Raycast to check if the player is pointing at a block RaycastHit hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, RaycastMask)) { //Track the blocks being placed Tracker = new BlockSpawnTracker(); ActionManager.AddAction(Tracker); //Place a new block Block b = InstantiateBlock(hit.transform.position); //Make sure new blocks can only get placed at the same y-axis Yaxis = b.transform.position.y; //Place cursor on top of the placed cube Transform grabber = b.transform.GetChild(0); Vector3 screenPos = Camera.main.WorldToScreenPoint(grabber.position); screenPos.z = 0; RectTransform rect = GetComponent <RectTransform>(); rect.anchoredPosition = screenPos; //Start multiplace StartCoroutine(_Place()); } }
private void runAction(GameObject ufo, IActionCallback callback) { var action = actionAdapter.MakeAction(ufo, callback); startedActions.Add(action); actionManager.AddAction(action); }
/// <summary> /// Upload contents recursively /// </summary> private void UploadRecursive(ShareFileClient client, int uploadId, FileSystemInfo source, Models.Item target, ActionType actionType) { if (source is DirectoryInfo) { var newFolder = new Models.Folder() { Name = source.Name }; bool isExist = false; if (Synchronize) { try { string path = String.Format("/{0}", source.Name); Item item = null; try { item = client.Items.ByPath(target.url, path).Execute(); } catch (ODataException e) { if (e.Code != System.Net.HttpStatusCode.NotFound) { throw e; } } if (item != null && item is Folder) { isExist = true; newFolder = (Folder)item; } } catch { } } if (!isExist) { newFolder = client.Items.CreateFolder(target.url, newFolder, OverWrite, false).Execute(); } ActionManager actionManager = new ActionManager(this, source.Name); foreach (var fsInfo in ((DirectoryInfo)source).EnumerateFileSystemInfos()) { if (fsInfo is DirectoryInfo && Recursive) { UploadRecursive(client, uploadId, fsInfo, newFolder, actionType); } else if (fsInfo is FileInfo) { IAction uploadAction = new UploadAction(FileSupport, client, fsInfo, newFolder, Details, actionType); actionManager.AddAction(uploadAction); } } actionManager.Execute(); } }
/// <summary> /// Download all items recursively /// </summary> private void DownloadRecursive(ShareFileClient client, int downloadId, Models.Item source, DirectoryInfo target, ActionType actionType) { if (source is Models.Folder) { var subdir = CreateLocalFolder(target, source as Folder); var children = client.Items.GetChildren(source.url).Execute(); if (children != null) { ActionManager actionManager = new ActionManager(); foreach (var child in children.Feed) { if (child is Models.Folder && Recursive) { DownloadRecursive(client, downloadId, child, subdir, actionType); } else if (child is Models.File) { DownloadAction downloadAction = new DownloadAction(FileSupport, client, downloadId, (Models.File)child, subdir, actionType); actionManager.AddAction(downloadAction); } } actionManager.Execute(); } } }
/// <summary> /// Start Upload to Sharefile location /// </summary> private void StartUpload(ShareFileClient client, int uploadId, Models.Item target, ICollection <string> resolvedPaths, ActionType actionType) { int transactionId = new Random((int)DateTime.Now.Ticks).Next(); Logger.Instance.Info("Uploading files to ShareFile server."); ActionManager actionManager = new ActionManager(); bool firstIteration = true; foreach (string path in resolvedPaths) { FileAttributes attr = System.IO.File.GetAttributes(path); FileSystemInfo source = ((attr & FileAttributes.Directory) == FileAttributes.Directory) ? new DirectoryInfo(path) : source = new FileInfo(path); // create an extra parent folder if CreateRoot flag is specified on target location if (firstIteration && CreateRoot) { DirectoryInfo parentFolder = Directory.GetParent(path); var newFolder = new Models.Folder() { Name = parentFolder.Name }; target = client.Items.CreateFolder(target.url, newFolder, OverWrite, false).Execute(); firstIteration = false; } if (source is DirectoryInfo) { UploadRecursive(client, uploadId, source, target, actionType); } else { IAction uploadAction = new UploadAction(FileSupport, client, source, target, Details, actionType); actionManager.AddAction(uploadAction); } } actionManager.Execute(); if (Move) { foreach (string path in resolvedPaths) { FileAttributes attr = System.IO.File.GetAttributes(path); FileSystemInfo source = ((attr & FileAttributes.Directory) == FileAttributes.Directory) ? new DirectoryInfo(path) : source = new FileInfo(path); if (Strict && source is DirectoryInfo) { DeleteSharefileStrictRecursive(client, source as DirectoryInfo, target); } DeleteLocalItemRecursive(source, Recursive); } } }
public void EnsureActionsCanBeQueuedAfterInitialLoad() { // Arrange Mock <ILog> mockLogger = new Mock <ILog>(); List <Task> tasks = new List <Task>(); List <string> results = new List <string>(); Task taskA = new Task(() => results.Add("A")); Task taskB = new Task(() => results.Add("B")); tasks.Add(taskA); tasks.Add(taskB); // Act IActionManager manager = new ActionManager(tasks, mockLogger.Object); Task[] tasksFromQueue = manager.GetTasks(); Assert.AreEqual(2, tasksFromQueue.Length); Task taskC = new Task(() => results.Add("C")); manager.AddAction(taskC); tasksFromQueue = manager.GetTasks(); Assert.AreEqual(3, tasksFromQueue.Length); manager.RunActions(); Assert.AreEqual("A", results[0]); Assert.AreEqual("B", results[1]); Assert.AreEqual("C", results[2]); // Assert Assert.AreEqual(0, manager.GetQueueCount()); // empty at this point so show that we can queue again manager.AddAction(taskC); tasksFromQueue = manager.GetTasks(); Assert.AreEqual(1, tasksFromQueue.Length); }
public void AddCacheReq(Vector3 pos) { if (!VoxelVolumes.ContainsKey(new IntVector3(pos))) { return; } ActionDelegate action = new ActionDelegate(this, new ActionEventHandler(OnChunkAddedEvent), new ChunkEventArgs(pos)); ActionManager.AddAction(action); }
/// <summary> /// Gets the import manager. /// </summary> /// <returns></returns> private ImportManager GetImportManager() { ImportManager importManager = Page.Session["importManager"] as ImportManager; if (importManager != null && importManager.ActionManager == null) { ActionManager actionManager = new ActionManager(); actionManager.AddAction(new ActionAddNote("AddNote", GetLocalResourceObject("Action_AddNote.Caption").ToString(), false)); actionManager.AddAction(new ActionAddResponse("AddResponse", GetLocalResourceObject("Action_AddResponse.Caption").ToString(), false)); actionManager.AddAction(new ActionAddTarget("AddTarget", GetLocalResourceObject("Action_AddTarget.Caption").ToString(), false)); actionManager.AddAction(new ActionScheduleActivity("SchedulePhoneCall", GetLocalResourceObject("SchedulePhoneCall.Caption"). ToString(), false, ActivityType.atPhoneCall)); actionManager.AddAction(new ActionScheduleActivity("ScheduleMeeting", GetLocalResourceObject("ScheduleMeeting.Caption"). ToString(), false, ActivityType.atAppointment)); actionManager.AddAction(new ActionScheduleActivity("ScheduleToDo", GetLocalResourceObject("ScheduleToDo.Caption").ToString(), false, ActivityType.atToDo)); importManager.ActionManager = actionManager; } return(importManager); }
private IEnumerator TestTrigger() { // Schedule event to be triggered one second later after start method is called yield return(new WaitForSeconds(1f)); Debug.Log("Event triggered"); // Trigger event to run subscribed methods ActionManager.TriggerAction(Events.ActionManagerTestEvent); ActionManager.RemoveListener(Events.ActionManagerTestEvent, TestMethod); // You can see this action with its own name from ActionManagerDebugger window with clicking to ConnectedEventId button ActionManager.AddAction(Events.ConnectedEventId, ConnectedMethodExample); ActionManager.SaveIdentifierStatus(); }
void Start() { _direction = new ReactiveProperty <Vector2>(); Observable.EveryUpdate().Where(x => HasAxist()).Subscribe(x => SetDirection()); _direction.Where(dir => dir != Vector2.zero).Subscribe(dir => { if (!_actionManager.HasActive(_entity)) { _actionManager.AddAction(_entity, new MoveAction(dir)); } }); }
//Use when adding a singular target to the project (from the user) public void AddNote(float x, float y) { SNoteData data = new SNoteData { x = x, y = y, noteType = SNoteType.LeftHanded, beatTime = GetClosestBeatSnapped(DurationToBeats(time)) }; //data.noteType = EditorInput.selectedHand; //float tempTime = GetClosestBeatSnapped(DurationToBeats(time)); /*foreach (SNote target in orderedNotes) { * if (Mathf.Approximately(target.data.beatTime, tempTime) && * (target.data.handType == EditorInput.selectedHand) && * (EditorInput.selectedTool != EditorTool.Melee)) return; * }*/ var action = new NSActionAddNote { noteData = data }; _actionManager.AddAction(action); }
/// <summary> /// Removes a block if the player is pointing at one /// </summary> public void Remove() { //Raycast on the cursor position //Check if a block is hit RaycastHit hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, RaycastMask)) { //Disable the block Block b = hit.transform.GetComponentInParent <Block>(); b.Toggle(); //Add the block to undo list ActionManager.AddAction(new DestroyedBlock(b)); } }
private void RecursiveDownload(ShareFileClient client, int downloadId, Models.Item source, DirectoryInfo target) { if (source is Models.Folder) { var children = client.Items.GetChildren(source.url).Execute(); var subdirCheck = new DirectoryInfo(System.IO.Path.Combine(target.FullName, source.FileName)); if (subdirCheck.Exists && !Force && !ResumeSupport.IsPending) { throw new IOException("Path " + subdirCheck.FullName + " already exists. Use -Force to ignore"); } var subdir = target.CreateSubdirectory(source.FileName); if (children != null) { ActionManager actionManager = new ActionManager(this, source.FileName); foreach (var child in children.Feed) { if (child is Models.Folder) { RecursiveDownload(client, downloadId, child, subdir); } else if (child is Models.File) { if (!ResumeSupport.IsPending || !ResumeSupport.CheckFileStatus(child.FileName)) { ActionType actionType = Force || ResumeSupport.IsPending ? ActionType.Force : ActionType.None; DownloadAction downloadAction = new DownloadAction(FileSupport, client, downloadId, (Models.File)child, subdir, actionType); actionManager.AddAction(downloadAction); } } } actionManager.Execute(); } } else if (source is Models.File) { ActionManager actionManager = new ActionManager(this, source.FileName); if (!ResumeSupport.IsPending || !ResumeSupport.CheckFileStatus(source.FileName)) { ActionType actionType = Force || ResumeSupport.IsPending ? ActionType.Force : ActionType.None; DownloadAction downloadAction = new DownloadAction(FileSupport, client, downloadId, (Models.File)source, target, actionType); actionManager.AddAction(downloadAction); } actionManager.Execute(); } }
public void Paint() { //Check if a block is hit RaycastHit hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, RaycastMask)) { Block block = hit.transform.GetComponentInParent <Block>(); Tracker = new PaintTracker(block.Colour); ActionManager.AddAction(Tracker); block.Paint(CurrentColour); Tracker.AddBlock(block); StartCoroutine(_Painting()); } }
IEnumerator _Grab() { //Instantiate a preview of the block InstantiatePreview(GrabbedBlock.transform.position); while (Active && Joycons.A) { //Raycast on the cursor position //Check if a block is hit RaycastHit hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, MoveMask)) { //Move the preview Preview.transform.position = hit.transform.position; } Debug.DrawLine(transform.position, transform.TransformDirection(Vector3.forward) * 100, Color.yellow, 3); //Rotate the preview left or right if (Joycons.LeftBumper) { Rotation -= Vector3.up * 90; Preview.transform.rotation = Quaternion.Euler(Rotation); } else if (Joycons.RightBumper) { Rotation += Vector3.up * 90; Preview.transform.rotation = Quaternion.Euler(Rotation); } yield return(null); } //Add the action to the actionlist ActionManager.AddAction(new PositionTracker(GrabbedBlock, GrabbedBlock.transform.position)); //Place the grabbed block on the preview position GrabbedBlock.transform.position = Preview.transform.position; GrabbedBlock.transform.rotation = Quaternion.Euler(Rotation); GrabbedBlock.Toggle(); //Destroy the preview and reset the grabber Destroy(Preview.gameObject); GrabbedBlock = null; Rotation = Vector3.zero; }
private void RecursiveUpload(ShareFileClient client, int uploadId, FileSystemInfo source, Models.Item target) { if (source is DirectoryInfo) { var newFolder = new Models.Folder() { Name = source.Name }; newFolder = client.Items.CreateFolder(target.url, newFolder, Force || ResumeSupport.IsPending, false).Execute(); ActionManager actionManager = new ActionManager(this, source.Name); ActionType actionType = Force ? ActionType.Force : ActionType.None; foreach (var fsInfo in ((DirectoryInfo)source).EnumerateFileSystemInfos()) { if (fsInfo is DirectoryInfo) { RecursiveUpload(client, uploadId, fsInfo, newFolder); } else if (fsInfo is FileInfo) { if (!ResumeSupport.IsPending || !ResumeSupport.CheckFileStatus(fsInfo.Name)) { IAction uploadAction = new UploadAction(FileSupport, client, fsInfo, newFolder, Details, actionType); actionManager.AddAction(uploadAction); } } } actionManager.Execute(); } else if (source is FileInfo) { ActionManager actionManager = new ActionManager(this, source.Name); if (!ResumeSupport.IsPending || !ResumeSupport.CheckFileStatus(source.Name)) { ActionType actionType = Force || ResumeSupport.IsPending ? ActionType.Force : ActionType.None; IAction uploadAction = new UploadAction(FileSupport, client, source, target, Details, actionType); actionManager.AddAction(uploadAction); } actionManager.Execute(); } }
// Start is called before the first frame update private void Start() { // Call this once for initializing action manager // when recalled all subscribed events will be erased ActionManager.Init(typeof(Events)); // Subscribe to ActionManagerTestEvent with desired Action<> ActionManager.AddAction(Events.ActionManagerTestEvent, TestMethod); // This method will be visible in ActionManagerDebugger window but because it is an anonymous method name won't be something understandable // Because of that avoiding anonymous methods is advised ActionManager.AddAction(Events.ActionManagerExampleEvent, () => Debug.Log("Never triggered event")); ActionManager.AddAction(Events.ActionManagerExampleEvent, () => Debug.Log("Never triggered event")); ActionManager.AddAction(Events.ActionManagerExampleEvent, () => Debug.Log("Never triggered event")); // This anonymous event submissions will be visible in debugger window separately ActionManager.ClearListener(0); // Start timed event for triggering event StartCoroutine(TestTrigger()); }
void LoadAction(XmlNode npcNode) { Action newAction = new Action(); XmlNodeList factionChildNodes = npcNode.ChildNodes; foreach (XmlNode node in factionChildNodes) { if (node.Name == "Name") { LoadName(node, newAction); } if (node.Name == "Requires") { LoadRequirement(node, newAction); } } ActionManager.AddAction(newAction); }
/// <summary> /// Start download process /// </summary> private void StartDownload(ShareFileClient client, PSDriveInfo driveInfo, ICollection <string> resolvedPaths, ActionType actionType) { int transactionId = new Random((int)DateTime.Now.Ticks).Next(); ActionManager actionManager = new ActionManager(this, string.Empty); bool firstIteration = true; var shareFileItems = new List <Item>(); foreach (string path in resolvedPaths) { var item = Utility.ResolveShareFilePath(driveInfo, path); if (item == null) { throw new FileNotFoundException(string.Format("Source path '{0}' not found on ShareFile server.", path)); } var target = new DirectoryInfo(LocalPath); if (!target.Exists) { throw new Exception(string.Format("Destination '{0}' path not found on local drive.", LocalPath)); } // if create root folder flag is specified then create a container folder first if (firstIteration && CreateRoot) { Models.Folder parentFolder = client.Items.GetParent(item.url).Execute() as Folder; target = CreateLocalFolder(target, parentFolder); firstIteration = false; } if (item is Models.Folder) { // if user downloading the root drive then download its root folders if ((item as Folder).Info.IsAccountRoot.GetValueOrDefault()) { var children = client.Items.GetChildren(item.url) .Select("Id") .Select("url") .Select("FileName") .Select("FileSizeBytes") .Select("Hash") .Select("Info") .Execute(); foreach (var child in children.Feed) { if (child is Models.Folder) { DownloadRecursive(client, transactionId, child, target, actionType); shareFileItems.Add(child); } } } else { DownloadRecursive(client, transactionId, item, target, actionType); shareFileItems.Add(item); } } else if (item is Models.File) { DownloadAction downloadAction = new DownloadAction(FileSupport, client, transactionId, (Models.File)item, target, actionType); actionManager.AddAction(downloadAction); shareFileItems.Add(item); } } actionManager.Execute(); // if strict flag is specified then also clean the target files which are not in source if (Strict) { var target = new DirectoryInfo(LocalPath); var directories = target.GetDirectories(); foreach (string path in resolvedPaths) { var item = Utility.ResolveShareFilePath(driveInfo, path); if (item is Folder) { foreach (DirectoryInfo directory in directories) { if (directory.Name.Equals(item.Name)) { DeleteLocalStrictRecursive(client, item, directory); break; } } } } } // on move remove source files if (Move) { foreach (var item in shareFileItems) { DeleteShareFileItemRecursive(client, item, Recursive); } } }
public void AddAction(BaseAction action, bool forced = false) { ActionManager.AddAction(this, action, forced); }
/// <summary> /// Gets the import manager. /// </summary> /// <returns></returns> private ImportManager GetImportManager() { ImportManager importManager = Page.Session["importManager"] as ImportManager; if (importManager != null && importManager.ActionManager == null) { ActionManager actionManager = new ActionManager(); actionManager.AddAction(new ActionAddNote("AddNote", GetLocalResourceObject("Action_AddNote.Caption").ToString(), false)); actionManager.AddAction(new ActionAddResponse("AddResponse", GetLocalResourceObject("Action_AddResponse.Caption").ToString(), false)); actionManager.AddAction(new ActionAddTarget("AddTarget", GetLocalResourceObject("Action_AddTarget.Caption").ToString(), false)); actionManager.AddAction(new ActionScheduleActivity("SchedulePhoneCall", GetLocalResourceObject("SchedulePhoneCall.Caption"). ToString(), false, ActivityType.atPhoneCall)); actionManager.AddAction(new ActionScheduleActivity("ScheduleMeeting", GetLocalResourceObject("ScheduleMeeting.Caption"). ToString(), false, ActivityType.atAppointment)); actionManager.AddAction(new ActionScheduleActivity("ScheduleToDo", GetLocalResourceObject("ScheduleToDo.Caption").ToString(), false, ActivityType.atToDo)); importManager.ActionManager = actionManager; } return importManager; }
void AddAction(ActionHandler ah) { actionManager.AddAction(ah); }
/// <summary> /// Start download process /// </summary> private void StartDownload(ShareFileClient client, PSDriveInfo driveInfo, ICollection<string> resolvedPaths, ActionType actionType) { int transactionId = new Random((int)DateTime.Now.Ticks).Next(); ActionManager actionManager = new ActionManager(this, string.Empty); bool firstIteration = true; var shareFileItems = new List<Item>(); foreach (string path in resolvedPaths) { var item = Utility.ResolveShareFilePath(driveInfo, path); if (item == null) { throw new FileNotFoundException(string.Format("Source path '{0}' not found on ShareFile server.", path)); } var target = new DirectoryInfo(LocalPath); if (!target.Exists) { throw new Exception(string.Format("Destination '{0}' path not found on local drive.", LocalPath)); } // if create root folder flag is specified then create a container folder first // KA - Fix. When CreateRoot is used and the source item is a folder we should NOT create the parent of that folder. // This possibly fixes another unknown scenario when the root folder is specified as the source. if (firstIteration && CreateRoot && !(item is Models.Folder)) { Models.Folder parentFolder = client.Items.GetParent(item.url).Execute() as Folder; target = CreateLocalFolder(target, parentFolder); firstIteration = false; } if (item is Models.Folder) { // if user downloading the root drive then download its root folders // KA - Fix. We should also process only subfolders and files if CreateRoot is not used and source is a folder. // This prevents DownloadRecursive from creating the parent folder in conditions where CreateRoot is not specified. // Code adapted from DownloadRecursive function and processes both file sources and folder sources appropriately now. // if ((item as Folder).Info.IsAccountRoot.GetValueOrDefault()) if ((item as Folder).Info.IsAccountRoot.GetValueOrDefault() || !CreateRoot) { var children = client.Items.GetChildren(item.url) .Select("Id") .Select("url") .Select("FileName") .Select("FileSizeBytes") .Select("Hash") .Select("Info") .Execute(); if (children != null) { (item as Folder).Children = children.Feed; foreach (var child in children.Feed) { child.Parent = item; if (child is Models.Folder && ((item as Folder).Info.IsAccountRoot.GetValueOrDefault() || Recursive)) { DownloadRecursive(client, transactionId, child, target, actionType); shareFileItems.Add(child); } else if (child is Models.File) { DownloadAction downloadAction = new DownloadAction(FileSupport, client, transactionId, (Models.File)child, target, actionType); actionManager.AddAction(downloadAction); } } if (!(item as Folder).Info.IsAccountRoot.GetValueOrDefault()) { shareFileItems.Add(item); } } } else { DownloadRecursive(client, transactionId, item, target, actionType); shareFileItems.Add(item); } } else if (item is Models.File) { DownloadAction downloadAction = new DownloadAction(FileSupport, client, transactionId, (Models.File)item, target, actionType); actionManager.AddAction(downloadAction); shareFileItems.Add(item); } } actionManager.Execute(); // if strict flag is specified then also clean the target files which are not in source if (Strict) { var target = new DirectoryInfo(LocalPath); var directories = target.GetDirectories(); foreach (string path in resolvedPaths) { var item = Utility.ResolveShareFilePath(driveInfo, path); if (item is Folder) { foreach (DirectoryInfo directory in directories) { if (directory.Name.Equals(item.Name)) { DeleteLocalStrictRecursive(client, item, directory); break; } } } } } // on move remove source files if (Move) { foreach(var item in shareFileItems) { // KA - Fix. Replaced 'Recursive' with '!KeepFolders'. This prevents "Move" from deleting folders even when KeepFolders is specified. // This fixes the bug that causes the source folder to be deleted in all scenarios where "Move" is specified and it does not contain children. // DeleteShareFileItemRecursive(client, item, Recursive); DeleteShareFileItemRecursive(client, item, !KeepFolders); } } }
/// <summary> /// Start download process /// </summary> private void StartDownload(ShareFileClient client, PSDriveInfo driveInfo, ICollection <string> resolvedPaths, ActionType actionType) { int transactionId = new Random((int)DateTime.Now.Ticks).Next(); Logger.Instance.Info("Downloading files from ShareFile server."); ActionManager actionManager = new ActionManager(); bool firstIteration = true; foreach (string path in resolvedPaths) { var item = ShareFileProvider.GetShareFileItem((ShareFileDriveInfo)driveInfo, path, null, null); // if user didn't specify the Sharefile HomeFolder in path then append in path // e.g. if user tries sf:/Folder1 as sharefile source then resolve this path to sf:/My Files & Folders/Folder1 if (item == null && !path.StartsWith(String.Format(@"\{0}\", DefaultSharefileFolder))) { string updatedPath = String.Format(@"\{0}\{1}", DefaultSharefileFolder, path); item = ShareFileProvider.GetShareFileItem((ShareFileDriveInfo)driveInfo, updatedPath, null, null); } var target = new DirectoryInfo(LocalPath); // if create root folder flag is specified then create a container folder first if (firstIteration && CreateRoot) { Models.Folder parentFolder = client.Items.GetParent(item.url).Execute() as Folder; target = CreateLocalFolder(target, parentFolder); firstIteration = false; } if (item is Models.Folder) { // if user downloading the root drive then download its root folders if ((item as Folder).Info.IsAccountRoot == true) { var children = client.Items.GetChildren(item.url).Execute(); foreach (var child in children.Feed) { if (child is Models.Folder) { DownloadRecursive(client, transactionId, child, target, actionType); } } } else { DownloadRecursive(client, transactionId, item, target, actionType); } } else if (item is Models.File) { DownloadAction downloadAction = new DownloadAction(FileSupport, client, transactionId, (Models.File)item, target, actionType); actionManager.AddAction(downloadAction); } } actionManager.Execute(); // on move remove source files if (Move) { foreach (string path in resolvedPaths) { var item = ShareFileProvider.GetShareFileItem((ShareFileDriveInfo)driveInfo, path, null, null); var target = new DirectoryInfo(LocalPath); // if strict flag is specified then also clean the target files which are not in source if (Strict) { DeleteLocalStrictRecursive(client, item, target); } DeleteShareFileItemRecursive(client, item, CreateRoot && Recursive); } } }