WorkbookPublishSettings.IsSettingsFile C# (CSharp) 메소드

IsSettingsFile() 정적인 개인적인 메소드

TRUE if the file is an internal settings file
static private IsSettingsFile ( string filePath ) : bool
filePath string
리턴 bool
    internal static bool IsSettingsFile(string filePath)
    {
        return filePath.EndsWith(WorkbookSettingsSuffix, StringComparison.InvariantCultureIgnoreCase);
    }

Usage Example

예제 #1
0
    /// <summary>
    /// Sanity testing on whether the file being uploaded is worth uploading
    /// </summary>
    /// <param name="localFilePath"></param>
    /// <returns></returns>
    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);
    }