예제 #1
0
        public void StripSpaces()
        {
            string configuration = new System.Text.StringBuilder()
                                   .AppendLine("[ DEFAULT ]")
                                   .AppendLine(" ConnectionType = initiator")
                                   .AppendLine("  [  SESSION  ]  ")
                                   .AppendLine("BeginString=FIX.4.2 ")
                                   .AppendLine(" SenderCompID =ISLD")
                                   .AppendLine("  TargetCompID  =  TW  ")
                                   .AppendLine("  Long  =  123  ")
                                   .AppendLine("  Double  =  1.23  ")
                                   .AppendLine("  Bool  =  N  ")
                                   .ToString();
            SessionSettings settings = new SessionSettings(new System.IO.StringReader(configuration));

            Assert.That(settings.Get().GetString("ConnectionType"), Is.EqualTo("initiator"));

            SessionID session = new SessionID("FIX.4.2", "ISLD", "TW");

            Assert.That(settings.Get(session).GetString("ConnectionType"), Is.EqualTo("initiator"));
            Assert.That(settings.Get(session).GetString("BeginString"), Is.EqualTo("FIX.4.2"));
            Assert.That(settings.Get(session).GetString("SenderCompID"), Is.EqualTo("ISLD"));
            Assert.That(settings.Get(session).GetString("TargetCompID"), Is.EqualTo("TW"));
            Assert.That(settings.Get(session).GetLong("Long"), Is.EqualTo(123));
            Assert.That(settings.Get(session).GetDouble("Double"), Is.EqualTo(1.23));
            Assert.That(settings.Get(session).GetBool("Bool"), Is.False);
        }
예제 #2
0
		public MainWindow()
		{
			instance = this;
			spySettings = ILSpySettings.Load();
			this.sessionSettings = new SessionSettings(spySettings);
			this.assemblyListManager = new AssemblyListManager(spySettings);
			
			this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));
			
			this.DataContext = sessionSettings;
			this.Left = sessionSettings.WindowBounds.Left;
			this.Top = sessionSettings.WindowBounds.Top;
			this.Width = sessionSettings.WindowBounds.Width;
			this.Height = sessionSettings.WindowBounds.Height;
			// TODO: validate bounds (maybe a monitor was removed...)
			this.WindowState = sessionSettings.WindowState;
			
			InitializeComponent();
			App.CompositionContainer.ComposeParts(this);
			Grid.SetRow(decompilerTextView, 1);
			rightPane.Children.Add(decompilerTextView);
			
			if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
				leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
				rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
			}
			sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
			
			InitMainMenu();
			InitToolbar();
			ContextMenuProvider.Add(treeView);
			ContextMenuProvider.Add(analyzerTree);
			
			this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
		}
예제 #3
0
 public int Clean(SessionSettings settings)
 {
     return(settings.Commands
            .Aggregate(new Session(settings.StartingPoint, ImmutableHashSet.Create(settings.StartingPoint)),
                       (session, command) => _commandExecutor.Execute(command, session))
            .CleanedPlaces.Count);
 }
예제 #4
0
        public void Start(string settingFile, bool ResendResult)
        {
            Stop();

            var settings = new SessionSettings(settingFile);

            Account.GetAccountInfo(settings);

            if (ResendResult)
            {
                foreach (var session in settings.getSessions())
                {
                    var dict = settings.get(session as SessionID);

                    var target = dict.getString("FileStorePath") + "\\"
                                 + dict.getString("BeginString") + "-"
                                 + dict.getString("SenderCompID") + "-"
                                 + dict.getString("TargetCompID") + ".seqnums";

                    try
                    {
                        var s = System.IO.File.ReadAllText(target);
                        var d = s.Remove(s.Length - 10);
                        System.IO.File.WriteAllText(target, d + "0000000001");
                    }
                    catch (Exception) {}
                }
            }

            cmdproc = SessionFactory.CommandProcessInstance(Account.target, this.AppReport);
            sock    = new SocketInitiator(cmdproc.App, new FileStoreFactory(settings), settings, new DefaultMessageFactory());
            sock.start();
        }
        /// <summary>
        /// Implements the <see cref="ProcessRecord"/> method for <see cref="SetTransmissionAltSpeedLimitsCmdlet"/>.
        /// </summary>
        protected override void ProcessRecord()
        {
            try
            {
                var sessionSvc = new SessionService();

                if (!Enable.IsPresent && !Disable.IsPresent)
                {
                    throw new Exception("Either the Enable or Disable parameter must be supplied");
                }

                var request = new SessionSettings {
                    AlternativeSpeedEnabled = Enable.IsPresent
                };

                bool success = Task.Run(async() => await sessionSvc.Set(request)).Result;

                if (success)
                {
                    WriteObject($"Alt speed settings {(Enable.IsPresent ? "enabled" : "disabled")} successfully");
                }
            }
            catch (Exception e)
            {
                ThrowTerminatingError(new ErrorRecord(new Exception(e.Message, e), null, ErrorCategory.OperationStopped, null));
            }
        }
예제 #6
0
        /**
         * Carrega dados para troca de senha.
         * @param settings
         * @param filaNovaSenha
         */
        public SessaoFIX(
            SessionSettings settings,
            string novaSenha,
            LinkedBlockingQueue <string> filaNovaSenha)
        {
            this.filaNovaSenha = filaNovaSenha;
            this.novaSenha     = novaSenha;

            object[] objsessions = settings.getSessions().ToArray();
            foreach (object objsession in objsessions)
            {
                SessionID session = (SessionID)objsession;
                try
                {
                    Dictionary dictionary = settings.get(session);
                    if (dictionary.has(FIX_RAWDATA))
                    {
                        senha = dictionary.getString(FIX_RAWDATA);
                    }
                }

                catch (ConfigError e)
                {
                    logger.Error("Falha de configuracao: " + e.Message);
                }
                catch (FieldConvertError e)
                {
                    logger.Error("Falha de conversao: " + e.Message);
                }
            }
        }
