C# Class CmisSync.Lib.Utils

Static methods that are useful in the context of synchronization.
ファイルを表示 Open project: aegif/CmisSync

Public Methods

Method Description
ConfigureLogging ( ) : void
CreateConflictFilename ( String path, String user ) : string

Find an available conflict free filename for this file. For instance: - if /dir/file does not exist, return the same path - if /dir/file exists, return /dir/file (1) - if /dir/file (1) also exists, return /dir/file (2) - etc

CreateConflictFoldername ( String path, String user ) : string
DeleteEvenIfReadOnly ( string filePath ) : void
FirstFolderContainsSecond ( string containingFolder, string containedFolder ) : bool

Says whether a folder contains another. Example: FirstFolderContainsSecond("/a", "/a/b") => true

FormatBandwidth ( double bitsPerSecond ) : string

Formats the bandwidth in typical 10 based calculation

FormatBandwidth ( long bitsPerSecond ) : string

Formats the bandwidth in typical 10 based calculation

FormatSize ( double byteCount ) : string

Format a file size nicely. Example: 1048576 becomes "1 MB"

FormatSize ( long byteCount ) : string

Format a file size nicely. Example: 1048576 becomes "1 MB"

HasWritePermissionOnDir ( string path ) : bool

Check whether the current user has write permission to the specified path.

IsDirectoryWorthSyncing ( string localDirectory, RepoInfo repoInfo ) : bool

Check whether the directory is worth syncing or not. Directories that are not worth syncing include ignored, system, and hidden folders.

IsFileWorthSyncing ( string filepath, RepoInfo repoInfo ) : bool

Check whether the file is worth syncing or not. This optionally excludes blank files or files too large.

IsFolder ( string path ) : bool

Whether a path points to a local directory or not. Must be an absolute local path.

IsInvalidFileName ( string name ) : bool

Check whether a file name is valid or not.

IsInvalidFolderName ( string name ) : bool

Check whether a folder name is valid or not.

IsSymlink ( FileSystemInfo fsi ) : bool

Determines whether this instance is a symlink the specified FileSystemInfo.

IsSymlink ( string path ) : bool

Whether a file or directory is a symbolic link.

IsValidISO88591 ( string input ) : bool

Determines whether this instance is valid ISO-8859-1 specified input.

IsvalidURL ( string url ) : bool

Check whether an URL is valid or not.

MoveFolderLocally ( string origin, string destination ) : void
NotifyUser ( string message ) : void

Send a message to the end user.

PathCombine ( string localDirectory, string filename ) : string

Like Path.Combine, but does not choke on special characters. Special characters are a separate concern, use this method if it is not the current concern.

SetUserNotificationListener ( UserNotificationListener listener ) : void

Register the component which will receive notifications intended for the end-user.

UpperFolderLocal ( string localFolderPath ) : string

Get the upper folder of a local path.

WorthSyncing ( string filename ) : System.Boolean

Check whether the file is worth syncing or not. Files that are not worth syncing include temp files, locks, etc.

WorthSyncing ( string localDirectory, string filename, RepoInfo repoInfo ) : System.Boolean

Check whether the file is worth syncing or not. Files that are not worth syncing include temp files, locks, etc.

Private Methods

Method Description
IsFilenameWorthSyncing ( string localDirectory, string filename ) : bool

Check whether the filename is worth syncing or not. Files that are not worth syncing include temp files, locks, etc.

Method Details

ConfigureLogging() public static method

public static ConfigureLogging ( ) : void
return void

CreateConflictFilename() public static method

Find an available conflict free filename for this file. For instance: - if /dir/file does not exist, return the same path - if /dir/file exists, return /dir/file (1) - if /dir/file (1) also exists, return /dir/file (2) - etc
public static CreateConflictFilename ( String path, String user ) : string
path String Path of the file in conflict
user String Local user
return string

CreateConflictFoldername() public static method

public static CreateConflictFoldername ( String path, String user ) : string
path String
user String
return string

DeleteEvenIfReadOnly() public static method

public static DeleteEvenIfReadOnly ( string filePath ) : void
filePath string
return void

FirstFolderContainsSecond() public static method

