internal static XmlContextFile GenerateContextFile(sDeployedContext context) { return _controller.GenerateContextFile(context); }
public XmlContextFile GenerateContextFile(sDeployedContext context) { XmlContextFile ret = new XmlContextFile(context.Name); ret.WriteStartElement("context"); ret.WriteStartAttribute("name"); ret.WriteValue(context.Name); ret.WriteEndAttribute(); ret.WriteRaw(_UNLOOP_EXTENSION); lock (_files) { if (_files.ContainsKey(context.Name)){ foreach (XmlContextFile xcf in _files[context.Name]) ret.AddInclude(xcf); } } ret.WriteEndElement(); return ret; }
public void LoadFromElement(XmlElement element) { sDeployedContext context = new sDeployedContext(); context.LoadFromElement((XmlElement)element.ChildNodes[0]); _pars.Add("Context", context); }
internal ContextDestroyedEvent(sDeployedContext context) { _pars.Add("Context", context); }
public void DeployContext(sDeployedContext context) { lock (_cachedDialPlans) { foreach (sDeployedProfile prof in CoreGenerator.Profiles) { if (prof.ContextName == context.Name) _cachedDialPlans.Remove(prof.Name); } } }
public void DeployContext(sDeployedContext context) { DirectoryInfo di = new DirectoryInfo(Settings.Current[Constants.BASE_PATH_NAME].ToString() + Path.DirectorySeparatorChar + Constants.DEFAULT_CONF_DIR + Path.DirectorySeparatorChar + Constants.DEFAULT_DIALPLAN_DIR); if (!di.Exists) { Log.Trace("Creating context directory to deploy context"); di.Create(); } XmlContextFile cfile = context.ContextFile; StreamWriter sw = new StreamWriter(di.FullName+Path.DirectorySeparatorChar+context.Name+".xml"); sw.Write(cfile.ToXMLContent(false)); sw.Flush(); sw.Close(); di = new DirectoryInfo(di.FullName + Path.DirectorySeparatorChar + context.Name); if (!di.Exists) { Log.Trace("Creating context directory"); di.Create(); } else { Log.Trace("Cleaning out files for context directory"); foreach (FileInfo fi in di.GetFiles()) fi.Delete(); } int index = 0; foreach (XmlContextFile xcf in cfile.Includes) { sw = new StreamWriter(di.FullName + Path.DirectorySeparatorChar+index.ToString("00000")+"_" + xcf.FileName + ".xml"); sw.Write(xcf.ToXMLContent(false)); sw.Flush(); sw.Close(); index++; } }
public static void RegenerateContextFile(string contextName) { Context ct = Context.LoadByName(contextName); sDeployedContext dc = new sDeployedContext(ct); Lock(); bool add = true; List<sDeployedContext> conts = contexts; for (int x = 0; x < conts.Count; x++) { if (conts[x].Name == dc.Name) { conts[x] = dc; add = false; break; } } if (add) conts.Add(dc); contexts = conts; UnLock(); _deployer.DeployContext(dc); EventController.TriggerEvent(new ContextDeploymentEvent(dc)); }