UploadWorkbooks.IsValidUploadFile C# (CSharp) Method

IsValidUploadFile() private method

Sanity testing on whether the file being uploaded is worth uploading
private IsValidUploadFile ( string localFilePath ) : bool
localFilePath string
return bool
    bool IsValidUploadFile(string localFilePath)
    {
        //If the file is a custom settings file for the workbook, then ignore it
        if(WorkbookPublishSettings.IsSettingsFile(localFilePath))
        {
            return false; //Nothing to do, it's just a settings file
        }

        //Ignore temp files, since we know we don't want to upload them
        var fileExtension = Path.GetExtension(localFilePath).ToLower();
        if ((fileExtension == ".tmp") || (fileExtension == ".temp"))
        {
            StatusLog.AddStatus("Ignoring temp file, " + localFilePath, -10);
            return false;
        }

        //These are the only kinds of files we know about...
        if ((fileExtension != ".twb") && (fileExtension != ".twbx"))
        {
            StatusLog.AddError("File is not a workbook: " + localFilePath);
            return false;
        }

        return true;
    }