Beispiel #1
0
 //------------------------------------------------------------
 // CController.CreateSourceModule
 //
 /// <summary>
 /// <para>Create a CSourceModule instance
 /// with an instance of a class implementing ICSSourceText.</para>
 /// <para>Call CSourceModule.CreateInstance and handle exceptions if throwed.</para>
 /// </summary>
 /// <param name="text"></param>
 /// <returns></returns>
 //------------------------------------------------------------
 internal CSourceModule CreateSourceModule(CSourceText text)
 {
     try
     {
         return(CSourceModule.CreateInstance(this, text));
     }
     catch (Exception excp)
     {
         OnCatastrophicError(excp);
     }
     return(null);
 }
Beispiel #2
0
        //------------------------------------------------------------
        // CController.GetSourceModule
        //
        /// <summary>
        /// <para>(In sscli, CInMemoryCompilerHost::GetSourceModule)</para>
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="needChecksum"></param>
        /// <returns></returns>
        //------------------------------------------------------------
        internal CSourceModule GetSourceModule(
            FileInfo srcFileInfo,
            bool needChecksum)
        {
            CSourceText sourceText = new CSourceText();

            // Read the source file.
            if (!sourceText.Initialize(srcFileInfo, needChecksum, encoding, this))
            {
                return(null);
            }
            return(CreateSourceModule(sourceText));//, out module);
        }