Exemple #1
0
        public static LImage OpenImage(string fileName, string resName)
        {
            byte[] buffer = null;
            try {
                buffer = LPKResource.OpenResource(fileName, resName);

                return(LImage.CreateImage(buffer));
            } catch (Exception) {
                throw new Exception("File not found. ( " + resName + " )");
            }
        }
Exemple #2
0
        public static Stream StrRes(string path)
        {
            if (path == null)
            {
                return(null);
            }
            Stream ins0 = null;

            if (path.IndexOf("->") == -1)
            {
                if (path.StartsWith("sd:"))
                {
                    ins0 = SdRes(path.Substring(3, (path.Length) - (3))).GetInputStream();
                }
                else if (path.StartsWith("class:"))
                {
                    ins0 = ClassRes(path.Substring(6, (path.Length) - (6)))
                           .GetInputStream();
                }
                else if (path.StartsWith("path:"))
                {
                    ins0 = FileRes(path.Substring(5, (path.Length) - (5))).GetInputStream();
                }
                else if (path.StartsWith("url:"))
                {
                    ins0 = RemoteRes(path.Substring(4, (path.Length) - (4)))
                           .GetInputStream();
                }
            }
            else
            {
                string[] newPath = StringUtils.Split(path, "->");
                ins0 = LPKResource.OpenStream(
                    newPath[0].Trim(), newPath[1].Trim());
            }
            return(ins0);
        }