/// <summary> /// Shows the new file form to create a word document /// </summary> private void showNewFileDialogForWordDoc() { _newFileNameForm = new NewFileNameForm(); _newFileNameForm.EvtDone += _newFileNameForm_EvtDone; _newFileNameForm.CreateFileType = NewFileNameForm.FileType.Word; _newFileNameForm.CreateFileDirectory = SmartPath.ACATNormalizePath(Common.AppPreferences.NewWordDocCreateFolder); _newFileNameForm.ShowDialog(); }
/// <summary> /// Shows the new file form to create a text file /// </summary> private void showNewFileDialogForTextFile() { _newFileNameForm = new NewFileNameForm(); _newFileNameForm.EvtDone += new NewFileNameForm.DoneEvent(_newFileNameForm_EvtDone); _newFileNameForm.CreateFileType = NewFileNameForm.FileType.Text; _newFileNameForm.CreateFileDirectory = SmartPath.ACATNormalizePath(Common.AppPreferences.NewTextFileCreateFolder); _newFileNameForm.Show(); }
/// <summary> /// Shows the new file form to create a text file /// </summary> private void showNewFileDialogForTextFile() { _newFileNameForm = new NewFileNameForm(); _newFileNameForm.EvtDone += _newFileNameForm_EvtDone; _newFileNameForm.CreateFileType = NewFileNameForm.FileType.Text; _newFileNameForm.CreateFileDirectory = SmartPath.ACATNormalizePath(Settings.NewTextFileCreateFolder); _newFileNameForm.ShowDialog(); }
/// <summary> /// Returns list of favorite folders. Parses the /// "FavoriteFolders" setting, normalizes it and /// returns the list of folders /// </summary> /// <returns></returns> public String[] GetFavoriteFolders() { if (String.IsNullOrEmpty(FavoriteFolders)) { return(new[] { Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) }); } return(SmartPath.ACATParseAndNormalizePaths(FavoriteFolders)); }
public void StartPath(bool run = false, uint path = 0, bool repeat = false, Unit invoker = null) { if (me.IsInCombat())// no wp movement in combat { Log.outError(LogFilter.Server, "SmartAI.StartPath: Creature entry {0} wanted to start waypoint movement while in combat, ignoring.", me.GetEntry()); return; } if (HasEscortState(SmartEscortState.Escorting)) { StopPath(); } if (path != 0) { if (!LoadPath(path)) { return; } } if (mWayPoints == null || mWayPoints.Empty()) { return; } AddEscortState(SmartEscortState.Escorting); mCanRepeatPath = repeat; SetRun(run); SmartPath wp = GetNextWayPoint(); if (wp != null) { mLastOOCPos = me.GetPosition(); me.GetMotionMaster().MovePoint(wp.id, wp.x, wp.y, wp.z); GetScript().ProcessEventsFor(SmartEvents.WaypointStart, null, wp.id, GetScript().GetPathId()); } }
// Initiate a file download void Download() { // Create variables to hold path data var dir = string.Empty; var dirs = new [] { dir }; var file = new SmartPath(Options.Download); // Get remote target path if (file.Value.Contains(Path.DirectorySeparatorChar.ToString())) { var arr = file.Value.Split(Path.DirectorySeparatorChar); dirs = arr.Reverse().Skip(1).Reverse().ToArray(); dir = string.Join( separator: Path.DirectorySeparatorChar.ToString(), values: (IEnumerable <string>)dirs ); file = new SmartPath(arr.Last()); } // Get local target path var localdir = Options.PathSpecified ? Options.Path : dir == "/" ? file.Value : new SmartPath(dir) + file.Value; // Change to the target file directory if (!string.IsNullOrEmpty(dir)) { foreach (var dirpart in dirs) { Client.CWD(dirpart); } } // Download the file Client.DownloadFile(file, localdir); }
/// <summary> /// Checks if the specified folder is valid /// Display error if is not valid /// </summary> /// <param name="folder">Name of folder</param> /// <returns>true on success</returns> private bool checkValidOrCreate(String folder) { var normalizedFolder = SmartPath.ACATNormalizePath(folder); if (Directory.Exists(normalizedFolder)) { return(true); } try { Directory.CreateDirectory(normalizedFolder); return(true); } catch (Exception) { DialogUtils.ShowTimedDialog( Context.AppPanelManager.GetCurrentForm() as Form, Resources.Error, string.Format(Resources.CouldNotCreateFolder0, normalizedFolder)); } return(false); }
void UpdatePath(uint diff) { if (!HasEscortState(SmartEscortState.Escorting)) { return; } if (mEscortInvokerCheckTimer < diff) { if (!IsEscortInvokerInRange()) { StopPath(mDespawnTime, mEscortQuestID, true); } mEscortInvokerCheckTimer = 1000; } else { mEscortInvokerCheckTimer -= diff; } // handle pause if (HasEscortState(SmartEscortState.Paused)) { if (mWPPauseTimer < diff) { if (!me.IsInCombat() && !HasEscortState(SmartEscortState.Returning) && (mWPReached || mLastWPIDReached == EventId.SmartEscortLastOCCPoint || mForcedPaused)) { GetScript().ProcessEventsFor(SmartEvents.WaypointResumed, null, mLastWP.id, GetScript().GetPathId()); RemoveEscortState(SmartEscortState.Paused); if (mForcedPaused)// if paused between 2 wps resend movement { ResumePath(); mWPReached = false; mForcedPaused = false; } if (mLastWPIDReached == EventId.SmartEscortLastOCCPoint) { mWPReached = true; } } mWPPauseTimer = 0; } else { mWPPauseTimer -= diff; } } if (HasEscortState(SmartEscortState.Returning)) { if (mWPReached)//reached OOC WP { RemoveEscortState(SmartEscortState.Returning); if (!HasEscortState(SmartEscortState.Paused)) { ResumePath(); } mWPReached = false; } } if (me.IsInCombat() || HasEscortState(SmartEscortState.Paused | SmartEscortState.Returning)) { return; } // handle next wp if (mWPReached)//reached WP { mWPReached = false; SmartPath wp = GetNextWayPoint(); if (mCurrentWPID == GetWPCount()) { EndPath(); } else if (wp != null) { SetRun(mRun); me.GetMotionMaster().MovePoint(wp.id, wp.x, wp.y, wp.z); } } }