예제 #7
0
        public MainWindow()
        {
            spySettings = ILSpySettings.Load();
            this.sessionSettings = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            this.DataContext = sessionSettings;
            this.Left = sessionSettings.WindowBounds.Left;
            this.Top = sessionSettings.WindowBounds.Top;
            this.Width = sessionSettings.WindowBounds.Width;
            this.Height = sessionSettings.WindowBounds.Height;
            // TODO: validate bounds (maybe a monitor was removed...)
            this.WindowState = sessionSettings.WindowState;

            InitializeComponent();
            decompilerTextView.mainWindow = this;

            if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
                leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
                rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
            }
            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            #if DEBUG
            AddDebugItemsToToolbar();
            #endif
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }
예제 #8
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("usage: Executor CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            try
            {
                SessionSettings        settings     = new SessionSettings(args[0]);
                Application            executorApp  = new Executor();
                MessageStoreFactory    storeFactory = new FileStoreFactory(settings);
                LogFactory             logFactory   = new ScreenLogFactory(settings);
                ThreadedSocketAcceptor acceptor     = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("FATAL ERROR: " + e.Message);
                Console.WriteLine(e.ToString());
            }
        }
예제 #9
0
        public override RefreshFlags Save(XElement root)
        {
            var xelem = new XElement(SETTINGS_SECTION_NAME);

            xelem.SetAttributeValue("BytesGroupCount", this.BytesGroupCountVM.Value);
            xelem.SetAttributeValue("BytesPerLine", this.BytesPerLineVM.Value);
            xelem.SetAttributeValue("UseHexPrefix", this.UseHexPrefix);
            xelem.SetAttributeValue("ShowAscii", this.ShowAscii);
            xelem.SetAttributeValue("LowerCaseHex", this.LowerCaseHex);
            xelem.SetAttributeValue("FontFamily", SessionSettings.Escape(this.FontFamily.Source));
            xelem.SetAttributeValue("FontSize", this.FontSize);
            xelem.SetAttributeValue("AsciiEncoding", (int)this.AsciiEncoding);

            var currElem = root.Element(SETTINGS_SECTION_NAME);

            if (currElem != null)
            {
                currElem.ReplaceWith(xelem);
            }
            else
            {
                root.Add(xelem);
            }

            WriteTo(Instance);

            return(RefreshFlags.None);
        }
예제 #10
0
		public MainWindow()
		{
			instance = this;
			spySettings = ILSpySettings.Load();
			this.sessionSettings = new SessionSettings(spySettings);
			this.assemblyListManager = new AssemblyListManager(spySettings);
			
			if (Environment.OSVersion.Version.Major >= 6)
				this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));
			else
				this.Icon = Images.AssemblyLoading;
			
			this.DataContext = sessionSettings;
			this.Left = sessionSettings.WindowBounds.Left;
			this.Top = sessionSettings.WindowBounds.Top;
			this.Width = sessionSettings.WindowBounds.Width;
			this.Height = sessionSettings.WindowBounds.Height;
			// TODO: validate bounds (maybe a monitor was removed...)
			this.WindowState = sessionSettings.WindowState;
			
			InitializeComponent();
			decompilerTextView.mainWindow = this;
			
			if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
				leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
				rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
			}
			sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
			
			this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
		}
예제 #11
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Iniciando.....");
                SessionSettings        settings     = new SessionSettings("../../../executor.cfg");
                IApplication           myApp        = new MyQuickFixApp();
                IMessageStoreFactory   storeFactory = new FileStoreFactory(settings);
                ILogFactory            logFactory   = new FileLogFactory(settings);
                ThreadedSocketAcceptor acceptor     = new ThreadedSocketAcceptor(
                    myApp,
                    storeFactory,
                    settings,
                    logFactory);
                HttpServer srv = new HttpServer(HttpServerPrefix, settings);

                //Iniciando acceptor
                acceptor.Start();
                //Iniciando servidor http
                srv.Start();
                Console.WriteLine("Rodando em: " + HttpServerPrefix);
                Console.WriteLine("Aperte enter para finalizar");
                Console.ReadLine();
                //Finalizando acceptor e servidor http
                srv.Stop();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("Error");
                Console.WriteLine(e.ToString());
            }
        }
예제 #12
0
        internal static SavedHexTabState FromXmlInternal(XElement child)
        {
            var savedState = new SavedHexTabState();

            savedState.BytesGroupCount = (int?)child.Attribute("BytesGroupCount");
            savedState.BytesPerLine    = (int?)child.Attribute("BytesPerLine");
            savedState.UseHexPrefix    = (bool?)child.Attribute("UseHexPrefix");
            savedState.ShowAscii       = (bool?)child.Attribute("ShowAscii");
            savedState.LowerCaseHex    = (bool?)child.Attribute("LowerCaseHex");
            savedState.AsciiEncoding   = (AsciiEncoding?)(int?)child.Attribute("AsciiEncoding");

            savedState.HexOffsetSize      = (int)child.Attribute("HexOffsetSize");
            savedState.UseRelativeOffsets = (bool)child.Attribute("UseRelativeOffsets");
            savedState.BaseOffset         = (ulong)child.Attribute("BaseOffset");
            savedState.FileName           = SessionSettings.Unescape((string)child.Attribute("FileName"));

            savedState.HexBoxState.TopOffset                  = (ulong)child.Attribute("HexBoxState-TopOffset");
            savedState.HexBoxState.Column                     = (int)child.Attribute("HexBoxState-Column");
            savedState.HexBoxState.StartOffset                = (ulong)child.Attribute("HexBoxState-StartOffset");
            savedState.HexBoxState.EndOffset                  = (ulong)child.Attribute("HexBoxState-EndOffset");
            savedState.HexBoxState.CaretPosition.Offset       = (ulong)child.Attribute("HexBoxState-HexBoxPosition-Offset");
            savedState.HexBoxState.CaretPosition.Kind         = (HexBoxPositionKind)(int)child.Attribute("HexBoxState-HexBoxPosition-Kind");
            savedState.HexBoxState.CaretPosition.KindPosition = (byte)(int)child.Attribute("HexBoxState-HexBoxPosition-KindPosition");

            var from = child.Attribute("HexBoxState-Selection-From");
            var to   = child.Attribute("HexBoxState-Selection-To");

            if (from != null && to != null)
            {
                savedState.HexBoxState.Selection = new HexSelection((ulong)from, (ulong)to);
            }

            return(savedState);
        }
