/// <summary>Validate a string or a list of strings, make sure aren't empty, invalid or null.</summary> public static bool FileString(out string _String) { byte[] bytes = null; bool status = false; (bytes, status) = HEVIO.FileBytesRead(DirFile); if (!status) { _String = null; return(false); } _String = HEVText.ByteArrayToString(bytes); return(true); }
private void InitMutex(string _CustomID) { #if MUTEX_ENABLED //( (GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes( typeof( GuidAttribute ), false ).GetValue( 0 ) ).Value; string appGuid = HEVIO.AssemblyGuidCurrent(); string mutexId = string.Format("Global\\{{{0}}}", appGuid); if (HEVText.Validate(_CustomID)) { mutexId = _CustomID; } mutex = new Mutex(false, mutexId); var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow); var securitySettings = new MutexSecurity(); securitySettings.AddAccessRule(allowEveryoneRule); mutex.SetAccessControl(securitySettings); #endif }