public JMMPluginResult SetPluginOrder(List <Guid> order, JMMPluginTypes type) { if (!pluginorder.ContainsKey(type)) { return new JMMPluginResult { Error = "There is no plugin of type " + type + " loaded", Ok = false } } ; Dictionary <Guid, int> d = pluginorder[type]; int xx = 0; foreach (Guid g in order) { d[g] = xx; JMMPluginPreferences ll = Settings.Default.Preferences.First(a => a.Guid == g); if (!ll.Orders.ContainsKey(type)) { ll.Orders.Add(type, xx); } else { ll.Orders[type] = xx; } xx++; } Settings.Default.Save(); return(new JMMPluginResult() { Ok = true }); } }
private static List <JMMPluginTypes> EnumerateTypes(JMMPluginTypes type) { List <JMMPluginTypes> l = new List <JMMPluginTypes>(); foreach (JMMPluginTypes p in Enum.GetValues(typeof(JMMPluginTypes))) { if ((type & p) == p) { l.Add(p); } } return(l); }
public JMMPluginResult <List <Guid> > GetPluginOrder(JMMPluginTypes type) { if (!pluginorder.ContainsKey(type)) { return new JMMPluginResult <List <Guid> > { Error = "There is no plugin of type " + type + " loaded", Ok = false } } ; return(new JMMPluginResult <List <Guid> > { Ok = true, Result = pluginorder[type].OrderBy(a => a.Value).Select(a => a.Key).ToList() }); }
private static void AddOrderToPreferences(Guid guid, JMMPluginPreferences pp, JMMPluginTypes p) { int val = Int32.MaxValue; if (pp.Orders.ContainsKey(p)) { val = pp.Orders[p]; } if (!pluginorder.ContainsKey(p)) { pluginorder.Add(p, new Dictionary <Guid, int>()); } Dictionary <Guid, int> kk = pluginorder[p]; if (!kk.ContainsKey(guid)) { kk.Add(guid, val); } else { kk[guid] = val; } }