예제 #13
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Session s = new Session();

            SessionSettings sessionSettings = new SessionSettings();

            sessionSettings.ClassOfService  = ClassOfService.General;
            sessionSettings.IsoLanguage     = "en-US";
            sessionSettings.ApplicationName = "i3lets";

            HostSettings hostSettings = new HostSettings();

            hostSettings.HostEndpoint = new HostEndpoint(Host, HostEndpoint.DefaultPort);

            AuthSettings authSettings;

            if (String.IsNullOrEmpty(UserName) || Password == null)
            {
                authSettings = new WindowsAuthSettings();
            }
            else
            {
                authSettings = new ICAuthSettings(UserName, Password);
            }

            StationSettings stationSettings = new StationlessSettings();

            s.Connect(sessionSettings, hostSettings, authSettings, stationSettings);

            StaticDataStore.AddSession(s);

            WriteObject(s);
        }
예제 #14
0
        void Save(XElement root)
        {
            // Prevent Load() from saving the settings every time a new exception is added
            if (disableSaveCounter != 0)
            {
                return;
            }

            var exs             = new XElement(SETTINGS_NAME);
            var existingElement = root.Element(SETTINGS_NAME);

            if (existingElement != null)
            {
                existingElement.ReplaceWith(exs);
            }
            else
            {
                root.Add(exs);
            }

            foreach (var tuple in GetDiff())
            {
                var exx = new XElement("Exception");
                exx.SetAttributeValue("ExceptionType", (int)tuple.Item2.ExceptionType);
                exx.SetAttributeValue("FullName", SessionSettings.Escape(tuple.Item2.Name));
                exx.SetAttributeValue("BreakOnFirstChance", tuple.Item2.BreakOnFirstChance);
                if (tuple.Item2.IsOtherExceptions)
                {
                    exx.SetAttributeValue("IsOtherExceptions", tuple.Item2.IsOtherExceptions);
                }
                exx.SetAttributeValue("DiffType", (int)tuple.Item1);
                exs.Add(exx);
            }
        }
