If the file is going to be created, You should use a file dialog to specify the directory path. There's a short list of illegal characters for file names.
The only truly reliable way to tell if a file name is acceptable is to try it. Permissions
is a morass.
For first part(Valid Filename), I use all ways and a temporary file creation to check if a file can be named as expected or throws an exception.
In some cases creating a file will not raise an exception until trying to delete it(eg: CON).
I also usa removePath arg to dictate it that file is just the name of file without its path.
If there is any denial of access to temp folder use a custom folder for creating test file.
This method will result false for . or .. or ... r any sequence of dot-only names in Windows, and also you can't create them manually, but those are not actually invalid names! those are uncreatable names for file or something like that ;).
And for next part(Not exists) just use: !File.Exists(yourFileNameWithPath).
If you create a DirectoryInfo for the file, it will throw an exception if there are any problems with the file/directory name, either invalid chars or length.
DirectoryInfo di = new DirectoryInfo(myFileName);
Console.WriteLine("This filename/path could be valid. The folder might not exist yet though.")
if(di.Exists)
Console.WriteLine("This file already exist.")
Not great that it is using exceptions for flow control, but you can be confident that it is right. OTOH, if you already planned to give the calling code an exception, mission accomplished.