Ejemplo n.º 1
0
        /// <summary>
        /// WebRequest를 이용해 Ftp 기능을 이용할 때 C# 폴더는 C로 읽혀지는 경우 있어 방지하기 위함.
        /// Uri.EscapeDataString 사용하면 /까지 전부 바뀌어 문제가 있는 기호만 변경함.
        /// </summary>
        /// <param name="Url"></param>
        /// <returns></returns>
        public static string EncodeUrlForWebRequest(string Url)
        {
            string Url2 = "";

            string[] aToFind = new string[] {
                "~", "!", "@", "#", "$",
                "%", "^", "&", "(", ")",
                "_", "+", "`", "-", "=",
                "{", "}", "[", "]", ";",
                "'"
            };
            for (int i = 0; i < Url.Length; i++)
            {
                char   c = Url[i];
                string s = c.ToString();
                if (Array.IndexOf(aToFind, s) != -1)
                {
                    s = CMath.Hex(c, true);
                }

                Url2 += s;
            }

            return(Url2);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// R, G, B 값에 해당하는 Hexa 값을 리턴함.
        /// </summary>
        /// <param name="Red">Red</param>
        /// <param name="Green">Green</param>
        /// <param name="Blue">Blue</param>
        /// <returns>Hexa 값</returns>
        public static string GetHexaByRGB(int Red, int Green, int Blue)
        {
            string r = "", g = "", b = "";

            r = CMath.Hex(Red, false);
            g = CMath.Hex(Green, false);
            b = CMath.Hex(Blue, false);
            return(r.PadLeft(2, '0') + g.PadLeft(2, '0') + b.PadLeft(2, '0'));
        }