Exemple #1
0
        private static string GetNuGetPackageName(ToolOptions options)
        {
            string moniker = options["-v", "--vendor"]?.Value;

            switch (moniker)
            {
            case "sqlserver":
                return("Jerrycurl.Tools.Vendors.SqlServer");

            case "oracle":
                return("Jerrycurl.Tools.Vendors.Oracle");

            case "mysql":
                return("Jerrycurl.Tools.Vendors.MySql");

            case "postgres":
                return("Jerrycurl.Tools.Vendors.Postgres");

            case "sqlite":
                return("Jerrycurl.Tools.Vendors.Sqlite");

            default:
                return(null);
            }
        }
Exemple #2
0
        private static ProxyArgs GetProxyArgs(ToolOptions options)
        {
            string moniker        = options["-v", "--vendor"]?.Value;
            string packageName    = DatabaseFacts.GetToolsNuGetPackage(moniker);
            string packageVersion = GetNuGetPackageVersionString();

            if (packageName == null || packageVersion == null)
            {
                return(null);
            }

            string sourcePath       = Path.GetDirectoryName(typeof(DotNetJerryHost).Assembly.Location);
            string projectPath      = Path.Combine(sourcePath, $"{ProxyAssemblyName}.csproj");
            string binPath          = Path.Combine(sourcePath, "built", moniker, "bin");
            string intermediatePath = Path.Combine(sourcePath, "built", moniker, "obj");
            string dllPath          = Path.Combine(binPath, $"{ProxyAssemblyName}.dll");

            binPath          = binPath.TrimEnd('\\', '/') + '\\';
            intermediatePath = intermediatePath.TrimEnd('\\', '/') + '\\';

            return(new ProxyArgs()
            {
                PackageName = packageName,
                PackageVersion = packageVersion,
                DllPath = dllPath,
                DllName = ProxyAssemblyName,
                ProjectPath = projectPath,
                BinPath = binPath,
                IntermediatePath = intermediatePath,
            });
        }
Exemple #3
0
        private static ProxyArgs GetProxyArgs(ToolOptions options)
        {
            string packageName = GetNuGetPackageName(options);

            if (packageName == null)
            {
                return(null);
            }

            string packageVersion = GetNuGetPackageVersion();
            string sourcePath     = Path.GetDirectoryName(typeof(Program).Assembly.Location);
            string projectPath    = null;
            string binPath        = null;
            string dllPath        = null;

            if (packageName != null)
            {
                projectPath = Path.Combine(sourcePath, "build", "build.csproj");
                binPath     = Path.Combine(sourcePath, "build", "bin", packageName.ToLower());
                dllPath     = Path.Combine(binPath, $"jerry-proxy.dll");
            }

            return(new ProxyArgs()
            {
                PackageName = packageName,
                PackageVersion = packageVersion,
                DllPath = dllPath,
                DllName = "jerry-proxy",
                ProjectPath = projectPath,
                BinPath = binPath,
            });
        }
Exemple #4
0
 /// <summary>
 /// Called just before ArcGIS.Desktop.Framework.Controls.EmbeddableControl.OpenAsync
 /// when this IEditingCreateToolControl is being used within the ActiveTemplate pane.
 /// </summary>
 /// <param name="options">tool options obtained from the template for the given toolID</param>
 /// <returns>true if the control is to be displayed in the ActiveTemplate pane.. False otherwise</returns>
 bool IEditingCreateToolControl.InitializeForActiveTemplate(ToolOptions options)
 {
     // assign the current options
     ToolOptions = options;
     // initialize the view
     InitializeOptions();
     return(true); // true <==> do show me in ActiveTemplate;   false <==> don't show me
 }
