Пример #1
0
		/// <summary>
		/// Gets the full path of ILSpy.exe, asking the user for it if it
		/// has not been set.
		/// </summary>
		/// <param name="owner">The owner for the path selection dialog, if it is needed.</param>
		/// <returns>The full path of ILSpy.exe, or <c>null</c> if the path was unknown and the user cancelled the path selection dialog.</returns>
		internal static string GetILSpyExeFullPathInteractive()
		{
			string path = PropertyService.Get(ILSpyExePathPropertyName);
			string askReason = null;
			
			if (String.IsNullOrEmpty(path)) {
				askReason = ResourceService.GetString("ILSpyAddIn.ILSpyPathNotSet");
			} else if (!File.Exists(path)) {
				askReason = ResourceService.GetString("ILSpyAddIn.ILSpyDoesNotExist");
			}
			
			if (askReason != null) {
				using(SetILSpyPathDialog dialog = new SetILSpyPathDialog(path, askReason)) {
					
					if (dialog.ShowDialog(WorkbenchSingleton.MainWin32Window) != DialogResult.OK || !File.Exists(dialog.SelectedFile)) {
						return null;
					}
					
					path = dialog.SelectedFile;
					PropertyService.Set(ILSpyExePathPropertyName, path);
					
				}
			}
			
			return path;
		}
Пример #2
0
        /// <summary>
        /// Gets the full path of ILSpy.exe, asking the user for it if it
        /// has not been set.
        /// </summary>
        /// <param name="owner">The owner for the path selection dialog, if it is needed.</param>
        /// <returns>The full path of ILSpy.exe, or <c>null</c> if the path was unknown and the user cancelled the path selection dialog.</returns>
        internal static string GetILSpyExeFullPathInteractive()
        {
            string path      = PropertyService.Get(ILSpyExePathPropertyName);
            string askReason = null;

            if (String.IsNullOrEmpty(path))
            {
                askReason = ResourceService.GetString("ILSpyAddIn.ILSpyPathNotSet");
            }
            else if (!File.Exists(path))
            {
                askReason = ResourceService.GetString("ILSpyAddIn.ILSpyDoesNotExist");
            }

            if (askReason != null)
            {
                using (SetILSpyPathDialog dialog = new SetILSpyPathDialog(path, askReason)) {
                    if (dialog.ShowDialog(WorkbenchSingleton.MainWin32Window) != DialogResult.OK || !File.Exists(dialog.SelectedFile))
                    {
                        return(null);
                    }

                    path = dialog.SelectedFile;
                    PropertyService.Set(ILSpyExePathPropertyName, path);
                }
            }

            return(path);
        }