public BotFactory(Maze maze, EngineSettings settings, WallGrid walls, BrainFactory brainFactory, EyeFactory eyeFactory) { _maze = maze; _settings = settings; _walls = walls; _brainFactory = brainFactory; _eyeFactory = eyeFactory; }
public LiveDbProvider(string path) { if (Directory.Exists(path) == false) { var model = new DocumentNodeModel(); var settings = new EngineSettings(path); LiveDomain.Core.Engine.Create(model, settings); } liveDbEngine = LiveDomain.Core.Engine.Load<DocumentNodeModel>(path); nodeTreeIsUpdated = true; }
/// <summary> /// Standard constructor to initialze member variables according to /// the provided EngineSettings object /// </summary> /// <param name="s"></param> public DebuggerSettings(EngineSettings s) { this.HideMainWindow = s.HideMainWindow; this.AutoCloseSpawnedWindows = s.AutoCloseSpawnedWindows; this.OKbeforeCLOSE = s.OKbeforeCLOSE; this.AlwaysClick = s.AlwaysClick; this.EnableKillAlso = s.EnableKillAlso; this.KillAlso = s.KillAlso; this.HideDebugger = s.HideDebugger; this.WaitForFullStartup = s.WaitForFullStartup; this.OnlyClosedIfButtonClick = s.OnlyCloseIfButtonClicked; this.IgnoreExceptions = s.IgnoreExceptions; this.ErrorCodes = s.ErrorCodes; }
/// <summary> /// Updates engine with new engine settings /// </summary> /// <param name="engineId">The Engine Id</param> /// <param name="engineSettings">The new engine settings</param> public void Update(int engineId, EngineSettings engineSettings) { var engine = db.Engines.FirstOrDefault(e => e.EngineId == engineId); if(engine != null) { if (engineSettings.Verbosity != null) engine.Verbosity = Convert.ToInt32(engineSettings.Verbosity); if (engineSettings.Testing != null) engine.Testing = Convert.ToBoolean(engineSettings.Testing); if (engineSettings.EngineLoopInterval != null) engine.EngineLoopInterval = Convert.ToInt32(engineSettings.EngineLoopInterval); if (engineSettings.GameLoopInterval != null) engine.GameLoopInterval = Convert.ToInt32(engineSettings.GameLoopInterval); if (engineSettings.SweepLoopInterval != null) engine.SweepLoopInterval = Convert.ToInt32(engineSettings.SweepLoopInterval); if (engineSettings.GridTimeout != null) engine.GridTimeout = Convert.ToInt32(engineSettings.GridTimeout); if (engineSettings.PlayerTimeout != null) engine.PlayerTimeout = Convert.ToInt32(engineSettings.PlayerTimeout); if (engineSettings.MaxPlayingTime != null) engine.MaxPlayingTime = Convert.ToInt32(engineSettings.MaxPlayingTime); if (engineSettings.MaxPlayingGrids != null) engine.MaxPlayingGrids = Convert.ToInt32(engineSettings.MaxPlayingGrids); db.Save(); } }
/// <summary> /// Standard constructor, initializes the fuzzer given the engine's settings /// </summary> /// <param name="s"></param> public RandomFuzz(EngineSettings s) : base(s) { this.Modifications = s.RandomFuzzModifications; this.ModificationBytes = s.RandomFuzzModificationBytes; this.endPercentage = s.RandomFuzzEndFilePercentage; this.startPercentage = s.RandomFuzzStartFilePercentage; this.Total = s.RandomFuzzTotalAttempts; this.progressIncrement = 100.0 / (this.Total + 1); this.SprayPercentage = s.RandomFuzzSprayPercentage; this.lowerBound = (int)(this.startPercentage / 100.0 * this.BaseFileStream.Length); this.upperBound = (int)(this.endPercentage / 100.0 * this.BaseFileStream.Length); this.sprayCount = (int)((double)(this.upperBound - this.lowerBound) * (this.SprayPercentage / 100.0)); }
/// <summary> /// Constructor. Initializes the settings of the fuzzer. /// </summary> /// <param name="s"></param> public SequentialFuzzer(EngineSettings s) : base(s) { this.startingByte = this.currentPosition = (int)((s.SequentialFuzzStartingIndex / 100.0) * (double)this.BaseFileStream.Length); this.endingByte = (int)(s.SequentialFuzzEndingIndex / 100.0 * (double)this.BaseFileStream.Length); if (this.endingByte == 0) this.endingByte = (int)this.BaseFileStream.Length; this.increments = s.SequentialFuzzerModificationIncrements; this.sizes = s.SequentialFuzzerModificationSizes; this.modifications = s.SequentialFuzzerModifications; this.modificationValues = s.SequentialFuzzerModificationBytes; this.Total = 0; foreach (byte increment in this.increments) this.Total += (uint)((this.endingByte - this.startingByte) / (long)increment); this.Total *= (uint)this.sizes.Count; this.Total *= (uint)this.modifications.Count; this.Total *= (uint)this.modificationValues.Count; this.progressIncrement = 100.0 / (this.Total + 1); }
private static void Main() { try { #if DEBUG File.Delete("TraceLog.txt"); #endif Application.ThreadException += OnThreadException; AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var settings = new EngineSettings {Dialect = "Templates/UdpFastFixDialect.xml", LicenseStore = "Licenses"}; Engine.Init(settings); Application.Run(new MainForm()); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Exception During Initialization", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ClientEngine(EngineSettings settings, string peerId = null) : this(settings, new DiskWriter(), peerId) { }
public ClientEngine(EngineSettings settings, PieceWriter writer, string peerId = null) : this(settings, new SocketListener(new IPEndPoint(IPAddress.Any, 0)), writer, peerId) { }
public ShaderConverter(EngineSettings engineSettings) { _engineSettings = engineSettings; }
/// <summary> /// Executes test plan /// </summary> /// <returns></returns> public int Execute(CancellationToken cancellationToken) { List <ResultParameter> metaData = new List <ResultParameter>(); HandleMetadata(metaData); string planToLoad = null; // If the --search argument is used, add the --ignore-load-errors to fix any load issues. if (Search.Any()) { // Warn log.Warning("Argument '--search' is deprecated. The '--ignore-load-errors' argument has been added to avoid potential test plan load issues."); IgnoreLoadErrors = true; } try { planToLoad = !string.IsNullOrWhiteSpace(TestPlanPath) ? Path.GetFullPath(TestPlanPath) : null; } catch (Exception) { Console.WriteLine("Invalid path: '{0}'", TestPlanPath); Console.WriteLine("The path only supports a valid file path."); return(Exit(ExitStatus.ArgumentError)); } try { HandleSearchDirectories(); } catch (ArgumentException) { return(Exit(ExitStatus.ArgumentError)); } EngineSettings.LoadWorkingDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); Assembly assembly = Assembly.GetExecutingAssembly(); Console.WriteLine($"OpenTAP Command Line Interface {FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion}\n"); if (!string.IsNullOrWhiteSpace(Settings)) { TestPlanRunner.SetSettingsDir(Settings); } if (!NonInteractive && UserInput.Interface == null) { CliUserInputInterface.Load(); } if (Results != null) { try { HandleResultListeners(); } catch (ArgumentException) { return(Exit(ExitStatus.ArgumentError)); } } if (planToLoad == null) { Console.WriteLine("Please supply a valid test plan path as an argument."); return(Exit(ExitStatus.ArgumentError)); } // Load TestPlan: if (!File.Exists(planToLoad)) { log.Error("File '{0}' does not exist.", planToLoad); log.Flush(); Thread.Sleep(100); return(Exit(ExitStatus.ArgumentError)); } try { HandleExternalParametersAndLoadPlan(planToLoad); } catch (TestPlan.PlanLoadException ex) { log.Error(ex.Message); return(Exit(ExitStatus.LoadError)); } catch (ArgumentException ex) { if (!string.IsNullOrWhiteSpace(ex.Message)) { log.Error(ex.Message); } return(Exit(ExitStatus.ArgumentError)); } catch (Exception e) { log.Error("Caught error while loading test plan: '{0}'", e.Message); log.Debug(e); return(Exit(ExitStatus.RuntimeError)); } log.Info("Test Plan: {0}", Plan.Name); if (ListExternal) { PrintExternalParameters(log); return(Exit(ExitStatus.Ok)); } Verdict verdict = TestPlanRunner.RunPlanForDut(Plan, metaData, cancellationToken); if (verdict == Verdict.Inconclusive) { return(Exit(ExitStatus.TestPlanInconclusive)); } if (verdict == Verdict.Fail) { return(Exit(ExitStatus.TestPlanFail)); } if (verdict > Verdict.Fail) { return(Exit(ExitStatus.RuntimeError)); } return(Exit(ExitStatus.Ok)); }
/// <summary> /// Constructor. Initializes the settings of the Engine. /// </summary> /// <param name="s"></param> public Engine(EngineSettings s) { s.CheckSettingsValidity(); this.settings = s; this.debugger = new Debugger(new DebuggerSettings(this.settings)); }
public PcapRandomFuzz(EngineSettings s) : base(s) { this.Total = 100000; }
private static void StartEngine() { int port; Torrent torrent = null; // Ask the user what port they want to use for incoming connections Console.Write(Environment.NewLine + "Choose a listen port: "); while (!Int32.TryParse(Console.ReadLine(), out port)) { } // Create the settings which the engine will use // downloadsPath - this is the path where we will save all the files to // port - this is the port we listen for connections on EngineSettings engineSettings = new EngineSettings(_downloadsPath, port); engineSettings.PreferEncryption = false; engineSettings.AllowedEncryption = EncryptionTypes.All; //engineSettings.GlobalMaxUploadSpeed = 30 * 1024; //engineSettings.GlobalMaxDownloadSpeed = 100 * 1024; //engineSettings.MaxReadRate = 1 * 1024 * 1024; // Create the default settings which a torrent will have. // 4 Upload slots - a good ratio is one slot per 5kB of upload speed // 50 open connections - should never really need to be changed // Unlimited download speed - valid range from 0 -> int.Max // Unlimited upload speed - valid range from 0 -> int.Max TorrentSettings torrentDefaults = new TorrentSettings(4, 150, 0, 0); // Create an instance of the engine. _engine = new ClientEngine(engineSettings); _engine.ChangeListenEndpoint(new IPEndPoint(IPAddress.Any, port)); byte[] nodes = null; try { nodes = File.ReadAllBytes(_dhtNodeFile); } catch { Console.WriteLine("No existing dht nodes could be loaded"); } DhtListener dhtListner = new DhtListener (new IPEndPoint (IPAddress.Any, port)); DhtEngine dht = new DhtEngine (dhtListner); _engine.RegisterDht(dht); dhtListner.Start(); _engine.DhtEngine.Start(nodes); // If the SavePath does not exist, we want to create it. if (!Directory.Exists(_engine.Settings.SavePath)) Directory.CreateDirectory(_engine.Settings.SavePath); // If the torrentsPath does not exist, we want to create it if (!Directory.Exists(_torrentsPath)) Directory.CreateDirectory(_torrentsPath); BEncodedDictionary fastResume; try { fastResume = BEncodedValue.Decode<BEncodedDictionary>(File.ReadAllBytes(_fastResumeFile)); } catch { fastResume = new BEncodedDictionary(); } // For each file in the torrents path that is a .torrent file, load it into the engine. foreach (string file in Directory.GetFiles(_torrentsPath)) { if (file.EndsWith(".torrent")) { try { // Load the .torrent from the file into a Torrent instance // You can use this to do preprocessing should you need to torrent = Torrent.Load(file); Console.WriteLine(torrent.InfoHash.ToString()); } catch (Exception e) { Console.Write("Couldn't decode {0}: ", file); Console.WriteLine(e.Message); continue; } // When any preprocessing has been completed, you create a TorrentManager // which you then register with the engine. TorrentManager manager = new TorrentManager(torrent, _downloadsPath, torrentDefaults); if (fastResume.ContainsKey(torrent.InfoHash.ToHex ())) manager.LoadFastResume(new FastResume ((BEncodedDictionary)fastResume[torrent.infoHash.ToHex ()])); _engine.Register(manager); // Store the torrent manager in our list so we can access it later torrents.Add(manager); manager.PeersFound += ManagerPeersFound; } } // If we loaded no torrents, just exist. The user can put files in the torrents directory and start // the client again if (torrents.Count == 0) { Console.WriteLine("No torrents found in the Torrents directory"); Console.WriteLine("Exiting..."); _engine.Dispose(); return; } // For each torrent manager we loaded and stored in our list, hook into the events // in the torrent manager and start the engine. foreach (TorrentManager manager in torrents) { // Every time a piece is hashed, this is fired. manager.PieceHashed += delegate(object o, PieceHashedEventArgs e) { lock (listener) listener.WriteLine(string.Format("Piece Hashed: {0} - {1}", e.PieceIndex, e.HashPassed ? "Pass" : "Fail")); }; // Every time the state changes (Stopped -> Seeding -> Downloading -> Hashing) this is fired manager.TorrentStateChanged += delegate (object o, TorrentStateChangedEventArgs e) { lock (listener) listener.WriteLine("OldState: " + e.OldState.ToString() + " NewState: " + e.NewState.ToString()); }; // Every time the tracker's state changes, this is fired foreach (var tracker in manager.TrackerManager.SelectMany(tier => tier.Trackers)) { tracker.AnnounceComplete += (sender, e) => listener.WriteLine(string.Format("{0}: {1}", e.Successful, e.Tracker.ToString())); } // Start the torrentmanager. The file will then hash (if required) and begin downloading/seeding manager.Start(); } // While the torrents are still running, print out some stats to the screen. // Details for all the loaded torrent managers are shown. var i = 0; var running = true; var sb = new StringBuilder(1024); while (running) { if ((i++) % 10 == 0) { sb.Remove(0, sb.Length); running = torrents.Exists(delegate(TorrentManager m) { return m.State != TorrentState.Stopped; }); AppendFormat(sb, "Total Download Rate: {0:0.00}kB/sec", _engine.TotalDownloadSpeed / 1024.0); AppendFormat(sb, "Total Upload Rate: {0:0.00}kB/sec", _engine.TotalUploadSpeed / 1024.0); AppendFormat(sb, "Disk Read Rate: {0:0.00} kB/s", _engine.DiskManager.ReadRate / 1024.0); AppendFormat(sb, "Disk Write Rate: {0:0.00} kB/s", _engine.DiskManager.WriteRate / 1024.0); AppendFormat(sb, "Total Read: {0:0.00} kB", _engine.DiskManager.TotalRead / 1024.0); AppendFormat(sb, "Total Written: {0:0.00} kB", _engine.DiskManager.TotalWritten / 1024.0); AppendFormat(sb, "Open Connections: {0}", _engine.ConnectionManager.OpenConnections); foreach (var manager in torrents) { AppendSeperator(sb); AppendFormat(sb, "State: {0}", manager.State); AppendFormat(sb, "Name: {0}", manager.Torrent == null ? "MetaDataMode" : manager.Torrent.Name); AppendFormat(sb, "Progress: {0:0.00}", manager.Progress); AppendFormat(sb, "Download Speed: {0:0.00} kB/s", manager.Monitor.DownloadSpeed / 1024.0); AppendFormat(sb, "Upload Speed: {0:0.00} kB/s", manager.Monitor.UploadSpeed / 1024.0); AppendFormat(sb, "Total Downloaded: {0:0.00} MB", manager.Monitor.DataBytesDownloaded / (1024.0 * 1024.0)); AppendFormat(sb, "Total Uploaded: {0:0.00} MB", manager.Monitor.DataBytesUploaded / (1024.0 * 1024.0)); var tracker = manager.TrackerManager.CurrentTracker; //AppendFormat(sb, "Tracker Status: {0}", tracker == null ? "<no tracker>" : tracker.State.ToString()); AppendFormat(sb, "Warning Message: {0}", tracker == null ? "<no tracker>" : tracker.WarningMessage); AppendFormat(sb, "Failure Message: {0}", tracker == null ? "<no tracker>" : tracker.FailureMessage); if (manager.PieceManager != null) AppendFormat(sb, "Current Requests: {0}", manager.PieceManager.CurrentRequestCount()); foreach (var peerId in manager.GetPeers()) AppendFormat(sb, "\t{2} - {1:0.00}/{3:0.00}kB/sec - {0}", peerId.Peer.ConnectionUri, peerId.Monitor.DownloadSpeed / 1024.0, peerId.AmRequestingPiecesCount, peerId.Monitor.UploadSpeed/ 1024.0); AppendFormat(sb, "", null); if (manager.Torrent != null) foreach (var file in manager.Torrent.Files) AppendFormat(sb, "{1:0.00}% - {0}", file.Path, file.BitField.PercentComplete); } Console.Clear(); Console.WriteLine(sb.ToString()); listener.ExportTo(Console.Out); } Thread.Sleep(500); } }
public static void phj() { int port = 8988; Torrent torrent = null; // Create the settings which the engine will use downloadsPath - this is the path where // we will save all the files to port - this is the port we listen for connections on EngineSettings engineSettings = new EngineSettings(ftg, port); engineSettings.PreferEncryption = false; engineSettings.AllowedEncryption = EncryptionTypes.All; //engineSettings.GlobalMaxUploadSpeed = 30 * 1024; //engineSettings.GlobalMaxDownloadSpeed = 100 * 1024; //engineSettings.MaxReadRate = 1 * 1024 * 1024; // Create the default settings which a torrent will have. 4 Upload slots - a good ratio // is one slot per 5kB of upload speed 50 open connections - should never really need to // be changed Unlimited download speed - valid range from 0 -> int.Max Unlimited upload // speed - valid range from 0 -> int.Max TorrentSettings torrentDefault = new TorrentSettings(14, 150, 0, 0); // Create an instance of the engine. ClientEngine engine = new ClientEngine(engineSettings); engine.ChangeListenEndpoint(new IPEndPoint(IPAddress.LoopbackMask, port)); byte[] nodes = null; try { nodes = File.ReadAllBytes(dhtNodeFile); } catch { Console.Write("No existing dht nodes could be loaded"); } DhtListener dhtListner = new DhtListener(new IPEndPoint(IPAddress.LoopbackMask, port)); DhtEngine dht = new DhtEngine(dhtListner); engine.RegisterDht(dht); dhtListner.Start(); engine.DhtEngine.Start(nodes); // If the SavePath does not exist, we want to create it. if (!Directory.Exists(engine.Settings.SavePath)) { Directory.CreateDirectory(engine.Settings.SavePath); } // If the torrentsPath does not exist, we want to create it if (!Directory.Exists(torrentsPath)) { Directory.CreateDirectory(torrentsPath); } BEncodedDictionary fastResume; try { Console.Write("resume file"); fastResume = BEncodedValue.Decode <BEncodedDictionary>(File.ReadAllBytes(fastResumeFile)); } catch { Console.Write("new file"); fastResume = new BEncodedDictionary(); } // For each file in the torrents path that is a .torrent file, load it into the engine. foreach (string file in Directory.GetFiles(torrentsPath)) { if (file.EndsWith(".torrent")) { try { // Load the .torrent from the file into a Torrent instance You can use this // to do preprocessing should you need to torrent = Torrent.Load(file); Console.Write(torrent.InfoHash.ToString()); Console.Write("load " + file); } catch (Exception e) { Console.Write("Couldn't decode {0}: ", file); Console.Write(e.Message); continue; } // When any preprocessing has been completed, you create a TorrentManager which // you then register with the engine. TorrentManager manager = new TorrentManager(torrent, downloadsPath, torrentDefault); if (fastResume.ContainsKey(torrent.InfoHash.ToHex())) { manager.LoadFastResume(new FastResume((BEncodedDictionary)fastResume[torrent.InfoHash.ToHex()])); } engine.Register(manager); // Store the torrent manager in our list so we can access it later torrents.Add(manager); manager.PeersFound += new EventHandler <PeersAddedEventArgs>(manager_PeersFound); } } // If we loaded no torrents, just exist. The user can put files in the torrents directory // and start the client again if (torrents.Count == 0) { Console.Write("No torrents found in the Torrents directory"); Console.Write("Exiting..."); engine.Dispose(); return; } // For each torrent manager we loaded and stored in our list, hook into the events in the // torrent manager and start the engine. foreach (TorrentManager manager in torrents) { // Every time a piece is hashed, this is fired. manager.PieceHashed += delegate(object o, PieceHashedEventArgs e) { lock (listener) listener.WriteLine(string.Format("Piece Hashed: {0} - {1}", e.PieceIndex, e.HashPassed ? "Pass" : "Fail")); }; // Every time the state changes (Stopped -> Seeding -> Downloading -> Hashing) this // is fired manager.TorrentStateChanged += delegate(object o, TorrentStateChangedEventArgs e) { lock (listener) listener.WriteLine("OldState: " + e.OldState.ToString() + " NewState: " + e.NewState.ToString()); }; // Every time the tracker's state changes, this is fired foreach (TrackerTier tier in manager.TrackerManager) { foreach (MonoTorrent.Client.Tracker.Tracker t in tier) { t.AnnounceComplete += delegate(object sender, AnnounceResponseEventArgs e) { listener.WriteLine(string.Format("{0}: {1}", e.Successful, e.Tracker.ToString())); }; } } // Start the torrentmanager. The file will then hash (if required) and begin downloading/seeding manager.Start(); } // While the torrents are still running, print out some stats to the screen. Details for // all the loaded torrent managers are shown. int i = 0; bool running = true; StringBuilder sb = new StringBuilder(1024); while (running) { if ((i++) % 10 == 0) { sb.Remove(0, sb.Length); running = torrents.Exists(delegate(TorrentManager m) { return(m.State != TorrentState.Stopped); }); AppendFormat(sb, "Total Download Rate: {0:0.00}kB/sec", engine.TotalDownloadSpeed / 1024.0); AppendFormat(sb, "Total Upload Rate: {0:0.00}kB/sec", engine.TotalUploadSpeed / 1024.0); AppendFormat(sb, "Disk Read Rate: {0:0.00} kB/s", engine.DiskManager.ReadRate / 1024.0); AppendFormat(sb, "Disk Write Rate: {0:0.00} kB/s", engine.DiskManager.WriteRate / 1024.0); AppendFormat(sb, "Total Read: {0:0.00} kB", engine.DiskManager.TotalRead / 1024.0); AppendFormat(sb, "Total Written: {0:0.00} kB", engine.DiskManager.TotalWritten / 1024.0); AppendFormat(sb, "Open Connections: {0}", engine.ConnectionManager.OpenConnections); foreach (TorrentManager manager in torrents) { AppendSeperator(sb); AppendFormat(sb, "State: {0}", manager.State); AppendFormat(sb, "Name: {0}", manager.Torrent == null ? "MetaDataMode" : manager.Torrent.Name); AppendFormat(sb, "Progress: {0:0.00}", manager.Progress); AppendFormat(sb, "Download Speed: {0:0.00} kB/s", manager.Monitor.DownloadSpeed / 1024.0); AppendFormat(sb, "Upload Speed: {0:0.00} kB/s", manager.Monitor.UploadSpeed / 1024.0); AppendFormat(sb, "Total Downloaded: {0:0.00} MB", manager.Monitor.DataBytesDownloaded / (1024.0 * 1024.0)); AppendFormat(sb, "Total Uploaded: {0:0.00} MB", manager.Monitor.DataBytesUploaded / (1024.0 * 1024.0)); MonoTorrent.Client.Tracker.Tracker tracker = manager.TrackerManager.CurrentTracker; //AppendFormat(sb, "Tracker Status: {0}" , tracker == null ? "<no tracker>" : tracker.State.ToString()); AppendFormat(sb, "Warning Message: {0}", tracker == null ? "<no tracker>" : tracker.WarningMessage); AppendFormat(sb, "Failure Message: {0}", tracker == null ? "<no tracker>" : tracker.FailureMessage); if (manager.PieceManager != null) { AppendFormat(sb, "Current Requests: {0}", manager.PieceManager); } foreach (PeerId p in manager.GetPeers()) { AppendFormat(sb, "\t{2} - {1:0.00}/{3:0.00}kB/sec - {0}", p.PeerID, p.Monitor.DownloadSpeed / 1024.0, p.AmRequestingPiecesCount, p.Monitor.UploadSpeed / 1024.0); } AppendFormat(sb, "", null); if (manager.Torrent != null) { foreach (TorrentFile file in manager.Torrent.Files) { AppendFormat(sb, "{1:0.00}% - {0}", file.Path, file.BitField.PercentComplete); } } AppendFormat(sb, "Total Download Rate: {0:0.00}kB/sec", engine.TotalDownloadSpeed / 1024.0); AppendFormat(sb, "Total Upload Rate: {0:0.00}kB/sec", engine.TotalUploadSpeed / 1024.0); } Console.Clear(); Console.Write(sb.ToString()); listener.ExportTo(Console.Out); } System.Threading.Thread.Sleep(500); } }
public ClientEngine(EngineSettings settings, PeerListener listener, string peerId = null) : this(settings, listener, new DiskWriter(), peerId) { }
private RcCore() { EngineSettings = new EngineSettings(); }
/// <summary> /// Constructor. Initializes the output path for the fuzzer to store successful runs. /// </summary> /// <param name="s"></param> public Fuzzer(EngineSettings s) { this.OutputPath = s.CrashDirectory; if (this.OutputPath.ElementAt(this.OutputPath.Length - 1) != '\\') this.OutputPath += '\\'; }
public ClientEngine(EngineSettings settings, PeerListener listener, PieceWriter writer, string peerId = null) { Check.Settings(settings); Check.Listener(listener); Check.Writer(writer); this.listener = listener; this.settings = settings; if (settings.FastResumePath != null && File.Exists(settings.FastResumePath)) { var encodedListData = File.ReadAllBytes(settings.FastResumePath); var encodedList = (BEncodedList) BEncodedValue.Decode(encodedListData); _fastResume = encodedList.Cast<BEncodedDictionary>() .Select(x => new FastResume(x)); } connectionManager = new ConnectionManager(this); RegisterDht(new NullDhtEngine()); diskManager = new DiskManager(this, writer); listenManager = new ListenManager(this); MainLoop.QueueTimeout(TimeSpan.FromMilliseconds(TickLength), () => { if (IsRunning && !disposed) LogicTick(); return !disposed; }); torrents = new List<TorrentManager>(); torrentsReadonly = new ReadOnlyCollection<TorrentManager>(torrents); CreateRateLimiters(); this.peerId = peerId ?? GeneratePeerId(); localPeerListener = new LocalPeerListener(this); localPeerManager = new LocalPeerManager(); LocalPeerSearchEnabled = SupportsLocalPeerDiscovery; listenManager.Register(listener); // This means we created the listener in the constructor if (listener.Endpoint.Port == 0) listener.ChangeEndpoint(new IPEndPoint(IPAddress.Any, settings.ListenPort)); }
public FightActivity(Person person, NeedEntry needEntry, EngineSettings settings, ConsoleHelper console) : base(person, needEntry, settings, console) { }