Exemple #5
0
        public BlockWordDictionary(IOptions <ToolOptions> options)
        {
            _options = options.Value;

            _wordsDictionary = new Lazy <Dictionary <string, string> >(() =>
            {
                var jsonData = File.ReadAllText(_options.Provider.Tag.BlockWord.FilePath);
                return(JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonData));
            });
        }
 public DefaultTagLoader(IEnumerable <ITagInfoProvider> tagInfoProviders,
                         IBlockWordDictionary blockWordDictionary,
                         IOptions <ToolOptions> options,
                         ILogger <DefaultTagLoader> logger)
 {
     TagInfoProviders    = tagInfoProviders;
     BlockWordDictionary = blockWordDictionary;
     _logger             = logger;
     Options             = options.Value;
 }
Exemple #7
0
        private static ToolOptions ParseArguments(string[] args)
        {
            ResponseSettings settings = new ResponseSettings()
            {
                WorkingDirectory   = Environment.CurrentDirectory,
                IgnoreComments     = true,
                IgnoreMissingFiles = false,
                IgnoreWhitespace   = true,
                DefaultExtension   = ".cli",
            };

            return(ToolOptions.Parse(ApplyDefaultArguments(args), settings));
        }
 public DownloadCommand(ILogger <DownloadCommand> logger,
                        IFileScanner fileScanner,
                        IOptions <ToolOptions> options,
                        ITagLoader tagLoader,
                        IEnumerable <ILyricDownloader> lyricDownloaderList,
                        IEnumerable <IAlbumDownloader> albumDownloaderList)
 {
     _logger              = logger;
     _fileScanner         = fileScanner;
     _tagLoader           = tagLoader;
     _lyricDownloaderList = lyricDownloaderList;
     _albumDownloaderList = albumDownloaderList;
     _options             = options.Value;
 }
Exemple #9
0
        public static RunnerArgs FromCommandLine(string[] args)
        {
            ToolOptions options = ParseArguments(args);

            return(new RunnerArgs()
            {
                Command = options.Default.Length > 0 ? options.Default[0] : null,
                Options = options,
                Connection = options["-c", "--connection"]?.Value,
                Namespace = options["-ns", "--namespace"]?.Value,
                Output = options["-o", "--output"]?.Value,
                Verbose = (options["--verbose"] != null),
                IsProxy = IsProxyRunner(),
                Proxy = GetProxyArgs(options),
            });
        }
Exemple #10
0
        public static RunnerArgs FromCommandLine(string[] args)
        {
            ToolParser  parser  = new ToolParser();
            ToolOptions options = parser.Parse(args);

            return(new RunnerArgs()
            {
                Command = args.Length > 0 ? args[0] : null,
                Options = options,
                Connection = options["-c", "--connection"]?.Value,
                Namespace = options["-ns", "--namespace"]?.Value,
                Output = options["-o", "--output"]?.Value,
                Verbose = (options["--verbose"] != null),
                IsProxy = (typeof(RunnerArgs).Assembly.GetName().Name == "jerry-proxy"),
                Proxy = GetProxyArgs(options),
            });
        }
        // Parser args parameters
        private static bool ParserArgs(string[] args)
        {
            var command = new RootCommand(description: "Specs validation tool")
            {
                new Option <bool>(aliases: new string[] { "--save", "-s" }, () => false)
                {
                    Description = "Save auto-fixes in original spec files.",
                },
                new Argument <string>("specs-path")
                {
                    Description = "The specs path can be a spec file path or a directory containing spec files.",
                },
            };

            command.Handler = CommandHandler.Create(
                (string specsPath, bool save) =>
            {
                options = new ToolOptions(specsPath, save);
            });

            return(command.InvokeAsync(args).Result == 0 && options != null);
        }
Exemple #12
0
 bool IEditingCreateToolControl.InitializeForActiveTemplate(ToolOptions options)
 {
     base.InitializeForActiveTemplate(options);
     if (MapView.Active == null)
     {
         return(true);
     }
     //Gather layers in the map
     LayersInMap.Clear();
     foreach (var layer in MapView.Active.Map.GetLayersAsFlattenedList().OfType <FeatureLayer>())
     {
         LayersInMap.Add(layer.Name);
     }
     if (LayersInMap.Count > 0)
     {
         SelectedLayer = LayersInMap[0];
     }
     //Get the table fields
     //Gather fields in the table - to prepopulate
     _ = GetTableFieldsAsync();
     return(true); // true <==> do show me in ActiveTemplate;   false <==> don't show me
 }
