コード例 #1
0
        public void Update(IProjectManager projectManager)
        {
            ProjectItems serverMethods = projectManager.ServerMethodFolderItems;

            if (serverMethods.Count == 0)
            {
                this.MethodInfos.Clear();
                return;
            }

            var updatedMethodInfos = new List <MethodInfo>();

            foreach (MethodInfo methodInfo in MethodInfos)
            {
                if (!projectManager.IsMethodExist(methodInfo.MethodName))
                {
                    continue;
                }

                MethodInfo updatedMethodInfo;
                if (methodInfo is PackageMethodInfo)
                {
                    updatedMethodInfo = new PackageMethodInfo((PackageMethodInfo)methodInfo);
                }
                else
                {
                    updatedMethodInfo = new MethodInfo(methodInfo);
                }

                updatedMethodInfo.PartialClasses.Clear();

                foreach (string partialClassPath in methodInfo.PartialClasses)
                {
                    if (!projectManager.IsFileExist(partialClassPath))
                    {
                        continue;
                    }

                    updatedMethodInfo.PartialClasses.Add(partialClassPath);
                }

                updatedMethodInfos.Add(updatedMethodInfo);
            }

            this.MethodInfos = updatedMethodInfos;
        }
コード例 #2
0
 public PackageMethodInfo(PackageMethodInfo packageMethodInfo) : base(packageMethodInfo)
 {
     this.ManifestFileName = packageMethodInfo.ManifestFileName;
 }
        private IProjectConfiguraiton MapXmlDocToProjectConfig(XmlDocument xmlDoc)
        {
            var projectConfiguration = new ProjectConfiguraiton();

            projectConfiguration.LastSelectedDir    = xmlDoc.SelectSingleNode("projectinfo/lastSelectedDir")?.InnerText;
            projectConfiguration.LastSelectedMfFile = xmlDoc.SelectSingleNode("projectinfo/lastSelectedMfFile")?.InnerText;
            bool.TryParse(xmlDoc.SelectSingleNode("projectinfo/useVSFormatting")?.InnerText, out bool isUsedVSFormatting);
            projectConfiguration.UseVSFormatting = isUsedVSFormatting;

            var connectionInfoXmlNodes = xmlDoc.SelectNodes("projectinfo/connections/connectionInfo");

            foreach (XmlNode connectionInfoNode in connectionInfoXmlNodes)
            {
                var connectionInfo = new ConnectionInfo();
                connectionInfo.ServerUrl = connectionInfoNode.SelectSingleNode("serverUrl").InnerText;
                connectionInfo.Database  = connectionInfoNode.SelectSingleNode("databaseName").InnerText;
                connectionInfo.Login     = connectionInfoNode.SelectSingleNode("login").InnerText;

                bool value;
                if (bool.TryParse(connectionInfoNode.SelectSingleNode("lastConnection")?.InnerText, out value))
                {
                    connectionInfo.LastConnection = value;
                }

                projectConfiguration.AddConnection(connectionInfo);
            }
            var methodInfoXmlNodes = xmlDoc.SelectNodes("projectinfo/methods/methodInfo");

            foreach (XmlNode methodInfoNode in methodInfoXmlNodes)
            {
                XmlNode    manifestFileNameNode = methodInfoNode.SelectSingleNode("manifestFileName");
                MethodInfo methodInfo;
                if (manifestFileNameNode != null)
                {
                    methodInfo = new PackageMethodInfo()
                    {
                        ManifestFileName = manifestFileNameNode.InnerText
                    };
                }
                else
                {
                    methodInfo = new MethodInfo();
                }

                methodInfo.InnovatorMethodConfigId = methodInfoNode.SelectSingleNode("configId").InnerText;
                methodInfo.InnovatorMethodId       = methodInfoNode.SelectSingleNode("id").InnerText;
                methodInfo.MethodName     = methodInfoNode.SelectSingleNode("methodName").InnerText;
                methodInfo.MethodType     = methodInfoNode.SelectSingleNode("methodType").InnerText;
                methodInfo.MethodComment  = methodInfoNode.SelectSingleNode("comments")?.InnerText;
                methodInfo.MethodLanguage = methodInfoNode.SelectSingleNode("language").InnerText;
                methodInfo.TemplateName   = methodInfoNode.SelectSingleNode("templateName").InnerText;
                methodInfo.PackageName    = methodInfoNode.SelectSingleNode("packageName").InnerText;

                EventSpecificData eventData;
                if (Enum.TryParse(methodInfoNode.SelectSingleNode("eventData")?.InnerText, out eventData))
                {
                    methodInfo.EventData = eventData;
                }
                else
                {
                    methodInfo.EventData = EventSpecificData.None;
                }

                XmlNode      executionAllowedTo        = methodInfoNode.SelectSingleNode("executionAllowedTo");
                XmlAttribute executionAllowedKeyedName = executionAllowedTo.Attributes["keyedName"];
                methodInfo.ExecutionAllowedToId        = executionAllowedTo.InnerText;
                methodInfo.ExecutionAllowedToKeyedName = executionAllowedKeyedName.InnerText;

                var partialClassesXmlNodes = methodInfoNode.SelectNodes("partialClasses/path");
                foreach (XmlNode partialClassesXmlNode in partialClassesXmlNodes)
                {
                    methodInfo.PartialClasses.Add(partialClassesXmlNode.InnerText);
                }

                projectConfiguration.MethodInfos.Add(methodInfo);
            }

            var searchItemNodes = xmlDoc.SelectNodes("projectinfo/lastSavedSearch/searchItem");

            foreach (XmlNode searchItemNode in searchItemNodes)
            {
                string itemTypeName = searchItemNode.Attributes["itemTypeName"]?.InnerText;
                if (string.IsNullOrEmpty(itemTypeName))
                {
                    continue;
                }
                var properties    = new List <PropertyInfo>();
                var propertyNodes = searchItemNode.SelectNodes("property");

                foreach (XmlNode propertyNode in propertyNodes)
                {
                    var savedSearch = new PropertyInfo();
                    savedSearch.PropertyName  = propertyNode.SelectSingleNode("propertyName").InnerText;
                    savedSearch.PropertyValue = propertyNode.SelectSingleNode("propertyValue").InnerText;

                    properties.Add(savedSearch);
                }


                projectConfiguration.LastSavedSearch.Add(itemTypeName, properties);
            }

            return(projectConfiguration);
        }