ICSharpCode.SharpZipLib.Zip.ZipNameTransform.IsValidName C# (CSharp) Method

IsValidName() public static method

Test a name to see if it is a valid name for a zip entry.
Zip path names are actually in Unix format, and should only contain relative paths. This means that any path stored should not contain a drive or device letter, or a leading slash. All slashes should forward slashes '/'. An empty name is valid for a file where the input comes from standard input. A null name is not considered valid.
public static IsValidName ( string name, bool relaxed ) : bool
name string The name to test.
relaxed bool If true checking is relaxed about windows file names and absolute paths.
return bool
        public static bool IsValidName(string name, bool relaxed)
        {
            bool result = (name != null);

            if (result) {
                if (relaxed) {
                    result = name.IndexOfAny(InvalidEntryCharsRelaxed) < 0;
                } else {
                    result =
                        (name.IndexOfAny(InvalidEntryChars) < 0) &&
                        (name.IndexOf('/') != 0);
                }
            }

            return result;
        }

Same methods

ZipNameTransform::IsValidName ( string name ) : bool