コード例 #1
0
def GetSnapshotData(sessionId, revitFilePath, snapshotStartTime,
                    snapshotEndTime, snapshotFolderPath, revitJournalFilePath,
                    snapshotError):
    projectFolderName = path_util.GetProjectFolderNameFromRevitProjectFilePath(
        revitFilePath)
    projectModelFolderPath = Path.GetDirectoryName(revitFilePath)
    modelName = snapshot_data_util.GetRevitModelName(revitFilePath)
    modelFileLastModified = path_util.GetLastWriteTimeUtc(revitFilePath)
    modelFileSize = path_util.GetFileSize(revitFilePath)
    modelRevitVersion = revit_file_util.GetRevitFileVersion(revitFilePath)
    modelRevitVersionDetails = snapshot_data_util.GetRevitFileVersionDetails(
        revitFilePath)

    snapshotData = {
        "projectFolderName":
        projectFolderName,
        "modelFolder":
        path_util.ExpandedFullNetworkPath(projectModelFolderPath),
        "modelName":
        modelName,
        "modelFileLastModified":
        (time_util.GetTimestampObject(modelFileLastModified)
         if modelFileLastModified is not None else None),
        "modelFileSize":
        modelFileSize,
        "modelRevitVersion":
        modelRevitVersion,
        "modelRevitVersionDetails":
        modelRevitVersionDetails,
        "snapshotStartTime": (time_util.GetTimestampObject(snapshotStartTime)
                              if snapshotStartTime is not None else None),
        "snapshotEndTime": (time_util.GetTimestampObject(snapshotEndTime)
                            if snapshotEndTime is not None else None),
        "sessionId":
        sessionId,
        "snapshotFolder":
        path_util.ExpandedFullNetworkPath(snapshotFolderPath),
        "snapshotError":
        snapshotError,
        "username":
        environment.GetUserName(),
        "machineName":
        environment.GetMachineName(),
        "gatewayAddresses":
        network_util.GetGatewayAddresses(),
        "ipAddresses":
        network_util.GetIPAddresses(),
        snapshot_data_util.SNAPSHOT_DATA__REVIT_JOURNAL_FILE:
        revitJournalFilePath
    }

    return snapshotData
コード例 #2
0
 def GetFileSize(self):
     return path_util.GetFileSize(self.revitFilePath)