public static DBFile Create(path) { // var s = new File.OpenRead(path); var s = new MemoryStream(); s.Write(); return new DBFile(s); }
var(path, pathWithPrefix) = CreateLongTempFolder(asNetwork: in asNetwork);
static void Main(string[] args) { path DirectoryInfo = FileInfo }
foreach (var(path, types) in importedTypes)
IsDirectorySeparator(path[basePath.Length])) &&
return (I$ClassName$)Assembly.Load(path).CreateInstance(className);
var(packages, standardOutput, standardError) = await Build(path, envVars).ConfigureAwait(false);
5 => FileList(path, SortFilesBy.Lastwritetime),
6 => FileList(path, SortFilesBy.Random),
3 => FileList(path, SortFilesBy.Extension),
4 => FileList(path, SortFilesBy.Lastaccesstime),
2 => FileList(path, SortFilesBy.Creationtime),
1 => FileList(path, SortFilesBy.FileSize),
public Move(IVec2 source, IVec2 destination) { path = (new AStar ()).GetPath (source, destination); }
var(path, pathWithPrefix) = CreateLongTempFolder(asNetwork: in asNetwork, withSlash: withSlash);
_ => FileList(path, SortFilesBy.Name),
var(path, pathWithPrefix) = CreateLongTempFile(true, in asNetwork);
//Creates corridors from room to room,and returns the list of corridors. (Rooms tiles are not included in corridors). private static List <TileData> defaultConnect(int seed, ref TileData[,] tiles, ref List <Room> rooms) { //Generate the weight map for A*. int[,] weights = generateWeight(seed, tiles); List <TileData> corridors = new List <TileData>(); //Connect first Room to all others. for (int i = 1; i < rooms.Count; i++) { //Get starting point. (middle of start Room) Point start = rooms[0].getTopRight(); start = new Point(start.x - rooms[0].length / 2, start.y - rooms[0].height / 2); //Get ending point. (middle of other Room) Point end = rooms[i].getTopRight(); end = new Point(end.x - rooms[i].length / 2, end.y - rooms[i].height / 2); //Plan: //Add starting point to Open List. //Sort Open list by F value, which is the distance from the end (found by heuristic) + currentCost. //While Open List is NOT empty //Get next Point to calculate, and put it on closed list. //foreach neighbor to this nextPoint //If neighbor point is the final point, make connections and break. //If neighbor point is not walkable, continue. //If neighbor point is NOT on the open List, calc ALL it's moveCost values F,G,H, and set the next Point //as it's cameFrom point. //If neighbor point is ON the open List (and maybe the closed), //if this REALcost (G, not heuristic) from this nextPoint is better than //the one it already has, replace its cameFrom with next point, and re-calc its F,G,H //OpenList sorted by F values. PriorityQueue <int, path> openList = new PriorityQueue <int, path>(); pathMap map = new pathMap(tiles.GetLength(0), tiles.GetLength(1)); path startPath = map.getPath(start); startPath.cameFrom = null; //Starting point came From null. (this is a flag for later) startPath.openList = true; startPath.setValues(0, 0, 0); //Start point doesn't need values. openList.Enqueue(0, startPath); bool isFinished = false; while (!openList.IsEmpty && !isFinished) { path next = openList.DequeueValue(); next.closedList = true; foreach (path neighbor in next.getNeighbors()) { if (neighbor.position.Equals(end)) { //Do ending stuff! isFinished = true; neighbor.cameFrom = next; //Start function to get the path, and put the path into corridors, and put the corridors on the tile map. corridors.AddRange(getFinishedPath(neighbor, ref tiles)); break; } //If not walkable, then check for that here. (currently not possible) if (!neighbor.openList) { //PUT on open List. neighbor.openList = true; neighbor.cameFrom = next; neighbor.setValues(next.cost + weights[neighbor.position.x, neighbor.position.y], neighbor.position.tileDiff(end)); openList.Enqueue(neighbor.probableCost, neighbor); } else if (!neighbor.closedList) { //Compare its current values, and change em if need be. int newCost = next.cost + weights[neighbor.position.x, neighbor.position.y]; if (newCost < neighbor.cost) { //May not actually work... KeyValuePair <int, path> oldPair = new KeyValuePair <int, path>(neighbor.probableCost, neighbor); openList.Remove(oldPair); neighbor.setValues(newCost, neighbor.position.tileDiff(end)); openList.Enqueue(neighbor.probableCost, neighbor); } } } } //End of While Loop } //End of For Loop return(corridors); }
public path GetPath(IVec2 MapPosStart, IVec2 MapPosEnd) { List<Node> result = new List<Node>(); List<AStarNodes> openQueue = new List<AStarNodes>(); List<AStarNodes> CloseList = new List<AStarNodes>(); AStarNodes startNode = new AStarNodes(); Node EndNode = null; startNode.NodeInfo = new Node(); startNode.NodeInfo.MapPos = MapPosStart; startNode.NodeInfo.MapSymbol = Map.CurrentMap.getTile(MapPosStart.x, MapPosStart.y); startNode.DistanceGone = 0; startNode.Distance2Go = GetDirectDistance2End(MapPosStart, MapPosEnd); openQueue.Add(startNode); CloseList.Add(startNode); while (openQueue.Count > 0) { var currentNode = openQueue[0]; openQueue.RemoveAt(0); if(currentNode.NodeInfo.MapPos == MapPosEnd) { EndNode = currentNode.NodeInfo; break; } var newNodes = GetNextPositions(currentNode, MapPosEnd); foreach (var item in newNodes) { if (isValid(item, ref CloseList)) { openQueue.Add(item); CloseList.Add(item); } } openQueue.Sort((AStarNodes a, AStarNodes b) => (a.Distance2Go + a.DistanceGone).CompareTo(b.Distance2Go + b.DistanceGone)); } while(EndNode != null) { if(EndNode.PrevNode != null) EndNode.PrevNode.NextNode = EndNode; result.Insert(0, EndNode); EndNode = EndNode.PrevNode; } // Debug.Log("AStarStopped path size: " + result.Count); //output { path theWay = new path(); theWay.FoundPath = result; theWay.isPathFound = result.Count > 0; return theWay; } }
var(path, _) = CreateLongTempFolder(asNetwork: in asNetwork);
await System.IO.File.AppendAllTextAsync(path, contents).ConfigureAwait(false);
var(path, pathWithPrefix) = isFolder
var(path, pathWithPrefix) = CreateLongTempFile(asNetwork: in asNetwork, withSlash: in withSlash);
=> InnerTask = GetDeserializationTask(path, defaultValue);
_stream = new FileStream(path, FileMode.Open);
select(path, mapped);
//<summary> //Open an image and load it into 2D array of colors (size: Height x Width) //</summary> /// <param name="ImagePath">Image file path</param> /// <returns>2D array of colors</returns> public static RGBPixel[,] OpenImage(string ImagePath) { Bitmap original_bm = new Bitmap(ImagePath); int Height = original_bm.Height; int Width = original_bm.Width; RGBPixel[,] Buffer = new RGBPixel[Height, Width]; unsafe { BitmapData bmd = original_bm.LockBits(new Rectangle(0, 0, Width, Height), ImageLockMode.ReadWrite, original_bm.PixelFormat); int x, y; int nWidth = 0; bool Format32 = false; bool Format24 = false; bool Format8 = false; if (original_bm.PixelFormat == PixelFormat.Format24bppRgb) { Format24 = true; nWidth = Width * 3; } else if (original_bm.PixelFormat == PixelFormat.Format32bppArgb || original_bm.PixelFormat == PixelFormat.Format32bppRgb || original_bm.PixelFormat == PixelFormat.Format32bppPArgb) { Format32 = true; nWidth = Width * 4; } else if (original_bm.PixelFormat == PixelFormat.Format8bppIndexed) { Format8 = true; nWidth = Width; } int nOffset = bmd.Stride - nWidth; byte *p = (byte *)bmd.Scan0; for (y = 0; y < Height; y++) { for (x = 0; x < Width; x++) { if (Format8) { Buffer[y, x].red = Buffer[y, x].green = Buffer[y, x].blue = p[0]; p++; } else { Buffer[y, x].red = p[2]; Buffer[y, x].green = p[1]; Buffer[y, x].blue = p[0]; if (Format24) { p += 3; } else if (Format32) { p += 4; } } } p += nOffset; } original_bm.UnlockBits(bmd); } return(Buffer); }
set => Update(path, value);
/** * Make publicpreview_icon available as a simple function * Returns the path to the preview of the image. * * @param string path of file * @param string token * @return string link to the preview * @since 8.0.0 * @suppress PhanDeprecatedFunction */ public static function publicPreview_icon(path, token) { return(\ publicPreview_icon(path, token)); }
var(path, pathWithPrefix) = CreateLongTempFile(!append, in asNetwork);
var(path, _) = CreateLongTempFolder(asNetwork: in asNetwork, withSlash: in withSlash);
var filesWithSuffix = allFiles.Select(path => (path, suffix: suffixFormatter.TryParseSuffix(ExtractSuffixValue(path, basePath, suffixSeparator))));
public web_key(path p, key e) { this.path = p; this.key = e; this.id_element = this.key.id; }
/// <summary> /// <see cref="PrivateProfile"/> クラスの新しいインスタンスを初期化して、指定された INI ファイルを読み取り専用で開きます。 /// </summary> /// <param name="path"> /// INI ファイルのパス /// </param> /// <param name="readOnly"> /// INI ファイルを読み取り専用で開くときに <c>true</c> を指定します。 /// </param> /// <param name="ignoreDuplicatedEntry"> /// <inheritdoc cref="PrivateProfile(bool)"/> /// </param> /// <exception cref="InvalidOperationException"> /// 既にファイルが開かれている状態で、書き込み用にファイルを開こうとしました。 /// </exception> public PrivateProfile(string path, bool readOnly = true, bool ignoreDuplicatedEntry = false) : this(ignoreDuplicatedEntry) => this.Read(path, readOnly);
var request = PrepareHammockQuery(path);
public SimulationDeJeux(path) { }