/// <summary> /// Gets command line args - for ClickOnce deployed applications, command line args may not be passed directly, they have to be retrieved. /// </summary> /// <returns>List of command line arg strings.</returns> private static IList <string> GetCommandLineArgs(string uniqueApplicationName) { string[] args = null; try { // The application was not clickonce deployed, get args from standard API's args = Environment.GetCommandLineArgs(); } catch (NotSupportedException) { // The application was clickonce deployed // Clickonce deployed apps cannot receive traditional commandline arguments // As a workaround commandline arguments can be written to a shared location before // the app is launched and the app can obtain its commandline arguments from the // shared location string appFolderPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), uniqueApplicationName); string cmdLinePath = Path.Combine(appFolderPath, "cmdline.txt"); if (File.Exists(cmdLinePath)) { try { using (TextReader reader = new StreamReader(cmdLinePath, Encoding.Unicode)) { args = NativeMethods.CommandLineToArgvW(reader.ReadToEnd()); } File.Delete(cmdLinePath); } catch (IOException) { } } } if (args == null) { args = Array.Empty <string>(); } return(new List <string>(args)); }
internal void LogoPathFromUri(string uri, Theme theme) { // all https://msdn.microsoft.com/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets // windows 10 https://msdn.microsoft.com/en-us/library/windows/apps/dn934817.aspx // windows 8.1 https://msdn.microsoft.com/en-us/library/windows/apps/hh965372.aspx#target_size // windows 8 https://msdn.microsoft.com/en-us/library/windows/apps/br211475.aspx string path; bool isLogoUriSet; // Using Ordinal since this is used internally with uri if (uri.Contains("\\", StringComparison.Ordinal)) { path = Path.Combine(Package.Location, uri); } else { // for C:\Windows\MiracastView etc path = Path.Combine(Package.Location, "Assets", uri); } if (theme == Theme.HighContrastBlack || theme == Theme.HighContrastOne || theme == Theme.HighContrastTwo) { isLogoUriSet = SetHighContrastIcon(path, ContrastBlack); } else if (theme == Theme.HighContrastWhite) { isLogoUriSet = SetHighContrastIcon(path, ContrastWhite); } else if (theme == Theme.Light) { isLogoUriSet = SetColoredIcon(path, ContrastWhite); } else { isLogoUriSet = SetColoredIcon(path, ContrastBlack); } if (!isLogoUriSet) { LogoPath = string.Empty; LogoType = LogoType.Error; ProgramLogger.Exception($"|{UserModelId} can't find logo uri for {uri} in package location: {Package.Location}", new FileNotFoundException(), GetType(), Package.Location); } }
/// <summary> /// Handles writing a file from a stream /// </summary> /// <param name="command">The command</param> /// <param name="cancellationToken">The cancellation token</param> /// <returns></returns> public async Task <WriteFileFromStreamCommandResult> Handle( WriteFileFromStreamCommand command, CancellationToken cancellationToken) { Argument.NotNull(command, nameof(command)); var commandResult = new WriteFileFromStreamCommandResult(); string folderPath = command.Path; if (string.IsNullOrEmpty(folderPath) == false) { await _directoryCreator .CreateDirectoryAsync(folderPath, cancellationToken) .ConfigureAwait(Await.Default); } string filePath = _path.Combine(folderPath, command.FileName); byte[] buffer = new byte[BufferSize]; long bytesWritten = 0L; using (var fileStream = _fileStreamFactory.Create(filePath, FileMode.Create, FileAccess.Write, FileShare.None, BufferSize, useAsync: true)) { int read; while ((read = await command.File .ReadAsync(buffer, 0, buffer.Length, cancellationToken) .ConfigureAwait(Await.Default)) > 0) { bytesWritten += read; if (bytesWritten > command.Size.Value) { throw new InvalidOperationException("Bytes saved greater than file size."); } await fileStream .WriteAsync(buffer, 0, read, cancellationToken) .ConfigureAwait(Await.Default); } await fileStream .FlushAsync(cancellationToken) .ConfigureAwait(Await.Default); } Require.MustBeTrue(bytesWritten, command.Size == bytesWritten, nameof(command.Size), "File size equals bytes saved"); commandResult.Result = WriteFileFromStreamCommandResultKind.Success; commandResult.BytesWritten = bytesWritten; return(commandResult); }
/// <summary> /// 删除拷贝的资源 /// </summary> /// <param name="targetpath"></param> /// <param name="platform"></param> static public void DeleteCopyAssets(string targetpath, RuntimePlatform platform) { targetpath = IPath.Combine(targetpath, BApplication.GetPlatformPath(platform)); //优先删除拷贝的美术资源,防止构建完再导入 其他资源等工作流完全切入DevOps再进行删除 var copyArtPath = IPath.Combine(targetpath, BResources.ART_ASSET_ROOT_PATH); if (Directory.Exists(copyArtPath)) { Directory.Delete(copyArtPath, true); } }
/// <summary> /// build apk,Assetbunld 位于Streaming下~ /// </summary> static public void BuildAPK() { InitBDFrame(); if (!BDEditorHelper.EditorConfig.IsSetConfig()) { BDebug.LogError("请注意设置apk keystore账号密码"); return; } var absroot = Application.dataPath.Replace("Assets", ""); PlayerSettings.Android.keystoreName = absroot + BDEditorHelper.EditorConfig.Android.keystoreName; PlayerSettings.keystorePass = BDEditorHelper.EditorConfig.Android.keystorePass; PlayerSettings.Android.keyaliasName = BDEditorHelper.EditorConfig.Android.keyaliasName; PlayerSettings.keyaliasPass = BDEditorHelper.EditorConfig.Android.keyaliasPass; // var outdir = BApplication.ProjectRoot + "/Build"; var outputPath = IPath.Combine(outdir, Application.productName + ".apk"); //文件夹处理 if (!Directory.Exists(outdir)) { Directory.CreateDirectory(outdir); } if (File.Exists(outputPath)) { File.Delete(outputPath); } //清空StreamingAsset var ios = IPath.Combine(Application.streamingAssetsPath, "iOS"); if (Directory.Exists(ios)) { Directory.Delete(ios, true); } var win = IPath.Combine(Application.streamingAssetsPath, "Windows"); if (Directory.Exists(win)) { Directory.Delete(win, true); } //开始项目一键打包 string[] scenes = { SCENEPATH }; UnityEditor.BuildPipeline.BuildPlayer(scenes, outputPath, BuildTarget.Android, BuildOptions.None); if (File.Exists(outputPath)) { Debug.Log("Build Success :" + outputPath); } else { Debug.LogException(new Exception("Build Fail! Please Check the log! ")); } }
/// <summary> /// 获取AssetbundleConfigLoder /// </summary> /// <returns></returns> static public AssetbundleConfigLoder GetAssetbundleConfigLoder(string rootPath, string platformPath) { //路径 var assetconfigPath = IPath.Combine(rootPath, platformPath, BResources.ART_ASSET_CONFIG_PATH); var assetTypePath = IPath.Combine(rootPath, platformPath, BResources.ART_ASSET_TYPES_PATH); //实例化 var configLoader = new AssetbundleConfigLoder(); configLoader.Load(assetconfigPath, assetTypePath); return(configLoader); }
/// <summary> /// 获取母包资源构建信息 /// </summary> /// <returns></returns> static public BasePackageAssetsBuildInfo GetPacakgeBuildInfo(string ouptputPath, RuntimePlatform platform) { var path = IPath.Combine(ouptputPath, BApplication.GetPlatformPath(platform), BResources.PACKAGE_BUILD_INFO_PATH); var buildinfo = new BasePackageAssetsBuildInfo(); if (File.Exists(path)) { var text = File.ReadAllText(path); buildinfo = JsonMapper.ToObject <BasePackageAssetsBuildInfo>(text); } return(buildinfo); }
/// <summary> /// 检测 /// </summary> /// <param name="res"></param> /// <returns></returns> private string FindAsset(string res) { //第一地址 var p = IPath.Combine(this.artRootPath, res); //寻址到第二路径,第二地址没有就放弃 if (!File.Exists(p)) { p = IPath.Combine(this.secArtRootPath, res); } return(p); }
public static string DetermineDataDirectory() { if (Directory.Exists(PortableDataPath)) { IsPortableMode = true; return(PortableDataPath); } else { return(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ModuleLocation)); } }
/// <summary> /// 启动本地的资源服务器 /// </summary> private void StartLocalAssetsFileServer() { if (EditorHttpListener == null) { //自动转hash PublishPipelineTools.PublishAssetsToServer(EXPORT_PATH); //开启文件服务器 EditorHttpListener = new EditorHttpListener(); var webdir = IPath.Combine(EXPORT_PATH, PublishPipelineTools.UPLOAD_FOLDER_SUFFIX); EditorHttpListener.Start("*", "10086", webdir); } }
/// <summary> /// 加载ExcelCache信息 /// </summary> private static Dictionary <string, string> LoadExcelCacheInfo() { var excelCachePath = IPath.Combine(BApplication.BDEditorCachePath, EXCEL_CACHE_PATH); Dictionary <string, string> excelCacheMap = new Dictionary <string, string>(); if (File.Exists(excelCachePath)) { var content = File.ReadAllText(excelCachePath); excelCacheMap = JsonMapper.ToObject <Dictionary <string, string> >(content); } return(excelCacheMap); }
/// <summary> /// 清理旧的persistent资源 /// </summary> static private void ClearOldPersistentAssets() { var runtimes = BApplication.SupportPlatform; foreach (var runtime in runtimes) { var path = IPath.Combine(Application.persistentDataPath, BApplication.GetPlatformPath(runtime)); if (Directory.Exists(path)) { Directory.Delete(path, true); } } }
/// <summary> /// 多路径寻址 /// </summary> /// <param name="assetFileName"></param> /// <returns></returns> public string FindMultiAddressAsset(string assetFileName) { //第一地址 var p = IPath.Combine(this.firstArtDirectory, assetFileName); //寻址到第二路径 if (!File.Exists(p)) { p = IPath.Combine(this.secArtDirectory, assetFileName); } return(p); }
/// <summary> /// 初始化DB /// </summary> /// <param name="str"></param> static public void Load(string root) { if (Connection != null) { Connection.Dispose(); } //persistent和streaming中,必须有存在一个 var path = IPath.Combine(root, Utils.GetPlatformPath(Application.platform) + "/Local.db"); // Connection = new SQLiteConnection(path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create); }
public void Setup() { _diskManager = Substitute.For <IStaticAbstraction>(); _pathManager = Substitute.For <IPath>(); _pathManager.Combine(Arg.Any <string>(), Arg.Any <string>()).Returns(x => { var data = x.Arg <string[]>(); return(data[0].TrimEnd('\\') + "\\" + data[1].TrimStart('\\')); }); _diskManager.Path.Returns(_pathManager); _cacheManager = Substitute.For <ICacheContainer>(); _gitUtils = new GitUtils(_diskManager, _cacheManager); }
private void BackupOriginFile() { // Using InvariantCulture since this is internal var timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fffffff", CultureInfo.InvariantCulture); var directory = Path.GetDirectoryName(FilePath).NonNull(); var originName = Path.GetFileNameWithoutExtension(FilePath); var backupName = $"{originName}-{timestamp}{FileSuffix}"; var backupPath = Path.Combine(directory, backupName); File.Copy(FilePath, backupPath, true); // todo give user notification for the backup process }
/// <summary> /// 创建assetbundle /// </summary> private static void BuildAssetBundle(BuildTarget target, string outPath, BuildAssetBundleOptions options = BuildAssetBundleOptions.ChunkBasedCompression) { AssetDatabase.RemoveUnusedAssetBundleNames(); string path = IPath.Combine(outPath, "Art"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } BuildPipeline.BuildAssetBundles(path, options, target); }
/// <summary> /// 获取分包设置路径 /// </summary> /// <param name="rootPath"></param> /// <param name="platform"></param> /// <returns></returns> static public string GetAssetsSubPackageInfoPath(string rootPath, RuntimePlatform platform, string subPackageName) { //旧版本兼容逻辑 if (subPackageName.StartsWith("ServerAssetsSubPackage_")) { return(IPath.Combine(rootPath, BApplication.GetPlatformPath(platform), subPackageName)); } else { var subPackagePath = string.Format(BResources.SERVER_ASSETS_SUB_PACKAGE_INFO_PATH, subPackageName); return(IPath.Combine(rootPath, BApplication.GetPlatformPath(platform), subPackagePath)); } }
static private void Json2Sqlite(string f, string json) { // var table = Path.GetFileName(f).Replace(Path.GetExtension(f), ""); var classname = "Game.Data." + table; var jsonObj = JsonMapper.ToObject(json); var assPath = IPath.Combine(BApplication.ProjectRoot, "Library/ScriptAssemblies/Assembly-CSharp.dll"); var ass = Assembly.LoadFile(assPath); // var t = ass.GetType(classname); // EditorUtility.DisplayProgressBar("Excel2Sqlite", string.Format("生成:{0} 记录条目:{1}", classname, jsonObj.Count), 0); if (t == null) { Debug.LogError(classname + "类不存在,请检查!"); return; } else { Debug.Log("导出:" + classname); } //数据库创建表 //sql.DB.Delete<>() sql.Connection.DropTableByType(t); // Debug.Log(t.FullName); sql.Connection.CreateTableByType(t); EditorUtility.ClearProgressBar(); // for (int i = 0; i < jsonObj.Count; i++) { var j = jsonObj[i]; var jo = JsonMapper.ToObject(t, j.ToJson()); try { sql.Connection.Insert(jo); } catch { Debug.LogError("导出数据有错,跳过! 错误位置:" + classname + ":" + i + "-" + jsonObj.Count); } } EditorUtility.DisplayProgressBar("Excel2Sqlite", string.Format("生成:{0} 记录条目:{1}", classname, jsonObj.Count), 1); }
public void Setup() { _ffmpegFileName = "/usr/sbin/ffmpeg"; _processRunner = Substitute.For <IProcessRunner>(); _argumentGenerator = Substitute.For <IFFmpegArgumentGenerator>(); _configManager = Substitute.For <IConfigManager <FFmpegConfig> >(); _fileSystem = Substitute.For <IFileSystem>(); _fileService = Substitute.For <IFile>(); _pathService = Substitute.For <IPath>(); _imageCount = 3; _timeout = TimeSpan.FromMilliseconds(10); _imageGenerator = new PreviewImageGenerator(_ffmpegFileName, _processRunner, _configManager, _argumentGenerator, _fileSystem, _imageCount, _timeout); _tempPath = "/Users/fred/temp"; _transcodeJob = new TranscodeJob() { SourceInfo = new MediaInfo() { FileName = "source", Duration = TimeSpan.FromHours(1), Streams = new StreamInfo[] { new VideoStreamInfo() { Index = 0 } } }, OutputFileName = "destination", Streams = new OutputStream[] { new VideoOutputStream() { SourceStreamIndex = 0 } } }; _ffmpegJobs = new List <FFmpegJob>(); _argumentGenerator.When(x => x.GenerateArguments(Arg.Any <FFmpegJob>())) .Do(x => _ffmpegJobs.Add(x[0] as FFmpegJob)); _fileSystem.File.Returns(_fileService); _fileSystem.Path.Returns(_pathService); _pathService.GetTempPath().Returns(_tempPath); _pathService.Combine(Arg.Any <string>(), Arg.Any <string>()).Returns(x => string.Join('/', x.Args())); }
/// <summary> /// 获取符合条件的资源名 /// </summary> /// <param name="floder"></param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public string[] GetAssets(string floder, string searchPattern = null) { //判断是否存在这个目录 List <string> rets = new List <string>(); //每个文件下判断 foreach (var direct in this.allRuntimeDirectList) { var fileDierct = IPath.Combine(direct, floder); // if (!Directory.Exists(fileDierct)) { continue; } // var res = Directory.GetFiles(fileDierct, "*.*", SearchOption.TopDirectoryOnly) .Where((r) => !r.EndsWith(".meta")); rets.AddRange(res); } // var splitStr = "/Runtime/"; for (int i = 0; i < rets.Count; i++) { var r = rets[i].Replace("\\", "/"); var index = r.IndexOf(splitStr); var rs = r.Substring(index + splitStr.Length).Split('.'); rets[i] = rs[0]; } //寻找符合条件的 if (!string.IsNullOrEmpty(searchPattern)) { rets = rets.FindAll((r) => { var fileName = Path.GetFileName(r); if (fileName.StartsWith(searchPattern)) { return(true); } return(false); }); } return(rets.ToArray()); }
public RepairSpoolFolderAssistant(IInteractionInvoker interactionInvoker, ITranslator translator, ISpoolerProvider spoolerProvider, IShellExecuteHelper shellExecuteHelper, IPath path, IFile file, IEnvironment environment, IAssemblyHelper assemblyHelper) { _interactionInvoker = interactionInvoker; _translator = translator; _shellExecuteHelper = shellExecuteHelper; _path = path; _file = file; _environment = environment; _assemblyHelper = assemblyHelper; _tempFolder = _path.GetFullPath(_path.Combine(spoolerProvider.SpoolFolder, "..")); }
/// <summary> /// 启动本地的资源服务器 /// </summary> private void StartLocalAssetsFileServer() { if (EditorHttpListener == null) { //自动转hash PublishPipelineTools.PublishAssetsToServer(EXPORT_PATH); //开启文件服务器 EditorHttpListener = new EditorHttpListener(); //添加AB文件服务器处理器 EditorHttpListener.AddWebAPIProccesor <WP_LocalABFileServer>(); var webdir = IPath.Combine(EXPORT_PATH, PublishPipelineTools.UPLOAD_FOLDER_SUFFIX); EditorHttpListener.Start("+", "10086"); } }
// /// <summary> /// 生成AssetBundle /// </summary> /// <param name="resRootPath"></param> /// <param name="outPath"></param> /// <param name="target"></param> public static void GenAssetBundle(string resRootPath, string outPath, BuildTarget target, BuildAssetBundleOptions options = BuildAssetBundleOptions.ChunkBasedCompression) { //0.cache path的路径 cachePath = IPath.Combine(outPath, "Art/Cache.json"); configPath = IPath.Combine(outPath, "Art/Config.json"); //1.环境准备 string rootPath = IPath.Combine(Application.dataPath, resRootPath); //扫描所有文件 var allFiles = Directory.GetFiles(rootPath, "*.*", SearchOption.AllDirectories); var fileList = new List <string>(allFiles); //剔除不打包的部分 for (int i = fileList.Count - 1; i >= 0; i--) { var fi = allFiles[i]; var extension = Path.GetExtension(fi.ToLower()); // if (extension.ToLower() == ".meta" || extension.ToLower() == ".cs" || extension.ToLower() == ".js") { fileList.RemoveAt(i); } } //2.分析ab包 AnalyzeResource(fileList.ToArray(), target, outPath); //3.生成AssetBundle BuildAssetBundle(target, outPath, options); //保存配置 FileHelper.WriteAllText(configPath, curManifestConfig.ToString()); //保存Cache.json FileHelper.WriteAllText(cachePath, AssetCache.ToString()); //删除无用文件 var delFiles = Directory.GetFiles(outPath, "*.*", SearchOption.AllDirectories); foreach (var df in delFiles) { var ext = Path.GetExtension(df); if (ext == ".meta" || ext == ".manifest") { File.Delete(df); } } //4.清除AB Name RemoveAllAbName(); }
/// <summary> /// 用mono编译 /// </summary> /// <param name="tempCodePath"></param> /// <param name="outBaseDllPath"></param> /// <param name="outHotfixDllPath"></param> static public void BuildByMono(string tempCodePath, string outBaseDllPath, string outHotfixDllPath) { var basecsPath = IPath.Combine(tempCodePath, "base.json"); var hotfixcsPath = IPath.Combine(tempCodePath, "hotfix.json"); var baseCs = JsonMapper.ToObject <List <string> >(File.ReadAllText(basecsPath)); var hotfixCs = JsonMapper.ToObject <List <string> >(File.ReadAllText(hotfixcsPath)); var dllFiles = Directory.GetFiles(tempCodePath, "*.dll", SearchOption.AllDirectories).ToList(); EditorUtility.DisplayProgressBar("编译服务", "[1/2]开始编译base.dll", 0.5f); //编译 base.dll try { Build(dllFiles.ToArray(), baseCs.ToArray(), outBaseDllPath); } catch (Exception e) { //EditorUtility.DisplayDialog("提示", "编译base.dll失败!", "OK"); Debug.LogError(e.Message); EditorUtility.ClearProgressBar(); return; } EditorUtility.DisplayProgressBar("编译服务", "[2/2]开始编译hotfix.dll", 0.7f); //将base.dll加入 dllFiles.Add(outBaseDllPath); //编译hotfix.dll try { Build(dllFiles.ToArray(), hotfixCs.ToArray(), outHotfixDllPath); } catch (Exception e) { Debug.LogError(e.Message); EditorUtility.ClearProgressBar(); return; } EditorUtility.DisplayProgressBar("编译服务", "清理临时文件", 0.9f); //删除临时目录 Directory.Delete(tempCodePath, true); //删除base.dll File.Delete(outBaseDllPath); EditorUtility.ClearProgressBar(); AssetDatabase.Refresh(); }
static Logger() { if (!Directory.Exists(ApplicationLogPath)) { Directory.CreateDirectory(ApplicationLogPath); } // Using InvariantCulture since this is used for a log file name var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt"); Trace.Listeners.Add(new TextWriterTraceListener(logFilePath)); Trace.AutoFlush = true; }
public RepairSpoolFolderAssistant(IInteractionInvoker interactionInvoker, ITranslationUpdater translationUpdater, ISpoolerProvider spoolerProvider, IShellExecuteHelper shellExecuteHelper, IPath path, IFile file, IEnvironment environment, IAssemblyHelper assemblyHelper) { _interactionInvoker = interactionInvoker; translationUpdater.RegisterAndSetTranslation(tf => _translation = tf.UpdateOrCreateTranslation(_translation)); _shellExecuteHelper = shellExecuteHelper; _path = path; _file = file; _environment = environment; _assemblyHelper = assemblyHelper; _tempFolder = _path.GetFullPath(_path.Combine(spoolerProvider.SpoolFolder, "..")); }
/// <summary> /// 创建assetbundle /// </summary> private static void BuildAssetBundle(BuildTarget target, string outPath) { AssetDatabase.RemoveUnusedAssetBundleNames(); string path = IPath.Combine(outPath, "Art"); if (Directory.Exists(path) == false) { Directory.CreateDirectory(path); } //使用lz4压缩 BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.ChunkBasedCompression, target); EditorUtility.ClearProgressBar(); }
static public void Init() { foreach (var p in PathList) { var _p = IPath.Combine(Application.dataPath, p); if (Directory.Exists(_p) == false) { Directory.CreateDirectory(_p); } } EditorUtility.DisplayDialog("提示", "目录生成完毕", "OK"); AssetDatabase.Refresh(); }
public static void HashName2AssetName(string path) { string android = "Android"; string iOS = "iOS"; android = IPath.Combine(path, android); iOS = IPath.Combine(path, iOS); string[] paths = new string[] { android, iOS }; foreach (var p in paths) { if (!Directory.Exists(p)) { Debug.Log("不存在:" + p); continue; } var cachePath = IPath.Combine(p, "Art/Cache.json"); var cacheDic = JsonMapper.ToObject <Dictionary <string, string> >(File.ReadAllText(cachePath)); float i = 0; foreach (var cache in cacheDic) { var source = IPath.Combine(p, "Art/" + cache.Value); var index = cache.Key.IndexOf("/Assets/"); string t = ""; if (index != -1) { t = cache.Key.Substring(index); } else { t = cache.Key; } var target = IPath.Combine(p, "ArtEditor/" + t); if (File.Exists(source)) { FileHelper.WriteAllBytes(target, File.ReadAllBytes(source)); } i++; EditorUtility.DisplayProgressBar("进度", i + "/" + cacheDic.Count, i / cacheDic.Count); } } EditorUtility.ClearProgressBar(); Debug.Log("还原完成!"); }
public void Initialize() { _fileSystemHelper = Substitute.For<IFileSystemHelper>(); _file = Substitute.For<IFile>(); _path = Substitute.For<IPath>(); _tagHelper = Substitute.For<ITagHelper>(); _path.GetFullPath(Arg.Any<string>()).ReturnsForAnyArgs(args => args.Arg<string>()); _path.Combine(Arg.Any<string[]>()).ReturnsForAnyArgs(args => System.IO.Path.Combine(args.Arg<string[]>())); _path.GetDirectoryName(Arg.Any<string>()).ReturnsForAnyArgs(args => System.IO.Path.GetDirectoryName(args.Arg<string>())); _target = new TagsOperation(_fileSystemHelper, _file, _path, _tagHelper); }
private void LoadRepository(IPath address) { if (address.AbsolutePath.EndsWith(".manifest")) { LoadManifest(address); return; } if (!address.AbsolutePath.EndsWith(".repository")) address = address.Combine("/" + Defaults.Repository); JsonFileHandler<ScriptRepository> repository_handler = new JsonFileHandler<ScriptRepository>(); repository_handler.ReadComplete += repository_handler_LoadComplete; repository_handler.ReadError += repository_handler_LoadError; repository_handler.ReadAsync(address); }