예제 #15
0
        private void go(string[] args)
        {
            try
            {
                var path = args[0];

                FileInfo info = new FileInfo(path);
                if (!info.Exists)
                {
                    Console.WriteLine("Source file does not exist");
                    return;
                }

                totalMaximumBytes += new FileInfo(path).Length;

                var connectionInfo = new SDCardFileConnectionInfo();
                connectionInfo.FilePath = path;

                var connection = new Connection(connectionInfo);

                var directory = args[1];
                var logger    = new SessionLogger(SessionSettings.CreateForFileAndPath(directory, info), connection);

                logger.Start();

                connection.Message += new MessageEvent(ConnectionMessage);
                connection.Connect();

                logger.Stop();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
예제 #16
0
        private Tuple <ServerConnectPack, SessionSettings> ConnectToServer_StartServerThreads(
            string serverName, int port)
        {
            SessionSettings sessionSettings = null;

            try
            {
                var tcpClient = new TcpClient();
                tcpClient.Connect(serverName, port);

                sessionSettings = new SessionSettings();
                CreateThreads(tcpClient, sessionSettings);

                // start the ConnectThread, FromThread, ToThread.
                StartServerThreads();

                this.ConnectPack = new ServerConnectPack(this.FromThread, tcpClient, serverName);
            }
            catch (SocketException ex)
            {
                MessageBox.Show("Socket Error: " + ex.Message);
            }

            return(new Tuple <ServerConnectPack, SessionSettings>(this.ConnectPack, sessionSettings));
        }
예제 #17
0
        protected override void ToXmlOverride(XElement xml)
        {
            xml.SetAttributeValue("BytesGroupCount", BytesGroupCount);
            xml.SetAttributeValue("BytesPerLine", BytesPerLine);
            xml.SetAttributeValue("UseHexPrefix", UseHexPrefix);
            xml.SetAttributeValue("ShowAscii", ShowAscii);
            xml.SetAttributeValue("LowerCaseHex", LowerCaseHex);
            xml.SetAttributeValue("AsciiEncoding", (int?)AsciiEncoding);

            xml.SetAttributeValue("HexOffsetSize", HexOffsetSize);
            xml.SetAttributeValue("UseRelativeOffsets", UseRelativeOffsets);
            xml.SetAttributeValue("BaseOffset", BaseOffset);
            xml.SetAttributeValue("FileName", SessionSettings.Escape(FileName));

            xml.SetAttributeValue("HexBoxState-TopOffset", HexBoxState.TopOffset);
            xml.SetAttributeValue("HexBoxState-Column", HexBoxState.Column);
            xml.SetAttributeValue("HexBoxState-StartOffset", HexBoxState.StartOffset);
            xml.SetAttributeValue("HexBoxState-EndOffset", HexBoxState.EndOffset);
            xml.SetAttributeValue("HexBoxState-HexBoxPosition-Offset", HexBoxState.CaretPosition.Offset);
            xml.SetAttributeValue("HexBoxState-HexBoxPosition-Kind", (int)HexBoxState.CaretPosition.Kind);
            xml.SetAttributeValue("HexBoxState-HexBoxPosition-KindPosition", (int)HexBoxState.CaretPosition.KindPosition);
            if (HexBoxState.Selection != null)
            {
                xml.SetAttributeValue("HexBoxState-Selection-From", HexBoxState.Selection.Value.From);
                xml.SetAttributeValue("HexBoxState-Selection-To", HexBoxState.Selection.Value.To);
            }
        }
예제 #18
0
        public void testSessionSettingsUTF8()
        {
            string configuration = new StringBuilder()
                                   .AppendLine("[DEFAULT]")
                                   .AppendLine("ConnectionType=initiator")
                                   .AppendLine("StartTime=00:00:00")
                                   .AppendLine("EndTime=00:00:00")
                                   .AppendLine("UseDataDictionary=N")
                                   .AppendLine("ReconnectInterval=30")
                                   .AppendLine("[SESSION]")
                                   .AppendLine("BeginString=FIX.4.2")
                                   .AppendLine("SenderCompID=Simor")
                                   .AppendLine("TargetCompID=Tom")
                                   .AppendLine("HeartBtInt=30")
                                   .ToString();

            SessionID sessionID = new SessionID("FIX.4.2", "Simor", "Tom");

            SessionSettings settings = new SessionSettings(new System.IO.StringReader(configuration));

            Assert.That(settings.Get(sessionID).Has(SessionSettings.ENCODING), Is.False);

            SocketInitiator si = new SocketInitiator(new NullApplication(), new MemoryStoreFactory(), settings);

            si.Start();
            var session = Session.LookupSession(sessionID);

            Assert.That(session.Encoding, Is.EqualTo(Encoding.GetEncoding("utf-8")));

            si.Stop();
        }
예제 #19
0
 private void ConnectToExistingSession()
 {
     this.BusyMessage = "Logging in...";
     this.IsBusy      = true;
     App.CurrentUser  = User.A;
     Mobeelizer.Login(SessionCode.ToString(), Resources.Config.c_userALogin, Resources.Config.c_userAPassword, (error) =>
     {
         this.IsBusy = false;
         try
         {
             if (error == null)
             {
                 App.CurrentUser = User.A;
                 SessionSettings.SaveSessionCode(Int32.Parse(this.SessionCode));
                 PushNotificationService.Instance.PerformUserRegistration();
                 navigationService.Navigate(new Uri(String.Format("/View/ExplorePage.xaml?SessionCode={0}", this.SessionCode), UriKind.Relative));
             }
             else if (error.Code == "missingConnection")
             {
                 this.navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_missingConnection);
             }
             else
             {
                 this.navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_cannotConnectToSession);
             }
         }
         catch
         {
             this.navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_cannotConnectToSession);
         }
     });
 }
예제 #20
0
        public FixClient(string targetCompId = Const.TargetCompId, string senderCompId = Const.SenderCompId, string uri = Const.Uri, int port = Const.Port)
        {
            var s = new SessionSetting
            {
                TargetCompID     = targetCompId,
                SenderCompID     = senderCompId,
                FixConfiguration = new[]
                {
                    "[DEFAULT]",
                    "ResetOnLogon=Y",
                    "FileStorePath=client",
                    "ConnectionType=initiator",
                    "ReconnectInterval=60",
                    "BeginString=FIX.4.4",
                    @"DataDictionary=ClientFIX44.xml",
                    "SSLEnable=N",
                    @"SSLProtocols=Tls",
                    "SSLValidateCertificates=N",
                    $"SocketConnectPort={port}",
                    "StartTime=00:00:00",
                    "EndTime=00:00:00",
                    "HeartBtInt=10",
                    "LogonTimeout=120",
                    $"SocketConnectHost={uri}",
                    "[SESSION]",
                }
            };

            _log = new LogToConsole();
            var settings     = new SessionSettings(s.GetFixConfigAsReader());
            var storeFactory = new MemoryStoreFactory();
            var logFactory   = new LykkeLogFactory(_log, false, false, false);

            _socketInitiator = new SocketInitiator(this, storeFactory, settings, logFactory);
        }
예제 #21
0
 public void SetSessionSettings()
 {
     SessionSettings = new SessionSettings();
     SessionSettings.ClassOfService  = ClassOfService.General;
     SessionSettings.ApplicationName = "ICELIB Lab 1";
     SessionSettings.IsoLanguage     = "en-US";
 }
예제 #22
0
        public ServerSession(IApplication application, string configFile)
        {
            _application = application;
            var CurrentSessionSettings       = new SessionSettings(configFile);
            MessageStoreFactory storeFactory = new FileStoreFactory(CurrentSessionSettings);
            LogFactory          logFactory   = new FileLogFactory(CurrentSessionSettings);

            this.Acceptor = new ThreadedSocketAcceptor(_application, storeFactory, CurrentSessionSettings, logFactory);

            _sessionId   = CurrentSessionSettings.GetSessions().FirstOrDefault();
            SessionState = SessionState.Idle;

            _application.MessageEvent += (message) =>
            {
                if (MessageEvent != null)
                {
                    MessageEvent(message);
                }
            };
            _application.LogonEvent += (s) =>
            {
                _sessionId    = s;
                SessionState |= SessionState.Connected;
            };
            _application.LogoutEvent += (s) =>
            {
                SessionState = SessionState.LoggedOut;
            };
        }
        public virtual SessionSettings Clone()
        {
            global::System.IntPtr cPtr = csSmartIdEnginePINVOKE.SessionSettings_Clone(swigCPtr);
            SessionSettings       ret  = (cPtr == global::System.IntPtr.Zero) ? null : new SessionSettings(cPtr, true);

            return(ret);
        }
