private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            StringBuilder _sb = new StringBuilder();

            if (QueryModelName != "")
            {
                try
                {
                    _queryModel = MetaDataCache.GetQueryModelDefine(QueryModelName);
                }
                catch (Exception ex)
                {
                    _sb.Append(string.Format("取QueryModel={0}出错!{1}", QueryModelName, ex.Message));
                }

                try
                {
                    _ruleList = MetaDataCache.GetDataCheckRuleDefine(QueryModelName, true);
                }
                catch (Exception ex2)
                {
                    _sb.Append(string.Format("取规则定义{0}出错!{1}", QueryModelName, ex2.Message));
                }
                e.Result = _sb.ToString();
            }
        }
Esempio n. 2
0
        public virtual void FixtureSetup()
        {
            SetupTestModel(Properties.Resources.TextCacheModel_xml);

            m_cache = new T();
            m_cache.MetaDataCache      = MetaDataCache.CreateMetaDataCache("TestModel.xml");
            m_cache.ParaContentsFlid   = SimpleRootsiteTestsConstants.kflidParaContents;
            m_cache.ParaPropertiesFlid = SimpleRootsiteTestsConstants.kflidParaProperties;
            m_cache.TextParagraphsFlid = SimpleRootsiteTestsConstants.kflidTextParas;

            Debug.Assert(m_wsManager == null);
            m_wsManager = new WritingSystemManager();
            m_cache.WritingSystemFactory = m_wsManager;

            CoreWritingSystemDefinition enWs;

            m_wsManager.GetOrSet("en", out enWs);
            m_wsEng = enWs.Handle;

            CoreWritingSystemDefinition frWs;

            m_wsManager.GetOrSet("fr", out frWs);
            m_wsFrn = frWs.Handle;

            CoreWritingSystemDefinition deWs;

            m_wsManager.GetOrSet("de", out deWs);
            m_wsDeu = deWs.Handle;

            m_wsManager.UserWs = m_wsEng;
            m_wsUser           = m_wsManager.UserWs;
        }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:FwModelBrowser"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public FwModelBrowser()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

#if USINGCPP
            m_ode = OleDbEncapClass.Create();
            m_ode.Init(SystemInformation.ComputerName + "\\SILFW", "TestLangProj", null,
                       FwKernelLib.OdeLockTimeoutMode.koltReturnError,
                       (int)FwKernelLib.OdeLockTimeoutValue.koltvFwDefault);
            m_mdc = FwMetaDataCacheClass.Create();
            m_mdc.Init(m_ode);
#else
            string modelDir = DirectoryFinder.FwSourceDirectory;
            modelDir = modelDir.Substring(0, modelDir.LastIndexOf('\\'));
            modelDir = Path.Combine(modelDir, @"Output\XMI");
            m_mdc    = MetaDataCache.CreateMetaDataCache(Path.Combine(modelDir, "xmi2cellar3.xml"));
#endif

            uint   clid      = 0;
            string classname = m_mdc.GetClassName(clid);
            m_tvClasses.SuspendLayout();
            AddNode(m_tvClasses.Nodes, classname, clid);
            m_tvClasses.Nodes[0].Expand();
            m_tvClasses.ResumeLayout(false);
        }
Esempio n. 4
0
        public DbSnapshot(DB db, Blockchain blockchain)
            : base(blockchain)
        {
            this.db       = db;
            this.snapshot = db.GetSnapshot();
            this.batch    = new WriteBatch();
            ReadOptions options = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            Blocks          = new DbCache <UInt256, BlockState>(db, options, batch, Prefixes.DATA_Block);
            Transactions    = new DbCache <UInt256, TransactionState>(db, options, batch, Prefixes.DATA_Transaction);
            Accounts        = new DbCache <UInt160, AccountState>(db, options, batch, Prefixes.ST_Account);
            AppChains       = new DbCache <UInt160, AppChainState>(db, options, batch, Prefixes.ST_Appchain);
            UnspentCoins    = new DbCache <UInt256, UnspentCoinState>(db, options, batch, Prefixes.ST_Coin);
            SpentCoins      = new DbCache <UInt256, SpentCoinState>(db, options, batch, Prefixes.ST_SpentCoin);
            Validators      = new DbCache <ECPoint, ValidatorState>(db, options, batch, Prefixes.ST_Validator);
            Assets          = new DbCache <UInt256, AssetState>(db, options, batch, Prefixes.ST_Asset);
            Contracts       = new DbCache <UInt160, ContractState>(db, options, batch, Prefixes.ST_Contract);
            Storages        = new DbCache <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage);
            HeaderHashList  = new DbCache <UInt32Wrapper, HeaderHashList>(db, options, batch, Prefixes.IX_HeaderHashList);
            ValidatorsCount = new DbMetaDataCache <ValidatorsCountState>(db, options, batch, Prefixes.IX_ValidatorsCount);
            BlockHashIndex  = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentBlock);
            HeaderHashIndex = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentHeader);
        }
