Example #1
0
 protected override bool ParseCore(string path, bool nothrow)
 {
     if (base.ParseCore(path, nothrow))
     {
         if (this.IsTemporaryEdbFile)
         {
             base.IsValid = false;
             if (!nothrow)
             {
                 throw new ArgumentException(DataStrings.ErrorEdbFileCannotBeTmp(path), "path");
             }
         }
         else
         {
             string fileName = Path.GetFileName(base.PathName);
             try
             {
                 LocalLongFullPath.ValidateFilePath(Path.Combine(Path.Combine(EdbFilePath.DefaultEdbFilePath, "LocalCopies"), fileName) + "0000");
             }
             catch (FormatException innerException)
             {
                 base.IsValid = false;
                 if (!nothrow)
                 {
                     throw new ArgumentException(DataStrings.ErrorEdbFileNameTooLong(fileName), innerException);
                 }
             }
         }
     }
     if (!base.IsValid && !nothrow)
     {
         throw new ArgumentException(DataStrings.ErrorEdbFilePathCannotConvert(path));
     }
     return(base.IsValid);
 }
        public static LocalLongFullPath GetAddUMLanguageLogPath(string setupLoggingPath, CultureInfo culture)
        {
            string            path   = string.Format("add-{0}{1}.msilog", "UMLanguagePack.", culture.ToString());
            string            path2  = Path.Combine(setupLoggingPath, path);
            LocalLongFullPath result = null;

            if (!LocalLongFullPath.TryParse(path2, out result))
            {
                result = null;
            }
            return(result);
        }
        // Token: 0x06000079 RID: 121 RVA: 0x00003AD8 File Offset: 0x00001CD8
        public static LocalLongFullPath ParseFromPathNameAndFileName(string pathName, string fileName)
        {
            LocalLongFullPath localLongFullPath = LocalLongFullPath.Parse(Path.Combine(pathName, fileName));

            try
            {
                localLongFullPath.ValidateFilePathLength();
            }
            catch (FormatException ex)
            {
                throw new ArgumentException(ex.Message, ex);
            }
            return(localLongFullPath);
        }
 // Token: 0x0600007D RID: 125 RVA: 0x00003BE4 File Offset: 0x00001DE4
 protected static void ValidatePathWithSpecifiedExtension(LocalLongFullPath path, string specifiedExtension)
 {
     if (string.IsNullOrEmpty(specifiedExtension))
     {
         specifiedExtension = string.Empty;
     }
     else if (specifiedExtension[0] != '.' || specifiedExtension.Length == 1 || -1 != specifiedExtension.IndexOfAny(("." + new string(Path.GetInvalidFileNameChars())).ToCharArray(), 1))
     {
         throw new FormatException(DataStrings.ErrorInvalidExtension(specifiedExtension));
     }
     if (specifiedExtension != null && string.Compare(Path.GetExtension(path.PathName), specifiedExtension, StringComparison.OrdinalIgnoreCase) != 0)
     {
         throw new FormatException(DataStrings.ErrorFilePathMismatchExpectedExtension(path.PathName, specifiedExtension));
     }
 }
Example #5
0
 public void ValidateEdbFileExtension()
 {
     LocalLongFullPath.ValidatePathWithSpecifiedExtension(this, ".edb");
 }
 // Token: 0x0600007B RID: 123 RVA: 0x00003B29 File Offset: 0x00001D29
 public static string ConvertInvalidCharactersInFileName(string fileName)
 {
     return(LocalLongFullPath.ConvertInvalidCharactersInternal(fileName, Path.GetInvalidFileNameChars()));
 }
 // Token: 0x06000078 RID: 120 RVA: 0x00003AB9 File Offset: 0x00001CB9
 public static bool TryParse(string path, out LocalLongFullPath resultObject)
 {
     resultObject = (LocalLongFullPath)LongPath.TryParseInternal(path, new LocalLongFullPath());
     return(null != resultObject);
 }
 // Token: 0x06000082 RID: 130 RVA: 0x00003E3C File Offset: 0x0000203C
 public void ValidateFilePathLength()
 {
     LocalLongFullPath.ValidateFilePath(base.PathName);
 }
 // Token: 0x0600007E RID: 126 RVA: 0x00003C6E File Offset: 0x00001E6E
 public void ValidateDirectoryPathLength()
 {
     LocalLongFullPath.ValidateDirectoryPath(base.PathName);
 }