public static void SetSelectedAdapter(int index)
 {
     if (index >= adapters.Length && index < 0 && selectedAdapterIndex == index)
     {
         return;
     }
     selectedAdapterIndex = index;
     selectedAdapter      = adapters[index];
 }
 private static void InitializeSelectedAdapter()
 {
     selectedAdapter = adapters.FirstOrDefault(a => Exists(a) && GetAdapterName(a) == GitManager.Settings.ExternalProgram) ?? adapters.FirstOrDefault(a => Exists(a));
     if (selectedAdapter != null)
     {
         selectedAdapterIndex = Array.IndexOf(adapters, selectedAdapter);
     }
     initiazlitedSelected = true;
 }
        private static bool Exists(IExternalAdapter adapterInfo)
        {
            ExternalAdapterAttribute attribute = adapterInfo.GetType().GetCustomAttributes(typeof(ExternalAdapterAttribute), false).FirstOrDefault() as ExternalAdapterAttribute;

            if (attribute == null)
            {
                return(false);
            }
            return(attribute.ProcessNames.All(p => ExistsOnPath(p)));
        }
        private static string GetAdapterName(IExternalAdapter adapter)
        {
            ExternalAdapterAttribute attribute = adapter.GetType().GetCustomAttributes(typeof(ExternalAdapterAttribute), false).FirstOrDefault() as ExternalAdapterAttribute;

            if (attribute == null)
            {
                return(null);
            }
            return(attribute.FriendlyName);
        }
예제 #5
0
        private static int GetAdapterPriority(IExternalAdapter adapter)
        {
            ExternalAdapterAttribute attribute = GetAdapterAttribute(adapter);

            if (attribute == null)
            {
                return(0);
            }
            return(attribute.Priority);
        }
예제 #6
0
        private static string GetAdapterName(IExternalAdapter adapter)
        {
            ExternalAdapterAttribute attribute = GetAdapterAttribute(adapter);

            if (attribute == null)
            {
                return(null);
            }
            return(attribute.FriendlyName);
        }
예제 #7
0
        private static bool Exists(IExternalAdapter adapterInfo)
        {
            ExternalAdapterAttribute attribute = GetAdapterAttribute(adapterInfo);

            if (attribute == null)
            {
                return(false);
            }
            return(attribute.ProcessNames.All(p => ExistsOnPath(p)));
        }
예제 #8
0
 private static ExternalAdapterAttribute GetAdapterAttribute(IExternalAdapter adapter)
 {
     return(adapter.GetType().GetCustomAttributes(typeof(ExternalAdapterAttribute), false).FirstOrDefault() as ExternalAdapterAttribute);
 }