Пример #1
0
        public FFFile(FFApp app, string fileName)
        {
#if DEBUG
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
#endif
            _app      = app;
            _id       = 0L;             // Will be inserted during next database update
            _fileName = fileName;
            _modified = Constants.ZeroDate;
            _context  = FileContextUtil.GetFileContextFromFileName(_fileName);

            var className = FileContextUtil.GetClassNameFromFileName(_fileName);
            if (!string.IsNullOrEmpty(className))
            {
                _class = new FFClass(_app, this, className);
            }

            UpdateVisibility();
        }
Пример #2
0
        public FFFile(FFApp app, FFDatabase db, SQLiteDataReader fileRdr)
        {
#if DEBUG
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (fileRdr == null)
            {
                throw new ArgumentNullException("rdr");
            }
#endif
            _app      = app;
            _id       = fileRdr.GetInt64(fileRdr.GetOrdinal("rowid"));
            _fileName = fileRdr.GetString(fileRdr.GetOrdinal("file_name"));
            _context  = FileContextUtil.GetFileContextFromFileName(_fileName);
            _modified = fileRdr.GetDateTime(fileRdr.GetOrdinal("modified"));

            var className = FileContextUtil.GetClassNameFromFileName(_fileName);
            if (!string.IsNullOrEmpty(className))
            {
                _class = new FFClass(_app, this, className);
            }

            UpdateVisibility();
        }
Пример #3
0
        public static CodeModel.Definitions.FunctionDefinition CreateFunctionDefinitionFromSqlReader(SQLiteDataReader rdr, string fileName)
        {
            var className = FileContextUtil.GetClassNameFromFileName(fileName);

            var funcName = rdr.GetString(rdr.GetOrdinal("name"));
            var sig      = FunctionSignature.ParseFromDb(rdr.GetString(rdr.GetOrdinal("sig")));

            var devDescValue = rdr.GetStringOrNull(rdr.GetOrdinal("description"));

            if (devDescValue != null)
            {
                // TODO: Transitionary until the next database version
                if (sig.Description == null)
                {
                    sig.Description = devDescValue;
                }
            }

            var trueFileName = fileName;
            var altFileName  = rdr.GetStringOrNull(rdr.GetOrdinal("alt_file_name"));

            if (!string.IsNullOrEmpty(altFileName))
            {
                trueFileName = altFileName;
            }
            var pos     = rdr.GetInt32(rdr.GetOrdinal("pos"));
            var filePos = new FilePosition(trueFileName, pos);

            return(new CodeModel.Definitions.FunctionDefinition(sig, filePos, 0, 0, 0, Span.Empty));
        }