Esempio n. 1
0
        internal static bool TryGetBufferViaExtensions(
            ProjectItem projectItem, string fileContents,
            out string documentViaExtensions, out List <ExtensionError> errors)
        {
            var converters  = EscherExtensionPointManager.LoadModelConversionExtensions();
            var serializers = EscherExtensionPointManager.LoadModelTransformExtensions();

            if (projectItem == null ||
                !VsUtils.EntityFrameworkSupportedInProject(projectItem.ContainingProject, PackageManager.Package, allowMiscProject: false) ||
                (serializers.Length == 0 && converters.Length == 0))
            {
                errors = new List <ExtensionError>();
                documentViaExtensions = "";
                return(false);
            }

            return(TryGetBufferViaExtensions(
                       PackageManager.Package, projectItem, fileContents,
                       converters, serializers, out documentViaExtensions, out errors));
        }
Esempio n. 2
0
        private string DispatchSaveToExtensions(string fileContents)
        {
            Debug.Assert(fileContents != null, "fileContents != null");

            // see if any extensions want to participate in saving
            if (Hierarchy != null)
            {
                var serializers = EscherExtensionPointManager.LoadModelTransformExtensions();
                var converters  = EscherExtensionPointManager.LoadModelConversionExtensions();

                var projectItem = VsUtils.GetProjectItem(Hierarchy, ItemId);

                if ((serializers.Length > 0 || converters.Length > 0) &&
                    projectItem != null &&
                    VsUtils.EntityFrameworkSupportedInProject(
                        projectItem.ContainingProject, PackageManager.Package, allowMiscProject: false))
                {
                    return(DispatchSaveToExtensions(PackageManager.Package, projectItem, fileContents, converters, serializers));
                }
            }

            return(fileContents);
        }