示例#1
0
    public override IEnumerable <Item> Load()
    {
        if (!IsValidConfinementItem(this))
        {
            yield break;
        }

        var deps = ProcessTools.GetNativeDependencies(File);

        if (deps == null)
        {
            yield break;
        }

        yield return(this);

        foreach (var dep in deps)
        {
            var item = Item.Resolve(Confinement, new FileInfo(dep));
            if (item == null)
            {
                continue;
            }

            foreach (var child_item in item.Load())
            {
                yield return(child_item);
            }
        }
    }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (_overrideIcon != null)
            {
                Icon = _overrideIcon;
            }
            else if (ParentForm?.Icon != null)
            {
                Icon = ParentForm.Icon;
            }
            else
            {
                try
                {
                    Icon = ProcessTools.GetIconFromEntryExe();
                }
                catch
                {
                    /* Fall back to the default icon */
                }
            }

            SetHeight();
            SetWidth();

            if (StartPosition == FormStartPosition.CenterParent && Owner != null && Owner.Visible)
            {
                this.CenterToForm(Owner);
            }

            Opacity = 1;
        }
示例#3
0
        public void Test01()
        {
            PictureData picture = new PictureData(new Canvas2(@"C:\wb2\20191204_ジャケット的な\バンドリ_イニシャル.jpg"), 1920, 1080);

            const int FRAME_NUM = 200;

            const int D_MAX = 20;
            int       dTarg = D_MAX;
            int       d     = D_MAX;

            using (WorkingDir wd = new WorkingDir())
            {
                FileTools.CreateDir(wd.GetPath("img"));

                for (int frame = 0; frame < FRAME_NUM; frame++)
                {
                    Console.WriteLine(frame);                     // test

                    picture.SetFrame(frame * 1.0 / FRAME_NUM);

                    // ---- 暗くする ----

                    if (frame == 10)
                    {
                        dTarg = 0;
                    }
                    else if (frame + 10 + D_MAX == FRAME_NUM)
                    {
                        dTarg = D_MAX;
                    }

                    if (d < dTarg)
                    {
                        d++;
                    }
                    else if (dTarg < d)
                    {
                        d--;
                    }

                    if (0 < d)
                    {
                        picture.SetDrakness(d * 1.0 / D_MAX);
                    }

                    // ----

                    picture.Save(wd.GetPath("img\\" + frame + ".jpg"));
                }

                ProcessTools.Batch(new string[]
                {
                    @"C:\app\ffmpeg-4.1.3-win64-shared\bin\ffmpeg.exe -r 20 -i %%d.jpg ..\out.mp4",
                },
                                   wd.GetPath("img")
                                   );

                File.Copy(wd.GetPath("out.mp4"), @"C:\temp\1.mp4", true);
            }
        }
        public static void SetupCulture()
        {
            var currentCulture = CultureInfo.CurrentCulture;

            var targetLocale = Settings.Default.Language;

            if (targetLocale.IsNotEmpty())
            {
                try
                {
                    currentCulture = SupportedLanguages.First(x => x.Name.Equals(targetLocale));
                }
                catch
                {
                    Settings.Default.Language = string.Empty;
                }
            }

            if (!currentCulture.Name.ContainsAny(SupportedLanguages.Select(x => x.Parent.Name),
                                                 StringComparison.OrdinalIgnoreCase))
            {
                currentCulture = EnUsCulture;
            }

            ProcessTools.SetDefaultCulture(currentCulture);
            var thread = Thread.CurrentThread;

            thread.CurrentCulture   = currentCulture;
            thread.CurrentUICulture = currentCulture;
        }
示例#5
0
    public static FileType GetFileType(FileInfo file)
    {
        var proc = ProcessTools.CreateProcess("file", file.FullName);

        if (proc == null)
        {
            return(FileType.Data);
        }

        var line = proc.StandardOutput.ReadLine();

        proc.Dispose();

        if (line == null)
        {
            return(FileType.Data);
        }

        if (line.Contains("Mach-O"))
        {
            return(FileType.MachO);
        }
        else if (line.Contains("PE32 executable"))
        {
            return(FileType.PE32Executable);
        }
        else if (line.Contains("ELF"))
        {
            return(FileType.ELF);
        }

        return(FileType.Data);
    }
        private static string CleanupPath(string path, bool isFilename = false)
        {
            if (string.IsNullOrEmpty(path)) return null;

            if (!isFilename)
            {
                // Try the fast method first for directories
                var trimmed = path.Trim('"', ' ', '\'', '\\', '/');

                if (!trimmed.ContainsAny(InvalidPathChars))
                    return trimmed;
            }

            try
            {
                path = ProcessTools.SeparateArgsFromCommand(path).FileName;
                if (!isFilename && path.Contains('.') && !Directory.Exists(path))
                    return Path.GetDirectoryName(path);
            }
            catch
            {
                // If sanitization failed just leave it be, it will be handled afterwards
            }
            return path.TrimEnd('\\');
        }