Esempio n. 5
0
        public Main(string path)
        {
            RootWorkPath = path;
            LoadConfig();
            Config.RestartCounter++;
            if (Config.RestartCounter > 3)
            {
                Config.RestartCounter = 0;
            }
            SaveConfig();
            paths = new SpringPaths(Path.GetDirectoryName(Config.ExecutableName), writableFolderOverride: Config.DataDir);
            if (!string.IsNullOrEmpty(Config.ExecutableName))
            {
                paths.OverrideDedicatedServer(Config.ExecutableName);
            }
            paths.MakeFolders();

            MetaCache = new MetaDataCache(paths, null);

            timer           = new Timer(30000);
            timer.Elapsed  += timer_Elapsed;
            timer.AutoReset = true;
            timer.Start();

            Downloader = new PlasmaDownloader.PlasmaDownloader(Config, null, paths);
        }
Esempio n. 6
0
        private object DictionaryXmlNodeListToObject(XmlNodeList nodeList, System.Type dictionaryType)
        {
            object dictionary = Activator.CreateInstance(dictionaryType);
            Type   keyType    = dictionaryType.GetTypeInfo().GenericTypeArguments[0];
            Type   valueType  = dictionaryType.GetTypeInfo().GenericTypeArguments[1];

            foreach (XmlNode node in nodeList)
            {
                object key   = node.Name; // will be replaced with dictionary mapper later
                object value = CreateInstanceOfType(valueType);

                if (valueType.IsClass && MetaDataCache.Contains(valueType))
                {
                    value = ToObject(value, node, node.Name);
                }
                else
                {
                    value = node.InnerText;
                }

                dictionaryType.GetMethod("Add").Invoke(dictionary, new[] { node.Name, value });
            }

            return(dictionary);
        }
Esempio n. 7
0
        public frmSinoSZ_RelationQuery(string _qv, string _param)
        {
            InitializeComponent();
            QueryModelName = _qv;
            string _title = StrUtils.GetMetaByName("标题", _param);

            if (_qv != "")
            {
                _queryModel = MetaDataCache.GetQueryModelDefine(_qv);
                if (_queryModel != null)
                {
                    if (_title != "")
                    {
                        this.Text = string.Format("{0}关联查询", _title);
                    }
                    else
                    {
                        this.Text = string.Format("查询[{0}]", _queryModel.DisplayName);
                    }

                    this.sinoSZUC_MD_Model_FieldList1.QueryModel = _queryModel;
                    this.sinoSZUC_MD_Model_FieldList1.ShowFieldsList();
                    this.sinoSZUC_MD_Model_FieldList1.FieldSelected += new EventHandler <FieldSelectEventArgs>(sinoSZUC_MD_Model_FieldList1_FieldSelected);
                    this.sinoSZUC_ConditionPanel1.MenuChanged       += new EventHandler <EventArgs>(sinoSZUC_ConditionPanel1_MenuChanged);
                }
                else
                {
                    XtraMessageBox.Show("查询模型未找到!");
                }
                this._initFinished = true;
            }
        }
