Initialize() private method

private Initialize ( ) : void
return void
Example #1
0
        internal static void InitializeRootLibrary(string xllPath)
        {
            // Loads the primary .dna library
            // Load sequence is:
            // 1. Look for a packed .dna file named "__MAIN__" in the .xll.
            // 2. Look for the .dna file in the same directory as the .xll file, with the same name and extension .dna.

            // CAREFUL: Sequence here is fragile - this is the first place where we start logging
            _XllPath         = xllPath;
            _xllPathPathInfo = new FileInfo(xllPath);
            Logging.LogDisplay.CreateInstance();
            Logger.Initialization.Verbose("Enter DnaLibrary.InitializeRootLibrary");
            byte[] dnaBytes = ExcelIntegration.GetDnaFileBytes("__MAIN__");
            if (dnaBytes != null)
            {
                Logger.Initialization.Verbose("Got Dna file from resources.");
                string pathResolveRoot = Path.GetDirectoryName(DnaLibrary.XllPath);
                rootLibrary = LoadFrom(dnaBytes, pathResolveRoot);
                // ... would have displayed error and returned null if there was an error.
            }
            else
            {
                Logger.Initialization.Verbose("No Dna file in resources - looking for file.");
                // No packed .dna file found - load from a .dna file.
                string dnaFileName = Path.ChangeExtension(XllPath, ".dna");
                rootLibrary = LoadFrom(dnaFileName);
                // ... would have displayed error and returned null if there was an error.
            }

            // If there have been problems, ensure that there is at lease some current library.
            if (rootLibrary == null)
            {
                Logger.Initialization.Error("No Dna Library found.");
                rootLibrary = new DnaLibrary();
            }

            rootLibrary.Initialize();
            Logger.Initialization.Verbose("Exit DnaLibrary.Initialize");
        }
Example #2
0
 internal static void Initialize()
 {
     ExcelDnaUtil.Initialize();
     DnaLibrary.Initialize();
 }