//-----------------------------------------------------------------------------
// Writes out a new actbusy file
//-----------------------------------------------------------------------------
bool CImportActBusy::Serialize( CUtlBuffer &buf, CDmElement *pRoot )
{
	SerializeHeader( buf );
 	buf.Printf( "\"ActBusy.txt\"\n" );
	buf.Printf( "{\n" );

	CDmAttribute *pChildren = pRoot->GetAttribute( "children" );
	if ( !pChildren || pChildren->GetType() != AT_ELEMENT_ARRAY )
		return NULL;

	CDmrElementArray<> children( pChildren );
	int nCount = children.Count();

	buf.PushTab();
	for ( int i = 0; i < nCount; ++i )
	{
		CDmElement *pChild = children[i];
 		buf.Printf( "\"%s\"\n", pChild->GetName() );
		buf.Printf( "{\n" );

		buf.PushTab();
		PrintStringAttribute( pChild, buf, "busy_anim", true );
		PrintStringAttribute( pChild, buf, "entry_anim", true );
		PrintStringAttribute( pChild, buf, "exit_anim", true );
		PrintStringAttribute( pChild, buf, "busy_sequence", true );
		PrintStringAttribute( pChild, buf, "entry_sequence", true );
		PrintStringAttribute( pChild, buf, "exit_sequence", true );
		PrintFloatAttribute( pChild, buf, "min_time" );
		PrintFloatAttribute( pChild, buf, "max_time" );
		PrintStringAttribute( pChild, buf, "interrupts" );
		buf.PopTab();

		buf.Printf( "}\n" );
	}
	buf.PopTab();

	buf.Printf( "}\n" );

	return true;
}
Example #2
0
static
DWORD
DumpShareInfo(
    PSHARE_INFO_502 pShareInfo
    )
{
    DWORD dwError = 0;
    DWORD dwAllowUserCount = 0;
    PWSTR* ppwszAllowUsers = NULL;
    DWORD dwDenyUserCount = 0;
    PWSTR* ppwszDenyUsers = NULL;
    BOOLEAN bReadOnly = FALSE;
    PSTR pszUserName = NULL;
    DWORD dwIndex = 0;

    dwError = PrintStringAttribute("name", pShareInfo->shi502_netname);
    BAIL_ON_SRVSVC_ERROR(dwError);

    dwError = PrintStringAttribute("path", pShareInfo->shi502_path);
    BAIL_ON_SRVSVC_ERROR(dwError);

    dwError = PrintStringAttribute("comment", pShareInfo->shi502_remark);
    BAIL_ON_SRVSVC_ERROR(dwError);

    if (pShareInfo->shi502_security_descriptor)
    {
        dwError = DeconstructSecurityDescriptor(
            pShareInfo->shi502_reserved,
            (PSECURITY_DESCRIPTOR_RELATIVE) pShareInfo->shi502_security_descriptor,
            &dwAllowUserCount,
            &ppwszAllowUsers,
            &dwDenyUserCount,
            &ppwszDenyUsers,
            &bReadOnly);
        BAIL_ON_SRVSVC_ERROR(dwError);

        if (dwAllowUserCount)
        {
            printf("allow=");

            for (dwIndex = 0; dwIndex < dwAllowUserCount; dwIndex++)
            {
                dwError = LwWc16sToMbs(ppwszAllowUsers[dwIndex], &pszUserName);
                BAIL_ON_SRVSVC_ERROR(dwError);

                printf("%s", pszUserName);
                if (dwIndex < dwAllowUserCount - 1)
                {
                    printf(",");
                }
            }

            printf("\n");
        }

        if (dwDenyUserCount)
        {
            printf("deny=");

            for (dwIndex = 0; dwIndex < dwDenyUserCount; dwIndex++)
            {
                dwError = LwWc16sToMbs(ppwszDenyUsers[dwIndex], &pszUserName);
                BAIL_ON_SRVSVC_ERROR(dwError);

                printf("%s", pszUserName);
                if (dwIndex < dwDenyUserCount - 1)
                {
                    printf(",");
                }
            }

            printf("\n");
        }

        printf("read_only=%s\n", bReadOnly ? "true" : "false");
    }

cleanup:

    FreeStringArray(dwAllowUserCount, ppwszAllowUsers);
    FreeStringArray(dwDenyUserCount, ppwszDenyUsers);

    return dwError;

error:

    goto cleanup;
}