프로젝트

일반

사용자정보

개정판 77cdac33

ID77cdac33b7bca4641193c97216f85dde1a21cb5e
상위 74abcf6f
하위 a7bee7cf

김태성이(가) 약 3년 전에 추가함

벽산 수정 후 백업

Change-Id: I8e3eb48f615478a49efa0ab4014a8ef17d273d0a

차이점 보기:

License/LicenseService.svc.cs
1
using Rhino.Licensing;
1
using log4net;
2
using Rhino.Licensing;
2 3
using System;
3 4
using System.Collections.Generic;
4 5
using System.Configuration;
......
14 15
{
15 16
    public partial class LicenseService : license.iLicenseService
16 17
    {
18
        ILog log = log4net.LogManager.GetLogger(typeof(LicenseService));
17 19
        protected License.DB.DataBase database = new DB.DataBase();
18 20

  
19 21
        public LicenseService()
20 22
        {
21
            LicensingService.LicenseServerPrivateKey = Key.Data;
22
            LicensingService.SoftwarePublicKey = Key2.Data;
23
            Upload();
23
            log4net.Config.XmlConfigurator.Configure();
24

  
25
            log.Info("LicenseService");
26

  
27
            try
28
            {
29
                LicensingService.LicenseServerPrivateKey = Key.Data;
30
                LicensingService.SoftwarePublicKey = Key2.Data;
31
                Upload();
32
            }
33
            catch (Exception ex)
34
            {
35
                log.Error(ex);
36
            }
24 37
            //new StreamReader(typeof(LicenseService)
25 38
            //                                   .Assembly
26 39
            //                                   .GetManifestResourceStream("License.key.xml")).ReadToEnd();
......
32 45

  
33 46
        public string GetLicense(string key, string machine, string Process, string user)
34 47
        {
35
            if (LicensingService.SoftwarePublicKey.Replace(System.Environment.NewLine, " ").Replace(" ", "") == key.Replace(System.Environment.NewLine, " ").Replace(" ", ""))
48
            string result = null;
49

  
50
            try
36 51
            {
37
                var guid = Guid.NewGuid();
38
                var generator = new LicenseGenerator(LicensingService.LicenseServerPrivateKey);
52
                if (LicensingService.SoftwarePublicKey.Replace(System.Environment.NewLine, " ").Replace(" ", "") == key.Replace(System.Environment.NewLine, " ").Replace(" ", ""))
53
                {
54
                    var guid = Guid.NewGuid();
55
                    var generator = new LicenseGenerator(Key.Data);
39 56
               
40
                var identifier = machine + @"\" + user + ": " + Process;
41
                var license = generator.Generate(identifier, guid, DateTime.MaxValue, LicenseType.Standard);
57
                    var identifier = machine + @"\" + user + ": " + Process;
58
                    var license = generator.Generate(identifier, guid, DateTime.MaxValue, LicenseType.Standard);
42 59

  
43
                database.Active(machine, Process, user, license);
60
                    database.Active(machine, Process, user, license);
44 61

  
45
                return license;
62
                    result = license;
63

  
64
                    log.Info("GetLicense : " + license);
65
                }
46 66
            }
47
            else
67
            catch (Exception ex)
48 68
            {
49
                return null;
69
                log.Error(ex);
50 70
            }
71

  
72
            return result;
51 73
        }
52 74

  
53 75
        public bool Validate(string key, string license)
......
59 81
                validator.AssertValidLicense();
60 82
                return true;
61 83
            }
62
            catch (Exception)
84
            catch (Exception ex)
63 85
            {
86
                log.Error(ex);
64 87
                throw new FaultException("License Validate Error");
65 88
            }
66 89
        }
67 90

  
68 91
        public bool Upload()
69 92
        {
70
            var uri =  ConfigurationManager.AppSettings["UploadUri"];
93
            var uri = ConfigurationManager.AppSettings["UploadUri"];
71 94
            var siteName = ConfigurationManager.AppSettings["Site"];
72
           database.UploadAsync(new Uri(uri), siteName).ConfigureAwait(false);
95

  
96
            try
97
            {
98
                database.UploadAsync(new Uri(uri), siteName).ConfigureAwait(false);
99

  
100
            }
101
            catch (Exception ex)
102
            {
103
                log.Error(ex);
104
            }
73 105

  
74 106
            return true;
75 107
        }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)