示例#7
0
        public override void Run(Configuration config, CommandArguments args)
        {
            base.Run(config, args);

            var workDir   = Path.Combine(Directory.GetCurrentDirectory(), config.StagingDirectory, Configuration.WebTarget);
            var buildArgs = string.Join(" ", GetFilesToBuild(workDir));

            buildArgs += " -s EXPORTED_FUNCTIONS=[" + string.Join(",", config.Web.ExportedFuncs.Select(s => $"\"_{s}\"")) + "]" + " -s ASSERTIONS=2";
            Console.WriteLine($"Start Emscripten build with args: '{buildArgs}'");
            ProcessTools.RunProcessAndEnsureSuccess(this, "Emscripten Build", config.Web.EmccPath, buildArgs, workDir);

            var outputPath = Path.Combine(config.BuildsDirectory, Configuration.WebTarget);

            Console.WriteLine($"Copy build to '{outputPath}'");
            IOTools.CopyDirectory(workDir, outputPath);

            Console.WriteLine($"Strip sources from '{outputPath}'");
            var filesToStrip = new List <string>();

            filesToStrip.AddRange(Directory.GetFiles(outputPath, "*.cpp", SearchOption.AllDirectories));
            filesToStrip.AddRange(Directory.GetFiles(outputPath, "*.h", SearchOption.AllDirectories));
            foreach (var file in filesToStrip)
            {
                Console.WriteLine($"Stripping '{file}'");
                File.Delete(file);
            }
        }
        private static bool CheckCondition(string psc)
        {
            try
            {
                var startInfo = ProcessTools.SeparateArgsFromCommand(psc).ToProcessStartInfo();
                startInfo.CreateNoWindow = true;
                startInfo.ErrorDialog    = false;
                startInfo.WindowStyle    = ProcessWindowStyle.Hidden;

                var p = Process.Start(startInfo);
                if (p == null)
                {
                    return(false);
                }

                if (!p.WaitForExit(5000))
                {
                    Console.WriteLine(@"Script's ConditionScript command timed out - " + psc);
                    p.Kill();
                    return(false);
                }

                return(p.ExitCode == 0);
            }
            catch (SystemException ex)
            {
                Console.WriteLine($@"Failed to test script condition ""{psc}"" - {ex.Message}");
                return(false);
            }
        }
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        int      selectedAddressId = int.Parse(BillingAddresses.SelectedValue);
        SkinBase page = HttpContext.Current.Handler as SkinBase;

        AspDotNetStorefrontCore.Customer adnsfCustomer = AspDotNetStorefrontCore.Customer.Current;

        string errorMessage, errorCode;

        this.PaymentProfileId = ProcessTools.SaveProfileAndPaymentProfile(adnsfCustomer.CustomerID, adnsfCustomer.EMail, AspDotNetStorefrontCore.AppLogic.AppConfig("StoreName"), this.PaymentProfileId, selectedAddressId, TextCreditCard.Text, TextCardSecurity.Text, ExpirationMonth.SelectedValue, ExpirationYear.SelectedValue, out errorMessage, out errorCode);

        if (PaymentProfileId <= 0)
        {
            ShowError(String.Format("{0} {1}", AspDotNetStorefrontCore.AppLogic.GetString("AspDotNetStorefrontGateways.AuthorizeNet.Cim.ErrorMessage", adnsfCustomer.SkinID, adnsfCustomer.LocaleSetting), errorMessage));
            return;
        }

        if (CBMakePrimaryCard.Checked)
        {
            AspDotNetStorefrontCore.Address adnsfAddress = new AspDotNetStorefrontCore.Address();
            adnsfAddress.LoadFromDB(selectedAddressId);
            adnsfAddress.MakeCustomersPrimaryAddress(AspDotNetStorefrontCore.AddressTypes.Billing);
            DataUtility.SetPrimaryPaymentProfile(adnsfCustomer.CustomerID, this.PaymentProfileId);
        }

        BindPage(this.PaymentProfileId);

        FireCardEditComplete();
    }
