Skip to content

Commit 54e693d

Browse files
committed
Add functions in Check Initializing & Init Failed region
1 parent 969b3cc commit 54e693d

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ public static bool IsHomePlugin(string id)
665665

666666
#endregion
667667

668-
#region Check Initializing or Init Failed
668+
#region Check Initializing & Init Failed
669669

670670
public static bool IsInitializingOrInitFailed(string id)
671671
{
@@ -685,6 +685,41 @@ public static bool IsInitializingOrInitFailed(string id)
685685
}
686686
}
687687

688+
public static bool IsInitializing(string id)
689+
{
690+
// Id does not exist in loaded plugins
691+
if (!_allLoadedPlugins.Any(x => x.Value.Metadata.ID == id)) return false;
692+
693+
// Plugin initialized already
694+
if (_allInitializedPlugins.ContainsKey(id))
695+
{
696+
return false;
697+
}
698+
// Plugin is still initializing
699+
else
700+
{
701+
return true;
702+
}
703+
}
704+
705+
public static bool IsInitializationFailed(string id)
706+
{
707+
// Id does not exist in loaded plugins
708+
if (!_allLoadedPlugins.Any(x => x.Value.Metadata.ID == id)) return false;
709+
710+
// Plugin initialized already
711+
if (_allInitializedPlugins.ContainsKey(id))
712+
{
713+
// Check if the plugin initialization failed
714+
return _initFailedPlugins.ContainsKey(id);
715+
}
716+
// Plugin is still initializing
717+
else
718+
{
719+
return false;
720+
}
721+
}
722+
688723
#endregion
689724

690725
#region Plugin Action Keyword

0 commit comments

Comments
 (0)