Esempio n. 8
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            SetupTestModel(Properties.Resources.TextCacheModel_xml);

            m_cache = new RealDataCache();
            m_cache.MetaDataCache      = MetaDataCache.CreateMetaDataCache("TestModel.xml");
            m_cache.ParaContentsFlid   = kflidParaContents;
            m_cache.ParaPropertiesFlid = kflidParaProperties;
            m_cache.TextParagraphsFlid = kflidTextParas;

            Debug.Assert(m_wsManager == null);
            m_wsManager = new PalasoWritingSystemManager();
            m_cache.WritingSystemFactory = m_wsManager;

            IWritingSystem enWs;

            m_wsManager.GetOrSet("en", out enWs);
            m_wsEng = enWs.Handle;

            IWritingSystem frWs;

            m_wsManager.GetOrSet("fr", out frWs);
            m_wsFrn = frWs.Handle;

            IWritingSystem deWs;

            m_wsManager.GetOrSet("de", out deWs);
            m_wsDeu = deWs.Handle;

            m_wsManager.UserWs = m_wsEng;
            m_wsUser           = m_wsManager.UserWs;
        }
Esempio n. 9
0
 public virtual void FixtureSetup()
 {
     FileUtils.Manager.SetFileAdapter(new MockFileOS());
     using (TextWriter fw = FileUtils.OpenFileForWrite("TestModel.xsd", Encoding.UTF8))
         fw.Write(Properties.Resources.TestModel_xsd);
     using (TextWriter fw = FileUtils.OpenFileForWrite("TestModel.xml", Encoding.UTF8))
         fw.Write(Properties.Resources.TestModel_xml);
     m_metaDataCache = MetaDataCache.CreateMetaDataCache("TestModel.xml");
 }
Esempio n. 10
0
 public ClonedView(StoreView view)
 {
     this.Blocks          = view.Blocks.CreateSnapshot();
     this.Transactions    = view.Transactions.CreateSnapshot();
     this.Storages        = view.Storages.CreateSnapshot();
     this.HeaderHashList  = view.HeaderHashList.CreateSnapshot();
     this.BlockHashIndex  = view.BlockHashIndex.CreateSnapshot();
     this.HeaderHashIndex = view.HeaderHashIndex.CreateSnapshot();
 }
Esempio n. 11
0
 int Flid(string field)
 {
     string[] parts = field.Trim().Split('.');
     if (parts.Length != 2)
     {
         throw new ArgumentException("Expected class.field but got " + field);
     }
     return((int)MetaDataCache.GetFieldId(parts[0], parts[1], true));
 }
Esempio n. 12
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            SetupTestModel(Resources.TextCacheModel_xml);

            m_sda = new RealDataCache();
            m_sda.MetaDataCache = MetaDataCache.CreateMetaDataCache("TestModel.xml");
            //m_cache.ParaContentsFlid = kflidParaContents;
            //m_cache.ParaPropertiesFlid = kflidParaProperties;
            //m_cache.TextParagraphsFlid = kflidTextParas;

            Debug.Assert(m_wsManager == null);
            m_wsManager = Cache.ServiceLocator.GetInstance <IWritingSystemManager>();
            m_sda.WritingSystemFactory = m_wsManager;

            m_wsAnal = Cache.DefaultAnalWs;

            m_wsVern = Cache.DefaultVernWs;

            //IWritingSystem deWs;
            //m_wsManager.GetOrSet("de", out deWs);
            //m_wsDeu = deWs.Handle;

            //m_wsManager.UserWs = m_wsEng;
            //m_wsUser = m_wsManager.UserWs;

            m_tsf = TsStrFactoryClass.Create();

            m_hvoLexDb = m_sda.MakeNewObject(kclsidLexDb, 0, -1, -1);

            kflidLexDb_Entries = m_sda.MetaDataCache.GetFieldId("LexDb", "Entries", false);
            kflidEntry_Form    = m_sda.MetaDataCache.GetFieldId("Entry", "Form", false);
            kflidEntry_Summary = m_sda.MetaDataCache.GetFieldId("Entry", "Summary", false);

            m_hvoKick = m_sda.MakeNewObject(kclsidEntry, m_hvoLexDb, kflidLexDb_Entries, 0);
            m_sda.SetMultiStringAlt(m_hvoKick, kflidEntry_Form, m_wsVern, m_tsf.MakeString("kick", m_wsVern));
            m_sda.SetString(m_hvoKick, kflidEntry_Summary, m_tsf.MakeString("strike with foot", m_wsAnal));

            var keyAttrs = new Dictionary <string, string[]>();

            keyAttrs["layout"] = new[] { "class", "type", "name", "choiceGuid" };
            keyAttrs["group"]  = new[] { "label" };
            keyAttrs["part"]   = new[] { "ref" };
            var layoutInventory = new Inventory("*.fwlayout", "/LayoutInventory/*", keyAttrs, "test", "nowhere");

            layoutInventory.LoadElements(Resources.Layouts_xml, 1);

            keyAttrs         = new Dictionary <string, string[]>();
            keyAttrs["part"] = new[] { "id" };

            var partInventory = new Inventory("*Parts.xml", "/PartInventory/bin/*", keyAttrs, "test", "nowhere");

            partInventory.LoadElements(Resources.Parts_xml, 1);

            m_layouts = new LayoutCache(m_sda.MetaDataCache, layoutInventory, partInventory);
        }