示例#10
0
        public static void RemovePrimeDat()
        {
            GeneratePrimeDat_Proc.WaitForExit();
            GeneratePrimeDat_Proc = null;

            ProcessTools.Start(Prime53File, "/D").WaitForExit();
        }
        public static int UninstallUsingMsi(this ApplicationUninstallerEntry entry, MsiUninstallModes mode,
                                            bool simulate)
        {
            try
            {
                var uninstallPath = GetMsiString(entry.BundleProviderKey, mode);
                if (string.IsNullOrEmpty(uninstallPath))
                {
                    return(-1);
                }

                var startInfo = ProcessTools.SeparateArgsFromCommand(uninstallPath).ToProcessStartInfo();
                startInfo.UseShellExecute = false;
                if (simulate)
                {
                    Thread.Sleep(SimulationDelay);
                    return(0);
                }
                return(startInfo.StartAndWait());
            }
            catch (IOException)
            {
                throw;
            }
            catch (InvalidOperationException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new FormatException(ex.Message, ex);
            }
        }
示例#12
0
        private static void RunExternalCommands(string commands, LoadingDialogInterface controller)
        {
            var lines = commands.SplitNewlines(StringSplitOptions.RemoveEmptyEntries);

            controller.SetMaximum(lines.Length);

            for (var i = 0; i < lines.Length; i++)
            {
                controller.SetProgress(i);

                var line = lines[i];
                try
                {
                    var filename = ProcessTools.SeparateArgsFromCommand(line);
                    filename.FileName = Path.GetFullPath(filename.FileName);
                    if (!File.Exists(filename.FileName))
                    {
                        throw new IOException(Localisable.Error_FileNotFound);
                    }
                    filename.ToProcessStartInfo().StartAndWait();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format(Localisable.MessageBoxes_ExternalCommandFailed_Message, line)
                                    + Localisable.MessageBoxes_Error_details + ex.Message,
                                    Localisable.MessageBoxes_ExternalCommandFailed_Title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public static int Modify(this ApplicationUninstallerEntry entry, bool simulate)
        {
            try
            {
                if (string.IsNullOrEmpty(entry.ModifyPath))
                {
                    return(-1);
                }

                var startInfo = ProcessTools.SeparateArgsFromCommand(entry.ModifyPath).ToProcessStartInfo();
                startInfo.UseShellExecute = false;
                if (simulate)
                {
                    Thread.Sleep(SimulationDelay);
                    return(0);
                }
                return(startInfo.StartAndWait());
            }
            catch (IOException)
            {
                throw;
            }
            catch (InvalidOperationException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new FormatException(ex.Message, ex);
            }
        }
示例#14
0
        public static string GetFairFullPath(string path)
        {
            using (WorkingDir wd = new WorkingDir())
            {
                string argsFile = wd.MakePath();
                string outFile  = wd.MakePath();
                string molp     = SecurityTools.MakePassword_9();

                string[] args =
                {
                    "//O",
                    outFile,
                    "//MOLP",
                    molp,
                    "//-E",
                    "//$",
                    JString.AsLine(path),
                };

                File.WriteAllLines(argsFile, args, StringTools.ENCODING_SJIS);

                ProcessTools.Start(@"C:\Factory\Bodewig\DenebolaToolkit\FairFullPath.exe", "//R \"" + argsFile + "\"").WaitForExit();

                string[] outLines = File.ReadAllLines(outFile, StringTools.ENCODING_SJIS)
                                    .Where(v => v.StartsWith(molp))
                                    .Select(v => v.Substring(molp.Length)).ToArray();

                if (outLines.Length != 1)
                {
                    throw new Exception("不正なパス文字列です。");
                }

                return(outLines[0]);
            }
        }
示例#15
0
        /// <summary>
        /// Get directories which are already used and should be skipped
        /// </summary>
        private static IEnumerable <string> GetDirectoriesToSkip(IEnumerable <ApplicationUninstallerEntry> existingUninstallers,
                                                                 IEnumerable <KVP> pfDirectories)
        {
            var dirs = new List <string>();

            foreach (var x in existingUninstallers)
            {
                dirs.Add(x.InstallLocation);
                dirs.Add(x.UninstallerLocation);

                if (string.IsNullOrEmpty(x.DisplayIcon))
                {
                    continue;
                }
                try
                {
                    var iconFilename = x.DisplayIcon.Contains('.')
                        ? ProcessTools.SeparateArgsFromCommand(x.DisplayIcon).FileName
                        : x.DisplayIcon;

                    dirs.Add(PathTools.GetDirectory(iconFilename));
                }
                catch
                {
                    // Ignore invalid DisplayIcon paths
                }
            }

            return(dirs.Where(x => !string.IsNullOrEmpty(x)).Distinct()
                   .Where(x => !pfDirectories.Any(pfd => pfd.Key.FullName.Contains(x, StringComparison.InvariantCultureIgnoreCase))));
        }
示例#16
0
        // ----

        public void MakeMovie()
        {
            if (this.Audio == null)
            {
                throw new Exception("Audio is null");
            }

            FileTools.Delete(this.GetVideoFile());
            FileTools.Delete(this.GetMovieFile());

            ProcessTools.Batch(new string[]
            {
                string.Format(@"{0}ffmpeg.exe -r {1} -i %%d.jpg ..\video.mp4",
                              AudioPicMP4Props.FFmpegPathBase,
                              AudioPicMP4Props.FPS
                              ),
            },
                               this.GetImageDir()
                               );

            if (File.Exists(this.GetVideoFile()) == false)
            {
                throw new Exception();
            }

            ProcessTools.Batch(new string[]
            {
                string.Format(@"{0}ffmpeg.exe -i video.mp4 -i {1} -map 0:0 -map 1:{2} -vcodec copy -codec:a copy movie.mp4",
                              AudioPicMP4Props.FFmpegPathBase,
                              this.Audio.GetFile(),
                              this.Audio.GetInfo().GetAudioStreamIndex()
                              ),
            },
                               this.WD.GetPath(".")
                               );

            if (Utils.IsEmptyFile(this.GetMovieFile()))
            {
                FileTools.Delete(this.GetMovieFile());

                ProcessTools.Batch(new string[]
                {
                    // -codec:a copy を除去
                    string.Format(@"{0}ffmpeg.exe -i video.mp4 -i {1} -map 0:0 -map 1:{2} -vcodec copy movie.mp4",
                                  AudioPicMP4Props.FFmpegPathBase,
                                  this.Audio.GetFile(),
                                  this.Audio.GetInfo().GetAudioStreamIndex()
                                  ),
                },
                                   this.WD.GetPath(".")
                                   );

                if (Utils.IsEmptyFile(this.GetMovieFile()))
                {
                    throw new Exception();
                }
            }
        }
示例#17
0
        public override void Run(Configuration config, CommandArguments args)
        {
            base.Run(config, args);

            var target        = args.GetTarget(this);
            var buildFileName = Path.Combine(config.BuildsDirectory, target, config.Windows.BuildFile);

            ProcessTools.RunProcessAndEnsureSuccess(this, $"Run('{target}')", buildFileName, "");
        }
示例#18
0
        public bool Run(string command, AppContext ctx)
        {
            foreach (var proc in _runningProcesses)
            {
                ProcessTools.KillProcessAndChildren(proc.Id);
            }
            _runningProcesses.Clear();

            return(false);
        }
示例#19
0
    public void Strip()
    {
        var proc = ProcessTools.CreateProcess("strip",
                                              String.Format("-u -r \"{0}\"", File.FullName));

        if (proc != null)
        {
            proc.Dispose();
        }
    }
        public ServiceEntry(string serviceName, string displayName, string command)
        {
            ProgramName   = serviceName;
            EntryLongName = displayName;

            Command         = command;
            CommandFilePath = ProcessTools.SeparateArgsFromCommand(command).FileName;

            FillInformationFromFile(CommandFilePath);
        }
示例#21
0
    private void Start()
    {
        var allProcess = ProcessTools.ListAllAppliction();

        foreach (var item in allProcess)
        {
            Debug.Log(item);
        }
        Debug.Log("当前进程数" + allProcess.Length);
    }
示例#22
0
        void RunBuildFor(string configurationName, string projectPath)
        {
            var gradleFile = Path.Combine(projectPath, "gradlew.bat");
            var gradleArgs = $"assemble{configurationName}";

            Console.WriteLine($"Run gradle build with args: '{gradleArgs}'");
            ProcessTools.RunProcessAndEnsureSuccess(this, "Gradle Build", gradleFile, gradleArgs, projectPath);

            Console.WriteLine("Stop gradle agent");
            ProcessTools.RunProcessAndEnsureSuccess(this, "Gradle Stop", gradleFile, "--stop", projectPath);
        }
示例#23
0
        private static void Run(string command)
        {
            command += " 1> stdout.tmp 2> stderr.tmp";

            ProcMain.WriteLog("command: " + command);

            ProcessTools.Batch(new string[] { command });

            ProcMain.WriteLog("stdout.tmp ----> " + File.ReadAllText("stdout.tmp", StringTools.ENCODING_SJIS) + " <---- ここまで");
            ProcMain.WriteLog("stderr.tmp ----> " + File.ReadAllText("stderr.tmp", StringTools.ENCODING_SJIS) + " <---- ここまで");
        }
示例#24
0
 public void SetDisplay(System.Windows.Window window)
 {
     foreach (var prompter in prompters)
     {
         prompter.NotifyUser += p => window.Dispatcher.Invoke(() =>
         {
             ProcessTools.PopThis(window);
             p.DisplayOn(window);
         });
     }
 }
 public bool IsGameRunning()
 {
     foreach (string executableName in this.executableNames)
     {
         if (ProcessTools.IsProcessRunning(executableName))
         {
             return(true);
         }
     }
     return(false);
 }
示例#26
0
        public override void Run(Configuration config, CommandArguments args)
        {
            base.Run(config, args);

            var target   = args.GetTarget(this);
            var buildDir = Path.Combine(config.BuildsDirectory, target);

            using (var proc = ProcessTools.RunProcess("python", "-m SimpleHTTPServer", buildDir)) {
                Console.WriteLine("Web server started on 'localhost:8000'");
            }
        }
示例#27
0
        private static void Perform_OutFile_Interlude(string arguments, string outFile, Func <bool> interlude)
        {
            using (Process p = ProcessTools.Start(
                       Prime4096File,
                       arguments + " \"" + outFile + "\"",
                       "",
                       ProcessTools.WindowStyle_e.INVISIBLE,
                       psi => psi.RedirectStandardOutput = true
                       ))
                using (new ThreadEx(() =>
                {
                    StreamReader reader = p.StandardOutput;

                    for (int c = 0; c < 100; c++)
                    {
                        string line = reader.ReadLine();

                        if (line == null)
                        {
                            break;
                        }

                        using (StreamWriter writer = new StreamWriter(LogFile, c != 0, Encoding.UTF8))
                        {
                            writer.WriteLine("[" + DateTime.Now + "." + (c + 1).ToString("D3") + "] " + line);
                        }
                    }
                }
                                    ))
                {
                    bool cancelled = false;

                    while (p.WaitForExit(2000) == false)
                    {
                        if (cancelled || interlude() == false)
                        {
                            ProcessTools.Start(Prime4096File, "/S").WaitForExit();
                            cancelled = true;
                        }
                    }
                }

            {
                string errorReportFile = Path.Combine(Path.GetDirectoryName(Prime4096File), Consts.ERROR_REPORT_LOCAL_FILE);

                if (File.Exists(errorReportFile))
                {
                    string message = File.ReadAllText(errorReportFile, Encoding.UTF8);
                    FileTools.Delete(errorReportFile);
                    throw new CUIError(message);
                }
            }
        }
示例#28
0
        private static void AddSteam()
        {
            WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
            bool             hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);

            if (!hasAdministrativeRight)
            {
                // relaunch the application with admin rights
                string           fileName    = Assembly.GetExecutingAssembly().Location;
                ProcessStartInfo processInfo = new ProcessStartInfo();
                processInfo.Arguments = "addsteam";
                processInfo.Verb      = "runas";
                processInfo.FileName  = fileName;

                try
                {
                    Process.Start(processInfo);
                }
                catch (Win32Exception)
                {
                    // This will be thrown if the user cancels the prompt
                }

                return;
            }
            string quote = "\"";
            string space = " ";

            // Process.Start("taskkill", "/im steam.exe /f").WaitForExit();

            if (ProcessTools.IsProcessRunning("steam"))
            {
                MessageBox.Show("Please close Steam before continuing");
            }
            if (ProcessTools.IsProcessRunning("steam"))
            {
                bool result = MessageBoxUtils.ShowChoiceDialog("Force close Steam? (Not recommended, close Steam manually if possible)", "Close Steam before adding shortcuts to Steam", "Force Close Steam", "I will close Steam manually");
                switch (result)
                {
                case true:
                    ProcessTools.KillProcess("steam", true, false);
                    break;

                case false:
                    ProcessTools.KillProcess("steam", true, true);     //CloseMainWindow shouldn't close steam, use as a lazy shortcut to process.Wait()
                    break;
                }
            }
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Medal of Honor Warfighter" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.MOHW.exe") + quote).WaitForExit();
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield 3" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BF3.exe") + quote).WaitForExit();
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield 4" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BF4.exe") + quote).WaitForExit();
            Process.Start("steam_shortcut_manager_cli.exe", "all" + space + quote + "Battlefield Hardline Beta" + quote + space + quote + Path.GetFullPath("Battlelogium.UI.BFH.exe") + quote).WaitForExit();
        }
