Пример #1
0
 /// <summary>
 /// Sets file size to the specified value -- DOES NOT reset file seek pointer to original location
 /// </summary>
 /// <param name="size"></param>
 /// <returns></returns>
 public bool SetFileSize(long size)
 {
     if (enablePrivileges)
     {
         return(Native32.SetFileSize(logHandle, size));
     }
     else
     {
         int lodist = (int)size;
         int hidist = (int)(size >> 32);
         Native32.SetFilePointer(logHandle, lodist, ref hidist, Native32.EMoveMethod.Begin);
         if (!Native32.SetEndOfFile(logHandle))
         {
             return(false);
         }
         return(true);
     }
 }