예제 #1
0
 public static bool HasAds(string path)
 {
     if (!SupportsAds(path))
     {
         return(false);
     }
     using (var sh = Kernel32Util.CreateFileForRead(path)) {
         return(!sh.IsInvalid);
     }
 }
예제 #2
0
        public static string LoadAds(string path)
        {
            if (!SupportsAds(path))
            {
                return(null);
            }

            using (var sh = Kernel32Util.CreateFileForRead(path)) {
                if (sh.IsInvalid)
                {
                    return(null);
                }
                using (var stream = new StreamReader(new FileStream(sh, FileAccess.Read))) {
                    return(stream.ReadToEnd());
                }
            }
        }