示例#29
0
 private static void CheckInstallPathPermissions(string path)
 {
     if (!PathTools.DirectoryHasWritePermission(path) ||
         !PathTools.DirectoryHasWritePermission(Path.Combine(path, "mods")) ||
         !PathTools.DirectoryHasWritePermission(Path.Combine(path, "userdata")))
     {
         if (MessageBox.Show("KK Manager doesn't have write permissions to the game directory! This can cause issues for both KK Manager and the game itself.\n\nDo you want KK Manager to fix permissions of the entire Koikatu folder?",
                             "No write access to game directory", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             ProcessTools.FixPermissions(path)?.WaitForExit();
         }
     }
 }
        /// <param name="iNewIpFrequency">Temps en minutes</param>
        public WebQueryHideIP(ProgressCancelNotifier iProgressCancelNotifier, bool iWithSafeNetwork, bool iWithIpCheck = true, int iNewIpFrequency = 30)
            : base(iProgressCancelNotifier)
        {
            if (ProcessTools.IsProcessRunning("privoxy") == false)
            {
                throw new Exception("Pour effectuer des requetes via proxy, le logiciel 'Privoxy' doit être lancé.");
            }

            if (ProcessTools.IsProcessRunning("vidalia") == false)
            {
                throw new Exception("Pour effectuer des requetes via proxy, le logiciel 'Vidalia' doit être lancé.");
            }

            WebQueryType = WebQueryTypeEnum.WebQueryWithProxy;

            newIpFrequency = iNewIpFrequency;
            proxyAdress    = PROXYADRESS;
            proxyPort      = PROXYPORT;
            socksAdress    = SOCKSADRESS;
            socksPort      = SOCKSPORT;
            socksPassword  = SOCKSPASSWORD;

            WithSafeNetwork = iWithSafeNetwork;

            //Chargement de la liste de user agent
            userAgentList.Add("Mozilla/5.0 (compatible; MSIE 9.0; AOL 9.7; AOLBuild 4343.19; Windows NT 6.1; WOW64; Trident/5.0; FunWebProducts)");
            userAgentList.Add("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0");
            userAgentList.Add("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36");
            userAgentList.Add("Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25");
            userAgentList.Add("Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14");
            userAgentList.Add("Mozilla/5.0 (X11; U; Linux i686; fr-fr) AppleWebKit/525.1+ (KHTML, like Gecko, Safari/525.1+) midori/1.19");

            //vérification de l'adresse proxy différente de l'adresse réel:
            if (iWithIpCheck)
            {
                string realIp  = new WebQueryNoHideIP(Notifier, iWithSafeNetwork).GetMyIp();
                string proxyIp = GetMyIp();

                if (proxyIp != null && realIp != null && proxyIp != realIp)
                {
                    using (var sublevel1 = new ProgressCancelNotifier.SubLevel(Notifier))
                    {
                        Notifier.Report("Ip proxy : {0}, Ip box : {1} ".FormatString(proxyIp, realIp));
                    }
                }
                else
                {
                    throw new Exception("Error lors de la vérification du proxy. Vérifier si le socks(vidalia) et le proxy(privoxy) sont bien démarrés.");
                }
            }
        }