/// <summary> /// This can be used to find the best localized file when there is only one file with the given name, /// and the file is part of the files distributed with Bloom (i.e., not something in a downloaded template). /// </summary> public static string GetBestLocalizableFileDistributedWithApplication(bool existenceOfEnglishVersionIsOptional, params string[] partsOfEnglishFilePath) { var englishPath = FileLocator.GetFileDistributedWithApplication(existenceOfEnglishVersionIsOptional, partsOfEnglishFilePath); if (!RobustFile.Exists(englishPath)) { return(englishPath); // just return whatever the original GetFileDistributedWithApplication gave. "", null, whatever it is. } return(BloomFileLocator.GetBestLocalizedFile(englishPath)); }
/// <summary> /// This can be used to find the best localized file when there is only one file with the given name, /// and the file is part of the files distributed with Bloom (i.e., not something in a downloaded template). /// </summary> public static string GetBestLocalizableFileDistributedWithApplication(bool existenceOfEnglishVersionIsOptional, params string[] partsOfEnglishFilePath) { // at this time, FileLocator does not have a way for the app to actually tell it where to find things distributed // with the application... var englishPath = FileLocator.GetFileDistributedWithApplication(true, partsOfEnglishFilePath); // ... so if it doesn't find it, we have to keep looking if (string.IsNullOrWhiteSpace(englishPath)) { //this one will throw if we still can't find it and existenceOfEnglishVersionIsOptional is false englishPath = BloomFileLocator.GetBrowserFile(existenceOfEnglishVersionIsOptional, partsOfEnglishFilePath); } if (!RobustFile.Exists(englishPath)) { return(englishPath); // just return whatever the original GetFileDistributedWithApplication gave. "", null, whatever it is. } return(BloomFileLocator.GetBestLocalizedFile(englishPath)); }