private static void PreencheURLw(URLws wsItem, string tagName, string urls, string uf, string subfolder)
{
if (urls == "")
return;
string AppPath = Propriedade.PastaExecutavel + "\\" + subfolder;
XmlDocument doc = new XmlDocument();
doc.LoadXml(urls);
XmlNodeList urlList = doc.ChildNodes;
if (urlList == null)
return;
for (int i = 0; i < urlList.Count; ++i)
{
for (int j = 0; j < urlList[i].ChildNodes.Count; ++j)
{
string appPath = "";
System.Reflection.PropertyInfo ClassProperty = wsItem.GetType().GetProperty(urlList[i].ChildNodes[j].Name);
if (ClassProperty != null)
{
appPath = AppPath + urlList[i].ChildNodes[j].InnerText;
if (!string.IsNullOrEmpty(urlList[i].ChildNodes[j].InnerText))
{
if (urlList[i].ChildNodes[j].InnerText.ToLower().EndsWith("asmx?wsdl"))
{
appPath = urlList[i].ChildNodes[j].InnerText;
}
else
{
if (!File.Exists(appPath))
{
appPath = "";
}
}
}
else
appPath = "";
ClassProperty.SetValue(wsItem, appPath, null);
}
if (appPath == "" && !string.IsNullOrEmpty(urlList[i].ChildNodes[j].InnerText))
{
bool wlog = false;
switch (NFe.Components.Propriedade.TipoAplicativo)
{
case TipoAplicativo.Cte:
wlog = urlList[i].ChildNodes[j].Name.StartsWith("CTe");
break;
case TipoAplicativo.MDFe:
wlog = urlList[i].ChildNodes[j].Name.StartsWith("MDFe");
break;
case TipoAplicativo.NFCe:
case TipoAplicativo.Nfe:
wlog = urlList[i].ChildNodes[j].Name.StartsWith("NFe") || urlList[i].ChildNodes[j].Name.StartsWith("DFe");
break;
default:
wlog = true;
break;
}
if (wlog)
{
string msg = "";
Console.WriteLine(msg = "wsItem <" + urlList[i].ChildNodes[j].InnerText + "> nao encontrada na classe URLws em <" + urlList[i].ChildNodes[j].Name + ">");
NFe.Components.Functions.WriteLog(msg, false, true, "");
}
}
}
}
}
#endregion