개정판 66bd3240
issue #0000 fileupload api - svg 추가
Change-Id: I3e3fdf586fd732c226f08ab9e2fbb300cb82ebc7
KCOM/App.xaml.cs | ||
---|---|---|
48 | 48 |
public static string Custom_ViewInfoId; |
49 | 49 |
public static bool ParameterMode = false; |
50 | 50 |
public static bool isExternal = false; |
51 |
public static bool isAuthenticate = false; |
|
52 |
public static string AuthenticateToken = null; |
|
51 | 53 |
|
52 | 54 |
/// <summary> |
53 | 55 |
/// logger |
... | ... | |
236 | 238 |
//_binding.ReceiveTimeout = new TimeSpan(0, 10, 0); |
237 | 239 |
//_binding.CloseTimeout = new TimeSpan(0, 5, 0); |
238 | 240 |
//_binding.SendTimeout = new TimeSpan(0, 5, 0); |
241 |
#if BASIC_BINDING |
|
239 | 242 |
|
240 | 243 |
#region 기본 binding |
241 | 244 |
BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None); |
... | ... | |
273 | 276 |
//httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; |
274 | 277 |
//System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding(reliableSession, httpTransport); |
275 | 278 |
#endregion |
276 |
|
|
279 |
#elif CUSTOM_BINDING |
|
277 | 280 |
#region custombinding |
278 |
//var customBinding = new System.ServiceModel.Channels.CustomBinding()
|
|
279 |
//{
|
|
280 |
// OpenTimeout = new TimeSpan(0, 15, 0),
|
|
281 |
// ReceiveTimeout = new TimeSpan(0, 15, 0),
|
|
282 |
// CloseTimeout = new TimeSpan(0, 15, 0),
|
|
283 |
// SendTimeout = new TimeSpan(0, 15, 0),
|
|
284 |
//};
|
|
281 |
var customBinding = new System.ServiceModel.Channels.CustomBinding() |
|
282 |
{ |
|
283 |
OpenTimeout = new TimeSpan(0, 15, 0), |
|
284 |
ReceiveTimeout = new TimeSpan(0, 15, 0), |
|
285 |
CloseTimeout = new TimeSpan(0, 15, 0), |
|
286 |
SendTimeout = new TimeSpan(0, 15, 0), |
|
287 |
}; |
|
285 | 288 |
|
286 |
//var messageEncoding = new WcfExtensions.ServiceModel.Channels.CompressionBindingElement();
|
|
287 |
//messageEncoding.Level = WcfExtensions.ServiceModel.Channels.CompressionLevel.Fast;
|
|
289 |
var messageEncoding = new WcfExtensions.ServiceModel.Channels.CompressionBindingElement(); |
|
290 |
messageEncoding.Level = WcfExtensions.ServiceModel.Channels.CompressionLevel.Fast; |
|
288 | 291 |
|
289 |
//var httpTranport = new System.ServiceModel.Channels.HttpTransportBindingElement
|
|
290 |
//{
|
|
291 |
// MaxBufferPoolSize = Int32.MaxValue,
|
|
292 |
// MaxBufferSize = Int32.MaxValue,
|
|
293 |
// MaxReceivedMessageSize = Int32.MaxValue,
|
|
294 |
// RequestInitializationTimeout = new TimeSpan(0, 10, 0),
|
|
295 |
// UseDefaultWebProxy = false,
|
|
296 |
// ProxyAddress = new Uri("Http://127.0.0.1:8888")
|
|
297 |
//};
|
|
292 |
var httpTranport = new System.ServiceModel.Channels.HttpTransportBindingElement |
|
293 |
{ |
|
294 |
MaxBufferPoolSize = Int32.MaxValue, |
|
295 |
MaxBufferSize = Int32.MaxValue, |
|
296 |
MaxReceivedMessageSize = Int32.MaxValue, |
|
297 |
RequestInitializationTimeout = new TimeSpan(0, 10, 0), |
|
298 |
//UseDefaultWebProxy = false,
|
|
299 |
//ProxyAddress = new Uri("Http://127.0.0.1:8888")
|
|
300 |
}; |
|
298 | 301 |
|
299 | 302 |
|
300 |
//customBinding.CreateBindingElements();
|
|
301 |
//customBinding.Elements.Add(messageEncoding);
|
|
302 |
//customBinding.Elements.Add(httpTranport);
|
|
303 |
customBinding.CreateBindingElements(); |
|
304 |
customBinding.Elements.Add(messageEncoding); |
|
305 |
customBinding.Elements.Add(httpTranport); |
|
303 | 306 |
|
304 | 307 |
|
305 |
//_binding = customBinding;
|
|
308 |
_binding = customBinding; |
|
306 | 309 |
#endregion |
307 | 310 |
|
311 |
#endif |
|
312 |
|
|
308 | 313 |
//Support.SetLicense(); |
309 | 314 |
|
310 | 315 |
#if DEBUG |
... | ... | |
314 | 319 |
#else |
315 | 320 |
BaseAddress = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal); |
316 | 321 |
#endif |
317 |
|
|
322 |
|
|
323 |
if (isAuthenticate) |
|
324 |
{ |
|
325 |
App.AuthenticateToken = Authenticate(BaseAddress); |
|
326 |
} |
|
327 |
|
|
318 | 328 |
var UploadAddress = CommonLib.Common.GetConfigString("KCOM_kr_co_devdoftech_cloud_FileUpload", "URL", ""); |
319 | 329 |
|
320 | 330 |
if (!string.IsNullOrWhiteSpace(UploadAddress) && !string.IsNullOrWhiteSpace(BaseAddress)) |
... | ... | |
327 | 337 |
|
328 | 338 |
FileUploadUri = uploadUri.ToString(); |
329 | 339 |
} |
340 |
#if BASIC_BINDING |
|
341 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc/", BaseAddress)); |
|
342 |
#elif CUSTOM_BINDING |
|
343 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc/gzip", BaseAddress)); |
|
344 |
#endif |
|
345 |
|
|
346 |
App.FileLogger.Debug(_EndPoint.Uri); |
|
330 | 347 |
|
331 |
App.FileLogger.Debug(string.Format("{0}/ServiceDeepView.svc/gzip", BaseAddress)); |
|
332 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", BaseAddress)); |
|
333 |
|
|
334 | 348 |
#if !DEBUG |
335 | 349 |
#endif |
336 | 350 |
//var license = new License.Validator.Valid(BaseAddress + "/License"); |
... | ... | |
366 | 380 |
await SplashScreenAsnyc(); |
367 | 381 |
} |
368 | 382 |
} |
383 |
private string Authenticate(string baseUri) |
|
384 |
{ |
|
385 |
string result = null; |
|
386 |
|
|
387 |
try |
|
388 |
{ |
|
389 |
Uri uri = new Uri(baseUri); |
|
390 |
string baseUrl = uri.Scheme + "://" + uri.Host + (uri.IsDefaultPort ? "" : ":" + uri.Port); |
|
391 |
|
|
392 |
using (System.Net.WebClient client = new System.Net.WebClient()) |
|
393 |
{ |
|
394 |
client.Headers.Add(HttpRequestHeader.Authorization, "!dsfadsfa@@~"); |
|
395 |
var response = client.DownloadString(baseUrl + "/Authenticate"); |
|
396 |
|
|
397 |
if (response != null) |
|
398 |
{ |
|
399 |
result = response; |
|
400 |
} |
|
401 |
} |
|
402 |
} |
|
403 |
catch (Exception) |
|
404 |
{ |
|
405 |
|
|
406 |
throw; |
|
407 |
} |
|
408 |
|
|
409 |
return result; |
|
410 |
} |
|
369 | 411 |
|
370 | 412 |
private void License_ValidateError(object sender, ValidateErrorArgs e) |
371 | 413 |
{ |
내보내기 Unified diff