Exemplo n.º 1
0
        public static void HandleCharacterListRequest(WorldClient client, CharactersListRequestMessage message)
        {
            if (client.Account != null && client.Account.Login != "")
            {
                var characterInFight = FindCharacterFightReconnection(client);
                if (characterInFight != null)
                {
                    client.ForceCharacterSelection = characterInFight;
                    SendCharacterSelectedForceMessage(client, characterInFight.Id);
                }
                else
                {
                    SendCharactersListWithRemodelingMessage(client);
                }

                if (client.WorldAccount != null && client.StartupActions.Count > 0)
                {
                    StartupHandler.SendStartupActionsListMessage(client, client.StartupActions);
                }
            }
            else
            {
                client.Send(new IdentificationFailedMessage((int)IdentificationFailureReasonEnum.KICKED));
                client.DisconnectLater(1000);
            }
        }
Exemplo n.º 2
0
        public ValidationResult ValidateFormImageFile(IFormFile formFile, List <FileExtensions> customFileExtensions = null, List <string> customMimeTypes = null, long customMaxFileSize = 0)
        {
            List <FileExtensions> allowedFileExtensions = customFileExtensions == null ? this.configurationConstants.ImageValidationRules.AllowedFormatExtensionsAsEnum : customFileExtensions;
            List <string>         allowedMimeTypes      = customMimeTypes == null ? this.configurationConstants.ImageValidationRules.AllowedMimeTypes : customMimeTypes;
            long maxAllowedFileSize = customMaxFileSize == 0 ? this.configurationConstants.ImageValidationRules.MaxAllowedFileSize : customMaxFileSize;

            var startupHandler       = new StartupHandler <IFormFile>();
            var fileExtensionHandler = new FileExtensionHandler(allowedFileExtensions);
            var fileMimeTypesHandler = new FileMimeTypesHandler(allowedMimeTypes);
            var fileSizeHandler      = new FileSizeHandler(maxAllowedFileSize);
            var imageBoxingHandler   = new ImageBoxingHandler();

            startupHandler
            .SetNext(fileExtensionHandler)
            .SetNext(fileMimeTypesHandler)
            .SetNext(fileSizeHandler)
            .SetNext(imageBoxingHandler);

            ValidationResult validationResult = new ValidationResult();
            string           resultMessage    = string.Empty;

            validationResult.Success = startupHandler.Handle(formFile, out resultMessage) != null;
            validationResult.Message = resultMessage;
            if (validationResult.Success)
            {
                validationResult.Message = "Image file is valid.";
            }

            return(validationResult);
        }
        public static void HandleCharactersListRequestMessage(WorldClient client, CharactersListRequestMessage message)
        {
            if (client.Account != null && client.Account.Login != "")
            {
                CharacterRecord characterRecord = CharacterHandler.FindCharacterFightReconnection(client);
                if (characterRecord != null)
                {
                    var fight = Singleton <FightManager> .Instance.GetFight(characterRecord.LeftFightId.Value);

                    CharacterHandler.SendCharacterSelectedForceMessage(client, characterRecord);
                    CharacterHandler.CommonCharacterForceSelection(client, characterRecord, fight);
                }
                else
                {
                    CharacterHandler.SendCharactersListMessage(client);
                    if (client.WorldAccount != null && client.StartupActions.Count > 0)
                    {
                        StartupHandler.SendStartupActionsListMessage(client, client.StartupActions);
                    }
                }
            }
            else
            {
                client.Send(new IdentificationFailedMessage((sbyte)IdentificationFailureReasonEnum.UNKNOWN_AUTH_ERROR));
                client.DisconnectLater(1000);
            }
        }
Exemplo n.º 4
0
        /// <inheritdoc/>
        public ValidationResult ValidateFormFile(IFormFile formFile, List <FileExtensions> customFileExtensions = null, List <string> customMimeTypes = null, long customMaxFileSize = 0)
        {
            List <FileExtensions> allowedFileExtensions = customFileExtensions ?? this.allowedFileFormatExtensions;
            List <string>         allowedMimeTypes      = customMimeTypes ?? this.allowedFilesMimeTypes;
            long maxAllowedFileSize = customMaxFileSize == 0 ? this.options.MaxAllowedFileSize : customMaxFileSize;

            var startupHandler       = new StartupHandler <IFormFile>();
            var fileExtensionHandler = new FileExtensionHandler(allowedFileExtensions);
            var fileMimeTypesHandler = new FileMimeTypesHandler(allowedMimeTypes);
            var fileSizeHandler      = new FileSizeHandler(maxAllowedFileSize);

            startupHandler
            .SetNext(fileExtensionHandler)
            .SetNext(fileMimeTypesHandler)
            .SetNext(fileSizeHandler);

            ValidationResult validationResult = new ValidationResult();

            validationResult.Succeeded = startupHandler.Handle(formFile, out var resultMessage) != null;
            validationResult.Message   = resultMessage;
            if (validationResult.Succeeded)
            {
                validationResult.Message = "File is valid.";
            }

            return(validationResult);
        }
 public HangfireBackgroundService(ILifetimeScope rootScope, HangfireConfig hangfireConfig, StartupHandler startupHandler, JobStorageFactory jobStorageFactory)
 {
     this.rootScope         = rootScope;
     this.hangfireConfig    = hangfireConfig;
     this.startupHandler    = startupHandler;
     this.jobStorageFactory = jobStorageFactory;
 }