Esempio n. 13
0
 public SnapshotView(IStore store)
 {
     this.snapshot   = store.GetSnapshot();
     Blocks          = new StoreDataCache <UInt256, TrimmedBlock>(snapshot, Prefixes.DATA_Block);
     Transactions    = new StoreDataCache <UInt256, TransactionState>(snapshot, Prefixes.DATA_Transaction);
     Storages        = new StoreDataCache <StorageKey, StorageItem>(snapshot, Prefixes.ST_Storage);
     HeaderHashList  = new StoreDataCache <SerializableWrapper <uint>, HeaderHashList>(snapshot, Prefixes.IX_HeaderHashList);
     BlockHashIndex  = new StoreMetaDataCache <HashIndexState>(snapshot, Prefixes.IX_CurrentBlock);
     HeaderHashIndex = new StoreMetaDataCache <HashIndexState>(snapshot, Prefixes.IX_CurrentHeader);
 }
Esempio n. 14
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string _fname = "";

            QueryModel = MetaDataCache.GetQueryModelDefine(compareRequest.QueryModelName);
            //处理比对数据表

            srcData = new DataTable();
            foreach (DataColumn _dc in compareRequest.ExcelData.Columns)
            {
                if (_dc.ColumnName == "XH")
                {
                    _fname = "XH";
                }
                else
                {
                    ExcelColumnAlias _alias = ExcelColumns[_dc.ColumnName];
                    _fname = _alias.Alias;
                }
                srcData.Columns.Add(_fname, _dc.DataType);
            }

            foreach (DataRow _dr in compareRequest.ExcelData.Rows)
            {
                DataRow _newrow = srcData.NewRow();
                foreach (DataColumn _dc in compareRequest.ExcelData.Columns)
                {
                    if (_dc.ColumnName == "XH")
                    {
                        _fname = "XH";
                    }
                    else
                    {
                        ExcelColumnAlias _alias = ExcelColumns[_dc.ColumnName];
                        _fname = _alias.Alias;
                    }
                    _newrow[_fname] = _dr[_dc.ColumnName];
                }
                srcData.Rows.Add(_newrow);
            }

            //调用比对服务
            using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
            {
                CompareResult = _msc.CompareData(compareRequest, srcData);
            }

            //建立关系
            MC_QueryModel.CreateDataRelation(this.QueryModel, CompareResult);
            DataTable _mtable = CompareResult.Tables[QueryModel.MainTable.TableName];
            DataTable _ctable = CompareResult.Tables["EXCELRESULTDATA"];

            CompareResult.Relations.Add("比对的EXCEL文件", _mtable.Columns["MAINID"], _ctable.Columns["MAINID"]);
        }
Esempio n. 15
0
 public XmlMapper()
 {
     if (MetaDataCache.Contains <T>())
     {
         ClassMetaData metaData = MetaDataCache.Get <T>();
         if (metaData.ClassAttributeContext.ContainsAttribute <XmlMapperAttribute>())
         {
             xmlMapperAttribute = metaData.ClassAttributeContext.GetAttribute <XmlMapperAttribute>();
         }
     }
 }