예제 #24
0
        TelnetConnectAndNegotiate(
            string Host, NegotiateSettings NegotiateSettings,
            ConcurrentMessageQueue TelnetQueue, ToThread ToThread)
        {
            var           sessionSettings = new SessionSettings();
            TelnetLogList logList         = null;
            bool          breakLoop       = false;

            // loop reading from NetworkStream and processing the telnet command.
            // loop until break flag is set.
            while (breakLoop == false)
            {
                var item = TelnetQueue.WaitAndPeek();
                if ((item is TelnetCommand) == false)
                {
                    break;
                }
                var telCmd = TelnetQueue.WaitAndDequeue() as TelnetCommand;

                byte[] responseBytes = null;
                {
                    var rv = ProcessTelnetCommand(telCmd, NegotiateSettings);
                    var cx = rv.Item1;
                    responseBytes = rv.Item2;
                }

                if ((responseBytes != null) && (responseBytes.Length > 0))
                {
                    var dataMessage = new SendDataMessage(responseBytes);
                    ToThread.PostInputMessage(dataMessage);
                }
            }
            return(new Tuple <SessionSettings, TelnetLogList>(
                       sessionSettings, logList));
        }
예제 #25
0
        public SessionSettings Handle(Guid configurationUid, int processId, ProcessPlatform processPlatform, uint profilingBeginTime, Guid agentApplicationUid)
        {
            Configuration configuration = (Configuration)_configurations[configurationUid];

            if (configuration == null)
            {
                throw new ConfigurationNotFoundException(configurationUid);
            }
            ConfigurationSettings   configurationSettings  = configuration.ConfigurationSettings;
            IProfilingTarget        profilingTarget        = _profilingTargets[configurationSettings.ProfilingTargetSettings.Uid];
            IProfilingTargetAdapter profilingTargetAdapter = profilingTarget.GetSafeAdapter();
            bool canStartProfiling = profilingTargetAdapter.CanStartProfiling(configurationSettings, processId);

            if (!canStartProfiling)
            {
                throw new TempException("Target process is not supported");
            }
            ActualizeConfigurationSettings(configurationSettings, processPlatform);
            Session session = (Session)_sessions.Create(configuration);

            session.StartProfiling(processId, agentApplicationUid, profilingBeginTime);
            SessionSettings sessionSettings = new SessionSettings(session.Uid, configurationSettings.ProfilingTargetSettings,
                                                                  configurationSettings.FrameworksSettings, configurationSettings.ProfilingTypesSettings, configurationSettings.GatewaySettings);

            sessionSettings.Validate();
            profilingTarget.GetSafeAdapter().ProfilingStarted(configurationSettings, sessionSettings, processId);
            return(sessionSettings);
        }
예제 #26
0
        static void Main(string[] args)
        {
            AppLogger = new PerDayFileLogSource(Directory.GetCurrentDirectory() + "\\Log", Directory.GetCurrentDirectory() + "\\Log\\Backup")
            {
                FilePattern = "Log.{0:yyyy-MM-dd}.log",
                DeleteDays  = 20
            };

            string path = ConfigurationManager.AppSettings["InitiatorPath"];

            SessionSettings  = new SessionSettings(path);
            FileStoreFactory = new FileStoreFactory(SessionSettings);
            ScreenLogFactory = new ScreenLogFactory(SessionSettings);
            MessageFactory   = new QuickFix.FIX44.MessageFactory();

            Program myProgram = new Program();

            Initiator = new SocketInitiator(myProgram, FileStoreFactory, SessionSettings, ScreenLogFactory);

            Initiator.Start();


            Console.WriteLine("Initiator successfully started...");
            Console.ReadKey();
        }
예제 #27
0
 public HomeController(ILogger <HomeController> logger, NWContext context, SessionSettings ss)
 {
     _context = context;
     _logger  = logger;
     _ss      = ss;
     _rs      = new RequestSettings(this);
 }
예제 #28
0
		public MainWindow()
		{
			instance = this;
			spySettings = ILSpySettings.Load();
			this.sessionSettings = new SessionSettings(spySettings);
			this.assemblyListManager = new AssemblyListManager(spySettings);
			
			this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));
			
			this.DataContext = sessionSettings;
			
			InitializeComponent();
			App.CompositionContainer.ComposeParts(this);
			mainPane.Content = decompilerTextView;
			
			if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
				leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
				rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
			}
			sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
			
			InitMainMenu();
			InitToolbar();
			ContextMenuProvider.Add(treeView, decompilerTextView);
			
			this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
		}
예제 #29
0
        ParseByteArray(byte[] ByteArray, int ArrayLx = -1, string DataStreamName = "")
        {
            if (ArrayLx == -1)
            {
                ArrayLx = ByteArray.Length;
            }

            var inputArray      = new InputByteArray(ByteArray, ArrayLx);
            var sessionSettings = new SessionSettings();

            var rv =
                ServerDataStream.ParseDataStream(inputArray, sessionSettings,
                                                 DataStreamName);
            var wrkstnCmdList    = rv.Item1;
            var responseItemList = rv.Item2;
            var dsh      = rv.Item3;
            var telList  = rv.Item4;
            var funcList = rv.Item5;

            byte[] remainingBytes = null;
            if (inputArray.RemainingLength > 0)
            {
                remainingBytes = inputArray.PeekBytes();
                var report = remainingBytes.ToHexReport(16);
            }

            return(new Tuple <WorkstationCommandList, ResponseItemList,
                              DataStreamHeader, TelnetCommandList, ControlFunctionList, byte[]>(
                       wrkstnCmdList, responseItemList, dsh, telList, funcList, remainingBytes));
        }
