Exemplo n.º 1
0
 public ListArtifacts(PerfOptions options) : base(options)
 {
     _client = new ContainerRegistryClient(new Uri(PerfTestEnvironment.Instance.Endpoint), PerfTestEnvironment.Instance.Credential,
                                           new ContainerRegistryClientOptions()
     {
         Audience = ContainerRegistryAudience.AzureResourceManagerPublicCloud
     });
 }
Exemplo n.º 2
0
        private void GenerateRegFile()
        {
            if (string.IsNullOrEmpty(fileNameTextBox.Text))
            {
                ShowErrorMessageDialog("Enter file name");
            }
            else if (fileNameTextBox.Text.Length > 260)
            {
                ShowErrorMessageDialog("File name is too long. Please try again");
            }
            else if (Path.GetExtension(fileNameTextBox.Text) == ".exe")
            {
                try
                {
                    string      filePath    = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                    string      fileName    = fileNameTextBox.Text;
                    PerfOptions perfOptions = (PerfOptions)perfOptionsComboBox.SelectedValue;

                    ;
                    ShowInfoMessageDialog($@"{perfOptionsMngr.ChangePerfOptions(filePath, fileName, perfOptions)}" +
                                          " file successfully created!");
                }
                catch (ArgumentException)
                {
                    ShowErrorMessageDialog("File name is not valid. Please try again");
                }
                catch (System.IO.PathTooLongException)
                {
                    ShowErrorMessageDialog("File name is too long. Please try again");
                }
                catch (NotSupportedException)
                {
                    ShowErrorMessageDialog("File name is not supported. Please try again");
                }
                catch (Exception)
                {
                    ShowErrorMessageDialog("Something went wrong. Please try again");
                }
            }
            else
            {
                ShowErrorMessageDialog("Enter file extension (.exe)");
            }
        }
        public string ChangePerfOptions(string filePath, string fileName, PerfOptions perfOption)
        {
            try
            {
                string text =
                    @"Windows Registry Editor Version 5.00" +
                    Environment.NewLine + Environment.NewLine +
                    $@"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\{fileName}\PerfOptions]" +
                    Environment.NewLine +
                    $"\"CpuPriorityClass\" = dword:0000000{(int)perfOption}";

                string file = Path.GetFileNameWithoutExtension(fileName).Replace(" ", "");
                string path = $@"{filePath}\{file}{perfOption.ToString()}Priority.reg";

                fileManager.CreateFile(path, text);
                return($"{file}{perfOption.ToString()}Priority.reg");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
        }
Exemplo n.º 4
0
 public ListArtifacts(PerfOptions options) : base(options)
 {
     _client = new ContainerRegistryClient(new Uri(PerfTestEnvironment.Instance.Endpoint), PerfTestEnvironment.Instance.Credential);
 }