Exemple #1
0
        public Image GetIcon()
        {
            var   images = ClientServiceLocator.GetService <IImageRepository>();
            Image image  = Properties.Resources._default;

            try {
                image = images.GetImage(IconFile);
            }
            catch (Exception) {}
            return(image);
        }
Exemple #2
0
        string GetNewProfileName()
        {
            string newNameBase = ClientServiceLocator.GetService <ILanguage>().GetText("Profile");
            string newName     = newNameBase;
            int    offset      = 1;

            while (profiles.Find(o => o.Name == newName) != null)
            {
                newName = newNameBase + " " + offset.ToString(CultureInfo.InvariantCulture);
                offset++;
            }
            return(newName);
        }
Exemple #3
0
        private void GetProfilesString(int start, IList <string> args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            var prof = args[start].Split(';');

            if (prof.Length < 1)
            {
                errors.Append(ClientServiceLocator.GetService <ILanguage>().GetText("ConsoleNotProfiles"));
            }
            foreach (var str in prof.Where(str => str.Length > 0))
            {
                Profiles.Add(str);
            }
        }
Exemple #4
0
        public bool Parse(string[] args)
        {
            var c = args.Length;

            if (console && c < 2)
            {
                errors.Append(ClientServiceLocator.GetService <ILanguage>().GetText("ConsoleInvalidArgument"));
                return(false);
            }
            for (int i = 0; i < c; i++)
            {
                switch (args[i])
                {
                case "-autorun":
                    if (console)
                    {
                        errors.Append(ClientServiceLocator.GetService <ILanguage>().GetText("FormInvalidArgument"));
                        return(false);
                    }
                    Minimalize = true;
                    return(true);

                case "-p":
                    ++i;
                    if (i >= c)
                    {
                        errors.Append(ClientServiceLocator.GetService <ILanguage>().GetText("ConsoleNotProfiles"));
                        return(false);
                    }
                    GetProfilesString(i, args);
                    Actions.Add(ConsoleActions.UseProfile);
                    Count++;
                    ConsoleMode = true;
                    break;

                default:
                    errors.Append(ClientServiceLocator.GetService <ILanguage>().GetText(console ? "ConsoleInvalidArgument" : "FormInvalidArgument"));
                    break;
                }
            }
            return(errors.Length == 0);
        }
Exemple #5
0
 public bool Validation(List <string> errors)
 {
     if (Name.Length == 0)
     {
         errors.Add(ClientServiceLocator.GetService <ILanguage>().GetText("ProfileNameIsEmpty"));
     }
     if (!BrowserSettings.Proxy.IsValid())
     {
         errors.Add("");
     }
     foreach (var settings in Connections.Where(x => x.Use).Select(x => x.Settings))
     {
         string error = "";
         if (!settings.Validate(out error))
         {
             errors.Add(error);
         }
     }
     return(errors.Count == 0);
 }