/// <summary> /// Gets an object pointing to a file at the same location (e. g. the same directory). /// </summary> /// <param name="newFileName">The new file name for which to get the ResourceLink object.</param> /// <param name="subdirectories">The subdirectory path to the file (optional). This parameter may not be supported by all ResourceLink implementations!</param> public override ResourceLink GetForAnotherFile(string newFileName, params string[] subdirectories) { newFileName.EnsureNotNullOrEmptyOrWhiteSpace(nameof(newFileName)); return(new AssemblyResourceLinkSource( _resourceLink.GetForAnotherFile(newFileName, subdirectories))); }
public void Check_OpenForReading_AnotherFile() { var resLink = new AssemblyResourceLink(this.GetType(), "Dummy", "CommonPixelShader.hlsl"); resLink = resLink.GetForAnotherFile("CommonPixelShader.hlsl", "..", "Dummy2"); var foundIncludeLine = false; using (var inStream = resLink.OpenRead()) using (var inStreamReader = new StreamReader(inStream)) { string?actLine; while (null != (actLine = inStreamReader.ReadLine())) { if (actLine.StartsWith("#include")) { foundIncludeLine = true; break; } } } Assert.IsTrue(foundIncludeLine); }
public void GetFileExtension_AssemblyResourceLink() { ResourceLink extPNG = new AssemblyResourceLink(this.GetType(), "DummyNamespace.DummyFile.png"); ResourceLink extJPG = extPNG.GetForAnotherFile("Dummy.jpg"); Assert.True(extPNG.FileExtension == "png"); Assert.True(extJPG.FileExtension == "jpg"); }