コード例 #1
0
ファイル: AppLocation.cs プロジェクト: damoOnly/e-commerce
        public static AppLocation Default()
        {
            AppLocation appLocation = new AppLocation();

            appLocation.Add(new HiApplication("/", "Common", ApplicationType.Common));
            return(appLocation);
        }
コード例 #2
0
ファイル: AppLocation.cs プロジェクト: damoOnly/e-commerce
        public static AppLocation Create(XmlNode node)
        {
            AppLocation result;

            if (node == null)
            {
                result = null;
            }
            else
            {
                AppLocation            appLocation = new AppLocation();
                XmlAttributeCollection attributes  = node.Attributes;
                if (attributes != null)
                {
                    foreach (XmlAttribute xmlAttribute in attributes)
                    {
                        if (xmlAttribute.Name == "pattern")
                        {
                            appLocation.Pattern = Globals.ApplicationPath + xmlAttribute.Value;
                        }
                        else
                        {
                            if (xmlAttribute.Name == "defaultName")
                            {
                                appLocation.DefaultName = xmlAttribute.Value;
                            }
                        }
                    }
                    for (int i = 0; i < node.ChildNodes.Count; i++)
                    {
                        XmlNode xmlNode = node.ChildNodes[i];
                        if (xmlNode.Name == "add")
                        {
                            XmlAttributeCollection attributes2 = xmlNode.Attributes;
                            if (attributes2 != null)
                            {
                                string          text    = Globals.ApplicationPath + attributes2["pattern"].Value;
                                string          value   = attributes2["name"].Value;
                                ApplicationType appType = (ApplicationType)Enum.Parse(typeof(ApplicationType), attributes2["type"].Value, true);
                                appLocation.Add(new HiApplication(text, value, appType));
                            }
                        }
                    }
                }
                result = appLocation;
            }
            return(result);
        }