예제 #30
0
        private SocketInitiator createInitiator(IApplication app, string encoding)
        {
            string initiatorConfiguration = new StringBuilder()
                                            .AppendLine("[DEFAULT]")
                                            .AppendLine("ConnectionType=initiator")
                                            .AppendLine("StartTime=00:00:00")
                                            .AppendLine("EndTime=00:00:00")
                                            .AppendLine("UseDataDictionary=N")
                                            .AppendLine("ReconnectInterval=30")

                                            .AppendLine("[SESSION]")
                                            .AppendLine("BeginString=FIX.4.2")
                                            .AppendLine("SenderCompID=Simor")
                                            .AppendLine("TargetCompID=Tom")
                                            .AppendLine("HeartBtInt=30")
                                            .AppendLine("SocketConnectHost=127.0.0.1")
                                            .AppendLine("SocketConnectPort=10000")
                                            .AppendLine(encoding != null ? "Encoding=" + encoding : "")
                                            .ToString();

            SessionSettings settings = new SessionSettings(new System.IO.StringReader(initiatorConfiguration));
            SocketInitiator si       = new SocketInitiator(app, new MemoryStoreFactory(), settings, null /*new ScreenLogFactory(true, true,true)*/);

            return(si);
        }
예제 #31
0
        public async Task <bool> CreateOrUpdateSession(ICart cart, SessionSettings settings)
        {
            var sessionRequest = CreateSessionRequest(cart, settings);
            var sessionId      = cart.GetKlarnaSessionId();

            if (string.IsNullOrEmpty(sessionId))
            {
                return(await CreateSession(sessionRequest, cart, settings).ConfigureAwait(false));
            }

            try
            {
                await _klarnaServiceApiFactory.Create(GetConfiguration(cart.MarketId))
                .UpdateSession(sessionId, sessionRequest)
                .ConfigureAwait(false);

                return(true);
            }
            catch (ApiException apiException)
            {
                if (apiException.StatusCode == HttpStatusCode.NotFound)
                {
                    return(await CreateSession(sessionRequest, cart, settings).ConfigureAwait(false));
                }

                _logger.Error(apiException.Message, apiException);
                return(false);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
                return(false);
            }
        }
예제 #32
0
    public void SetUp()
    {
        application = new ApplicationImpl();
        SessionSettings     settings            = new SessionSettings("c:\\development\\quickfix\\test\\cfg\\at_client.cfg");
        MessageStoreFactory messageStoreFactory =
            new MemoryStoreFactory();

        QuickFix42.MessageFactory messageFactory = new QuickFix42.MessageFactory();

        initiator = new SocketInitiator
                        (application, messageStoreFactory, settings, messageFactory);

        server = new Process();
        server.StartInfo.FileName  = "c:\\development\\quickfix\\test\\debug\\at\\at";
        server.StartInfo.Arguments = "-f c:\\development\\quickfix\\test\\cfg\\at.cfg";
        server.Start();

        Thread quickFixThread = new Thread(RunThread);

        quickFixThread.Start();

        for (int i = 0; i < 50; ++i)
        {
            if (application.isLoggedOn())
            {
                break;
            }
            Thread.Sleep(1000);
        }
        if (!application.isLoggedOn())
        {
            throw new Exception();
        }
    }
예제 #33
0
        private Session CreateSessionRequest(ICart cart, SessionSettings settings)
        {
            // Check if we shared PI before, if so it allows us to share it again
            var canSendPersonalInformation = AllowedToSharePersonalInformation(cart);
            var config = GetConfiguration(cart.MarketId);

            var sessionRequest = GetSessionRequest(cart, config, settings.SiteUrl, canSendPersonalInformation);

            if (ServiceLocator.Current.TryGetExistingInstance(out ISessionBuilder sessionBuilder))
            {
                sessionRequest = sessionBuilder.Build(sessionRequest, cart, config, settings.AdditionalValues);
            }

            var market         = _marketService.GetMarket(cart.MarketId);
            var currentCountry = market.Countries.FirstOrDefault();

            // Clear PI if we're not allowed to send it yet (can be set by custom session builder)
            if (!canSendPersonalInformation &&
                !CanSendPersonalInformation(currentCountry))
            {
                // Can't share PI yet, will be done during the first authorize call
                sessionRequest.ShippingAddress = null;
                sessionRequest.BillingAddress  = null;

                // If the pre assessment is not enabled then don't send the customer information to Klarna
                if (!config.CustomerPreAssessment)
                {
                    sessionRequest.Customer = null;
                }
            }

            return(sessionRequest);
        }
예제 #34
0
        public void CalledWithSomeSimpleSettings_ShouldCleanAndCountCleanedPlaces()
        {
            // Arrange
            var startingPoint = new Point(10, 10);
            var robotSettings = new SessionSettings(startingPoint, new List <Command>
            {
                new Command(CompassDirection.North, 1),
                new Command(CompassDirection.East, 1),
                new Command(CompassDirection.South, 1),
                new Command(CompassDirection.West, 1),
            });
            var expectedSession       = new Session(startingPoint, ImmutableHashSet.Create(startingPoint));
            var cleanedPlacesInTheEnd = Enumerable.Range(0, 10).Select(i => new Point(0, i)).ToImmutableHashSet();
            var expectedSessionOnEnd  = new Session(new Point(1, 1), cleanedPlacesInTheEnd);

            _suit.SetupMock <ICommandExecutor>(e =>
                                               // Make the runner emulate first 3 commands did nothing
                                               e.Execute(It.Is <Command>(c => robotSettings.Commands.Contains(c)), expectedSession.Equivalent()) == expectedSession &&
                                               // But the last one returned 10 cleaned places
                                               e.Execute(robotSettings.Commands[3], expectedSession.Equivalent()) == expectedSessionOnEnd);

            // Act
            var result = _suit.Sut.Clean(robotSettings);

            // Assert
            result.Should().Be(cleanedPlacesInTheEnd.Count,
                               " anyway only the cleanedPlacesAtTheEnd.Count should matter");
        }
