C# Class AGS.Editor.Utilities

Exibir arquivo Open project: adventuregamestudio/ags Class Usage Examples

Public Properties

Property Type Description
SelectedReligion string

Public Methods

Method Description
AddAllMatchingFiles ( IList list, string fileMask ) : void
AddAllMatchingFiles ( IList list, string fileMask, bool fullPaths ) : void
CalculateGraphicsProportion ( Control control ) : float

Returns relation between current graphics resolution and default DpiY (96.0). Can be used when arranging controls and resizing forms.

CheckLabelWidthsOnForm ( Control parentControl ) : void
CopyFileAndSetDestinationWritable ( string sourceFileName, string destFileName ) : void

Copies the source to destination, and makes sure that the newly created destination file is not read-only.

CopyFont ( int fromSlot, int toSlot ) : void
CopyMemory ( IntPtr source, IntPtr destination, int numberOfBytes ) : void
CopyTextToClipboard ( string text ) : void
CreateCopyOfBitmapPreservingColourDepth ( Bitmap source ) : Bitmap
CreateHardLink ( string destFileName, string sourceFileName ) : bool
CreateHardLink ( string destFileName, string sourceFileName, bool overwrite ) : bool
DeleteFileIfExists ( string fileName ) : void
DoesFileNameContainOnlyValidCharacters ( string fileName ) : bool
DoesFileNeedRecompile ( string sourceFile, string destinationFile ) : bool

Returns whether the sourceFile is newer than the destinationFile or if the destinationFile doesn't exist.

EnsureStandardSubFoldersExist ( ) : void
FindExistingFont ( string fontNames ) : FontFamily

Iterates given array of font family names and return the first FontFamily object that is installed in the system. If none was found, returns generic Sans-Serif system font.

GetBitmapForSpriteResizedKeepingAspectRatio ( Sprite sprite, int width, int height, bool centreInNewCanvas, bool drawOutline, Color backgroundColour ) : Bitmap
GetControlThatHasFocus ( ) : Control
GetDirectoryFileList ( string directory, string fileMask ) : string[]

Wraps Directory.GetFiles in a handler to deal with an exception erroneously being thrown on Linux network shares if no files match.

GetDirectoryFileList ( string directory, string fileMask, SearchOption searchOption ) : string[]

Wraps Directory.GetFiles in a handler to deal with an exception erroneously being thrown on Linux network shares if no files match.

GetProcessForActiveApplication ( ) : Process
GetRelativeToProjectPath ( string absolutePath ) : string
GetSizeSpriteWillBeRenderedInGame ( int spriteSlot, int &width, int &height ) : void

Gets the size at which the sprite will be rendered in the game. This will be the sprite size, but doubled if it is a 320-res sprite in a 640-res game.

ImageToIcon ( Image image ) : Icon

Converts an image to icon. Code taken from comments section in: http://ryanfarley.com/blog/archive/2004/04/06/507.aspx

IsControlPressed ( ) : bool
IsMonoRunning ( ) : bool
IsShiftPressed ( ) : bool
IsThisApplicationCurrentlyActive ( ) : bool
IsWindowsVistaOrHigher ( ) : bool
IsWindowsXPOrHigher ( ) : bool
OpenAGSRegistryKey ( ) : RegistryKey
SetDirectoryFilesAccess ( string directory ) : void
SetDirectoryFilesAccess ( string directory, System.Security.Principal.SecurityIdentifier sid ) : void
SetDirectoryFilesAccess ( string directory, System.Security.Principal.SecurityIdentifier sid, FileSystemRights rights ) : void
SetDirectoryFilesAccess ( string directory, System.Security.Principal.SecurityIdentifier sid, FileSystemRights rights, AccessControlType type ) : void

Sets security permissions for all files in a directory.

SetFileAccess ( string fileName, System.Security.Principal.SecurityIdentifier sid, FileSystemRights rights, AccessControlType type ) : void

Sets security permissions for a specific file.

Private Methods

Method Description
DestroyIcon ( IntPtr hIcon ) : bool
GetFocus ( ) : IntPtr
GetForegroundWindow ( ) : IntPtr
GetWindowThreadProcessId ( IntPtr hWnd, IntPtr &lpdwProcessId ) : IntPtr

Method Details

AddAllMatchingFiles() public static method

public static AddAllMatchingFiles ( IList list, string fileMask ) : void
list IList
fileMask string
return void

AddAllMatchingFiles() public static method

public static AddAllMatchingFiles ( IList list, string fileMask, bool fullPaths ) : void
list IList
fileMask string
fullPaths bool
return void

CalculateGraphicsProportion() public static method

Returns relation between current graphics resolution and default DpiY (96.0). Can be used when arranging controls and resizing forms.
public static CalculateGraphicsProportion ( Control control ) : float
control System.Windows.Forms.Control
return float

CheckLabelWidthsOnForm() public static method

public static CheckLabelWidthsOnForm ( Control parentControl ) : void
parentControl System.Windows.Forms.Control
return void

CopyFileAndSetDestinationWritable() public static method

Copies the source to destination, and makes sure that the newly created destination file is not read-only.
public static CopyFileAndSetDestinationWritable ( string sourceFileName, string destFileName ) : void
sourceFileName string
destFileName string
return void

CopyFont() public static method

public static CopyFont ( int fromSlot, int toSlot ) : void
fromSlot int
toSlot int
return void

CopyMemory() public static method

public static CopyMemory ( IntPtr source, IntPtr destination, int numberOfBytes ) : void
source System.IntPtr
destination System.IntPtr
numberOfBytes int
return void

CopyTextToClipboard() public static method

public static CopyTextToClipboard ( string text ) : void
text string
return void

