public void CubicCurveFor(PDFPoint delta, PDFPoint deltaHandleStart, PDFPoint deltaHandleEnd) { PDFPoint end = ConvertDeltaToActual(delta); PDFPoint handleStart = ConvertDeltaToActual(deltaHandleStart); PDFPoint handleEnd = ConvertDeltaToActual(deltaHandleEnd); PathBezierCurveData arc = new PathBezierCurveData(end, handleStart, handleEnd, true, true); CurrentPath.Add(arc); IncludeInBounds(end); IncludeInBounds(handleStart); IncludeInBounds(handleEnd); Cursor = end; LastHandle = handleEnd; }
public void FillPath(FillingRule fillingRule, bool close) { if (CurrentPath == null) { return; } CurrentPath.SetFilled(fillingRule); if (close) { CurrentSubpath?.CloseSubpath(); } ClosePath(); }
protected override void ProcessIdentifiableItems(IIdentifiable identifiable, IObjectNode collection, Index index) { if (propertyGraphDefinition.IsTargetItemObjectReference(collection, index, identifiable)) { externalReferences.Add(identifiable); if (!externalReferenceAccessors.TryGetValue(identifiable, out var accessors)) { externalReferenceAccessors.Add(identifiable, accessors = new List <NodeAccessor>()); } accessors.Add(CurrentPath.GetAccessor()); } else { internalReferences.Add(identifiable); } }
public override void VisitObject(object obj, ObjectDescriptor descriptor, bool visitMembers) { var shouldRemove = context.EnterNode(descriptor.Type); if (context.SerializeAsReference) { Result.Add(new AssetPartReference { AssetPart = obj, Path = CurrentPath.Clone() }); } else { base.VisitObject(obj, descriptor, visitMembers); } context.LeaveNode(descriptor.Type, shouldRemove); }
public void NavigateFolderBack() { if (String.Compare(CurrentPath, _projectPath) != 0) { string[] directories = CurrentPath.Split(Path.DirectorySeparatorChar); directories = directories.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToArray(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < directories.Length - 1; i++) { Console.WriteLine($"directory name: {directories[i]}"); builder.Append($"{directories[i]}{Path.DirectorySeparatorChar}"); } Console.WriteLine($"output: {builder.ToString()}"); ShowFolderContent(builder.ToString()); } }
protected override void ProcessIdentifiableMembers(IIdentifiable identifiable, IMemberNode member) { if (propertyGraphDefinition.IsMemberTargetObjectReference(member, identifiable)) { externalReferences.Add(identifiable); if (!externalReferenceAccessors.TryGetValue(identifiable, out var accessors)) { externalReferenceAccessors.Add(identifiable, accessors = new List <NodeAccessor>()); } accessors.Add(CurrentPath.GetAccessor()); } else { internalReferences.Add(identifiable); } }
public void StrokePath(bool close) { if (CurrentPath == null) { return; } CurrentPath.SetStroked(); if (close) { CurrentSubpath?.CloseSubpath(); } ClosePath(); }
/// <summary> /// Initializes config locations and setup /// </summary> private void Initialize() { var parentMask = pathMask; var searchPath = CurrentPath; var configFiles = new List <string>(); // Find RootPath if (File.Exists($@"{CurrentPath.AddLast(@"\")}{FileNames.AppSettingsJson}")) { RootPath = CurrentPath; } else { for (var count = 0; count < parentLevels; count++) { searchPath = Path.GetFullPath(Path.Combine(CurrentPath, parentMask)); if (File.Exists($@"{searchPath.AddLast(@"\")}{FileNames.AppSettingsJson}")) { RootPath = searchPath; break; } parentMask += pathMask; } } // Add appsettings.json if (File.Exists($@"{RootPath.AddLast(@"\")}{FileNames.AppSettingsJson}")) { configFiles.Add($@"{RootPath.AddLast(@"\")}{FileNames.AppSettingsJson}"); } // Add appsettings.{environment}.json if (File.Exists($@"{RootPath.AddLast(@"\")}{string.Format(FileNames.AppSettingsEnvironmentJson, CurrentEnvironment)}")) { configFiles.Add($@"{RootPath.AddLast(@"\")}{string.Format(FileNames.AppSettingsEnvironmentJson, CurrentEnvironment)}"); } // Add App_Data\AppSettings.json if (File.Exists($@"{AppDataFolder.AddLast(@"\")}{FileNames.AppSettingsJson}")) { configFiles.Add($@"{AppDataFolder.AddLast(@"\")}{FileNames.AppSettingsJson}"); } // Add App_Data\ConnectionStrings.json if (File.Exists($@"{AppDataFolder.AddLast(@"\")}{FileNames.ConnectionStringsJson}")) { configFiles.Add($@"{AppDataFolder.AddLast(@"\")}{FileNames.ConnectionStringsJson}"); } // Load Load(configFiles); }
protected void BindFileListRepeater(bool updateAjax) { List <MyFileItem> fileItems = new List <MyFileItem>(); if (!string.IsNullOrEmpty(this.CurrentPath)) { //ADD IN THE PARENT DIRECTORY fileItems.Add(new MyFileItem(ParentFolderText, FileItemType.Directory)); } //GET DIRECTORIES string[] directories = System.IO.Directory.GetDirectories(FullCurrentPath); foreach (string dir in directories) { DirectoryInfo dirInfo = new DirectoryInfo(dir); if (dirInfo.Name != ".svn") { fileItems.Add(new MyFileItem(dirInfo.Name, FileItemType.Directory)); _FileNameList.Add(dirInfo.Name); } } //GET FILES string[] files = System.IO.Directory.GetFiles(FullCurrentPath); foreach (string file in files) { FileInfo fileInfo = new FileInfo(Path.Combine(FullCurrentPath, file)); if (fileInfo.Exists) { FileItemType thisType = FileHelper.IsImageFile(Path.Combine(FullCurrentPath, file)) ? FileItemType.Image : FileItemType.Other; fileItems.Add(new MyFileItem(fileInfo.Name, thisType)); _FileNameList.Add(fileInfo.Name); } } FileListRepeater.DataSource = fileItems; FileListRepeater.DataBind(); // UPDATE ASSOCIATED PATH CONTROLS CurrentFolder.Text = string.Format("{0}", CurrentTheme); if (CurrentPath.Length > 0) { CurrentFolder.Text += string.Format("\\{0}", CurrentPath.Replace("\\", "<wbr>\\")); } if (updateAjax) { FileListAjax.Update(); } }
public static void BuildPathToNote(Markdown.Item newCurrentNote) { CurrentPath.Clear(); while (newCurrentNote.Parent != null) { int i = newCurrentNote.Parent.Childs.IndexOf(newCurrentNote); if (i >= 0) { CurrentPath.Insert(0, i); } else { break; } newCurrentNote = newCurrentNote.Parent; } }
private string GetRhinoDocumentPathFromLayerName(string LayerName) { string[] DocumentPaths = RhinoDocument.Worksession.ModelPaths; if (DocumentPaths != null) { foreach (string CurrentPath in DocumentPaths) { if (CurrentPath.Contains(LayerName)) { return(CurrentPath); } } } return(null); }
protected override bool Visit(ModelMetadata metadata, string key, object model) { RuntimeHelpers.EnsureSufficientExecutionStack(); if (model != null && !CurrentPath.Push(model)) { // This is a cycle, bail. return(true); } var entry = GetValidationEntry(model); key = entry?.Key ?? key ?? string.Empty; metadata = entry?.Metadata ?? metadata; var strategy = entry?.Strategy; if (ModelState.HasReachedMaxErrors) { SuppressValidation(key); return(false); } else if (entry != null && entry.SuppressValidation) { // Use the key on the entry, because we might not have entries in model state. SuppressValidation(entry.Key); CurrentPath.Pop(model); return(true); } using (StateManager.Recurse(this, key ?? string.Empty, metadata, model, strategy)) { if (Metadata.IsEnumerableType) { return(VisitComplexType(DynamicFormsCollectionValidationStrategy.Instance)); } if (Metadata.IsComplexType) { return(VisitComplexType(DynamicFormsComplexObjectValidationStrategy.Instance)); } return(VisitSimpleType()); } }
/// <summary> /// Get the proper output path for a given input file and output directory /// </summary> /// <param name="outDir">Output directory to use</param> /// <param name="inplace">True if the output file should go to the same input folder, false otherwise</param> /// <returns>Complete output path</returns> public string GetOutputPath(string outDir, bool inplace) { // If the current path is empty, we can't do anything if (string.IsNullOrWhiteSpace(CurrentPath)) { return(null); } // If the output dir is empty (and we're not inplace), we can't do anything if (string.IsNullOrWhiteSpace(outDir) && !inplace) { return(null); } // Check if we have a split path or not bool splitpath = !string.IsNullOrWhiteSpace(ParentPath); // If we have an inplace output, use the directory name from the input path if (inplace) { return(Path.GetDirectoryName(CurrentPath)); } // If the current and parent paths are the same, just use the output directory if (!splitpath || CurrentPath.Length == ParentPath.Length) { return(outDir); } // By default, the working parent directory is the parent path string workingParent = ParentPath; // TODO: Should this be the default? Always create a subfolder if a folder is found? // If we are processing a path that is coming from a directory and we are outputting to the current directory, we want to get the subfolder to write to if (outDir == Environment.CurrentDirectory) { workingParent = Path.GetDirectoryName(ParentPath); } // Determine the correct subfolder based on the working parent directory int extraLength = workingParent.EndsWith(':') || workingParent.EndsWith(Path.DirectorySeparatorChar) || workingParent.EndsWith(Path.AltDirectorySeparatorChar) ? 0 : 1; return(Path.GetDirectoryName(Path.Combine(outDir, CurrentPath.Remove(0, workingParent.Length + extraLength)))); }
protected void ParrentFolder() { if (!String.IsNullOrEmpty(CurrentPath)) { string[] path = CurrentPath.Split('\\'); if (path.Length <= 2 && path.Any(i => String.IsNullOrEmpty(i))) { CurrentFolderItems.Clear(); DirectoryItemVM item = Items.FirstOrDefault(i => i.Name == $"{path.FirstOrDefault()}\\"); item.ClearChildren(); } var parrent = Directory.GetParent(CurrentPath); if (parrent != null) { CurrentPath = parrent.FullName; } } }
public void CreateStaticPath() { CurrentPath.Enqueue(new Vector2Int(8, 0)); CurrentPath.Enqueue(new Vector2Int(9, 0)); CurrentPath.Enqueue(new Vector2Int(10, 0)); CurrentPath.Enqueue(new Vector2Int(10, -1)); CurrentPath.Enqueue(new Vector2Int(10, -2)); CurrentPath.Enqueue(new Vector2Int(10, -3)); CurrentPath.Enqueue(new Vector2Int(9, -3)); CurrentPath.Enqueue(new Vector2Int(8, -3)); CurrentPath.Enqueue(new Vector2Int(7, -3)); CurrentPath.Enqueue(new Vector2Int(7, -2)); CurrentPath.Enqueue(new Vector2Int(7, -1)); CurrentPath.Enqueue(new Vector2Int(7, 0)); }
public MoveResult MoveToRandomSpotWithin(Vector3 location, float radius, string destination = null) { if (generatingPath) { return(MoveResult.GeneratingPath); } if (!playerMover.CanFly || (!MovementManager.IsFlying && !playerMover.ShouldFlyTo(location))) { return(innerNavigator.MoveTo(location, destination)); } var currentLocation = GameObjectManager.LocalPlayer.Location; if (location.DistanceSqr(currentLocation) > PathPrecisionSqr) { if (ShouldGeneratePath(location, radius)) { generatingPath = true; origin = currentLocation; requestedDestination = location; finalDestination = location.AddRandomDirection2D(radius); pathGeneratorStopwatch.Restart(); logger.Info("Generating path on {0} from {1} to {2}", WorldManager.ZoneId, origin, finalDestination); GeneratePath(origin, finalDestination).ContinueWith(HandlePathGenerationResult); return(MoveResult.GeneratingPath); } if (CurrentPath.Count == 0) { return(MoveResult.ReachedDestination); } return(MoveToNextHop(destination)); } logger.Info("Navigation reached current destination. Within {0}", currentLocation.Distance(location)); requestedDestination = Vector3.Zero; playerMover.MoveStop(); CurrentPath.Reset(); return(MoveResult.Done); }
public override void VisitObjectMember(object container, ObjectDescriptor containerDescriptor, IMemberDescriptor member, object value) { // Don't visit base parts as they are visited at the top level. if (typeof(Asset).IsAssignableFrom(member.DeclaringType) && (member.Name == Asset.BasePartsProperty)) { return; } if (sourceFiles != null) { if (member.Type == typeof(UFile) && value != null) { var file = (UFile)value; if (!string.IsNullOrWhiteSpace(file.ToString())) { var attribute = member.GetCustomAttributes <SourceFileMemberAttribute>(true).SingleOrDefault(); if (attribute != null) { if (!sourceFiles.ContainsKey(file)) { sourceFiles.Add(file, attribute.UpdateAssetIfChanged); } else if (attribute.UpdateAssetIfChanged) { // If the file has already been collected, just update whether it should update the asset when changed sourceFiles[file] = true; } } } } } if (sourceMembers != null) { if (member.Type == typeof(UFile)) { var attribute = member.GetCustomAttributes <SourceFileMemberAttribute>(true).SingleOrDefault(); if (attribute != null) { sourceMembers[CurrentPath.Clone()] = value as UFile; } } } base.VisitObjectMember(container, containerDescriptor, member, value); }
public virtual void ExecutePath() { if (!Computed) { Vector2 targetPos = CurrentPath[0].Position; if (targetPos != Transform.Position) { Vector2 direction = (targetPos - Transform.Position).Normalized(); Transform.Position += direction * Speed * Time.DeltaTime; } float distance = (targetPos - Transform.Position).Length; if (distance <= 0.1f) { CurrentPath.RemoveAt(0); } } }
public override MoveResult MoveTo(MoveToParameters parameters) { if (generatingPath) { return(MoveResult.GeneratingPath); } if (!playerMover.IsDiving && (!playerMover.CanFly || (parameters.MapId != null && parameters.MapId != -1 && parameters.MapId != WorldManager.ZoneId) || (!MovementManager.IsFlying && !playerMover.ShouldFlyTo(parameters.Location)))) { return(Original.MoveTo(parameters)); } var currentLocation = GameObjectManager.LocalPlayer.Location; if (parameters.Location.DistanceSqr(currentLocation) > PathPrecisionSqr) { if (ShouldGeneratePath(parameters.Location)) { generatingPath = true; origin = currentLocation; finalDestination = requestedDestination = parameters.Location; pathGeneratorStopwatch.Restart(); logger.Info("Generating path on {0} from {1} to {2}", WorldManager.ZoneId, origin, finalDestination); GeneratePath(origin, finalDestination).ContinueWith(HandlePathGenerationResult); return(MoveResult.GeneratingPath); } if (CurrentPath.Count == 0) { return(MoveResult.ReachedDestination); } return(MoveToNextHop(parameters.Destination)); } logger.Info("Navigation reached current destination. Within {0}", currentLocation.Distance(parameters.Location)); requestedDestination = Vector3.Zero; playerMover.MoveStop(); CurrentPath.Reset(); return(MoveResult.Done); }
protected void FixedUpdate() { if (!pause) { if (CurrentPath != null && CurrentPath.Count > 0) { NextWayPoint = CurrentPath.Peek(); if (MoveTimeCurrent < MoveTimeTotal) { MoveTimeCurrent += Time.deltaTime; if (MoveTimeCurrent > MoveTimeTotal) { MoveTimeCurrent = MoveTimeTotal; } } else { CurrentWaypointPosition = CurrentPath.Pop(); if (CurrentPath.Count == 0) { Reset(); } else { MoveTimeCurrent = 0; currentFrequency++; MoveTimeTotal = (CurrentWaypointPosition - CurrentPath.Peek()).magnitude / walkSpeed; } } } else { currentFrequency = 3; } }//Fim PAUSE //Faz a busca a cada 2 waypoints if (currentFrequency > frequencyPerWayPoints) { Search(); currentFrequency = 0; } }
/// <summary> /// change the working directory to a ScopePath off of the site /// RootPath. /// </summary> /// <param name="InPath"></param> public void ChangeDirectoryToScopePath(ScopePath InPath) { RootPath absHomePath = CompleteHomePath; // if this FtpClient object contains a SitePath and/or HomePath, then // can only change the absolute dir path to a ScopePath. if (absHomePath == null) { throw new FtpException( "Cannot change dir to absolute scope path." + " FtpClient does not have a SitePath and HomeRootPath." + " Use the ChangeDirectoryToFullPath method instead."); } FullPath absPath = absHomePath + InPath; CurrentPath.Empty(); ChangeDirectory(absPath.ToString( )); }
public bool CheckPathDestination() { //if we reached the destination tile if (CurrentPath.IndexOf(CurrentTile) == 0) { IsMoving = false; //GetComponent<Animation>().CrossFade("idle"); //EventManager.TriggerEvent(cEvents.DESTINATION_REACHED); DestinationReached(); return(true); } else { //curTile becomes the next one CurrentTile = CurrentPath[CurrentPath.IndexOf(CurrentTile) - 1]; NextTilePos = GetWorldTilePos(CurrentTile.GridTile); return(false); } }
protected void BindCurrentFile() { //HIDE FILE DETAILS BY DEFAULT FileDetails.Visible = false; //DETERMINE IF WE HAVE DETAILS TO DISPLAY if (!string.IsNullOrEmpty(this.CurrentFileName)) { //UPDATE IMAGE PANELS FileInfo fileInfo = new FileInfo(this.FullCurrentFileName); if (fileInfo.Exists) { FileDetails.Visible = true; FileName.Text = fileInfo.Name; FileSize.Text = FormatSize(fileInfo.Length); System.Drawing.Image thisImage = null; try { thisImage = System.Drawing.Image.FromFile(fileInfo.FullName); ImagePreview.ImageUrl = "~/Assets/" + CurrentPath.Replace("\\", "/") + "/" + this.CurrentFileName + "?ts=" + DateTime.Now.ToString("hhmmss"); ImagePreview.Visible = true; Dimensions.Visible = true; Dimensions.Text = string.Format("({0}w X {1}h)", thisImage.Width, thisImage.Height); ShowPickImage(); } catch { ImagePreview.Visible = false; Dimensions.Visible = false; } finally { if (thisImage != null) { thisImage.Dispose(); thisImage = null; } } } } NoFileSelectedPanel.Visible = !FileDetails.Visible; FileDetailsAjax.Update(); }
public async Task Rollback() { if (CurrentPath.ContainsKey(Context.ConnectionId) && CurrentPath[Context.ConnectionId]?.Path?.Length > 0) { await UpdateCurrent(new PathData()); } else { lock (lockObj) { var target = HistoryPaths.LastOrDefault(); if (target == null) { return; } HistoryPaths.Remove(target); Clients.All.SendAsync("removeLastHistory").GetAwaiter().GetResult(); } } }
public virtual void VisitCollection(IEnumerable collection, CollectionDescriptor descriptor) { int i = 0; // Make a copy in case VisitCollectionItem mutates something var items = new List <object>(); foreach (var item in collection) { items.Add(item); } foreach (var item in items) { CurrentPath.Push(descriptor, i); VisitCollectionItem(collection, descriptor, i, item, TypeDescriptorFactory.Find(item?.GetType() ?? descriptor.ElementType)); CurrentPath.Pop(); i++; } }
public void can_automatically_follow_redirects() { // Do it manually Get("/redirect-three-times"); LastResponse.Status.ShouldEqual(302); LastResponse.Body.ShouldEqual("Redirecting"); LastResponse.Headers["Location"].ShouldEqual("/redirect-twice"); CurrentPath.ShouldEqual("/redirect-three-times"); CurrentUrl.ShouldEqual("http://localhost:3000/redirect-three-times"); FollowRedirect(); LastResponse.Status.ShouldEqual(301); LastResponse.Body.ShouldEqual("Redirecting"); LastResponse.Headers["Location"].ShouldEqual("/redirect"); CurrentPath.ShouldEqual("/redirect-twice"); CurrentUrl.ShouldEqual("http://localhost:3000/redirect-twice"); FollowRedirect(); LastResponse.Body.ShouldEqual("Redirecting"); LastResponse.Headers.Keys.ShouldContain("Location"); LastResponse.Headers["Location"].ShouldEqual("/info?redirected=true"); CurrentPath.ShouldEqual("/redirect"); CurrentUrl.ShouldEqual("http://localhost:3000/redirect"); FollowRedirect(); LastResponse.Status.ShouldEqual(200); LastResponse.Body.ShouldContain("GET /info"); LastResponse.Headers.Keys.ShouldNotContain("Location"); CurrentPath.ShouldEqual("/info?redirected=true"); CurrentUrl.ShouldEqual("http://localhost:3000/info?redirected=true"); // Do it automatically AutoRedirect = true; Get("/redirect-three-times"); LastResponse.Status.ShouldEqual(200); LastResponse.Body.ShouldContain("GET /info"); LastResponse.Headers.Keys.ShouldNotContain("Location"); CurrentPath.ShouldEqual("/info?redirected=true"); CurrentUrl.ShouldEqual("http://localhost:3000/info?redirected=true"); }
public void Relocate(IHexCell newLocation) { if (!CanRelocate(newLocation)) { throw new InvalidOperationException("CanRelocate must return true on the given arguments"); } if (CurrentPath != null) { CurrentPath.Clear(); } PositionCanon.ChangeOwnerOfPossession(this, newLocation); if (RelocationCoroutine != null) { StopCoroutine(RelocationCoroutine); } RelocationCoroutine = StartCoroutine(PlaceUnitOnGridCoroutine(newLocation.AbsolutePosition)); }
// // EnvVar resolving! // protected bool TryResolveEnvVar(out string pathStringResolved) { string envVarValue; if (!TryExpandMyEnvironmentVariables(out envVarValue)) { pathStringResolved = null; return(false); } Debug.Assert(envVarValue != null); Debug.Assert(envVarValue.Length > 0); var envVarWith2PercentsLength = EnvVar.Length; Debug.Assert(CurrentPath.Length >= envVarWith2PercentsLength); var pathStringWithoutEnvVar = CurrentPath.Substring(envVarWith2PercentsLength, CurrentPath.Length - envVarWith2PercentsLength); pathStringResolved = envVarValue + pathStringWithoutEnvVar; return(true); }
protected void Page_Load(object sender, EventArgs e) { _CategoryId = AlwaysConvert.ToInt(Request.QueryString["CategoryId"]); InitializeCatalogItems(); // INITIALIZE ICON PATH _IconPath = AbleCommerce.Code.PageHelper.GetAdminThemeIconPath(this.Page); CGrid.DataSource = _CatalogItems; CGrid.DataBind(); if (!Page.IsPostBack) { // Caption.Text = string.Format(Caption.Text, CatalogNode.Name); // SET THE CURRENT PATH IList <CatalogPathNode> currentPath = CatalogDataSource.GetPath(_CategoryId, false); CurrentPath.DataSource = currentPath; CurrentPath.DataBind(); } }
public override void VisitObject(object obj, ObjectDescriptor descriptor, bool visitMembers) { var identifiable = obj as IIdentifiable; if (identifiable != null) { HashSet <IIdentifiable> identifiables; if (!IdentifiablesById.TryGetValue(identifiable.Id, out identifiables)) { IdentifiablesById.Add(identifiable.Id, identifiables = new HashSet <IIdentifiable>()); } identifiables.Add(identifiable); List <MemberPath> paths; if (!IdentifiablePaths.TryGetValue(identifiable, out paths)) { IdentifiablePaths.Add(identifiable, paths = new List <MemberPath>()); } paths.Add(CurrentPath.Clone()); } base.VisitObject(obj, descriptor, visitMembers); }