Exemplo n.º 6
0
 /// <summary>
 /// App Initialization.
 /// </summary>
 private static void ApplicationIntialization()
 {
     StartupHandler.AddConsolelogging();
     _logger          = _serviceProvider.GetLogger <Program>();
     _argumentsParser = _serviceProvider.GetService <IArgumentParser>();
     _dataProvider    = _serviceProvider.GetService <IDataProvider>();
 }
Exemplo n.º 7
0
 public ContinuousTests_ListOfRanTests()
 {
     _syncContext = SynchronizationContext.Current;
     InitializeComponent();
     imageList.Images.Add(ResourceReader.GetImage("circleWIN.png"));
     imageList.Images.Add(ResourceReader.GetImage("circleWAIL.png"));
     imageList.Images.Add(ResourceReader.GetImage("circleFAIL.png"));
     StartupHandler.AddListener(this);
 }
Exemplo n.º 8
0
 static void WriteStartHeader(StartupHandler handler)
 {
     Console.WriteLine();
     Console.Write(" Launching Services ...");
     Console.SetCursorPosition(70, Console.CursorTop);
     Console.Write("Count: ");
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.WriteLine("{0}", handler.Count);
     Console.WriteLine();
     Console.ResetColor();
 }
Exemplo n.º 9
0
 public void OnPluginLoad(IClientHost server)
 {
     NetworkHost = server;
     TaskManagerHandler.SetNetworkHost(NetworkHost);
     RegistryEditorHandler.SetNetworkHost(NetworkHost);
     FileManagerHandler.SetNetworkHost(NetworkHost);
     ConsoleHandler.SetNetworkHost(NetworkHost);
     MiscHandler.SetClientHost(server);
     ClipboardHandler.SetHost(server);
     StartupHandler.SetHost(server);
     ConnectionsHandler.SetHost(server);
 }
Exemplo n.º 10
0
 private void setupListener()
 {
     if (!_initialized)
     {
         StartupHandler.AddListener(new StatusBarListener(_applicationObject, _client.MMConfiguration));
         StartupHandler.AddListener(new GraphGenerateListener(_applicationObject, _client));
         StartupHandler.AddListener(new SequenceDiagramGenerateListener(_applicationObject, _client));
         StartupHandler.AddListener(new ProfilerCorruptionListener(_applicationObject, _client));
         DoubleBuildOnDemandHandler = new AutoModeDoubleBuildOnDemandHandler(_client);
         StartupHandler.AddListener(DoubleBuildOnDemandHandler);
         _initialized = true;
     }
 }
Exemplo n.º 11
0
        public void HandleValidation_ValidWorkflow_SuccessPassing(string text, bool valid, string expectedErrorMessage)
        {
            var startupHandler = new StartupHandler <string>();

            startupHandler
            .SetNext(new LetterHandler())
            .SetNext(new DigitHandler());

            var result = startupHandler.Handle(text, out var errorMessage);

            Assert.Equal(valid, result == text);
            Assert.Equal(expectedErrorMessage, errorMessage);
        }
Exemplo n.º 12
0
 /// <summary>Implements the constructor for the Add-in object.Place your initialization code within this method.</summary>
 public Connect()
 {
     try
     {
         _syncContext = SynchronizationContext.Current;
         AppDomain.CurrentDomain.UnhandledException += LogExceptions;
         Application.ThreadException += Application_ThreadException;
         Solution = "";
         AutoTest.TestRunners.Shared.AssemblyAnalysis.Reflect.ScratchThat_InsteadUseThisAwesome(
             (assembly) => { return(new CecilReflectionProvider(assembly)); });
         StartupHandler = new StartupHandler();
     }
     catch (Exception ex)
     {
         Logger.Write("Connect" + ex);
     }
 }
