Example #1
0
            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
            }
Example #2
0
        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));
        }
Example #3
0
        internal static Texture2D GetFileIcon(string path)
        {
            string relativePath = GetRelativePath.ToApplication(path);

            Texture2D result = InternalEditorUtility.GetIconForFile(relativePath);

            if (result == null)
            {
                return(GetFileIcon());
            }

            return(result);
        }
Example #4
0
        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);
        }
Example #5
0
        internal static Texture GetFileIcon(string path)
        {
            string relativePath = GetRelativePath.ToApplication(path);

            return(GetFileIconFromRelativePath(relativePath));
        }