Example #1
0
        public MainForm(IFileReader fileReader,
                        IFileTabPageFactory fileTabPageFactory,
                        IOptionsHandler optionsHandler)
        {
            InitializeComponent();

            if (components == null)
            {
                components = new System.ComponentModel.Container();
            }

            this.fileReader         = fileReader;
            this.fileTabPageFactory = fileTabPageFactory;
            this.optionsHandler     = optionsHandler;
            options = optionsHandler.Options;
            wrapLongLinesMenuItem.Checked = !options.WrapLongLines;

            var menuItems = new ToolStripItem[]
            {
                copyPathMenuItem,
                toolStripSeparator3,
                closeMenuItem,
                closeAllButThisMenuItem,
                closeAllMenuItem
            };

            contextMenuStrip = new ContextMenuStrip(components)
            {
                Name = $"contextMenuStrip",
                Size = new Size(197, 98)
            };
            contextMenuStrip.Items.AddRange(menuItems);
        }
Example #2
0
        static OptionsDto StartUp()
        {
            var serializer = new XmlSerializer(typeof(OptionsDto));

            try
            {
                using (var r = new StreamReader(optionsPath))
                    return((OptionsDto)serializer.Deserialize(r));
            }catch (Exception e)
            {
                var options = new OptionsDto();
                options.Version      = "0";
                options.Lang         = "eng";
                options.AuthIP       = "127.0.0.1";
                options.Register     = "http://localhost/Register";
                options.News         = "http://localhost/News";
                options.FTP          = new FtpInfo();
                options.FTP.URL      = "ftp://localhost/";
                options.FTP.User     = "";
                options.FTP.Password = "";

                using (var r = new StreamWriter(optionsPath))
                    serializer.Serialize(r, options);

                return(options);
            }
        }
Example #3
0
        public async Task <CustomApiResponse> Put([FromBody] OptionsDto entity)
        {
            var inputEntity = _mapper.Map <Options>(entity);
            var result      = await _optionService.Update(inputEntity);

            return(new CustomApiResponse(entity.Id, result ? "Succeeded" : "Failed", !result));
        }
Example #4
0
 static void Main()
 {
     options = StartUp();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new Patcher_s4());
     ShutDown();
 }
        public FileBuildOrderLogic(OptionsDto optionsDto)
        {
            _optionsDto = optionsDto;

            if (!string.IsNullOrEmpty(_optionsDto?.LastKnownFile))
            {
                _optionsDto.LastKnownFile = _optionsDto.LastKnownFile.Contains("BuildOrder.json") ? _optionsDto.LastKnownFile : _optionsDto.LastKnownFile + "/BuildOrder.json";
            }
        }
Example #6
0
        public void UpdateOptions(OptionsDto options)
        {
            var optionsDb = optionsRepository.ReadOptions();

            optionsRepository.UpdateOptions(
                optionsDb != null
                    ? (Options)mapper.Map(
                    options, optionsDb, typeof(OptionsDto), typeof(Options))
                    : mapper.Map <Options>(options));
        }
Example #7
0
        public OptionsForm(MainForm mainForm, IOptionsService optionsService)
            : base(mainForm, optionsService)
        {
            InitializeComponent();

            options             = optionsService.ReadOptions();
            this.optionsService = optionsService;

            MyInitializeComponent();
        }
Example #8
0
        public async Task <CustomApiResponse> Post([FromBody] OptionsDto entity)
        {
            var inputEntity = _mapper.Map <Options>(entity);
            //if (await _optionService.IsExisted(entity.Name))
            //{
            //	return new CustomApiResponse("OptionName đã tồn tại", true);
            //}
            var result = await _optionService.Add(inputEntity);

            return(new CustomApiResponse(result));
        }
Example #9
0
        public AzureDevOpsLogic(OptionsDto optionsDto)
        {
            _optionsDto          = optionsDto;
            _httpClient          = new CustomHttpClient();
            _fileBuildOrderLogic = new FileBuildOrderLogic(optionsDto);

            //Define PAT token
            var authToken = Convert.ToBase64String(Encoding.ASCII.GetBytes($":{_optionsDto.ApiKey}"));

            //Define Authorization
            _httpClient.SetAuthorization(new AuthenticationHeaderValue("Basic", authToken));
        }
Example #10
0
        public AzureDevOps_Platform_Test()
        {
            _options = new OptionsDto
            {
                Mode           = "AzureDevOps",
                ApiKey         = "cqjk3s2pkv5x5o57feaw6j2qs4id2thfsw3w544hiqgt347gfoja",
                SourceUri      = "http://kamina.azuredevops.local/DefaultCollection/Kamina",
                ProjectName    = "Tengen Toppa Gurren Lagann",
                SourceBranch   = "develop",
                LastKnownFile  = "Input/BuildOrder.json",
                MaxErrorCycles = 6
            };

            _azureDevOps         = new AzureDevOpsLogic(_options);
            _fileBuildOrderLogic = new FileBuildOrderLogic(_options);
        }
Example #11
0
 public void SaveFile(OptionsDto options)
 {
     if (FileDetails != null)
     {
         fileWriter.CreateOrOverwriteFile(FileDetails.FileName, TextBox.Text);
     }
     else
     {
         var saveFileDialog = new SaveFileDialog();
         if (saveFileDialog.ShowDialog() == DialogResult.OK)
         {
             fileWriter.CreateOrOverwriteFile(saveFileDialog.FileName, TextBox.Text);
             // TODO: Add in correct position, not to the end
             options.AppendToOpenedFiles(saveFileDialog.FileName);
             FileDetails = new FileDetails(saveFileDialog.FileName);
             Text        = FileDetails.ShowFileName;
         }
     }
 }
Example #12
0
 private NextToMainForm(IOptionsService optionsService)
 {
     options = optionsService.ReadOptions();
 }
 public async Task <IActionResult> Put([FromBody] OptionsDto options)
 {
     return(Success(await _optionsService.CreateAsync(options)));
 }
        public async Task <IActionResult> Post([FromBody] OptionsDto options)
        {
            await _optionsService.UpdateAsync(options);

            return(Success());
        }
Example #15
0
 public SizeProvider(IOptionsProvider optionsProvider)
 {
     options = optionsProvider.Options;
 }
Example #16
0
 private void LoadOptions()
 {
     options = optionsService.ReadOptions();
 }