private GroupInfo[] GetUserGroups(Guid userID, IncludeType includeType, Guid?categoryId) { var result = new List <GroupInfo>(); var distinctUserGroups = new List <GroupInfo>(); var refs = GetRefsInternal(); IEnumerable <UserGroupRef> userRefs = null; if (refs is UserGroupRefStore) { userRefs = ((UserGroupRefStore)refs).GetRefsByUser(userID); } foreach (var g in GetGroupsInternal().Where(g => !categoryId.HasValue || g.CategoryID == categoryId)) { if (((g.CategoryID == Constants.SysGroupCategoryId || userRefs == null) && IsUserInGroupInternal(userID, g.ID, refs)) || (userRefs != null && userRefs.Any(r => !r.Removed && r.RefType == UserGroupRefType.Contains && r.GroupId == g.ID))) { distinctUserGroups.Add(g); } } if (IncludeType.Distinct == (includeType & IncludeType.Distinct)) { result.AddRange(distinctUserGroups); } result.Sort((group1, group2) => String.Compare(group1.Name, group2.Name, StringComparison.Ordinal)); return(result.ToArray()); }
/// <summary> /// シェーダ#includeファイルの内容を開き、読み取るためのユーザーによって実施されるメソッド。 /// </summary> /// <param name="type">#includeファイルの場所を示すD3D_INCLUDE_TYPE型の値</param> /// <param name="fileName">#includeファイルの名前</param> /// <param name="parentStream"> #includeファイルが含まれていコンテナ。</param> /// <returns></returns> public Stream Open(IncludeType type, string fileName, Stream parentStream) { var assm = Assembly.GetExecutingAssembly(); Stream stream = assm.GetManifestResourceStream(m_prefix + "." + fileName); return(stream); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var filename = $"shaders/{fileName}"; var content = _fs.ReadBinaryFile(filename); return(new MemoryStream(content)); }
/* FILE IO METHODS */ /// <summary> /// Open a text file containing HLSL shader byte code. Search nearby directories if an absolute path /// to the file isn't provided. /// </summary> /// <param name="type"></param> /// <param name="fileName">The name of the shader file or absolute path to it (including the name).</param> /// <returns></returns> public Stream Open(IncludeType type, string fileName, Stream parentStream) { // Pull the working directory, or use the environment's if one isn't provided string currentDir = CurrentDirectory.Peek(); if (currentDir == null) { currentDir = Environment.CurrentDirectory; } // Examine the current working directory & subdirectories for the shader files to include string filePath = fileName; if (!Path.IsPathRooted(fileName)) { List<string> dirsToSearch = new List<string> { currentDir }; dirsToSearch.AddRange(IncludeDirectories); foreach (var dirPath in dirsToSearch) { string currentFile = Path.Combine(dirPath, fileName); if (NativeFile.Exists(currentFile)) { filePath = currentFile; break; } } } if (filePath == null || !NativeFile.Exists(filePath)) { throw new FileNotFoundException(String.Format("Unable to find the shader file [{0}]", filePath ?? fileName)); } // Open & read the found file NativeFileStream fileStream = new NativeFileStream(filePath, NativeFileMode.Open, NativeFileAccess.Read); CurrentDirectory.Push(Path.GetDirectoryName(filePath)); return fileStream; }
public Include(IncludeType type, string uri, string content, DateTime lastModifiedAt) { Type = type; Source = uri; Content = content; LastModifiedAt = lastModifiedAt; }
public Include RegisterInclude(string source, IncludeType type) { var include = _reader.Read(source, type); _storage.Store(include); return(include); }
/// <summary> /// Obtains index range of selected text. /// </summary> /// <param name="min"></param> /// <param name="max"></param> /// <returns></returns> public Vector2i GetRange(Vector2f min, Vector2f max, IncludeType includeType) { // FIXME: more optimal Vector2i range = new Vector2i(int.MaxValue, int.MinValue); for (int i = 0; i < glyphs.Length; i++) { if (glyphs[i].IsIncluded(min, max, includeType)) { int idx = (int)glyphs[i].IndexInArray; if (range.X > idx) { range.X = idx; } if (range.Y < idx) { range.Y = idx; } } } if (range.X == int.MaxValue) { return(new Vector2i(0, -1)); } return(range); }
public SearchQueryInclude(IncludeType IncludeType) { this.Type = IncludeType; this.SearchParameterList = new List <DomainModel.SearchParameter>(); this.IsIterate = false; this.IsRecurse = false; }
public IncludeParameter(bool Iterate, bool Recurse, IncludeType Type, string Value) { this.Type = Type; this.Iterate = Iterate; this.Recurse = Recurse; this.Value = Value; }
public static void Include(this HtmlHelper helper, IncludeType type, params string[] sources) { foreach (var path in sources) { helper.Include(type, path); } }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var s = File.OpenRead(Path.Combine(_SourceDirectory.FullName, fileName)); _OpenStreams.Add(s); return(s); }
public void AddHeaderContent(IncludeType CType, string Content, bool IsRelative) { if (string.IsNullOrEmpty(Content)) { return; } Literal ltrHeader = new Literal(); ltrHeader.ID = string.Format("ltr{0}", Content.GetHashCode().ToString("X")); string ltrText = null; switch (CType) { case IncludeType.Js: ltrText = string.Format("<script type='text/javascript' src='{0}'></script>", GetContentPath(Content, IsRelative)); break; case IncludeType.Css: ltrText = string.Format("<link rel='stylesheet' href='{0}' type='text/css' />", GetContentPath(Content, IsRelative)); break; case IncludeType.RawContent: ltrText = Content; break; } ltrHeader.Text = string.Concat(ltrText, Environment.NewLine); this.Header.Controls.Add(ltrHeader); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { string baseDir; if (type == IncludeType.Local) { baseDir = String.Concat(m_pathStacks.FindAll(item => item != "\\")); } else { baseDir = m_pathStacks.First(); } string fullFileName = Path.Combine(baseDir, fileName); string localPath = Path.GetDirectoryName(fullFileName.Substring(baseDir.Length)); m_pathStacks.Add(localPath); if (MyFileSystem.FileExists(fullFileName)) { return(new FileStream(fullFileName, FileMode.Open, FileAccess.Read)); } else { return(Stream.Null); } }
/// <summary> /// Include resolution method. Override it to provide a custom include resolution. Note that /// this Options instance must have been created with enableIncludes set to 'true'. /// </summary> /// <returns><c>true</c>, if find include was tryed, <c>false</c> otherwise.</returns> /// <param name="sourcePath">requesting source name</param> /// <param name="includePath">include name to search for.</param> /// <param name="incType">As in c, relative include or global</param> /// <param name="incFile">the resolved name of the include, empty if resolution failed</param> /// <param name="incContent">if resolution succeeded, contain the source code in plain text of the include</param> protected virtual bool TryFindInclude(string sourcePath, string includePath, IncludeType incType, out string incFile, out string incContent) { if (incType == IncludeType.Relative) { incFile = Path.Combine(Path.GetDirectoryName(sourcePath), includePath); if (File.Exists(incFile)) { using (StreamReader sr = new StreamReader(incFile)) incContent = sr.ReadToEnd(); return(true); } } else { foreach (string incDir in IncludeDirectories) { incFile = Path.Combine(incDir, includePath); if (File.Exists(incFile)) { using (StreamReader sr = new StreamReader(incFile)) incContent = sr.ReadToEnd(); return(true); } } } incFile = ""; incContent = ""; return(false); }
public int Next(int minValue, int maxValue, IncludeType type) { CheckInts(minValue, maxValue); var returnVal = 0; switch (type) { case IncludeType.None: returnVal = _rand.Next(minValue + 1, maxValue); break; case IncludeType.StartOnly: returnVal = _rand.Next(minValue, maxValue); break; case IncludeType.EndOnly: returnVal = _rand.Next(minValue + 1, maxValue + 1); break; case IncludeType.Both: returnVal = _rand.Next(minValue, maxValue + 1); break; } return(returnVal); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { Stream stream; if (type == IncludeType.Local) { string path = Path.Combine(this.BaseShaderPath, fileName); if (File.Exists(path)) { string content = File.ReadAllText(path); stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream); writer.Write(content); writer.Flush(); stream.Position = 0; } else { stream = null; } } else { stream = null; } return(stream); }
public IIncludeResult OpenInclude(IncludeType eType, string path, string includerPath) { if (!String.IsNullOrEmpty(includerPath)) { string fileDir = Path.GetDirectoryName(includerPath); IIncludeResult r = DoPath(fileDir, path); if (r != null) { return(r); } } foreach (string s in m_SearchDirs) { if (Directory.Exists(s)) { IIncludeResult r = DoPath(s, path); if (r != null) { return(r); } } } return(null); }
public static string RenderIncludes(this HtmlHelper helper, IncludeType type, bool isInDebugMode) { var sources = helper.ViewData[getViewDataKey(type)] as IList<string> ?? new List<string>(); var toRender = helper.RenderIncludes(sources, type, isInDebugMode); helper.ViewData[getViewDataKey(type)] = new List<string>(); return toRender; }
public static string RenderIncludes(this HtmlHelper helper, IncludeType type, bool isInDebugMode) { var sources = helper.ViewData[getViewDataKey(type)] as IList <string> ?? new List <string>(); var toRender = helper.RenderIncludes(sources, type, isInDebugMode); helper.ViewData[getViewDataKey(type)] = new List <string>(); return(toRender); }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { string fullPath = Global.FXPath + fileName; if (!File.Exists(fullPath)) Error.MessageMissingFile(Properties.Resources.ERR_IO_EffectMissingIncludeFile, fullPath, effectFile); stream = new FileStream(fullPath, FileMode.Open, FileAccess.Read); }
//file name - #include "./Shaders/Common.fx" //public Stream Open(IncludeType type, string fileName, Stream parentStream) { // var key = Path.GetFileNameWithoutExtension(fileName); // stream = this.GetType().Assembly.GetManifestResourceStream(resources[key]); // return stream; //} public Stream Open(IncludeType type, string fileName, Stream parentStream) { var key = Path.GetFileNameWithoutExtension(fileName); stream = resources[key].GetResourceStream(); return(stream); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { // Look for shaders in the startup directory. string shaderPath = Environment.CurrentDirectory + "\\" + fileName; // Open the shader in a new file stream. return(new FileStream(shaderPath, FileMode.Open, FileAccess.Read, FileShare.Read)); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { Log.Debug("...include: {0}", fileName); if (!Includes.Contains(fileName)) { Includes.Add(fileName); } return(File.OpenRead(buildContext.ResolveContentPath(fileName))); }
private void RadioButton_CheckedChanged(object sender, EventArgs e) { if (radioCopy.Checked) Responce = IncludeType.Copy; else if (radioLink.Checked) Responce = IncludeType.Link; else Responce = IncludeType.Skip; }
public void GetDirectoryListLATs(string fileMask, IncludeType includeType, IEnumerable <string> expectedLATs) { var options = new Options { FileMask = fileMask, IncludeType = includeType }; var result = CreateSftpTaskInstance().ListDirectoryInternal(_dummyParams, options, new System.Threading.CancellationToken()); Assert.That(result.Select(f => f.LastAccessTime.ToString(CultureInfo.InvariantCulture)), Is.EquivalentTo(expectedLATs)); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"dEngine.Graphics.Shaders.{fileName}.shader"); _includeStream = stream; return(_includeStream); }
public void GetDirectoryList(string fileMask, IncludeType includeType, IEnumerable <string> expectedFileNames) { var options = new Options { FileMask = fileMask, IncludeType = includeType }; var result = CreateSftpTaskInstance().ListDirectoryInternal(_dummyParams, options, new System.Threading.CancellationToken()); Assert.That(result.Select(f => f.Name), Is.EquivalentTo(expectedFileNames)); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var currentDirectory = CurrentDirectory.Peek(); if (currentDirectory == null) { currentDirectory = Environment.CurrentDirectory; } var filePath = fileName; if (!Path.IsPathRooted(filePath)) { var directoryToSearch = new List <string> { currentDirectory }; directoryToSearch.AddRange(IncludeDirectories); foreach (var dirPath in directoryToSearch) { var selectedFile = Path.Combine(dirPath, fileName); if (File.Exists(selectedFile)) { filePath = selectedFile; break; } } } Stream stream = null; // Make sure that this file is not in the resolved list FileResolved.Remove(fileName); if (filePath == null || !File.Exists(filePath)) { // Else try to use the include file callback if (IncludeFileCallback != null) { stream = IncludeFileCallback(type == IncludeType.System, fileName); if (stream != null) { FileResolved.Add(fileName, new FileItem(fileName, CleanPath(fileName), DateTime.Now)); return(stream); } } Logger.Error("Unable to find file [{0}]", CurrentSpan, filePath ?? fileName); return(null); } stream = new FileStream(filePath, FileMode.Open, FileAccess.Read); CurrentDirectory.Push(Path.GetDirectoryName(Path.GetFullPath(filePath))); var fullPath = Path.GetFullPath(filePath); FileResolved.Add(fileName, new FileItem(fileName, CleanPath(fullPath), File.GetLastWriteTime(fullPath))); return(stream); }
private static Result OpenImpl(IntPtr thisPtr, IncludeType includeType, IntPtr fileNameRef, IntPtr pParentData, ref IntPtr dataRef, ref int bytesRef) { unsafe { try { var shadow = ToShadow <IncludeShadow>(thisPtr); var callback = (Include)shadow.Callback; Stream stream = null; Stream parentStream = null; if (shadow._frames.ContainsKey(pParentData)) { parentStream = shadow._frames[pParentData].Stream; } stream = callback.Open(includeType, Marshal.PtrToStringAnsi(fileNameRef), parentStream); if (stream == null) { return(Result.Fail); } GCHandle handle; //if (stream is DataStream) //{ // // Magic shortcut if we happen to get a DataStream // var data = (DataStream)stream; // dataRef = data.PositionPointer; // bytesRef = (int)(data.Length - data.Position); // handle = new GCHandle(); //} //else { // Read the stream into a byte array and pin it byte[] data = ReadStream(stream); handle = GCHandle.Alloc(data, GCHandleType.Pinned); dataRef = handle.AddrOfPinnedObject(); bytesRef = data.Length; } shadow._frames.Add(dataRef, new Frame(stream, handle)); return(Result.Ok); } catch (SharpGenException exception) { return(exception.ResultCode.Code); } catch (Exception) { return(Result.Fail); } } }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { string fullFileName = Path.Combine(m_effectPath, fileName); DateTime sourceTime = File.GetLastWriteTime(fullFileName); if (sourceTime > m_mostUpdateDateTime) m_mostUpdateDateTime = sourceTime; return new FileStream(fullFileName, FileMode.Open, FileAccess.Read); }
public void Open(IncludeType type, string fileName, out Stream stream) { if (type == IncludeType.System) stream = fileSystem.GetAssetStream(fileName); else { string path = Path.Combine(Path.GetDirectoryName(fileSystem.GetAssetFullPath(originalAssetName)), fileName); stream = fileSystem.GetAssetStream(path); } }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { string s = Utils.GetRootPath() + "\\Content\\Shaders\\" + fileName; using (StreamReader sr = new StreamReader(s)) { string str = sr.ReadToEnd(); stream = new MemoryStream(System.Text.Encoding.Default.GetBytes(str)); } }
public static void Include(this HtmlHelper helper, IncludeType type, string source) { var sourcesToInclude = helper.ViewData[getViewDataKey(type)] as IList<string> ?? new List<string>(); if (!sourcesToInclude.Contains(source)) { sourcesToInclude.Add(source); } helper.ViewData[getViewDataKey(type)] = sourcesToInclude; }
public bool CopyOrLinkFile(string file, bool exists, out IncludeType action, out bool applyforall) { var dialog = new AddItemDialog(file, exists, FileType.File); var result = dialog.ShowModal(this); action = dialog.Responce; applyforall = dialog.ApplyForAll; return(result); }
public override void ParseParameter(string[] parameters, FileInfo sourceFilePath, int lineNumber, IAssemblerContext context) { string includeFilename = parameters[0]; IncludeType matchType = IncludeType.Relative; if (parameters.Length > 1) { string incType = parameters[1].Replace("Sharpmake.", ""); incType = incType.Replace("IncludeType.", ""); if (!Enum.TryParse <IncludeType>(incType, out matchType)) { throw new Error("\t" + sourceFilePath.FullName + "(" + lineNumber + "): error: Sharpmake.Include invalid include type used ({0})", parameters[1]); } } string includeAbsolutePath = Path.IsPathRooted(includeFilename) ? includeFilename : null; if (Util.IsPathWithWildcards(includeFilename)) { if (matchType != IncludeType.Relative) { throw new Error("\t" + sourceFilePath.FullName + "(" + lineNumber + "): error: Sharpmake.Include with non-relative match types, wildcards are not supported ({0})", includeFilename); } includeAbsolutePath = includeAbsolutePath ?? Path.Combine(sourceFilePath.DirectoryName, includeFilename); context.AddSourceFiles(Util.DirectoryGetFilesWithWildcards(includeAbsolutePath)); } else { includeAbsolutePath = includeAbsolutePath ?? Util.PathGetAbsolute(sourceFilePath.DirectoryName, includeFilename); if (matchType == IncludeType.Relative) { if (!Util.FileExists(includeAbsolutePath)) { includeAbsolutePath = Util.GetCapitalizedPath(includeAbsolutePath); } } else { string matchIncludeInParentPath = MatchIncludeInParentPath(includeFilename, sourceFilePath.DirectoryName, matchType); if (matchIncludeInParentPath == null) { throw new Error("\t" + sourceFilePath.FullName + "(" + lineNumber + "): error: Sharpmake.Include file not found '{0}'[{1}]. Search started from '{2}'", includeFilename, matchType, sourceFilePath.DirectoryName); } includeAbsolutePath = Util.GetCapitalizedPath(matchIncludeInParentPath); } if (!Util.FileExists(includeAbsolutePath)) { throw new Error("\t" + sourceFilePath.FullName + "(" + lineNumber + "): error: Sharpmake.Include file not found {0}", includeFilename); } context.AddSourceFile(includeAbsolutePath); } }
internal GroupInfo[] GetGroups(IncludeType includeType, Guid?categoryId) { var groups = groupCache.Get(ID.ToString(), () => CoreContext.UserManager.GetUserGroups(ID, IncludeType.Distinct, null)); if (categoryId.HasValue) { return(groups.Where(r => r.CategoryID.Equals(categoryId.Value)).ToArray()); } return(groups); }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { if (type == IncludeType.Local) { stream = new FileStream(Path.Combine(ParentPath, fileName), FileMode.Open, FileAccess.Read); } else { this.sysHandler.Open(type, fileName, parentStream, out stream); } }
public string RegisterCombination(IEnumerable<string> sources, IncludeType type, DateTime now) { var combinedContent = new StringBuilder(); foreach (var source in sources) { var include = RegisterInclude(source, type); combinedContent.Append(include.Content).AppendLine(); } var combination = new IncludeCombination(type, sources, combinedContent.ToString(), now, _settings.Types[type]); var key = _storage.Store(combination); return key; }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var currentDirectory = CurrentDirectory.Peek(); if (currentDirectory == null) currentDirectory = Environment.CurrentDirectory; var filePath = fileName; if (!Path.IsPathRooted(filePath)) { var directoryToSearch = new List<string> {currentDirectory}; directoryToSearch.AddRange(IncludeDirectories); foreach (var dirPath in directoryToSearch) { var selectedFile = Path.Combine(dirPath, fileName); if (File.Exists(selectedFile)) { filePath = selectedFile; break; } } } Stream stream = null; // Make sure that this file is not in the resolved list FileResolved.Remove(fileName); if (filePath == null || !File.Exists(filePath)) { // Else try to use the include file callback if (IncludeFileCallback != null) { stream = IncludeFileCallback(type == IncludeType.System, fileName); if (stream != null) { FileResolved.Add(fileName, new FileItem(fileName, CleanPath(fileName), DateTime.Now)); return stream; } } Logger.Error("Unable to find file [{0}]", CurrentSpan, filePath ?? fileName); return null; } stream = new FileStream(filePath, FileMode.Open, FileAccess.Read); CurrentDirectory.Push(Path.GetDirectoryName(Path.GetFullPath(filePath))); var fullPath = Path.GetFullPath(filePath); FileResolved.Add(fileName, new FileItem(fileName, CleanPath(fullPath), File.GetLastWriteTime(fullPath))); return stream; }
public Include Read(string source, IncludeType type) { if (String.IsNullOrEmpty(source)) { throw new ArgumentException("source must have a value", source); } var abs = ToFileSystem(source); var file = new FileInfo(abs); if (!file.Exists) { throw new InvalidOperationException(string.Format("{0} does not exist", source)); } var content = File.ReadAllText(abs); var lastModifiedAt = File.GetLastWriteTimeUtc(abs); return new Include(type, source, content, lastModifiedAt); }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { if (type == IncludeType.Local) { stream = new FileStream(Path.Combine(ParentPath, fileName), FileMode.Open, FileAccess.Read); } else { if (systemincludes.ContainsKey(fileName)) { stream = systemincludes[fileName].ToStream(); } stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); } //set include type, so the factory can know LastIncludeType = type; }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { switch (type) { case IncludeType.Local: fileName = Path.Combine(_baseDirectory, fileName); break; case IncludeType.System: break; default: break; } // .fx 支持的字符集是 ASCII,而不是 UTF-8 或其他,这就是为什么 SharpDX 在进行文件预处理的时候使用的是 Encoding.ASCII。不过 fxc 看起来更智能一些,即使是带 BOM 头 // 的 UTF-8 也是能读取和编译的。有些 .fx(在 Windows 下)保存时选择的“UTF-8”实际上都是带 BOM 头的,所以这些文件就出现了 BOM 头。但是为什么 ShaderBytecode.CompileFromFile // 又是正常的? // 我这里仿照的是(推测的)fxc 的处理逻辑。 using (var streamReader = new StreamReader(fileName, Encoding.UTF8, true)) { var text = streamReader.ReadToEnd(); var textBytes = Encoding.ASCII.GetBytes(text); return new MemoryStream(textBytes); } }
public string RenderIncludes(IEnumerable<string> sources, IncludeType type, bool isInDebugMode) { var toRender = new StringBuilder(); if (sources.Count() > 0) { if (_http.Context.IsDebuggingEnabled && isInDebugMode) { Clear(); foreach (var source in sources) { var url = _reader.ToAbsolute(source); toRender.AppendFormat(_includeFormatStrings[type], url).AppendLine(); } } else { var hash = RegisterCombination(sources, type, DateTime.UtcNow); var outputUrl = _reader.ToAbsolute(string.Format(_settings.Types[type].Path, type.ToString().ToLowerInvariant(), HttpUtility.UrlEncode(hash))); toRender.AppendFormat(_includeFormatStrings[type], outputUrl); } } return toRender.ToString(); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var currentDirectory = CurrentDirectory.Peek(); if (currentDirectory == null) #if NETFX_CORE currentDirectory = Windows.ApplicationModel.Package.Current.InstalledLocation.Path; #else currentDirectory = Environment.CurrentDirectory; #endif var filePath = fileName; if (!Path.IsPathRooted(filePath)) { var directoryToSearch = new List<string> {currentDirectory}; directoryToSearch.AddRange(IncludeDirectories); foreach (var dirPath in directoryToSearch) { var selectedFile = Path.Combine(dirPath, fileName); if (NativeFile.Exists(selectedFile)) { filePath = selectedFile; break; } } } if (filePath == null || !NativeFile.Exists(filePath)) { throw new FileNotFoundException(String.Format("Unable to find file [{0}]", filePath ?? fileName)); } NativeFileStream fs = new NativeFileStream(filePath, NativeFileMode.Open, NativeFileAccess.Read); CurrentDirectory.Push(Path.GetDirectoryName(filePath)); return fs; }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { if (type == IncludeType.Local) { string path = this.BaseShaderPath + "\\" + fileName; if (File.Exists(path)) { string content = File.ReadAllText(path); stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream); writer.Write(content); writer.Flush(); stream.Position = 0; } else { stream = null; } } else { stream = null; } }
public Stream Open( IncludeType type, string fileName, Stream parentStream ) { Log.Debug("...include: {0}", fileName); if (!Includes.Contains(fileName)) { Includes.Add(fileName); } return File.OpenRead( buildContext.ResolveContentPath( fileName ) ); }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { string path; if (type == IncludeType.Local) { FileStream ps = parentStream as FileStream; // Attempt to include relative to current file if( ps != null ){ path = Path.Combine(Path.GetDirectoryName(ps.Name), fileName); if (File.Exists(path)) { stream = new FileStream(path, FileMode.Open, FileAccess.Read); return; } } // Attempt to include relative to origin file path = Path.Combine(this.BaseShaderPath, fileName); if (File.Exists(path)) { stream = new FileStream(path, FileMode.Open, FileAccess.Read); return; } } // If system type include or if the file was not found for a local include path = Path.Combine(this.sysincludepath, fileName); if (File.Exists(path)) { stream = new FileStream(path, FileMode.Open, FileAccess.Read); } else { stream = null; } }
Include(IncludeType type, EntityOperation operation) { Type = type; Operation = operation; }
private static string getViewDataKey(IncludeType type) { return typeof (IncludeCombinerHtmlExtensions).FullName + "_" + type; }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { stream = null; foreach (string searchPath in m_IncludeDirs) { string includePath = Path.Combine(searchPath, fileName); if (File.Exists(includePath)) { stream = new FileStream(includePath, FileMode.Open); break; } } Debug.Helper.Assert(stream != null, "Include file not found " + fileName); }
public Stream Open(IncludeType type, string path, Stream parentStream) { var bytes = ReadAllBytes(path); var stream = new MemoryStream(bytes); return stream; }
public Stream Open( IncludeType type, string fileName, Stream parentStream ) { //Log.Information("{0} {1} {2}", type, fileName, parentStream ); return File.OpenRead( buildContext.Resolve( fileName ) ); }
/// <summary> /// Locates the appropriate format string for the requirement type /// </summary> /// <param name="versionType"></param> /// <param name="spType"></param> /// <param name="productType"></param> /// <param name="architectureType"></param> /// <param name="includeType"></param> /// <returns></returns> private string GetDescriptionFormat(VersionType versionType, ServicePackType spType, ProductType productType, ArchitectureType architectureType, IncludeType includeType) { return DescriptionFormats[(int)versionType, (int)spType, (int)productType, (int)architectureType, (int)includeType]; }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var s = File.OpenRead(Path.Combine(_SourceDirectory.FullName, fileName)); _OpenStreams.Add(s); return s; }
public void Open(IncludeType type, string fileName, Stream parentStream, out Stream stream) { stream = new FileStream(includeDirectory + fileName, FileMode.Open, FileAccess.Read); }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { var codeString = Properties.Resources.ResourceManager.GetString(Path.GetFileNameWithoutExtension(fileName), System.Globalization.CultureInfo.InvariantCulture); MemoryStream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream); writer.Write(codeString); writer.Flush(); stream.Position = 0; return stream; }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { string baseDir; if (type == IncludeType.Local) { baseDir = String.Concat(m_pathStacks.FindAll(item => item != "\\")); } else { baseDir = m_pathStacks.First(); } string fullFileName = Path.Combine(baseDir, fileName); string localPath = Path.GetDirectoryName(fullFileName.Substring(baseDir.Length)); m_pathStacks.Add(localPath); if (MyFileSystem.FileExists(fullFileName)) { return new FileStream(fullFileName, FileMode.Open, FileAccess.Read); } else { return Stream.Null; } }
public Stream Open(IncludeType type, string fileName, Stream parentStream) { stream = new StreamReader(fileName).BaseStream; return stream; }