Default File Names for Individual Orientation of Device:
Default-Portrait.pngDefault-PortraitUpsideDown.pngDefault-Landscape.pngDefault-LandscapeLeft.pngDefault-LandscapeRight.png
I have created this blog to help programmers who have just started their career thats why I have written all the tutorials from practical approach rather then theoretical. If anyone has any query related to programming don't hesitate to ask. My contact information is in my profile. Also I would like to thank all the websites/Individual(s) from whom I gathered the material.
Default-Portrait.pngDefault-PortraitUpsideDown.pngDefault-Landscape.pngDefault-LandscapeLeft.pngDefault-LandscapeRight.pngusing Microsoft.Win32.Security;Here's a method to add a dir, and set NTFS permissions on it for a given user:
private Boolean CreateDir(String strSitePath, String strUserName) {
Boolean bOk;
try {
Directory.CreateDirectory(strSitePath);
SecurityDescriptor secDesc = SecurityDescriptor.GetFileSecurity(strSitePath, SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);
Dacl dacl = secDesc.Dacl;
Sid sidUser = new Sid (strUserName);
// allow: folder, subfolder and files
// modify
dacl.AddAce (new AceAccessAllowed (sidUser, AccessType.GENERIC_WRITE | AccessType.GENERIC_READ | AccessType.DELETE | AccessType.GENERIC_EXECUTE , AceFlags.OBJECT_INHERIT_ACE | AceFlags.CONTAINER_INHERIT_ACE));
// deny: this folder
// write attribs
// write extended attribs
// delete
// change permissions
// take ownership
DirectoryAccessType DAType = DirectoryAccessType.FILE_WRITE_ATTRIBUTES | DirectoryAccessType.FILE_WRITE_EA | DirectoryAccessType.DELETE | DirectoryAccessType.WRITE_OWNER | DirectoryAccessType.WRITE_DAC;
AccessType AType = (AccessType)DAType;
dacl.AddAce (new AceAccessDenied (sidUser, AType));
secDesc.SetDacl(dacl);
secDesc.SetFileSecurity(strSitePath, SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);
bOk = true;
} catch {
bOk = false;
}
return bOk;
} /* CreateDir */
The AceFlags determine the level of inheritance on the object.