Beispiel #1
0
        public static AssemblyName GetAssemblyNameFromPath(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }
            AssemblyName assemblyName = null;

            if (Microsoft.Expression.Framework.Documents.PathHelper.FileExists(path))
            {
                try
                {
                    assemblyName = AssemblyName.GetAssemblyName(path);
                }
                catch (ArgumentException argumentException)
                {
                }
                catch (IOException oException)
                {
                }
                catch (BadImageFormatException badImageFormatException)
                {
                }
                catch (OutOfMemoryException outOfMemoryException)
                {
                    LowMemoryMessage.Show();
                }
            }
            return(assemblyName);
        }
Beispiel #2
0
 public static Assembly LoadFile(string path)
 {
     try
     {
         return(Assembly.LoadFile(path));
     }
     catch (IOException oException)
     {
     }
     catch (BadImageFormatException badImageFormatException)
     {
     }
     catch (OutOfMemoryException outOfMemoryException)
     {
         LowMemoryMessage.Show();
     }
     return(null);
 }
Beispiel #3
0
 public static Assembly Load(AssemblyName assemblyName)
 {
     try
     {
         return(Assembly.Load(assemblyName));
     }
     catch (IOException oException)
     {
     }
     catch (BadImageFormatException badImageFormatException)
     {
     }
     catch (OutOfMemoryException outOfMemoryException)
     {
         LowMemoryMessage.Show();
     }
     return(null);
 }
Beispiel #4
0
        public static IProjectItem AddImageDataFromClipboard(IProjectManager projectManager, IProject project)
        {
            InteropBitmap data;
            IProjectItem  projectItem;

            try
            {
                data = (InteropBitmap)Clipboard.GetData(DataFormats.Bitmap);
                goto Label0;
            }
            catch (OutOfMemoryException outOfMemoryException)
            {
                LowMemoryMessage.Show();
                projectItem = null;
            }
            return(projectItem);

Label0:
            if (data == null)
            {
                return(null);
            }
            FormatConvertedBitmap formatConvertedBitmap = new FormatConvertedBitmap(data, PixelFormats.Bgr32, null, 0);
            string str = projectManager.TargetFolderForProject(project);
            string availableFilePath = ProjectPathHelper.GetAvailableFilePath("Image.png", str, null);

            using (FileStream fileStream = new FileStream(availableFilePath, FileMode.Create, FileAccess.Write))
            {
                PngBitmapEncoder pngBitmapEncoder = new PngBitmapEncoder();
                pngBitmapEncoder.Frames.Add(BitmapFrame.Create(formatConvertedBitmap));
                pngBitmapEncoder.Save(fileStream);
                fileStream.Close();
            }
            DocumentCreationInfo documentCreationInfo = new DocumentCreationInfo()
            {
                SourcePath = availableFilePath,
                TargetPath = availableFilePath
            };

            return(project.AddItem(documentCreationInfo));
        }
Beispiel #5
0
        public static Assembly LoadFrom(string path)
        {
            Assembly assembly = null;

            try
            {
                if (Microsoft.Expression.Framework.Documents.PathHelper.FileExists(path))
                {
                    assembly = Assembly.LoadFrom(path);
                }
            }
            catch (IOException oException)
            {
            }
            catch (BadImageFormatException badImageFormatException)
            {
            }
            catch (OutOfMemoryException outOfMemoryException)
            {
                LowMemoryMessage.Show();
            }
            return(assembly);
        }