示例#1
0
        public override CommandResult Invoke(Guid group, int id, object inputArg, ref object outputArg)
        {
            var settings    = _interactiveWorkflow.Shell.GetService <IRSettings>();
            var initialPath = settings.WorkingDirectory != null?PathHelper.EnsureTrailingSlash(settings.WorkingDirectory) : null;

            var file = _interactiveWorkflow.Shell.FileDialog().ShowOpenFileDialog(Resources.HistoryFileFilter, initialPath, Resources.LoadHistoryTitle);

            if (file != null)
            {
                _history.TryLoadFromFile(file);
            }
            return(CommandResult.Executed);
        }
示例#2
0
        public override CommandResult Invoke(Guid group, int id, object inputArg, ref object outputArg)
        {
            var initialPath = RToolsSettings.Current.WorkingDirectory != null?PathHelper.EnsureTrailingSlash(RToolsSettings.Current.WorkingDirectory) : null;

            var file = _appShell.FileDialog.ShowOpenFileDialog(Resources.HistoryFileFilter, initialPath, Resources.LoadHistoryTitle);

            if (file != null)
            {
                _history.TryLoadFromFile(file);
            }

            return(CommandResult.Executed);
        }
示例#3
0
        internal string GetFullPathName(string friendlyName)
        {
            string folder = friendlyName;

            if (friendlyName == null)
            {
                return(folder);
            }

            if (!friendlyName.StartsWithIgnoreCase("~"))
            {
                return(folder);
            }

            if (friendlyName.EqualsIgnoreCase("~"))
            {
                return(UserDirectory);
            }

            return(PathHelper.MakeRooted(PathHelper.EnsureTrailingSlash(UserDirectory), friendlyName.Substring(2)));
        }
示例#4
0
 internal string GetFriendlyDirectoryName(string directory)
 {
     if (!string.IsNullOrEmpty(UserDirectory))
     {
         if (directory.EndsWithOrdinal("\\") && !directory.EndsWithOrdinal(":\\"))
         {
             directory = directory.Substring(0, directory.Length - 1);
         }
         if (directory.StartsWithIgnoreCase(UserDirectory))
         {
             var relativePath = PathHelper.MakeRelative(UserDirectory, directory);
             if (relativePath.Length > 0)
             {
                 return("~/" + relativePath.Replace('\\', '/'));
             }
             return("~");
         }
         return(directory.Replace('\\', '/'));
     }
     return(directory);
 }