Says whether a folder contains another. Example: FirstFolderContainsSecond("/a", "/a/b") => true
public static FirstFolderContainsSecond ( string containingFolder, string containedFolder ) : bool
containingFolder string
containedFolder string
return bool

FormatBandwidth() public static method

Formats the bandwidth in typical 10 based calculation
public static FormatBandwidth ( double bitsPerSecond ) : string
bitsPerSecond double /// Bits per second. ///
return string

FormatBandwidth() public static method

Formats the bandwidth in typical 10 based calculation
public static FormatBandwidth ( long bitsPerSecond ) : string
bitsPerSecond long /// Bits per second. ///
return string

FormatSize() public static method

Format a file size nicely. Example: 1048576 becomes "1 MB"
public static FormatSize ( double byteCount ) : string
byteCount double
return string

FormatSize() public static method

Format a file size nicely. Example: 1048576 becomes "1 MB"
public static FormatSize ( long byteCount ) : string
byteCount long
return string

HasWritePermissionOnDir() public static method

Check whether the current user has write permission to the specified path.
public static HasWritePermissionOnDir ( string path ) : bool
path string
return bool

IsDirectoryWorthSyncing() public static method

Check whether the directory is worth syncing or not. Directories that are not worth syncing include ignored, system, and hidden folders.
public static IsDirectoryWorthSyncing ( string localDirectory, RepoInfo repoInfo ) : bool
localDirectory string
repoInfo RepoInfo
return bool

IsFileWorthSyncing() public static method

Check whether the file is worth syncing or not. This optionally excludes blank files or files too large.
public static IsFileWorthSyncing ( string filepath, RepoInfo repoInfo ) : bool
filepath string
repoInfo RepoInfo
return bool

IsFolder() public static method

Whether a path points to a local directory or not. Must be an absolute local path.
public static IsFolder ( string path ) : bool
path string
return bool

IsInvalidFileName() public static method

Check whether a file name is valid or not.
public static IsInvalidFileName ( string name ) : bool
name string
return bool

IsInvalidFolderName() public static method

Check whether a folder name is valid or not.
public static IsInvalidFolderName ( string name ) : bool
name string
return bool

IsSymlink() public static method

Determines whether this instance is a symlink the specified FileSystemInfo.
public static IsSymlink ( FileSystemInfo fsi ) : bool
fsi System.IO.FileSystemInfo /// If set to true fsi. ///
return bool

IsSymlink() public static method

Whether a file or directory is a symbolic link.
public static IsSymlink ( string path ) : bool
path string
return bool

IsValidISO88591() public static method

Determines whether this instance is valid ISO-8859-1 specified input.
public static IsValidISO88591 ( string input ) : bool
input string If set to true input.
return bool

IsvalidURL() public static method

Check whether an URL is valid or not.
public static IsvalidURL ( string url ) : bool
url string
return bool

MoveFolderLocally() public static method

public static MoveFolderLocally ( string origin, string destination ) : void
origin string
destination string
return void

NotifyUser() public static method

Send a message to the end user.
public static NotifyUser ( string message ) : void
message string
return void

PathCombine() public static method

Like Path.Combine, but does not choke on special characters. Special characters are a separate concern, use this method if it is not the current concern.
public static PathCombine ( string localDirectory, string filename ) : string
localDirectory string
filename string
return string

SetUserNotificationListener() public static method

Register the component which will receive notifications intended for the end-user.
public static SetUserNotificationListener ( UserNotificationListener listener ) : void
listener UserNotificationListener
return void

UpperFolderLocal() public static method

Get the upper folder of a local path.
public static UpperFolderLocal ( string localFolderPath ) : string
localFolderPath string
return string

WorthSyncing() public static method

Check whether the file is worth syncing or not. Files that are not worth syncing include temp files, locks, etc.
public static WorthSyncing ( string filename ) : System.Boolean
filename string
return System.Boolean

WorthSyncing() public static method

Check whether the file is worth syncing or not. Files that are not worth syncing include temp files, locks, etc.
public static WorthSyncing ( string localDirectory, string filename, RepoInfo repoInfo ) : System.Boolean
localDirectory string
filename string
repoInfo RepoInfo
return System.Boolean