示例#1
0
 /// <summary>
 /// Get a Guid based on the input string, unlike non-generic version, this is specialized for a type of entry.
 /// GuidGeneratorFunc must be set or standard GetDeterministicGuid() would be called.
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public static Guid GetDeterministicGuid(string input)
 {
     if (_guidGenFunc != null)
     {
         return(_guidGenFunc(input));
     }
     return(W32StringUtils.GetDeterministicGuid(input));
 }
示例#2
0
        public static Stream NewTempStream(out string fileName, string ext)
        {
            if (ext.StartsWith("."))
            {
                ext = ext.TrimStart('.');
            }
            do
            {
                fileName = PathFE.Combine(Path.GetTempPath(), W32StringUtils.RandomString(8) + "." + ext);
            }while (File.Exists(fileName));

            return(new FileStream(fileName, FileMode.CreateNew));
        }