private bool SetLnk( ref bool isLnkDirectory, ref string resolvedLnkPath) { bool handled = false; resolvedLnkPath = FileLnk.GetResolvedFileName(TargetFilePath); if (FileLnk.IsDirectory(resolvedLnkPath)) { icon = IconReader.GetFolderIconSTA(TargetFilePath, IconReader.FolderType.Open, true); handled = true; isLnkDirectory = true; } else if (FileLnk.IsNetworkRoot(resolvedLnkPath)) { isLnkDirectory = true; } else if (string.IsNullOrEmpty(resolvedLnkPath)) { Log.Info($"Resolve *.LNK '{TargetFilePath}' has no icon"); } else { IWshShell shell = new WshShell(); IWshShortcut lnk = shell.CreateShortcut(TargetFilePath) as IWshShortcut; arguments = lnk.Arguments; workingDirectory = lnk.WorkingDirectory; string iconLocation = lnk.IconLocation; if (iconLocation.Length > 2) { iconLocation = iconLocation[0..^ 2];
public IActionResult Post([FromBody] FileLnk fileLnk) { try { if (fileLnk.Id == Guid.Empty) { var fileLink = _mapper.Map <FileLink>(fileLnk); _unitOfWork.FileLinks.Add(fileLink); _unitOfWork.Complete(); return(Created(new Uri($"{Request.Path}/{fileLink.Id}", UriKind.Relative), _mapper.Map <FileLnk>(fileLink))); } } catch (Exception e) { string message = e.Message; } return(BadRequest()); }