프로젝트

일반

사용자정보

개정판 f2c3d74c

IDf2c3d74cbc743b53a72ec322027a4fb5f3ab6887
상위 55bf7ac2
하위 46bcf9ba

김태성이(가) 4년 이상 전에 추가함

appcast에 markus.ini 추가

Change-Id: Ie98c0d4d87ad74b9648c84cab71a6462528b9c17

차이점 보기:

CommonLib/Common.cs
18 18
        [DllImport("kernel32")]
19 19
        private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
20 20

  
21
        public static string AppDataFolder
21
        public static string AppStartFolder
22 22
        {
23 23
            get
24 24
            {
25
                return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MARKUS");
25
                return AppDomain.CurrentDomain.BaseDirectory;
26
                //return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MARKUS");
26 27
            }
27 28
        }
28 29

  
......
36 37
        public static string GetConfigString(string section, string key, string def)
37 38
        {
38 39
            System.Text.StringBuilder strbuilder = new System.Text.StringBuilder(512);
39
            GetPrivateProfileString(section, key, def, strbuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
40
            GetPrivateProfileString(section, key, def, strbuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
40 41
            return strbuilder.ToString();
41 42
        }
42 43

  
......
49 50
        /// <returns></returns>
50 51
        public static void WriteConfigString(string section, string key, string value)
51 52
        {
52
            WritePrivateProfileString(section, key, value, Path.Combine(AppDataFolder, "MARKUS.ini"));            
53
            WritePrivateProfileString(section, key, value, Path.Combine(AppStartFolder, "MARKUS.ini"));            
53 54
        }
54 55

  
55 56
        /// <summary>
......
63 64
        public static string GetConfigString(string section, string key, string def,bool isExternal)
64 65
        {
65 66
            System.Text.StringBuilder strbuilder = new System.Text.StringBuilder(512);
66
            GetPrivateProfileString(section, key, def, strbuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
67
            GetPrivateProfileString(section, key, def, strbuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
67 68

  
68 69
            string result = strbuilder.ToString();
69 70
            //internal 이면 result return
70 71
            if (isExternal)
71 72
            {
72 73
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(512);
73
                GetPrivateProfileString("External", "IP", "", stringBuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
74
                GetPrivateProfileString("External", "IP", "", stringBuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
74 75
                string external_ip = stringBuilder.ToString();
75 76
                stringBuilder = new StringBuilder();
76
                GetPrivateProfileString("Internal", "IP", "", stringBuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
77
                GetPrivateProfileString("Internal", "IP", "", stringBuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
77 78
                string internal_ip = stringBuilder.ToString();
78 79

  
79 80
                //internalport:externalport
80 81
                stringBuilder = new StringBuilder();
81
                GetPrivateProfileString("PortForwarding", "HUB", "", stringBuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
82
                GetPrivateProfileString("PortForwarding", "HUB", "", stringBuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
82 83
                string[] forwarding_hub = stringBuilder.ToString().Split(':');
83 84
                stringBuilder = new StringBuilder();
84
                GetPrivateProfileString("PortForwarding", "RESOURCE", "", stringBuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
85
                GetPrivateProfileString("PortForwarding", "RESOURCE", "", stringBuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
85 86
                string[] forwarding_resource = stringBuilder.ToString().Split(':');
86 87
                stringBuilder = new StringBuilder();
87
                GetPrivateProfileString("PortForwarding", "BASE", "", stringBuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
88
                GetPrivateProfileString("PortForwarding", "BASE", "", stringBuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
88 89
                string[] forwarding_base = stringBuilder.ToString().Split(':');
89 90

  
90 91
                if(result.Contains(internal_ip))
......
106 107
                if (isExternal)
107 108
                {
108 109
                    System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(512);
109
                    GetPrivateProfileString("External", "IP", "", stringBuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
110
                    GetPrivateProfileString("External", "IP", "", stringBuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
110 111
                    string external_ip = stringBuilder.ToString();
111 112
                    stringBuilder = new StringBuilder();
112
                    GetPrivateProfileString("Internal", "IP", "", stringBuilder, 512, Path.Combine(AppDataFolder, "MARKUS.ini"));
113
                    GetPrivateProfileString("Internal", "IP", "", stringBuilder, 512, Path.Combine(AppStartFolder, "MARKUS.ini"));
113 114
                    string internal_ip = stringBuilder.ToString();
114 115
                    result = result.Replace(internal_ip, external_ip);
115 116
                }
......
124 125
        public static string GetAlertMessageString(string section, string key, string def)
125 126
        {
126 127
            System.Text.StringBuilder strbuilder = new System.Text.StringBuilder(1024);
127
            GetPrivateProfileString(section, key, def, strbuilder, 1024, Path.Combine(AppDataFolder, "MARKUS.ini"));
128
            GetPrivateProfileString(section, key, def, strbuilder, 1024, Path.Combine(AppStartFolder, "MARKUS.ini"));
128 129
            byte[] byte64 = Convert.FromBase64String(strbuilder.ToString());
129 130
            
130 131
            return Regex.Unescape(Encoding.UTF8.GetString(byte64));
......
136 137
        public static string GetConnectionString()
137 138
        {
138 139
            System.Text.StringBuilder strbuilder = new System.Text.StringBuilder(512);
139
            GetPrivateProfileString("ConnectionString", "STRING", "", strbuilder, 512, Path.Combine(AppDataFolder, "FinalService.ini"));
140
            GetPrivateProfileString("ConnectionString", "STRING", "", strbuilder, 512, Path.Combine(AppStartFolder, "FinalService.ini"));
140 141
            return Decrypt(strbuilder.ToString(), "Doftech1073#");
141 142
        }
142 143
        private static string Decrypt(string textToDecrypt, string key)

내보내기 Unified diff

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