Esempio n. 16
0
 public CloneSnapshot(Snapshot snapshot)
 {
     this.PersistingBlock = snapshot.PersistingBlock;
     this.Blocks          = snapshot.Blocks.CreateSnapshot();
     this.Transactions    = snapshot.Transactions.CreateSnapshot();
     this.Contracts       = snapshot.Contracts.CreateSnapshot();
     this.Storages        = snapshot.Storages.CreateSnapshot();
     this.HeaderHashList  = snapshot.HeaderHashList.CreateSnapshot();
     this.BlockHashIndex  = snapshot.BlockHashIndex.CreateSnapshot();
     this.HeaderHashIndex = snapshot.HeaderHashIndex.CreateSnapshot();
 }
Esempio n. 17
0
        public virtual void FixtureSetup()
        {
            CheckDisposed();

            string modelDir = DirectoryFinder.FwSourceDirectory;

            modelDir        = modelDir.Substring(0, modelDir.LastIndexOf('\\'));
            modelDir        = Path.Combine(modelDir, @"Output\XMI");
            m_realDataCache = new RealDataCache();
            m_realDataCache.MetaDataCache = MetaDataCache.CreateMetaDataCache(Path.Combine(modelDir, "xmi2cellar3.xml"));
        }
Esempio n. 18
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.CheckFileExists  = true;
                dlg.RestoreDirectory = true;
                dlg.Title            = "Open Fieldworks Language Project";
                dlg.ValidateNames    = true;
                dlg.Multiselect      = false;
                dlg.Filter           = "Project files (*.xml)|*.xml";
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Cursor = Cursors.WaitCursor;
                    try
                    {
                        DateTime start    = DateTime.Now;
                        string   modelDir = DirectoryFinder.FwSourceDirectory;
                        modelDir = modelDir.Substring(0, modelDir.LastIndexOf('\\'));
                        modelDir = Path.Combine(modelDir, @"Output\XMI");
                        string mdcPathname = Path.Combine(modelDir, "xmi2cellar3.xml");
                        using (RealCacheLoader loader = new RealCacheLoader())
                        {
                            m_objects.Clear();
                            m_cache = loader.LoadCache(mdcPathname, dlg.FileName, m_objects);
                        }
                        DateTime end       = DateTime.Now;
                        TimeSpan span      = new TimeSpan(end.Ticks - start.Ticks);
                        string   totalTime = String.Format("Minutes: {0}, Seconds: {1}, Millseconds: {2}",
                                                           ((span.Hours * 60) + span.Minutes).ToString(), span.Seconds.ToString(), span.Milliseconds.ToString());
                        m_tstbLoadTime.Text = String.Format("Time to Load: {0}", totalTime);
                    }
                    finally
                    {
                        Cursor = Cursors.Default;
                    }
#if FlushMemory
                    MemoryManagement.FlushMemory();
#endif
                    uint mainClid = MetaDataCache.GetClassId("LangProject");
                    int  mainHvo  = 0;
                    foreach (KeyValuePair <int, uint> kvp in m_objects)
                    {
                        //uint clid = (uint)m_cache.get_IntProp(kvp.Key, (int)CmObjectFields.kflidCmObject_Class);
                        if (kvp.Value == mainClid)
                        {
                            mainHvo = kvp.Key;
                            break;
                        }
                    }
                    m_current = new SelectedObject(0, mainHvo, mainClid);
                    PopulateMainListView();
                }
            }
        }
Esempio n. 19
0
 public ClonedView(StoreView view)
 {
     this.PersistingBlock = view.PersistingBlock;
     this.Blocks          = view.Blocks.CreateSnapshot();
     this.Transactions    = view.Transactions.CreateSnapshot();
     this.Contracts       = view.Contracts.CreateSnapshot();
     this.Storages        = view.Storages.CreateSnapshot();
     this.HeaderHashList  = view.HeaderHashList.CreateSnapshot();
     this.BlockHashIndex  = view.BlockHashIndex.CreateSnapshot();
     this.HeaderHashIndex = view.HeaderHashIndex.CreateSnapshot();
     this.ContractId      = view.ContractId.CreateSnapshot();
 }
