private void Dispose(bool disposing)
 {
     if (_storage != null)
     {
         _storage.Dispose();
         _storage = null;
     }
 }
        public DatabaseTargetTextBuilder(string workingDir)
        {
            if (workingDir == null)
            {
                throw new ArgumentNullException("workingDir",
                                                "The working directory is required and cannot be null (or Nothing).");
            }
            if (workingDir.Length == 0 || !Directory.Exists(workingDir))
            {
                throw new ArgumentException(
                          "The working directory is required and cannot be null (or Nothing).",
                          "workingDir");
            }

            _storage = new DatabaseTargetTextStorage(true, false, true,
                                                     workingDir);
            _workingDir = workingDir;
        }
        public DatabaseTargetTextBuilder(DataSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (!source.IsBuilding || !source.IsValid)
            {
                throw new ArgumentException("source");
            }

            string workingDir = source.OutputDir;

            _source = source;

            _storage = new DatabaseTargetTextStorage(true, false, true,
                                                     workingDir);
            _workingDir = workingDir;
        }
예제 #4
0
 public void Uninitialize()
 {
     try
     {
         if (_localStorage != null)
         {
             _localStorage.Dispose();
             _localStorage = null;
         }
         if (_msdnStorage != null)
         {
             _msdnStorage.Dispose();
             _msdnStorage = null;
         }
     }
     catch
     {
     }
 }
        public bool Build()
        {
            if (String.IsNullOrEmpty(_workingDir) ||
                !Directory.Exists(_workingDir))
            {
                return(false);
            }

            string dataDir = null;

            if (_source != null && Directory.Exists(_source.InputDir))
            {
                dataDir = _source.InputDir;
            }
            else
            {
                dataDir = Environment.ExpandEnvironmentVariables(
                    @"%DXROOT%\Data\Reflection");
                dataDir = Path.GetFullPath(dataDir);
            }
            if (!Directory.Exists(dataDir))
            {
                return(false);
            }

            this.AddTargets(dataDir, "*.xml", true, ReferenceLinkType.None);

            if (_storage != null)
            {
                _storage.Dispose();
                _storage = null;
            }

            // Perform a defragmentation of the PersistentDictionary.edb database
            Process process = new Process();

            ProcessStartInfo startInfo = process.StartInfo;

            startInfo.FileName               = "esentutl.exe";
            startInfo.Arguments              = "-d " + DataSource.DatabaseFileName + " -o";
            startInfo.UseShellExecute        = false;
            startInfo.CreateNoWindow         = true;
            startInfo.WorkingDirectory       = _workingDir;
            startInfo.RedirectStandardOutput = false;

            // Now, start the process - there will still not be output till...
            process.Start();
            // We must wait for the process to complete...
            process.WaitForExit();
            int exitCode = process.ExitCode;

            process.Close();
            if (exitCode != 0)
            {
                return(false);
            }

            string[] logFiles = Directory.GetFiles(_workingDir, "*.log",
                                                   SearchOption.TopDirectoryOnly);
            if (logFiles != null)
            {
                for (int i = 0; i < logFiles.Length; i++)
                {
                    File.Delete(logFiles[i]);
                }
            }

            return(true);
        }
예제 #6
0
 public DatabaseTargetCollection(int tn)
 {
     _targetsStorage = new DatabaseTargetTextStorage(true, false);
 }
예제 #7
0
 private TargetController()
 {
     _localStorage = new MemoryTargetStorage();
     _msdnStorage  = new DatabaseTargetTextStorage(true, false);
 }