public void Refresh()
        {
            Assemblies.Clear();
            Assemblies.AddRange(ReadAssembly(TestAssembly, _workingDirectory));

            Console.WriteLine(ToString());
        }
Example #2
0
        protected override bool OnValidateArguments(IEnumerable <string> extras)
        {
            var hasError = false;

            Assemblies.AddRange(extras.Where(a => !string.IsNullOrWhiteSpace(a)));

            if (Assemblies.Count != 2)
            {
                Console.Error.WriteLine($"{Program.Name}: Exactly two assemblies are required.");
                hasError = true;
            }

            var missing = Assemblies.Where(i => !File.Exists(i));

            if (missing.Any())
            {
                foreach (var file in missing)
                {
                    Console.Error.WriteLine($"{Program.Name}: File does not exist: `{file}`.");
                }
                hasError = true;
            }

            return(!hasError);
        }
Example #3
0
 public IAssemblyLookupSet IncludeAssemblies(IEnumerable <Assembly> assemblies)
 {
     return(new AssemblyLookupSet(
                _baseTypes,
                Assemblies
                .AddRange(assemblies)));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatabaseConsoleWrapper"/> class.
        /// </summary>
        /// <param name="assemblies">The assemblies containing the embedded resources.</param>
        /// <param name="connectionString">The default connection string.</param>
        /// <param name="company">The company name.</param>
        /// <param name="appName">The application/domain name.</param>
        /// <param name="outDir">The output path/directory.</param>
        /// <param name="useBeefDbo">Indicates whether to use the standard BEEF <b>dbo</b> schema objects (defaults to <c>true</c>).</param>
        private DatabaseConsoleWrapper(Assembly[] assemblies, string connectionString, string company, string appName, string outDir, bool useBeefDbo = true)
        {
            ConnectionString = Check.NotEmpty(connectionString, nameof(connectionString));
            Company          = Check.NotEmpty(company, nameof(company));
            AppName          = Check.NotEmpty(appName, nameof(appName));
            OutDir           = Check.NotEmpty(outDir, nameof(outDir));
            if (assemblies == null)
            {
                assemblies = Array.Empty <Assembly>();
            }

            if (useBeefDbo)
            {
                var a = new List <Assembly> {
                    typeof(DatabaseConsoleWrapper).Assembly
                };
                a.AddRange(assemblies);
                Assemblies.AddRange(a);
            }
            else
            {
                Assemblies.AddRange(assemblies);
            }

            OverrideConnectionString();
        }
Example #5
0
        ///
        public override void Initialize()
        {
            base.Initialize();

            LoadUserInfos();

            // Load modules
            GlobalContainer.LoadComponents <IClientModule>(TypeLoadFilter);
            GlobalContainer.LoadComponents <IModuleShell>(TypeLoadFilter);

            // Get types
            var moduleTypes = GlobalContainer.GetRegisteredImplementations(typeof(IClientModule));
            var shellTypes  = GlobalContainer.GetRegisteredImplementations(typeof(IModuleShell)).ToArray();

            // Get assemblies
            Assemblies.AddRange(moduleTypes.Union(shellTypes).Distinct().Select(t => t.Assembly).Distinct().ToList());

            // Raise load event for AssemblyConfiguration
            RaiseAssemblyConfigurationLoaded(new AssemblyConfiguration
            {
                Assemblies = Assemblies.Select(m => new AssemblyConfig(Path.GetFileName(m.Location))).ToList()
            });

            // Raise AssemblyLoaded event for earch assembly
            foreach (var module in Assemblies)
            {
                RaiseAssemblyLoaded(new AssemblyConfig(Path.GetFileName(module.Location)));
            }

            RaiseAssembliesLoaded(Assemblies);
        }
Example #6
0
        protected override bool OnValidateArguments(IEnumerable <string> extras)
        {
            var hasError = false;

            AssemblyName ??= "Merged";

            if (string.IsNullOrWhiteSpace(OutputPath))
            {
                OutputPath = AssemblyName + ".dll";
            }
            else
            {
                if (OutputPath.EndsWith("/") || OutputPath.EndsWith("\\") || Directory.Exists(OutputPath))
                {
                    OutputPath = Path.Combine(OutputPath, AssemblyName + ".dll");
                }

                var dir = Path.GetDirectoryName(OutputPath);
                if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
            }

            var assemblies = extras.Where(p => !string.IsNullOrEmpty(p)).ToArray();

            foreach (var assemblyOrDir in assemblies.ToArray())
            {
                if (Directory.Exists(assemblyOrDir))
                {
                    Assemblies.AddRange(Directory.GetFiles(assemblyOrDir, "*.dll"));
                }
                else if (File.Exists(assemblyOrDir))
                {
                    Assemblies.Add(assemblyOrDir);
                }
                else
                {
                    Console.Error.WriteLine($"{Program.Name}: File does not exist: `{assemblyOrDir}`.");
                    hasError = true;
                }
            }

            if (Assemblies.Count == 0)
            {
                Console.Error.WriteLine($"{Program.Name}: At least one assembly is required `--assembly=PATH`.");
                hasError = true;
            }

            if (hasError)
            {
                Console.Error.WriteLine($"{Program.Name}: Use `{Program.Name} help {Name}` for details.");
            }

            return(!hasError);
        }
Example #7
0
        public IDapperConfiguration FromAssemblies(IEnumerable <Assembly> assemblies)
        {
            if (assemblies == null)
            {
                throw new ArgumentNullException(nameof(assemblies));
            }

            Assemblies.AddRange(assemblies);

            return(this);
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeGenExecutorArgs"/> class.
        /// </summary>
        /// <param name="assemblies">The <see cref="Assemblies"/>.</param>
        /// <param name="parameters">The <see cref="Parameters"/>.</param>
        public CodeGenExecutorArgs(IEnumerable <Assembly>?assemblies = null, Dictionary <string, string>?parameters = null)
        {
            if (assemblies != null)
            {
                Assemblies.AddRange(assemblies);
            }

            if (parameters != null)
            {
                Parameters = parameters;
            }
        }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeGenExecutorArgs"/> class.
        /// </summary>
        /// <param name="logger">The <see cref="ILogger"/>.</param>
        /// <param name="assemblies">The <see cref="Assemblies"/>.</param>
        /// <param name="parameters">The <see cref="Parameters"/>.</param>
        public CodeGenExecutorArgs(ILogger logger, IEnumerable <Assembly>?assemblies = null, Dictionary <string, string>?parameters = null)
        {
            Logger = Check.NotNull(logger, nameof(Logger));

            if (assemblies != null)
            {
                Assemblies.AddRange(assemblies);
            }

            if (parameters != null)
            {
                Parameters = parameters;
            }
        }
Example #10
0
        /// <inheritdoc />
        public override async Task Extract()
        {
            var packageUnzipPath = await NuGetPackageHelper.InstallPackages(_packageNames, Platform, FrameworkConstants.CommonFrameworks.Tizen4).ConfigureAwait(false);

            Log.Debug($"Package unzip path is {packageUnzipPath}");

            Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "ElmSharp*.dll", SearchOption.AllDirectories));
            Assemblies.AddRange(Directory.GetFiles(packageUnzipPath, "Tizen*.dll", SearchOption.AllDirectories));

            foreach (var directory in Directory.GetDirectories(packageUnzipPath, "*.*", SearchOption.AllDirectories))
            {
                CecilSearchDirectories.Add(directory);
            }
        }
