public ChoXmlDocument(string filePathOrXml, bool watchChange, bool readOnly) { ChoGuard.ArgumentNotNullOrEmpty(filePathOrXml, "FilePath or Xml"); filePathOrXml = filePathOrXml.Trim(); _watchChange = watchChange; _readOnly = readOnly; if (filePathOrXml.StartsWith("<")) { _xml = filePathOrXml; } else { _filePath = filePathOrXml; } if (IsXmlFile) { if (watchChange || !readOnly) { _queuedMsgService = new ChoQueuedMsgService <object>("{0}_{1}".FormatString(_filePath, typeof(ChoXmlDocument).Name), ChoStandardQueuedMsgObject <object> .QuitMsg, false, false, QueueMessageHandler); _timerService = new ChoTimerService <string>(String.Format("{0}_Timer", System.IO.Path.GetFileNameWithoutExtension(_filePath)), OnTimerServiceCallback, null, 5000, false); } } Load(); }
public ChoIniDocumentService(string name, ChoIniDocument iniDocument) { ChoGuard.ArgumentNotNull(name, "Name"); ChoGuard.ArgumentNotNull(iniDocument, "IniDocument"); _iniDocument = iniDocument; _queuedMsgService = new ChoQueuedMsgService <string>(name, ChoStandardQueuedMsgObject <string> .QuitMsg, false, false, QueueMessageHandler); _timerService = new ChoTimerService <string>(String.Format("{0}_Timer", _iniDocument.GetHashCode()), new ChoTimerService <string> .ChoTimerServiceCallback(OnTimerServiceCallback), null, 1000, 5000, false); }
public ChoXmlDocument(string filePathOrXml) { ChoGuard.ArgumentNotNullOrEmpty(filePathOrXml, "FilePath or Xml"); filePathOrXml = filePathOrXml.Trim(); if (filePathOrXml.StartsWith("<")) { _xml = filePathOrXml; } else { _filePath = filePathOrXml; } if (IsXmlFile) { //_includeXmlFileRegEx = new Regex(String.Format(@"^\s*\[INCLUDE\(""(?<{0}>[A-Za-z0-9:\\\._\s*]+)""\)\]\s*[{1}](?<{2}>.*)$|^\s*\[INCLUDE\(""(?<{0}>[A-Za-z0-9:\\\._\s*]+)""\)\]\s*$", INI_INCLUDE_FILE_FILEPATH_TOKEN, _commentChars, INI_INCLUDE_FILE_COMMENTS_TOKEN), // RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline); _queuedMsgService = new ChoQueuedMsgService <ChoStandardQueuedMsg>(new ChoStandardQueuedMsgObject().QuitServiceMsg, false, new ChoQueuedMsgService <ChoStandardQueuedMsg> .ChoQMessageHandler(QueueMessageHandler)); _timerService = new ChoTimerService <string>(String.Format("{0}_Timer", System.IO.Path.GetFileNameWithoutExtension(_filePath)), new ChoTimerService <string> .ChoTimerServiceCallback(OnTimerServiceCallback), null, 1000, 5000, false); } }