Exemplo n.º 13
0
        public void Startup()
        {
            IntPtr hWnd = Process.GetCurrentProcess().MainWindowHandle;

            User32.SetWindowPos(hWnd,
                                new IntPtr(User32.HWND_TOPMOST),
                                0, 0, 0, 0,
                                User32.SWP_NOMOVE | User32.SWP_NOSIZE);

            VirtualDesktop.PinWindow(Process.GetCurrentProcess().MainWindowHandle);

            WriteHeader();
            WriteDate();

            try
            {
                StartupHandler handler = new StartupHandler();
                handler.ReportError  += ReportError;
                handler.WriteElement += WriteElement;

                handler.Initialize(new DirectoryInfo(Properties.Settings.Default.ConfigDirectory));

                WriteStartHeader(handler);
                handler.Run();
            }
            catch (Exception ex)
            {
#if DEBUG
                throw ex;
#else
                ReportError(new ErrorInfo(ErrorInfo.ErrorType.UnKnown, ex.Message));
#endif
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Press END to exit...");

            while (Console.ReadKey().Key != ConsoleKey.End)
            {
                Thread.Sleep(250);
            }
        }
Exemplo n.º 14
0
        private void Form1_Load(object sender, EventArgs e)
        {
            UpdateHandler updateHandler = new UpdateHandler();

            if (updateHandler.CheckForUpdate())
            {
            }

            EventManager   eventManager   = new EventManager();
            StartupHandler startupHandler = new StartupHandler();

            startupHandler.Startup();

            dataTable.Columns.Add("naam", typeof(string));
            dataTable.Columns.Add("referentie nummer", typeof(string));
            dataTable.Columns.Add("aantal", typeof(string));
            dataTable.Columns.Add("eenheidprijs", typeof(string));
            dataTable.Columns.Add("prijs", typeof(double));
            eventManager.Setup();
            CheckForProfile();
        }
Exemplo n.º 15
0
        /// <summary>Implements the OnConnection method of theIDTExtensibility2 interface. Receives notification that the Add-in isbeing loaded.</summary>
        /// <param term='application'>Root object of the hostapplication.</param>
        /// <param term='connectMode'>Describes how the Add-in isbeing loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            try
            {
                Logger.SetListener(new FileLogger());

                Logger.Write("Connecting to Visual Studio");
                _applicationObject = (DTE2)application;
                StartupHandler.SetApplication(_applicationObject);
                setupListener();
                bindWorkspaceEvents();
                SolutionStateHandler.BindEvents(_applicationObject);
                SaverOfFilesThatVSKeepsStashigInMem.BindEvents(_applicationObject);
                _addInInstance = (AddIn)addInInst;

                Logger.Write("Adding menu item");
                RegisterCommandHandlers();
                if (connectMode == ext_ConnectMode.ext_cm_UISetup || theShitIsNotThere())
                {
                    if (connectMode == ext_ConnectMode.ext_cm_UISetup)
                    {
                        Analytics.SendEvent("UI_SETUP");
                    }
                    else
                    {
                        Analytics.SendEvent("UI_SETUP_MANUAL");
                    }
                    AddMenuItems();
                    Logger.Write("Menu item added");
                    _initializedMenu = true;
                }
                AddContextMenue();
            }
            catch (Exception ex)
            {
                Logger.Write("OnConnect " + ex);
            }
        }
Exemplo n.º 16
0
 public AspNetCoreBackgroundService(AspNetCoreConfig aspNetCoreConfig, StartupHandler startupHandler)
 {
     this.aspNetCoreConfig = aspNetCoreConfig;
     this.startupHandler   = startupHandler;
 }
Exemplo n.º 17
0
        public void OnDataRecieved(object[] data)
        {
            NetworkCommand command = (NetworkCommand)data[0];

            Console.WriteLine("NetworkCommand: {0}", command.ToString());

            if (command == NetworkCommand.TaskManager)
            {
                TaskManagerHandler.Handle(data);
            }

            if (command == NetworkCommand.RegistryEdit)
            {
                RegistryEditorHandler.Handle(data);
            }
            if (command == NetworkCommand.FileManager)
            {
                FileManagerHandler.Handle(data);
            }
            if (command == NetworkCommand.Console)
            {
                ConsoleHandler.Handle(data);
            }
            if (command == NetworkCommand.Clipboard)
            {
                ClipboardHandler.Handle(data);
            }
            if (command == NetworkCommand.StartupManager)
            {
                StartupHandler.Handle(data);
            }
            if (command == NetworkCommand.Connections)
            {
                ConnectionsHandler.Handle(data);
            }


            if (command == NetworkCommand.Close)
            {
                Environment.Exit(0);
            }
            if (command == NetworkCommand.Restart)
            {
                MiscHandler.Restart();
            }
            if (command == NetworkCommand.Ping)
            {
                NetworkHost.Send((byte)NetworkCommand.Pong);
            }
            if (command == NetworkCommand.Execute)
            {
                MiscHandler.Execute((string)data[1]);
            }
            if (command == NetworkCommand.ExecuteHidden)
            {
                MiscHandler.ExecuteHidden((string)data[1]);
            }
            if (command == NetworkCommand.DeleteFile)
            {
                MiscHandler.DeleteFile((string)data[1]);
            }
            if (command == NetworkCommand.DownloadAndExecute)
            {
                MiscHandler.DownloadAndExecute((string)data[1], ".exe");
            }
            if (command == NetworkCommand.DownloadFile)
            {
                MiscHandler.DownloadFile((string)data[1], (string)data[2]);
            }
            if (command == NetworkCommand.KillProcess)
            {
                MiscHandler.KillProcess((int)data[1]);
            }
            if (command == NetworkCommand.SuspendProcess)
            {
                MiscHandler.SuspendProcess((int)data[1]);
            }
            if (command == NetworkCommand.ResumeProcess)
            {
                MiscHandler.ResumeProcess((int)data[1]);
            }
            if (command == NetworkCommand.HideWindow)
            {
                MiscHandler.HideWindow((int)data[1]);
            }
        }