Example #11
0
        internal Client Build()
        {
            var proxyers = new List <GrpcProxyer>();

            foreach (var proxyerOptions in ProxyerOptions)
            {
                foreach (var assemblyName in proxyerOptions.AssemblyNames)
                {
                    proxyerOptions.AddAssembly(Assembly.Load(assemblyName));
                }
                proxyerOptions.Interceptors.AddRange(GlobalInterceptors);

                var servicerType = ServicerHelper.GetServicerTypes(proxyerOptions.Assemblies);
                proxyers.Add(new GrpcProxyer(servicerType, proxyerOptions));
                Assemblies.AddRange(proxyerOptions.Assemblies);
            }
            return(new Client(proxyers, ProxyerOptions));
        }
Example #12
0
        public BfCache(Dictionary <string, AssemblyTuple> nameToAssemblyTuple)
        {
            GetTypes(nameToAssemblyTuple);

            Assemblies.AddRange(new HashSet <BfAssembly>(_dictionary.Values));

            var index = 0;

            while (index < Types.Count)
            {
                var bfType = Types[index];

                if (bfType.Name != "<Module>")
                {
                    bfType.Populate();

                    Methods.AddRange(bfType.Methods);
                    Events.AddRange(bfType.Events);
                    Fields.AddRange(bfType.Fields);
                }

                ++index;
            }

            // ReSharper disable once ForCanBeConvertedToForeach
            for (var i = 0; i < Types.Count; ++i)
            {
                Types[i].Methods.Distinct().ForEach(m => m.Populate());
            }

            Types.Distinct().ForEach(bfType => bfType.Commit());

            Types.Distinct().ForEach(bfType =>
            {
                bfType.Methods.ForEach(m => m.Dispose());
                bfType.Events.ForEach(m => m.Dispose());
                bfType.Fields.ForEach(m => m.Dispose());
            });

            Assemblies.Distinct().ForEach(bfAssembly => bfAssembly.Dispose());

            Delegates();
            ReIndex();
        }
