private void WriteFile(object viewModel, bool keepOldCopy) { var relativePath = GetRelativePath.Invoke(viewModel, Indexes); if (keepOldCopy) { StoreOldCopyOfFile(relativePath); } var absolutePath = Path.Combine(UploadsAbsolutePhysicalPath, relativePath); var parentFolderInfo = new FileInfo(absolutePath).Directory; if (parentFolderInfo != null && !parentFolderInfo.Exists) { parentFolderInfo.Create(); } File.WriteAllBytes(absolutePath, BinaryContents); UpdateBinding?.Invoke(viewModel, null, relativePath, Indexes); #if NETFRAMEWORK var username = HttpContext.Current?.Request?.GetOwinContext()?.Request?.User?.Identity?.Name; _logger.Info($"Upload - User [{username}] uploaded File [{absolutePath}]"); #else _logger.Info($"Upload - Uploaded File [{absolutePath}]"); #endif }
static string GetFilePath(string imageFileName) { string path = Path.Combine( AssemblyLocation.GetAssemblyParentDirectory( Assembly.GetAssembly(typeof(PlasticLocalization))), "PlasticImage"); string relativePath = GetRelativePath.ToApplication(path); return(Path.Combine(relativePath, imageFileName)); }
internal static Texture2D GetFileIcon(string path) { string relativePath = GetRelativePath.ToApplication(path); Texture2D result = InternalEditorUtility.GetIconForFile(relativePath); if (result == null) { return(GetFileIcon()); } return(result); }
static void OpenFile(string path) { if (path == null) return; string relativePath = GetRelativePath.ToApplication(path); bool result = AssetDatabase.OpenAsset( AssetDatabase.LoadMainAssetAtPath(relativePath)); if (result) return; OpenOperation.OpenFile(path); }
internal static Texture GetFileIcon(string path) { string relativePath = GetRelativePath.ToApplication(path); return(GetFileIconFromRelativePath(relativePath)); }