CreateCopyOfBitmapPreservingColourDepth() public static method

public static CreateCopyOfBitmapPreservingColourDepth ( Bitmap source ) : Bitmap
source System.Drawing.Bitmap
return System.Drawing.Bitmap

CreateHardLink() public static method

public static CreateHardLink ( string destFileName, string sourceFileName ) : bool
destFileName string
sourceFileName string
return bool

CreateHardLink() public static method

public static CreateHardLink ( string destFileName, string sourceFileName, bool overwrite ) : bool
destFileName string
sourceFileName string
overwrite bool
return bool

DeleteFileIfExists() public static method

public static DeleteFileIfExists ( string fileName ) : void
fileName string
return void

DoesFileNameContainOnlyValidCharacters() public static method

public static DoesFileNameContainOnlyValidCharacters ( string fileName ) : bool
fileName string
return bool

DoesFileNeedRecompile() public static method

Returns whether the sourceFile is newer than the destinationFile or if the destinationFile doesn't exist.
public static DoesFileNeedRecompile ( string sourceFile, string destinationFile ) : bool
sourceFile string
destinationFile string
return bool

EnsureStandardSubFoldersExist() public static method

public static EnsureStandardSubFoldersExist ( ) : void
return void

FindExistingFont() public static method

Iterates given array of font family names and return the first FontFamily object that is installed in the system. If none was found, returns generic Sans-Serif system font.
public static FindExistingFont ( string fontNames ) : FontFamily
fontNames string
return System.Drawing.FontFamily

GetBitmapForSpriteResizedKeepingAspectRatio() public static method

public static GetBitmapForSpriteResizedKeepingAspectRatio ( Sprite sprite, int width, int height, bool centreInNewCanvas, bool drawOutline, Color backgroundColour ) : Bitmap
sprite Sprite
width int
height int
centreInNewCanvas bool
drawOutline bool
backgroundColour Color
return System.Drawing.Bitmap

GetControlThatHasFocus() public static method

public static GetControlThatHasFocus ( ) : Control
return System.Windows.Forms.Control

GetDirectoryFileList() public static method

Wraps Directory.GetFiles in a handler to deal with an exception erroneously being thrown on Linux network shares if no files match.
public static GetDirectoryFileList ( string directory, string fileMask ) : string[]
directory string
fileMask string
return string[]

GetDirectoryFileList() public static method

Wraps Directory.GetFiles in a handler to deal with an exception erroneously being thrown on Linux network shares if no files match.
public static GetDirectoryFileList ( string directory, string fileMask, SearchOption searchOption ) : string[]
directory string
fileMask string
searchOption SearchOption
return string[]

GetProcessForActiveApplication() public static method

public static GetProcessForActiveApplication ( ) : Process
return System.Diagnostics.Process

GetRelativeToProjectPath() public static method

public static GetRelativeToProjectPath ( string absolutePath ) : string
absolutePath string
return string

GetSizeSpriteWillBeRenderedInGame() public static method

Gets the size at which the sprite will be rendered in the game. This will be the sprite size, but doubled if it is a 320-res sprite in a 640-res game.
public static GetSizeSpriteWillBeRenderedInGame ( int spriteSlot, int &width, int &height ) : void
spriteSlot int
width int
height int
return void

ImageToIcon() public static method

Converts an image to icon. Code taken from comments section in: http://ryanfarley.com/blog/archive/2004/04/06/507.aspx
public static ImageToIcon ( Image image ) : Icon
image Image The image
return System.Drawing.Icon

IsControlPressed() public static method

public static IsControlPressed ( ) : bool
return bool

IsMonoRunning() public static method

public static IsMonoRunning ( ) : bool
return bool

IsShiftPressed() public static method

public static IsShiftPressed ( ) : bool
return bool

IsThisApplicationCurrentlyActive() public static method

public static IsThisApplicationCurrentlyActive ( ) : bool
return bool

IsWindowsVistaOrHigher() public static method

public static IsWindowsVistaOrHigher ( ) : bool
return bool

IsWindowsXPOrHigher() public static method

public static IsWindowsXPOrHigher ( ) : bool
return bool

OpenAGSRegistryKey() public static method

public static OpenAGSRegistryKey ( ) : RegistryKey
return Microsoft.Win32.RegistryKey

SetDirectoryFilesAccess() public static method

public static SetDirectoryFilesAccess ( string directory ) : void
directory string
return void

SetDirectoryFilesAccess() public static method

public static SetDirectoryFilesAccess ( string directory, System.Security.Principal.SecurityIdentifier sid ) : void
directory string
sid System.Security.Principal.SecurityIdentifier
return void

SetDirectoryFilesAccess() public static method

public static SetDirectoryFilesAccess ( string directory, System.Security.Principal.SecurityIdentifier sid, FileSystemRights rights ) : void
directory string
sid System.Security.Principal.SecurityIdentifier
rights FileSystemRights
return void

SetDirectoryFilesAccess() public static method

Sets security permissions for all files in a directory.
public static SetDirectoryFilesAccess ( string directory, System.Security.Principal.SecurityIdentifier sid, FileSystemRights rights, AccessControlType type ) : void
directory string
sid System.Security.Principal.SecurityIdentifier
rights FileSystemRights
type AccessControlType
return void

SetFileAccess() public static method

Sets security permissions for a specific file.
public static SetFileAccess ( string fileName, System.Security.Principal.SecurityIdentifier sid, FileSystemRights rights, AccessControlType type ) : void
fileName string
sid System.Security.Principal.SecurityIdentifier
rights FileSystemRights
type AccessControlType
return void

Property Details

SelectedReligion public_oe static_oe property

public static string SelectedReligion
return string