Esempio n. 20
0
 public frmSinoSZ_DataDetail(MDSearch_ResultDataIndex _searchResutIndex)
 {
     InitializeComponent();
     QueryModel = MetaDataCache.GetQueryModelDefine(_searchResutIndex.SourceColumn.QueryModel.FullName);
     using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient())
     {
         MainKeyID = _msc.GetMainTableKeyByChildKey(_searchResutIndex.SourceColumn, _searchResutIndex.MainKey);
     }
     this.Text        = string.Format("{0}的详细信息", QueryModel.DisplayName);
     SearchResutIndex = _searchResutIndex;
     ShowKKPanel();
 }
Esempio n. 21
0
 public CloneSnapshot(Snapshot snapshot)
 {
     this.PersistingBlock = snapshot.PersistingBlock;
     this.Blocks          = snapshot.Blocks.CreateSnapshot();
     this.Transactions    = snapshot.Transactions.CreateSnapshot();
     this.UnspentCoins    = snapshot.UnspentCoins.CreateSnapshot();
     this.Assets          = snapshot.Assets.CreateSnapshot();
     this.Contracts       = snapshot.Contracts.CreateSnapshot();
     this.Storages        = snapshot.Storages.CreateSnapshot();
     this.HeaderHashList  = snapshot.HeaderHashList.CreateSnapshot();
     this.NextValidators  = snapshot.NextValidators.CreateSnapshot();
     this.BlockHashIndex  = snapshot.BlockHashIndex.CreateSnapshot();
     this.HeaderHashIndex = snapshot.HeaderHashIndex.CreateSnapshot();
 }
Esempio n. 22
0
        public FtpFileSystem(FtpClient client)
        {
            if (!client.IsConnected)
            {
                throw new ArgumentException("Cannot use unconnected FTP client", "client");
            }

            mClient = client;
            mClient.EnableThreadSafeDataConnections = true;
            mCache = new MetaDataCache(CACHE_LIFETIME, true)
            {
                PathSeperator = '/'
            };
        }
Esempio n. 23
0
 public CloneSnapshot(Snapshot snapshot, Blockchain blockchain)
     : base(blockchain)
 {
     this.PersistingBlock = snapshot.PersistingBlock;
     this.Blocks          = snapshot.Blocks.CreateSnapshot();
     this.Transactions    = snapshot.Transactions.CreateSnapshot();
     this.AppChains       = snapshot.AppChains.CreateSnapshot();
     this.NativeNEP5s     = snapshot.NativeNEP5s.CreateSnapshot();
     this.Contracts       = snapshot.Contracts.CreateSnapshot();
     this.Storages        = snapshot.Storages.CreateSnapshot();
     this.HeaderHashList  = snapshot.HeaderHashList.CreateSnapshot();
     this.BlockHashIndex  = snapshot.BlockHashIndex.CreateSnapshot();
     this.HeaderHashIndex = snapshot.HeaderHashIndex.CreateSnapshot();
     this.AppChainState   = snapshot.AppChainState.CreateSnapshot();
 }
Esempio n. 24
0
 public DbSnapshot(SimpleServerDB db)
 {
     this.db         = db;
     Blocks          = new DbCache <UInt256, BlockState>(db, Prefixes.DATA_Block);
     Transactions    = new DbCache <UInt256, TransactionState>(db, Prefixes.DATA_Transaction);
     Accounts        = new DbCache <UInt160, AccountState>(db, Prefixes.ST_Account);
     UnspentCoins    = new DbCache <UInt256, UnspentCoinState>(db, Prefixes.ST_Coin);
     SpentCoins      = new DbCache <UInt256, SpentCoinState>(db, Prefixes.ST_SpentCoin);
     Validators      = new DbCache <ECPoint, ValidatorState>(db, Prefixes.ST_Validator);
     Assets          = new DbCache <UInt256, AssetState>(db, Prefixes.ST_Asset);
     Contracts       = new DbCache <UInt160, ContractState>(db, Prefixes.ST_Contract);
     Storages        = new DbCache <StorageKey, StorageItem>(db, Prefixes.ST_Storage);
     HeaderHashList  = new DbCache <UInt32Wrapper, HeaderHashList>(db, Prefixes.IX_HeaderHashList);
     ValidatorsCount = new DbMetaDataCache <ValidatorsCountState>(db, Prefixes.IX_ValidatorsCount);
     BlockHashIndex  = new DbMetaDataCache <HashIndexState>(db, Prefixes.IX_CurrentBlock);
     HeaderHashIndex = new DbMetaDataCache <HashIndexState>(db, Prefixes.IX_CurrentHeader);
 }
