コード例 #1
0
        public static void ContractNSave(XmlNode xmlNode, string xmlFilePath)
        {
            ChoNestedDictionary <string, XmlNode> xmlFileList = ContractIncludes(xmlNode, xmlFilePath);

            foreach (string fileName in xmlFileList.Keys)
            {
                ChoXmlDocument.Save(xmlFileList[fileName], fileName, true);
            }
        }
コード例 #2
0
        private void SaveInternal()
        {
            ChoNestedDictionary <string, XmlNode> xmlFileList = ContractIncludes(_xmlDocument, _filePath);

            foreach (string fileName in xmlFileList.Keys)
            {
                if (_lastWriteTimeCache.GetValue(fileName) <= File.GetLastWriteTime(fileName))
                {
                    ChoXmlDocument.Save(xmlFileList[fileName], fileName, true);
                }
            }
        }
コード例 #3
0
        private void QueueMessageHandler(IChoQueuedMsgServiceObject <ChoStandardQueuedMsg <object> > msgObject)
        {
            if (msgObject == null)
            {
                return;
            }

            lock (_syncRoot)
            {
                if (msgObject.State.Msg == null)
                {
                    if (!_readOnly)
                    {
                        ChoNestedDictionary <string, XmlNode> xmlFileList = ContractIncludes(_xmlDocument, _filePath);

                        foreach (string fileName in xmlFileList.Keys)
                        {
                            if (_lastWriteTimeCache.GetValue(fileName) <= File.GetLastWriteTime(fileName))
                            {
                                ChoXmlDocument.Save(xmlFileList[fileName], fileName, true);
                            }
                        }
                    }
                }
                else if (msgObject.State.Msg is ChoConfigurationCompositeFileChangedEventArgs)
                {
                    ChoConfigurationCompositeFileChangedEventArgs e = msgObject.State.Msg as ChoConfigurationCompositeFileChangedEventArgs;
                    if (e != null)
                    {
                        try
                        {
                            ChoXmlDocumentChangingEventArgs xmlDocumentChangingEventArgs = new ChoXmlDocumentChangingEventArgs(_filePath, e.ModifiedIncludeFiles);
                            DocumentChanging.Raise(this, xmlDocumentChangingEventArgs);

                            if (xmlDocumentChangingEventArgs.IgnoreLoadDocument)
                            {
                                return;
                            }

                            _xmlDocument = null;
                            Load();

                            DocumentChanged.Raise(this, new ChoXmlDocumentChangedEventArgs(_filePath, e.ModifiedIncludeFiles));
                        }
                        catch
                        {
                            DocumentLoaded = false;
                            throw;
                        }
                    }
                }
            }
        }