Exemple #13
0
 /// <summary>
 /// Called just before ArcGIS.Desktop.Framework.Controls.EmbeddableControl.OpenAsync
 /// when this IEditingCreateToolControl is being used within the Template Properties
 /// dialog
 /// </summary>
 /// <param name="options">tool options obtained from the template for the given toolID</param>
 /// <returns>true if the control is to be displayed in Template Properties. False otherwise</returns>
 bool IEditingCreateToolControl.InitializeForTemplateProperties(ToolOptions options)
 {
     ToolOptions = options;
     InitializeOptions();
     return(true); // true <==> do show me in TemplateProperties;   false <==> don't show me
 }
 //   ----  start of callback function for the buttons
 private void strClicked(object sender, RoutedEventArgs e)
 {
     tool = ToolOptions.ROBOT;
 }
        private void canvasClicked(object sender, MouseButtonEventArgs e)
        {
            int x = (int)((e.GetPosition(mapCanvas).X - squareSpacing) / (squareWidth + squareSpacing));
            int y = (int)((e.GetPosition(mapCanvas).Y - squareSpacing) / (squareHeight + squareSpacing));

            switch (tool)
            {
                case ToolOptions.OBJECTIVE:
                    tool = ToolOptions.NONE;
                    mapSpace.setObjective(x, y);
                    break;
                case ToolOptions.OBSTACLE:
                    mapSpace.setObstacle(x, y);
                    break;
                case ToolOptions.ROBOT:
                    tool = ToolOptions.NONE;
                    mapSpace.SetRobot(x, y);
                    break;
                case ToolOptions.NONE:
                default:
                    break;
            }

            drawMap();
        }
 private void obstacleClicked(object sender, RoutedEventArgs e)
 {
     tool = ToolOptions.OBSTACLE;
 }
 private void endClicked(object sender, RoutedEventArgs e)
 {
     tool = ToolOptions.OBJECTIVE;
 }
 public LyricItemCollectionFactory(IOptions <ToolOptions> options)
 {
     _options = options.Value;
 }
 public static TBuilder WithToolOptions <TBuilder>(this TBuilder builder, ToolOptions options)
     where TBuilder : IEndpointConventionBuilder
 {
     return(builder.WithMetadata(options));
 }
Exemple #20
0
 /// <summary>
 /// Creates a new instance of an Factory class, initializes it with the specified arguments.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="options"></param>
 /// <param name="logger"></param>
 public SyncFactory(IKeycloakRequestClient client, IOptionsMonitor <ToolOptions> options, ILogger <SyncFactory> logger)
 {
     _options = options.CurrentValue;
     _client  = client;
     _logger  = logger;
 }
Exemple #21
0
 public FileNameTagInfoProvider(IOptions <ToolOptions> options)
 {
     _options = options.Value;
 }
Exemple #22
0
 public override bool InitializeForActiveTemplate(ToolOptions toolOptions)
 {
     base.InitializeForActiveTemplate(toolOptions);
     return(true); // true <==> do show me in ActiveTemplate;   false <==> don't show me
 }
Exemple #23
0
 /// <summary>
 /// Called just before ArcGIS.Desktop.Framework.Controls.EmbeddableControl.OpenAsync
 /// when this IEditingCreateToolControl is being used within the Template Properties
 /// dialog
 /// </summary>
 /// <param name="options">tool options obtained from the template for the given toolID</param>
 /// <returns>true if the control is to be displayed in Template Properties. False otherwise</returns>
 bool IEditingCreateToolControl.InitializeForTemplateProperties(ToolOptions options)
 {
     return(false); // don't show the options in template properties
 }
Exemple #24
0
 public override bool InitializeForTemplateProperties(ToolOptions toolOptions)
 {
     base.InitializeForTemplateProperties(toolOptions);
     return(false);
 }