|
of_calculatefileattributes
|
|
Full name
|
pfc_n_cst_filesrv.of_calculatefileattributes
|
Access
|
protected
|
Extend of
|
unsignedlong
|
Return value
|
unsignedlong
|
Prototype
|
protected function unsignedlong of_calculatefileattributes(string,boolean,boolean,boolean,boolean)
|
Name
|
Datatype
|
lb_Archive
|
boolean
|
lb_Hidden
|
boolean
|
lb_ReadOnly
|
boolean
|
lb_Subdirectory
|
boolean
|
lb_System
|
boolean
|
lul_Attrib
|
ulong
|
protected function unsignedlong of_calculatefileattributes (string as_filename, boolean ab_readonly, boolean ab_hidden, boolean ab_system, boolean ab_archive);//////////////////////////////////////////////////////////////////////////////
// Protected Function: of_SetFileAttributes
// Arguments: as_FileName The file whose attributes you want to set; an
// absolute path may be specified or it will
// be relative to the current working directory.
// ab_ReadOnly The new value for the Read-Only attribute.
// ab_Hidden The new value for the Hidden attribute.
// ab_System The new value for the System attribute.
// ab_Archive The new value for the Archive attribute.
// Returns: Unsigned Long - The new attribute byte
// Description: Calculate the new attribute byte for a file. If null is passed
// for any of the attributes, it will not be changed.
//////////////////////////////////////////////////////////////////////////////
// Rev. History: Version
// 5.0 Initial version
//////////////////////////////////////////////////////////////////////////////
// Copyright © 1996-1999 Sybase, Inc. and its subsidiaries. All rights reserved. Any distribution of the
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
boolean lb_ReadOnly, lb_Hidden, lb_System, lb_Subdirectory, lb_Archive
ulong lul_Attrib
// Get the current attribute values
If of_GetFileAttributes(as_FileName, lb_ReadOnly, lb_Hidden, &
lb_System, lb_Subdirectory, lb_Archive) = -1 Then
Return -1
End If
// Preserve the Subdirectory attribute
If lb_Subdirectory Then
lul_Attrib = 16
Else
lul_Attrib = 0
End If
// Set Read-Only
If Not IsNull(ab_ReadOnly) Then
If ab_ReadOnly Then lul_Attrib = lul_Attrib + 1
Else
If lb_ReadOnly Then lul_Attrib = lul_Attrib + 1
End If
// Set Hidden
If Not IsNull(ab_Hidden) Then
If ab_Hidden Then lul_Attrib = lul_Attrib + 2
Else
If lb_Hidden Then lul_Attrib = lul_Attrib + 2
End If
// Set System
If Not IsNull(ab_System) Then
If ab_System Then lul_Attrib = lul_Attrib + 4
Else
If lb_System Then lul_Attrib = lul_Attrib + 4
End If
// Set Archive
If Not IsNull(ab_Archive) Then
If ab_Archive Then lul_Attrib = lul_Attrib + 32
Else
If lb_Archive Then lul_Attrib = lul_Attrib + 32
End If
Return lul_Attrib
end function