예제 #35
0
 public SocketInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)
     : base(application, storeFactory, settings, logFactory)
 {
     app_ = application;
     storeFactory_ = storeFactory;
     settings_ = settings;
     logFactory_ = logFactory;
 }
예제 #36
0
        public SignInStatus Login(string server, string user, string password)
        {
            try
            {
                var session_settings = new SessionSettings();
                var host_settings = new HostSettings(new HostEndpoint(server));
                var auth_settings = new ICAuthSettings(user, password);

                ICSession = new Session();
                session_settings.ApplicationName = "DialerNetAPIDemo";

                ICSession.ConnectionStateChanged += ICSession_ConnectionStateChanged;
                ICSession.Connect(session_settings, host_settings, auth_settings, new StationlessSettings());

                DialerConfiguration = new DialerConfigurationManager(ICSession);

                InitializeCampaigns(ICSession);
                InitializeWorkgroups(ICSession);
                InitializeContactLists(ICSession);
                InitializePolicySets(ICSession);
                return SignInStatus.Success;
            }
            catch(ININ.IceLib.Connection.RequestTimeoutException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Timeout while connecting", e);
            }
            catch(ININ.IceLib.Connection.SessionDisconnectedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch(ININ.IceLib.IceLibLicenseException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Cannot connect, missing license", e);

            }
            catch(ININ.IceLib.IceLibException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch(System.ObjectDisposedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect, session was disposed", e);
            }
            catch (Exception e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unknown error while connecting", e);
            }
            return SignInStatus.Failure;
        }
        public LinqPadSpyContainer(Application currentApplication, Language decompiledLanguage)
        {
            if (currentApplication == null)
            {
                throw new ArgumentNullException("currentApplication");
            }
            if (decompiledLanguage == null)
            {
                throw new ArgumentNullException("decompiledLanguage");
            }

            this.decompiledLanguage = decompiledLanguage;

            this.currentApplication = currentApplication;

            // Initialize supported ILSpy languages. Values used for the combobox.
            Languages.Initialize(CompositionContainerBuilder.Container);

            this.CurrentAssemblyList = new AssemblyList("LINQPadAssemblyList", this.currentApplication);

            ICSharpCode.ILSpy.App.CompositionContainer = CompositionContainerBuilder.Container;

            CompositionContainerBuilder.Container.ComposeParts(this);

            // A hack to get around the global shared state of the Window object throughout ILSpy.
            ICSharpCode.ILSpy.MainWindow.SpyWindow = this;

            this.spySettings = ILSpySettings.Load();

            this.sessionSettings = new SessionSettings(this.spySettings)
            {
                ActiveAssemblyList = this.CurrentAssemblyList.ListName
            };

            SetUpDataContext();

            this.assemblyPath = LinqPadUtil.GetLastLinqPadQueryAssembly();

            this.decompilerTextView = GetDecompilerTextView();

            InitializeComponent();

            this.mainPane.Content = this.decompilerTextView;

            this.InitToolbar();

            this.Loaded += new RoutedEventHandler(this.MainWindowLoaded);
        }
        static void Main(string[] args)
        {
            SessionSettings settings = new SessionSettings(@"C:\acceptor.cfg");
            Startup application = new Startup();

            FileStoreFactory storeFactory = new FileStoreFactory(settings);
            ScreenLogFactory logFactory = new ScreenLogFactory(settings);
            IMessageFactory messageFactory = new DefaultMessageFactory();
            ThreadedSocketAcceptor server = new ThreadedSocketAcceptor(application, storeFactory, settings, logFactory, messageFactory);

            server.Start();
            Console.WriteLine("####### Server Socket Fix Start ...press <enter> to quit");

            Console.Read();
            server.Stop();
        }
예제 #39
0
        //Constructors---------------------------------------------------------------------------------------------------------//

        //Methods--------------------------------------------------------------------------------------------------------------//

        //BindModel method
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            SessionSettings sessionSettings = null;
            if (controllerContext.HttpContext.Session != null)
            {
                sessionSettings = (SessionSettings)controllerContext.HttpContext.Session[sessionKey];
            }
            
            if (sessionSettings == null)
            {
                sessionSettings = new SessionSettings();
                if (controllerContext.HttpContext.Session != null)
                {
                    controllerContext.HttpContext.Session[sessionKey] = sessionSettings;
                }
            }
            return sessionSettings;
        }
예제 #40
0
 public SocketInitiator(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, Stream dictionaryStream = null)
     : this(application, storeFactory, settings, null, dictionaryStream)
 {
 }
예제 #41
0
 public SocketInitiator(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory, Stream dictionaryStream = null)
     : base(application, storeFactory, settings, logFactory, messageFactory, dictionaryStream)
 {
 }
예제 #42
0
 /// FIXME handle other socket options like TCP_NO_DELAY here
 protected override void OnConfigure(SessionSettings settings)
 {
     try
     {
         reconnectInterval_ = Convert.ToInt32(settings.Get().GetLong(SessionSettings.RECONNECT_INTERVAL));
     }
     catch (System.Exception)
     { }
 }
예제 #43
0
        /// <summary>
        /// handle other socket options like TCP_NO_DELAY here
        /// </summary>
        /// <param name="settings"></param>
        protected override void OnConfigure(SessionSettings settings)
        {
            try
            {
                reconnectInterval_ = Convert.ToInt32(settings.Get().GetLong(SessionSettings.RECONNECT_INTERVAL));
            }
            catch (System.Exception)
            { }

            // Don't know if this is required in order to handle settings in the general section
            socketSettings_.Configure(settings.Get());
        }       
예제 #44
0
 public SocketInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings)
     : this(application, storeFactory, settings, null)
 {
 }