Example #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tizen"/> class.
        /// </summary>
        public Tizen()
        {
            var packageUnzipPath = Environment.CurrentDirectory;

            Log.Debug($"Package unzip path is {packageUnzipPath}");

            var retryPolicy = Policy
                              .Handle <Exception>()
                              .WaitAndRetry(
                5,
                retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
                (exception, timeSpan, context) =>
            {
                Log.Warning(
                    "An exception was thrown whilst retrieving or installing {0}: {1}",
                    _packageName,
                    exception);
            });

            retryPolicy.Execute(() =>
            {
                var repo           = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2");
                var packageManager = new PackageManager(repo, packageUnzipPath);
                var package        = repo.FindPackagesById(_packageName).Single(x => x.Version.ToString() == "4.0.0");

                Log.Debug("Using Tizen.NET {0} released on {1}", package.Version, package.Published);
                Log.Debug("{0}", package.ReleaseNotes);

                packageManager.InstallPackage(package, ignoreDependencies: true, allowPrereleaseVersions: false);
            });

            var elmSharp = Directory.GetFiles(packageUnzipPath, "ElmSharp*.dll", SearchOption.AllDirectories);

            Assemblies.AddRange(elmSharp);

            var tizenNet = Directory.GetFiles(packageUnzipPath, "Tizen*.dll", SearchOption.AllDirectories);

            Assemblies.AddRange(tizenNet);

            CecilSearchDirectories.Add($"{packageUnzipPath}\\Tizen.NET.4.0.0\\build\\tizen40\\ref");
            CecilSearchDirectories.Add($"{packageUnzipPath}\\Tizen.NET.4.0.0\\lib\\netstandard2.0");
        }
        protected override bool OnValidateArguments(IEnumerable <string> extras)
        {
            var hasError = false;

            var assemblies = extras.Where(p => !string.IsNullOrWhiteSpace(p)).ToArray();

            foreach (var assemblyOrDir in assemblies.ToArray())
            {
                if (Directory.Exists(assemblyOrDir))
                {
                    Assemblies.AddRange(Directory.GetFiles(assemblyOrDir, "*.dll"));
                }
                else if (File.Exists(assemblyOrDir))
                {
                    Assemblies.Add(assemblyOrDir);
                }
                else
                {
                    Console.Error.WriteLine($"{Program.Name}: File does not exist: `{assemblyOrDir}`.");
                    hasError = true;
                }
            }

            if (Assemblies.Count == 0)
            {
                Console.Error.WriteLine($"{Program.Name}: At least one assembly is required.");
                hasError = true;
            }

            if (!string.IsNullOrWhiteSpace(OutputPath))
            {
                var dir = Path.GetDirectoryName(OutputPath);
                if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
            }

            return(!hasError);
        }
Example #15
0
 public GrpcProxyerOptions AddAssembly(params Assembly[] assemblies)
 {
     Assemblies.AddRange(assemblies);
     return(this);
 }
 public AssemblyTypeResolver(IEnumerable <Assembly> assemblies)
 {
     Assemblies.AddRange(assemblies);
 }
 public ServiceRegistration OfAssemblies(IEnumerable <Assembly> assemblies)
 {
     Assemblies.AddRange(assemblies);
     return(this);
 }