예제 #1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null || provider == null)
            {
                return(base.EditValue(context, provider, value));
            }

            string filePath         = value as string;
            string initialDirectory = null;

            if (!string.IsNullOrEmpty(filePath))
            {
                filePath = Helpers.ExpandFolderVariables(filePath, true);
                string directoryPath = Path.GetDirectoryName(filePath);

                if (!string.IsNullOrEmpty(directoryPath) && Directory.Exists(directoryPath))
                {
                    initialDirectory = directoryPath;
                }
            }

            filePath = ImageHelpers.OpenImageFileDialog(null, initialDirectory);

            if (!string.IsNullOrEmpty(filePath))
            {
                value = Helpers.GetVariableFolderPath(filePath, true);
            }

            return(value);
        }
예제 #2
0
        public static string GetAbsolutePath(string path)
        {
            path = Helpers.ExpandFolderVariables(path);

            if (!Path.IsPathRooted(path)) // Is relative path?
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
            }

            return(Path.GetFullPath(path));
        }
예제 #3
0
 public string GetFullPath()
 {
     return(Helpers.ExpandFolderVariables(Path));
 }