Click here to Skip to main content
15,891,136 members

Comments by Member 13801408 (Top 3 by date)

Member 13801408 26-Jul-18 13:28pm View    
No, in local machine.

This is internal app
Member 13801408 31-May-18 16:30pm View    
Hi Richard,
Thanks for the help.

When I tried running this, I'm getting correct output what I was expecting. But the foreach loop is iterating synchronously. But I want It to run in Asynchronously. So that I can improve the performance.

Thanks, in advance.

This is the unzip code:

protected internal static void data(string filepath)
{
try
{
//Extract Sub-Directory from the filepath
Create_Sub_DirectoryUnzip = filepath .Substring(MainForm.sourcepath.Length+1);
Create_Sub_DirectoryUnzip = Path.GetDirectoryName(Create_Sub_DirectoryUnzip);
//Log Filename without extension
Log_Filename = Path.GetFileNameWithoutExtension(filepath);
Log_Filename = Log_Filename.Remove(Log_Filename.Length - 4);
//Extract path to unzip the file
Extract_Path = destinationpath + "\\" + Create_Sub_DirectoryUnzip + "Unzip" ;
Unzipfilepath = Extract_Path + "\\" + Log_Filename + ".log";

if (!File.Exists(Unzipfilepath))
{
if (!Directory.Exists(Extract_Path))
{
Directory.CreateDirectory(Extract_Path);
}
ZipFile.ExtractToDirectory(filepath, Extract_Path);
}

if (new FileInfo(Unzipfilepath).Length > 0)
{
var contentvalid = File.ReadLines(Unzipfilepath).Skip(0).Take(1).First();
var content = File.ReadLines(Unzipfilepath).Skip(1).Take(1).First();

string valid = contentvalid.Split('|').Skip(0).Take(1).First();
if (valid == "Timestamp")
{
string RecordType = content.Split('|').Skip(7).Take(1).First();
if (RecordType == "10")
{
SQL_Bulk_Copy oHelper = new SQL_Bulk_Copy();
logFilePath = Unzipfilepath;
oHelper.BulkInsertIntoDatabase(logFilePath);
}
else
{
File.Delete(Unzipfilepath);
}
}
else
{
File.Delete(Unzipfilepath);
}
}
else
{
File.Delete(Unzipfilepath);
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
Member 13801408 15-May-18 14:34pm View    
Thank you for your response.

I tried this method.(it will work only when Namespace is ns2) My question is what if the namespace is ns1?

The data in the xml string contain different namespaces for different messages
But we don't know what will the be namespace in that string, I may get either
<ns2:faclocnr>2782
or
<ns1:faclocnr>2782