Esempio n. 25
0
        public DbSnapshot(DB db)
        {
            this.db       = db;
            this.snapshot = db.GetSnapshot();
            this.batch    = new WriteBatch();
            ReadOptions options = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            Blocks          = new DbCache <UInt256, TrimmedBlock>(db, options, batch, Prefixes.DATA_Block);
            Transactions    = new DbCache <UInt256, TransactionState>(db, options, batch, Prefixes.DATA_Transaction);
            Contracts       = new DbCache <UInt160, ContractState>(db, options, batch, Prefixes.ST_Contract);
            Storages        = new DbCache <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage);
            HeaderHashList  = new DbCache <UInt32Wrapper, HeaderHashList>(db, options, batch, Prefixes.IX_HeaderHashList);
            BlockHashIndex  = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentBlock);
            HeaderHashIndex = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentHeader);
        }
Esempio n. 26
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            //查询记录
            this.backgroundWorker1.ReportProgress(0, "正在按条件查询记录");
            try
            {
                _queryModel = MetaDataCache.GetQueryModelDefine(CheckParam.Request.QueryModelName);


                DataTable _dt = QueryRecord();

                if (_dt == null || _dt.Rows.Count < 1)
                {
                    _resultTable = null;
                    return;
                }
                else
                {
                    _resultTable = CreateResultTable(_dt);
                }
                //按规则检验】
                if (CheckParam.Rules.Count > 0)
                {
                    int i     = 0;
                    int _step = 40 / CheckParam.Rules.Count;
                    foreach (MD_CheckRule _rule in CheckParam.Rules)
                    {
                        this.backgroundWorker1.ReportProgress(25 + i * _step, string.Format("正在检验第{0}条规则", i + 1));
                        CheckRule(_rule, _queryModel);
                    }
                }
                //检查更新记录
                this.backgroundWorker1.ReportProgress(70, "正在检查更新记录");
                CheckUpdateRecord();

                //筛选记录
                this.backgroundWorker1.ReportProgress(85, "正在筛选记录");
                FilterRecord();
                e.Result = "";
            }
            catch (Exception ex)
            {
                this.backgroundWorker1.ReportProgress(0, string.Format("检记录发生错误!{0}", ex.Message));
                e.Result = "ERROR!" + ex.Message;
            }
        }
Esempio n. 27
0
        public void CreateMetaDataCacheDuplicateClassesInTwoFiles()
        {
            var bogusDataPathname = "Good.xml";

            using (var w = FileUtils.OpenFileForWrite(bogusDataPathname, Encoding.UTF8))
            {
                w.WriteLine("<?xml version='1.0' encoding='utf-8'?>");
                w.WriteLine("<EntireModel>");
                w.WriteLine("<class num='0' id='BaseClass' abstract='true'/>");
                w.WriteLine("<class num='1' id='ClassA' abstract='false' base='BaseClass'/>");
                w.WriteLine("</EntireModel>");
                w.Flush();
                w.Close();
            }
            IFwMetaDataCache mdc;

            try
            {
                mdc = MetaDataCache.CreateMetaDataCache(bogusDataPathname);
            }
            finally
            {
                FileUtils.Delete(bogusDataPathname);
            }
            // Not good, since a file with that name has already been processed.
            bogusDataPathname = "ReallyGood.xml";
            using (var w = FileUtils.OpenFileForWrite(bogusDataPathname, Encoding.UTF8))
            {
                w.WriteLine("<?xml version='1.0' encoding='utf-8'?>");
                w.WriteLine("<EntireModel>");
                w.WriteLine("<class num='1' id='ClassA' abstract='false' base='BaseClass'/>");
                w.WriteLine("</EntireModel>");
                w.Flush();
                w.Close();
            }
            try
            {
                mdc.InitXml(bogusDataPathname, false);
            }
            finally
            {
                FileUtils.Delete(bogusDataPathname);
            }
        }
