public void AddRecord(LibRecord record)
 {
     if (settings.Records.ContainsKey(record.SourceFileName))
         settings.Records[record.SourceFileName] = record;
     else
         settings.Records.Add(record.SourceFileName, record);
 }
        public bool IsSourceCompiled(string sourcePath)
        {
            string    name   = Path.GetFileNameWithoutExtension(sourcePath);
            LibRecord record = ReadRecord(name);

            if (record == null)
            {
                return(false);
            }

            var sourceInfo = new FileInfo(sourcePath);

            if (record.SourceLastWriteTime != sourceInfo.LastWriteTime)
            {
                return(false);
            }

            string dllPath = Path.Combine(Data.LibraryDir, Path.GetFileNameWithoutExtension(sourcePath) + ".dll");

            if (!File.Exists(dllPath))
            {
                return(false);
            }

            return(true);
        }
 public void AddRecord(LibRecord record)
 {
     if (settings.Records.ContainsKey(record.SourceFileName))
     {
         settings.Records[record.SourceFileName] = record;
     }
     else
     {
         settings.Records.Add(record.SourceFileName, record);
     }
 }
        /// <summary>
        ///     Compiles and saves a dll from source code.
        /// </summary>
        /// <param name="sourcePath">Path to cs file.</param>
        /// <param name="sourceCode">Source code</param>
        /// <returns></returns>
        private LibRecord ExportIndicatorAsDll(string sourcePath, string sourceCode)
        {
            string name = Path.GetFileNameWithoutExtension(sourcePath);
            string targedPath = Path.Combine(Data.LibraryDir, name + ".dll");

            compiler.CompileSourceToDll(sourceCode, targedPath);

            var sourceInfo = new FileInfo(sourcePath);
            var record = new LibRecord
            {
                SourceFileName = name,
                SourceLastWriteTime = sourceInfo.LastWriteTime,
            };

            return record;
        }