예제 #45
0
 /// <summary>
 /// handle other socket options like TCP_NO_DELAY here
 /// </summary>
 /// <param name="settings"></param>
 protected override void OnConfigure(SessionSettings settings)
 {
     try
     {
         reconnectInterval_ = Convert.ToInt32(settings.Get().GetLong(SessionSettings.RECONNECT_INTERVAL));
     }
     catch (System.Exception)
     { }
     if (settings.Get().Has(SessionSettings.SOCKET_NODELAY))
     {
         socketSettings_.SocketNodelay = settings.Get().GetBool(SessionSettings.SOCKET_NODELAY);
     }
 }
예제 #46
0
 public SessionToken(ISessionInfo mySessionInfo)
 {
     SessionInfo     = mySessionInfo;
     SessionSettings = new SessionSettings();
       //  Transaction     = null;
 }
예제 #47
0
 public SocketInitiator(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory)
     : this(new SessionFactory(application, storeFactory, logFactory, messageFactory), settings)
 {
 }
예제 #48
0
 public SocketInitiator(SessionFactory sessionFactory, SessionSettings settings)
     : base(sessionFactory, settings)
 {
 }
예제 #49
0
 public FileStoreFactory(SessionSettings settings)
 {
     settings_ = settings;
 }
예제 #50
0
		static void ShowPane(DockedPane dockedPane, IPane content, RowDefinition paneRow, SessionSettings.PaneSettings paneSettings) {
			paneRow.MinHeight = 100;
			if (paneSettings.Height > 0 && (paneRow.Height == null || paneRow.Height.Value == 0))
				paneRow.Height = new GridLength(paneSettings.Height, GridUnitType.Pixel);
			dockedPane.Title = content.PaneTitle;
			if (dockedPane.Content != content) {
				var pane = dockedPane.Content;
				if (pane != null)
					pane.Closed();
				dockedPane.Content = content;
			}
			dockedPane.Visibility = Visibility.Visible;
			content.Opened();
		}
예제 #51
0
		static void ClosePane(DockedPane dockedPane, RowDefinition paneRow, ref SessionSettings.PaneSettings paneSettings) {
			paneSettings.Height = paneRow.Height.Value;
			paneRow.MinHeight = 0;
			paneRow.Height = new GridLength(0);
			dockedPane.Visibility = Visibility.Collapsed;

			var pane = dockedPane.Content;
			dockedPane.Content = null;
			if (pane != null)
				pane.Closed();
		}
예제 #52
0
 public FileLogFactory(SessionSettings settings)
 {
     settings_ = settings;
 }
예제 #53
0
 public SocketInitiator(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory)
     : this(application, storeFactory, settings, logFactory, null)
 {
 }
예제 #54
0
파일: SessionToken.cs 프로젝트: Vadi/sones
 public SessionToken(ISessionInfo mySessionInfo)
 {
     SessionInfo     = mySessionInfo;
     SessionSettings = new SessionSettings();
 }
예제 #55
0
        public MainWindow()
        {
            instance = this;
            mainMenu = new Menu();
            spySettings = ILSpySettings.Load();
            this.sessionSettings = new SessionSettings(spySettings);
            this.sessionSettings.PropertyChanged += sessionSettings_PropertyChanged;
            this.assemblyListManager = new AssemblyListManager(spySettings);
            Themes.ThemeChanged += Themes_ThemeChanged;
            Themes.IsHighContrastChanged += (s, e) => Themes.SwitchThemeIfNecessary();
            Options.DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;
            OtherSettings.Instance.PropertyChanged += OtherSettings_PropertyChanged;
            InitializeTextEditorFontResource();

            languageComboBox = new ComboBox() {
                DisplayMemberPath = "Name",
                Width = 100,
                ItemsSource = Languages.AllLanguages,
            };
            languageComboBox.SetBinding(ComboBox.SelectedItemProperty, new Binding("FilterSettings.Language") {
                Source = sessionSettings,
            });

            InitializeComponent();
            AddTitleInfo(IntPtr.Size == 4 ? "x86" : "x64");
            App.CompositionContainer.ComposeParts(this);

            if (sessionSettings.LeftColumnWidth > 0)
                leftColumn.Width = new GridLength(sessionSettings.LeftColumnWidth, GridUnitType.Pixel);
            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InstallCommands();

            tabGroupsManager = new TabGroupsManager<TabState>(tabGroupsContentPresenter, tabManager_OnSelectionChanged, tabManager_OnAddRemoveTabState);
            tabGroupsManager.OnTabGroupSelected += tabGroupsManager_OnTabGroupSelected;
            var theme = Themes.GetThemeOrDefault(sessionSettings.ThemeName);
            if (theme.IsHighContrast != Themes.IsHighContrast)
                theme = Themes.GetThemeOrDefault(Themes.CurrentDefaultThemeName) ?? theme;
            Themes.Theme = theme;
            InitializeAssemblyTreeView(treeView);

            InitMainMenu();
            InitToolbar();
            loadingImage.Source = ImageCache.Instance.GetImage("dnSpy-Big", theme.GetColor(ColorType.EnvironmentBackground).InheritedColor.Background.GetColor(null).Value);

            this.Activated += (s, e) => UpdateSystemMenuImage();
            this.Deactivated += (s, e) => UpdateSystemMenuImage();
            this.ContentRendered += MainWindow_ContentRendered;
            this.IsEnabled = false;
        }
예제 #56
0
 public ScreenLogFactory(SessionSettings settings)
 {
     settings_ = settings;
 }
예제 #57
0
 public SocketInitiator(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory)
     : base(application, storeFactory, settings, logFactory, messageFactory)
 {
 }