Пример #1
0
        public static string Compile(string strDefLibValue, string strLibFileName)
        {
            if (strDefLibValue.Length <= 0)
            {
                throw new Exception("Unable to compile the lib file def.");
            }

            string strLibLinkFile = DefFactory.LibLinkFileName;

            if (File.Exists(strLibLinkFile) != true)
            {
                throw new Exception("Missing link.exe lib.exe mspdb60.dll file, it cannot be compiled.");
            }

            if (Directory.Exists(DefFactory.AppCachePathName) != true)
            {
                Directory.CreateDirectory(DefFactory.AppCachePathName);
            }

            string strLinkDefFile = DefFactory.AppCachePathName + Path.GetFileNameWithoutExtension(strLibFileName) + ".def";
            string strOutLibFile  = Path.GetDirectoryName(strLibFileName) + @"\" + Path.GetFileNameWithoutExtension(strLibFileName) + ".lib";

            File.WriteAllText(strLinkDefFile, strDefLibValue);
            DefFactory.ComplieLibFile(strLibLinkFile, string.Format(@"/def:{0} /machine:i386 /out:{1}", strLinkDefFile, strOutLibFile));
            File.Delete(strLinkDefFile);

            return(strOutLibFile);
        }
Пример #2
0
 private void btnComplie_Click(object sender, EventArgs args)
 {
     try
     {
         string strLibFileName = txtLibFileName.Text;
         string strDefLibValue = DefFactory.Create(strLibFileName);
         if (File.Exists(DefFactory.Compile(strDefLibValue, strLibFileName)) != true)
         {
             MessageBox.Show("Dll to Lib, has not been properly compiled.");
         }
         else
         {
             MessageBox.Show("Dll to Lib, has been properly compiled.");
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }