Ejemplo n.º 1
0
        //public static void LoadPATLib(IToken libName)
        //{
        //    string dll = Ultility.LibFolderPath + "/" + libName.Text + ".dll";
        //    if(File.Exists(dll))
        //    {
        //        Ultility.LoadDLLLibrary(dll);
        //    }
        //    else
        //    {
        //        throw new ParsingException("The C# library " + dll + " can not be found!", libName);
        //    }
        //}

        public static void LoadStandardLib(IToken libPath, string filePathOld)
        {
            string filePath = ParsingException.GetFileNameByLineNumber(libPath.Line);

            string dll = libPath.Text.Trim('"');

            if (dll == "PAT.Math")
            {
                Ultility.LoadMathLib();
                return;
            }
            if (File.Exists(dll))
            {
                Ultility.LoadDLLLibrary(dll);
            }
            else
            {
                string dlllocal = "";
                if (!string.IsNullOrEmpty(filePath))
                {
                    dlllocal = Path.Combine(Path.GetDirectoryName(filePath), dll) + ".dll";
                    if (File.Exists(dlllocal))
                    {
                        Ultility.LoadDLLLibrary(dlllocal);
                        return;
                    }
                    dlllocal = " or " + dlllocal;
                }

                dll = Path.Combine(Ultility.LibFolderPath, libPath.Text.Trim('"') + ".dll");
                if (File.Exists(dll))
                {
                    Ultility.LoadDLLLibrary(dll);
                }
                else
                {
                    throw new ParsingException(string.Format(Resources.The_C__library__0__can_not_be_found_, dll + dlllocal),
                                               libPath);
                }
            }
        }
Ejemplo n.º 2
0
 public static Icon GetIcon(string key)
 {
     return(Icon.FromHandle(((Bitmap)Ultility.GetImage(key)).GetHicon()));
 }