private void GetAppFromDirectory(string path, List<Program> list, int depth) { if(maxDepth != -1 && depth > maxDepth) { return; } try { foreach (string file in Directory.GetFiles(path)) { if (ProgramStorage.Instance.ProgramSuffixes.Split(';').Any(o => file.EndsWith("." + o)) || suffixes.Split(';').Any(o => file.EndsWith("." + o))) { Program p = CreateEntry(file); list.Add(p); } } foreach (var subDirectory in Directory.GetDirectories(path)) { GetAppFromDirectory(subDirectory, list, depth + 1); } } catch (Exception e) { var woxPluginException = new WoxPluginException("Program", $"GetAppFromDirectory failed: {path}", e); Log.Error(woxPluginException); } }
internal void UpdatePluginMetadataTranslations(PluginPair pluginPair) { var pluginI18n = pluginPair.Plugin as IPluginI18n; if (pluginI18n == null) return; try { pluginPair.Metadata.Name = pluginI18n.GetTranslatedPluginTitle(); pluginPair.Metadata.Description = pluginI18n.GetTranslatedPluginDescription(); } catch (Exception e) { var woxPluginException = new WoxPluginException(pluginPair.Metadata.Name, "Update Plugin metadata translation failed:", e); Log.Error(woxPluginException); } }
private void GetAppFromDirectory(string path, List<Program> list, int depth) { if(_maxDepth != -1 && depth > _maxDepth) { return; } try { foreach (string file in Directory.GetFiles(path)) { if (_suffixes.Any(o => file.EndsWith("." + o))) { Program p = CreateEntry(file); p.Source = this; list.Add(p); } } foreach (var subDirectory in Directory.GetDirectories(path)) { GetAppFromDirectory(subDirectory, list, depth + 1); } } catch (Exception e) { var woxPluginException = new WoxPluginException("Program", $"GetAppFromDirectory failed: {path}", e); Log.Exception(woxPluginException); } }