Example #1
0
 public abstract void CreateUpdateDeleteMessage(Message message, DataProviderAction action);
Example #2
0
        private static Hashtable LoadResource(ResourceManagerType resourceType, Hashtable target, string language, string cacheKey)
        {
            CSContext csContext = CSContext.Current;
            string filePath = csContext.PhysicalPath("Languages\\" + language + "\\{0}");// csContext.MapPath("~" + CSConfiguration.GetConfig().FilesPath + "/Languages/" + language + "/{0}");

            switch (resourceType) {
                case ResourceManagerType.ErrorMessage:
                    filePath = string.Format(filePath, "Messages.xml");
                    break;

                default:
                    filePath = string.Format(filePath, "Resources.xml");
                    break;
            }

            CacheDependency dp = new CacheDependency(filePath);

            XmlDocument d = new XmlDocument();
            try {
                d.Load( filePath );
            } catch {
                return target;
            }

            foreach (XmlNode n in d.SelectSingleNode("root").ChildNodes) {
                if (n.NodeType != XmlNodeType.Comment) {
                    switch (resourceType) {
                        case ResourceManagerType.ErrorMessage:
                            Message m = new Message(n);
                            target[m.MessageID] = m;
                            break;

                        case ResourceManagerType.String:
                            if (target[n.Attributes["name"].Value] == null)
                                target.Add(n.Attributes["name"].Value, n.InnerText);
                            else
                                target[n.Attributes["name"].Value] = n.InnerText;

                            break;
                    }
                }
            }

            // Create a new cache dependency and set it to never expire
            // unless the underlying file changes
            //
            // 7/26/2004 Terry Denham
            // We should only keep the default language cached forever, not every language.
            //DateTime cacheUntil;
            if( language == CSConfiguration.GetConfig().DefaultLanguage ) {
                CSCache.Max(cacheKey,target,dp);
            }
            else {
                CSCache.Insert(cacheKey,target,dp,CSCache.HourFactor);
            }

            return target;
        }