Subversion Repository Public Repository

Nextrek

Diff Revisions 104 vs 105 for /csvTojSon/csvTojSon/frmMain.cs

Diff revisions: vs.
  @@ -19,6 +19,15 @@
19 19 InitializeComponent();
20 20 }
21 21
22 + private void frmMain_Load(object sender, EventArgs e)
23 + {
24 + System.Collections.Specialized.NameValueCollection nvc = System.Configuration.ConfigurationManager.AppSettings;
25 + cfgSettings.apiKeyBingMaps = (nvc.AllKeys.Contains("apiKeyBingMaps") ? nvc["apiKeyBingMaps"] : string.Empty);
26 + cfgSettings.bingMapsApiUrl = (nvc.AllKeys.Contains("bingMapsApiUrl") ? nvc["bingMapsApiUrl"] : string.Empty);
27 + cfgSettings.fileScarti = (nvc.AllKeys.Contains("fileScarti") ? nvc["fileScarti"] : string.Empty);
28 + cfgSettings.xmlNameSpace = (nvc.AllKeys.Contains("xmlNameSpace") ? nvc["xmlNameSpace"] : string.Empty);
29 + }
30 +
22 31 private void btnSource_Click(object sender, EventArgs e)
23 32 {
24 33 OpenFileDialog dlg = new OpenFileDialog()
  @@ -113,6 +122,11 @@
113 122 commaFile.root = new Types.CSV.Root();
114 123 commaFile.root.results = new Types.CSV.Record[dt.Rows.Count];
115 124
125 + System.Collections.Specialized.NameValueCollection nvc = System.Configuration.ConfigurationManager.AppSettings;
126 + cfgSettings.fileScarti = (nvc.AllKeys.Contains("fileScarti") ? nvc["fileScarti"] : string.Empty);
127 +
128 + string fileOk = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(txtDestionationFile.Text), System.IO.Path.GetFileNameWithoutExtension(txtDestionationFile.Text) + ".txt");
129 +
116 130 int righeOK = 0, righeKO = 0;
117 131
118 132 for (int riga = 0; riga <= dt.Rows.Count - 1; riga++)
  @@ -141,11 +155,20 @@
141 155 commaFile.root.results[riga].latitudine = location.Latitude;
142 156 commaFile.root.results[riga].longitudine = location.Longitude;
143 157 righeOK++;
158 + System.IO.File.AppendAllText(fileOk, "Coordinate trovate (" + righeOK + " su " + (riga + 1) + ") per " + query + " -> lat. " + location.Latitude.ToString("#0.0000000") + ", long. " + location.Longitude.ToString("#0.0000000") + "\r\n");
144 159 }
145 160 else
146 161 {
147 162 righeKO++;
148 - Console.WriteLine("Coordinate non trovate (" + righeKO + " su " + riga + ") per " + query);
163 + string msg = "Coordinate non trovate (" + righeKO + " su " + (riga + 1) + ") per " + query + "\r\n";
164 + if (cfgSettings.fileScarti.Trim() != "")
165 + {
166 + System.IO.File.AppendAllText(cfgSettings.fileScarti, msg);
167 + }
168 + else
169 + {
170 + Console.WriteLine(msg);
171 + }
149 172 }
150 173 if (riga % 5 == 0)
151 174 {