public Particle(float duration, Vector2 basePos, float layerDepth, PosFunc posFunc, DirFunc dirFunc, RadiusFunc radiusFunc, Texture2D orignTex, Vector2 texOrign, Nullable <Rectangle> sourceRect, ColorSetTimeFunc colorFunc) { this.duration = duration; this.basePos = basePos; this.layerDepth = layerDepth; this.posFunc = posFunc; this.dirFunc = dirFunc; this.radiusFunc = radiusFunc; this.colorFunc = colorFunc; this.tex = orignTex; this.texOrign = texOrign; this.sourceRect = sourceRect; }
public Particle( float duration, Vector2 basePos, float layerDepth, PosFunc posFunc, DirFunc dirFunc, RadiusFunc radiusFunc, Texture2D orignTex, Vector2 texOrign, Nullable<Rectangle> sourceRect, ColorSetTimeFunc colorFunc ) { this.duration = duration; this.basePos = basePos; this.layerDepth = layerDepth; this.posFunc = posFunc; this.dirFunc = dirFunc; this.radiusFunc = radiusFunc; this.colorFunc = colorFunc; this.tex = orignTex; this.texOrign = texOrign; this.sourceRect = sourceRect; }
// dir-walk-cb - Higher Order Perl pp. 21-22 public static object Dir_Walk_CB(string top, FileFunc fileFunc, DirFunc dirFunc) { if (PerlFileOps.IsDir(top)) // -d { // There is not an equivalent to Perl's opendir/readir. The line below tries to read the files and directories // in directory "top" and will throw an exception if the directory with this name doesn't exist or has some // kind of access error FileSystemInfo[] filesAndDirs; try { filesAndDirs = (new DirectoryInfo(top)).GetFileSystemInfos(); } catch (Exception e) { Console.WriteLine("Couldn't open directory {0}: {1} - skipping.", top, e.Message); return(null); } // Using List<object> vs. ArrayList, references: // https://docs.microsoft.com/en-us/dotnet/api/system.collections.arraylist?view=netframework-4.8#remarks // https://github.com/dotnet/platform-compat/blob/master/docs/DE0006.md List <object> results = new List <object>(); foreach (FileSystemInfo file in filesAndDirs) { // System.IO doesn't return aliases like "." or ".." for any GetXXX calls // so we don't need code to exclude them object r = Dir_Walk_CB(file.FullName, fileFunc, dirFunc); if (r != null) { results.Add(r); } } return(dirFunc(top, results)); } else { return(fileFunc(top)); } }
// dir-walk-cb-def - Higher Order Perl p. 24 public static object Dir_Walk_CB_Def(string top, FileFunc fileFunc, DirFunc dirFunc) { if (PerlFileOps.IsDir(top)) // -d { // There is not an equivalent to Perl's opendir/readir. The line below tries to read the files and directories // in directory "top" and will throw an exception if the directory with this name doesn't exist or has some // kind of access error FileSystemInfo[] filesAndDirs; try { filesAndDirs = (new DirectoryInfo(top)).GetFileSystemInfos(); } catch (Exception e) { Console.WriteLine("Couldn't open directory {0}: {1} - skipping.", top, e.Message); return(null); } List <object> results = new List <object>(); foreach (FileSystemInfo file in filesAndDirs) { // System.IO doesn't return aliases like "." or ".." for any GetXXX calls // so we don't need code to exclude them object r = Dir_Walk_CB_Def(file.FullName, fileFunc, dirFunc); if (r != null) { results.Add(r); } } return((dirFunc != null) ? dirFunc(top, results) : null); } else { return((fileFunc != null) ? fileFunc(top) : null); } }
/// <summary> /// Are the given bits all set in the given value. /// </summary> public static bool IsSet(this DirFunc value, DirFunc bits) { return((value & bits) == bits); }
/// <summary> /// Are the given bits all set in the given value. /// </summary> public static bool IsSet(this DirFunc value, DirFunc bits) { return ((value & bits) == bits); }