You have a file on disk and you want to find the corresponding file in the Vault. There are several techniques you can use, but none of them are perfect.
Technique 1: Unique file names
If unique file names is turned on, then you can do a search for the file name. Use GetUniqueFileNameRequired to determine if unique file names is turned on, then use FindFilesBySearchConditions to do a search on that file name.
Even if unique file names is not turned on, this is still a pretty good approach, you just need to handle the case where multiple files have the same name.
Technique 2: Map the working folder
Create a map between the local folder and the Vault folder. Then you can look up the Vault folder by its Vault path. Use GetEnforceWorkingFolder to tell if there is an enforced working folder. If true, use GetRequiredWorkingFolderLocation to find out what that folder is. If false, you need to look at the client settings to find the working folder location (see this blog post).
Now that you have the working folder, you can map between the local path and the Vault path. A call to FindLatestFilesByPaths will get you the File object from the Vault.
Technique 3: Checksum
Get the checksum of the local file and use that to find the Vault file. You can find the checksum code in Checksum.cs. Next call FindFilePathsByNameAndChecksum to locate the file and related folders. The nice thing about this technique is that it also locates the exact version of the file. However, if the file has been edited on disk then this technique will not work.