Esempio n. 28
0
        private MDQuery_Request CreateZGDQueryRequest(string _dh, DateTime _sdate, DateTime _edate)
        {
            string                 _qvName = "HG_GDFS.海关报关单";
            MDModel_QueryModel     _qv     = MetaDataCache.GetQueryModelDefine(_qvName);
            MC_QueryRequsetFactory _rf     = new MC_QueryRequsetFactory();

            _rf.QueryModelName = _qvName;
            //加条件
            MDQuery_ConditionItem _cItem = new MDQuery_ConditionItem();

            _cItem.ColumnIndex = "1";
            _cItem.Column      = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("VOYAGE_NO"));
            _cItem.Operator    = "等于";
            _cItem.Values      = new List <string>();
            _cItem.Values.Add(_dh);
            _rf.AddConditonItem(_cItem);

            _cItem             = new MDQuery_ConditionItem();
            _cItem.ColumnIndex = "2";
            _cItem.Column      = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("D_DATE"));
            _cItem.Operator    = "时间段";
            _cItem.Values      = new List <string>();
            _cItem.Values.Add(_sdate.ToString("yyyyMMdd"));
            _cItem.Values.Add(_edate.ToString("yyyyMMdd"));
            _rf.AddConditonItem(_cItem);
            _rf.AddExpression("1*2");

            //加结果
            _rf.AddResultTable(_qv.MainTable);
            foreach (MDModel_Table_Column _tc in _qv.MainTable.Columns)
            {
                _rf.AddResultTableColumn(_qv.MainTable, _tc);
            }
            foreach (string _cTName in _qv.ChildTableDict.Keys)
            {
                MDModel_Table _ctable = _qv.ChildTableDict[_cTName];
                _rf.AddResultTable(_ctable);
                foreach (MDModel_Table_Column _ccol in _ctable.Columns)
                {
                    _rf.AddResultTableColumn(_ctable, _ccol);
                }
            }
            return(_rf.GetQueryRequest());
        }
Esempio n. 29
0
 public CloneSnapshot(Snapshot snapshot, Blockchain blockchain)
     : base(blockchain)
 {
     this.PersistingBlock = snapshot.PersistingBlock;
     this.Blocks          = snapshot.Blocks.CreateSnapshot();
     this.Transactions    = snapshot.Transactions.CreateSnapshot();
     this.Accounts        = snapshot.Accounts.CreateSnapshot();
     this.AppChains       = snapshot.AppChains.CreateSnapshot();
     this.UnspentCoins    = snapshot.UnspentCoins.CreateSnapshot();
     this.SpentCoins      = snapshot.SpentCoins.CreateSnapshot();
     this.Validators      = snapshot.Validators.CreateSnapshot();
     this.Assets          = snapshot.Assets.CreateSnapshot();
     this.Contracts       = snapshot.Contracts.CreateSnapshot();
     this.Storages        = snapshot.Storages.CreateSnapshot();
     this.HeaderHashList  = snapshot.HeaderHashList.CreateSnapshot();
     this.ValidatorsCount = snapshot.ValidatorsCount.CreateSnapshot();
     this.BlockHashIndex  = snapshot.BlockHashIndex.CreateSnapshot();
     this.HeaderHashIndex = snapshot.HeaderHashIndex.CreateSnapshot();
 }
Esempio n. 30
0
        public void CreateMetaDataCacheNotXMLData()
        {
            // <?xml version="1.0" encoding="utf-8"?>
            const string bogusDataPathname = "Bogus.txt";

            using (var w = FileUtils.OpenFileForWrite(bogusDataPathname, Encoding.UTF8))
            {
                w.WriteLine("Non-XML data");
                w.Flush();
                w.Close();
            }
            try
            {
                MetaDataCache.CreateMetaDataCache(bogusDataPathname);
            }
            finally
            {
                FileUtils.Delete(bogusDataPathname);
            }
        }