コード例 #1
0
ファイル: ClientLauncher.cs プロジェクト: wonook/reef
        private void AddDependencies(FileSystemInfo jobFolder, IConfiguration driverClientConfiguration)
        {
            // driver client configuration
            var driverClientConfigurationFile = Path.GetFullPath(Path.Combine(
                                                                     jobFolder.FullName,
                                                                     _reefFileNames.GetClrDriverConfigurationName()));

            _configurationSerializer.ToFile(driverClientConfiguration, driverClientConfigurationFile);
            _driverClientConfiguration.LocalFiles.Add(driverClientConfigurationFile);

            /*
             * var jsonSDKFile = Path.Combine(jobFolder.FullName, "Org.Apache.REEF.Bridge.Core.Driver.runtimeconfig.json");
             * File.WriteAllText(jsonSDKFile, jsonSDK);
             * _driverClientConfiguration.GlobalFiles.Add(jsonSDKFile);
             */

            // resource files
            var a = typeof(ClientLauncher).Assembly;

            foreach (var name in a.GetManifestResourceNames())
            {
                Log.Log(Level.Info, "Extracting resource {0}", name);
                var resource = a.GetManifestResourceStream(name);
                using (var file = new FileStream(name, FileMode.Create, FileAccess.Write))
                {
                    resource.CopyTo(file);
                }
            }

            var directory = ClientUtilities.GetPathToExecutingAssembly();
            {
                if (Directory.Exists(directory))
                {
                    // For input paths that are directories, extract only files of a predetermined type
                    _driverClientConfiguration.GlobalFiles.Add(
                        Directory.GetFiles(directory).Where(IsAssemblyToCopy));
                }
                else
                {
                    // Throw if a path input was not a file or a directory
                    throw new FileNotFoundException($"Global Assembly Directory not Found: {directory}");
                }
            }
        }