public int Callback(string mqId) { var filter = TableFilter.New().Equals("id", mqId); var eventEntity = _DataAccess.Query(WFTEventEntity.TableCode).FixField("*").Where(filter).QueryFirst <WFTEventEntity>(); if (eventEntity == null) { throw new Exception($"回调任务{mqId}不存在"); } if (eventEntity.ProcessDate == DateTime.MinValue) { throw new Exception($"回到任务会处理完毕,请稍后回调"); } var tinsEntity = _WFTask.GetTinsById(eventEntity.Tinsid); var taskEntity = _WFTask.GetTaskById(eventEntity.Taskid); var fins = _WorkFlowIns.GetFlowInstance(eventEntity.Finsid); var bisJsonData = GetBisData(taskEntity, eventEntity.Dataid, fins.ServiceId, eventEntity.Tinsid, out bool isMultipleNextTask); var nextTasks = _WFTask.GetNextTasks(taskEntity, tinsEntity, bisJsonData); if (nextTasks.Length != 1) { throw new Exception("流程配置错误,下个任务节点数量必须是1"); } taskEntity.ReplaceTemplateInfo(bisJsonData); using (var tran = TransHelper.BeginTrans()) { //1、更新任务实例状态 eventEntity.State = EDBEntityState.Modified; eventEntity.Waitcallback = 0; eventEntity.Callbackdate = DateTime.Now; _DataAccess.Update(eventEntity); tinsEntity.State = EDBEntityState.Modified; tinsEntity.Edate = DateTime.Now; _DataAccess.Update(tinsEntity); //2、找下个任务节点,并流转,回调节点不应该有多个下个节点 //如果下一个节点是聚合节点,则需要加锁,防止与回调冲突。默认等待10S if (nextTasks[0].Type == ETaskType.JuHe) { var lockKey = $"{MutexConfig.WORKFLOWLOCKPRE}{fins.Dataid}"; var success = ExeWithLock(lockKey, MutexConfig.WORKFLOWLOCKTIMEOUT, () => { ExeNextTask(fins, nextTasks); tran.Commit(); }); if (!success) { throw new Exception($"未获取独占锁,请重试,dataid:{fins.Dataid }"); } } else { ExeNextTask(fins, nextTasks); tran.Commit(); } } return(1); }
public void Save() { var purchase = new PurchaseModel { PurchaseID = _view.PurchaseID, Tgl = _view.Tgl, Jam = _view.Jam, SupplierID = _view.SupplierID, SupplierName = _view.SupplierName, Keterangan = _view.Catatan, TotalHarga = _view.Total, Diskon = _view.DiskonLain, BiayaLain = _view.BiayaLain, GrandTotal = _view.GrandTotal, ListBrg = _view.ListBrg, IsClosed = _view.IsClosedPO }; purchase.ListBrg = purchase.ListBrg.Where(x => x.BrgID != "").ToList(); using (var trans = TransHelper.NewScope()) { var result = _purchaseBL.Save(purchase); var result2 = _bpPurchaseBL.Generate(result); trans.Complete(); } }
public void Save() { var repack = new RepackModel { RepackID = _view.RepackID, Tgl = _view.Tgl, Jam = _view.Jam, BPStokID = _view.BPStokID, BrgIDMaterial = _view.BrgIDMaterial, BrgNameMaterial = _view.BrgNameMaterial, QtyMaterial = _view.QtyMaterial, HppMaterial = _view.HppMaterial, BrgIDHasil = _view.BrgIDHasil, BrgNameHasil = _view.BrgIDHasil, QtyHasil = _view.QtyHasil, HppHasil = _view.HppHasil, SlotControl = _view.SlotControl }; using (var trans = TransHelper.NewScope()) { var result = _repackBL.Save(repack); var result2 = _bpStokBL.Generate(result); trans.Complete(); } }
private void Save() { var kasBon = new KasBonModel { KasBonID = BiayaIDText.Text, Tgl = TglText.Value.ToString("dd-MM-yyyy"), Jam = JamText.Text, PihakKeduaID = PihakKeduaCombo.SelectedValue.ToString(), JenisKasID = JenisKasCombo.SelectedValue.ToString(), Keterangan = KeteranganText.Text, NilaiKasBon = NilIText.Value }; using (var trans = TransHelper.NewScope()) { var result = _kasBonBL.Save(kasBon); try { _bpKasBL.Generate(result); _bpPiutangBL.GenPiutang(result); } catch (ArgumentException ex) { MessageBox.Show(ex.Message); } trans.Complete(); } }
private void Save() { var returDeposit = new ReturDepositModel { ReturDepositID = ReturDepositIDText.Text, Tgl = TglText.Value.ToString("dd-MM-yyyy"), Jam = JamText.Text, DepositID = DepositIDText.Text, JenisKasID = JenisKasCombo.SelectedValue.ToString(), Catatan = KeteranganReturDepositText.Text, NilaiSisaDeposit = SisaDepositText.Value, NilaiReturDeposit = NilaiReturText.Value }; var deposit = _depositBL.GetData(returDeposit.DepositID); using (var trans = TransHelper.NewScope()) { var result = _returDepositBL.Save(returDeposit); var bpKas = _bpKasBL.Generate(returDeposit); var bpHutang = _bpHutangBL.GenHutang(returDeposit, deposit); trans.Complete(); } }
public void ListDataTest() { using (var trans = TransHelper.NewScope()) { // arrange var expected1 = StokAdjustmentDataFactory(); var expected2 = expected1.CloneObject(); expected2.StokAdjustmentID = "A2"; var expected = new List<StokAdjustmentModel> { expected1, expected2 }; _stokAdjustmentDal.Insert(expected1); _stokAdjustmentDal.Insert(expected2); // act var actual = _stokAdjustmentDal.ListData(expected1.TglTrs, expected2.TglTrs); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.ListBrg)); } }
public CustomerModel Save(CustomerModel customer) { if (customer == null) { throw new ArgumentNullException(nameof(customer)); } // validate nama if (customer.CustomerName.Trim() == "") { throw new ArgumentException("CustomerName kosong"); } using (var trans = TransHelper.NewScope()) { if (customer.CustomerID.Trim() == "") { customer.CustomerID = GenNewID(); } _customerDal.Delete(customer.CustomerID); _customerDal.Insert(customer); _pihakKeduaBL.Save(customer); trans.Complete(); } return(customer); }
public void ListData_ValidData_NoEx() { using (var trans = TransHelper.NewScope()) { // arrange var item1 = DepositDataFactory(); _depositDal.Insert(item1); var item2 = item1.CloneObject(); item2.DepositID = "A2"; _depositDal.Insert(item2); var expected = new List <DepositModel> { item1, item2 }; // act var actual = _depositDal.ListData("17-02-2019", "17-02-2019"); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.PihakKeduaName) .Excluding(x => x.JenisBayarName)); } }
public void ListDataTest() { using (var trans = TransHelper.NewScope()) { // arrange var expected1 = StokInOutDataFactory(); _stokInOutDal.Insert(expected1); var expected2 = StokInOutDataFactory2(); expected2.StokInID = expected1.StokInID; _stokInOutDal.Insert(expected2); var expected = new List <StokInOutModel> { expected1, expected2 }; // act var actual = _stokInOutDal.ListData(expected1.StokInID); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.BrgName) .Excluding(x => x.JenisMutasiName)); } }
public void Save() { var orderJual = new OrderJualModel { OrderJualID = _view.OrderJualID, TglOrderJual = _view.TglOrderJual, JamOrderJual = _view.JamOrderJual, CustomerID = _view.CustomerID, BuyerName = _view.BuyerName, Alamat = _view.Alamat, NoTelp = _view.NoTelpon, Catatan = _view.Catatan, NilaiTotal = _view.NilaiTotal, NilaiDiskonLain = _view.NilaiDiskonLain, NilaiBiayaLain = _view.NilaiBiayaLain, NilaiGrandTotal = _view.NilaiGrandTotal, }; orderJual.ListBrg = orderJual.ListBrg.Where(x => x.BrgID != "").ToList(); using (var trans = TransHelper.NewScope()) { var result = _orderJualBL.Save(orderJual); trans.Complete(); } }
public void ListData_ValidData_NoEx() { using (var trans = TransHelper.NewScope()) { // arrange var item1 = BrgDataFactory(); _brgDal.Insert(item1); var item2 = Brg2DataFactory(); _brgDal.Insert(item2); var expected = new List <BrgModel> { item1, item2 }; // act var actual = _brgDal.ListData(); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.SubJenisBrgName) .Excluding(x => x.ColorName) .Excluding(x => x.MerkName) .Excluding(x => x.CreateTimestamp) .Excluding(x => x.UpdateTimestamp) .Excluding(x => x.JenisBrgID) .Excluding(x => x.JenisBrgName)); } }
private bool SellItem(MsgInformationEx MsgDTO, DriftBottleItemModel item, int count = 1) { var record = ItemCollectionRecord.Get(MsgDTO.FromQQ); if (!record.CheckItem(item.Name, count)) { MsgSender.PushMsg(MsgDTO, "你的背包里没有足够多的该物品!"); return(false); } var price = HonorSvc.GetItemPrice(item, MsgDTO.FromQQ); var msg = $"贩卖 {item.Name}*{count} 将获得 {(price * count).CurencyFormat()},是否确认贩卖?"; if (!WaiterSvc.WaitForConfirm(MsgDTO, msg)) { MsgSender.PushMsg(MsgDTO, "交易取消!"); return(false); } var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ); TransHelper.SellItemToShop(item.Name, osPerson, count); osPerson.Update(); MsgSender.PushMsg(MsgDTO, $"贩卖成功!你当前拥有金币 {osPerson.Golds.CurencyFormat()}"); return(true); }
public void ListData_ValidData_NoEx() { using (var trans = TransHelper.NewScope()) { // arrange var item1 = BukuKasDataFactory(); _jenisTrsKasirDal.Insert(item1); var item2 = item1.CloneObject(); item2.BukuKasID = "A2"; _jenisTrsKasirDal.Insert(item2); var expected = new List <BukuKasModel> { item1, item2 }; // act var actual = _jenisTrsKasirDal.ListData(item1.TglBuku, item1.TglBuku); // assert // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.PihakKetigaName) .Excluding(x => x.JenisTrsKasirName)); } }
public void GenLunasPiutangCancel(LunasPiutangModel lunasPiutang) { using (var trans = TransHelper.NewScope()) { foreach (var item in lunasPiutang.ListPiutangBayar) { // ambil data bpPiutang var bpPiutang = this.GetData(item.PiutangID); if (bpPiutang.ListLunas == null) continue; // ubah ienumerable => list (biar bisa di-remove) var listLunas = new List<BPPiutangDetilModel>(); listLunas.AddRange(bpPiutang.ListLunas); // cari item pelunasannya var pelunasan = listLunas.Find(x => x.ReffID == lunasPiutang.LunasPiutangID); // escape point if (pelunasan == null) continue; // remove listLunas.Remove(pelunasan); bpPiutang.ListLunas = listLunas; // proses this.Save(bpPiutang); } trans.Complete(); } }
public void 雹() { var record = ItemCollectionRecord.Get(SelfQQNum); if (record.HonorCollections.IsNullOrEmpty()) { MsgSender.PushMsg(GroupNum, 0, "你没有任何物品", BindAi); return; } var commonItems = record.HonorCollections.Where(p => p.Value.Type == HonorType.Normal).SelectMany(p => p.Value.Items).ToList(); if (commonItems.IsNullOrEmpty()) { MsgSender.PushMsg(GroupNum, 0, "你没有任何非限定物品", BindAi); return; } var(key, _) = commonItems.RandElement(); var osPerson = OSPerson.GetPerson(SelfQQNum); TransHelper.SellItemToShop(key, osPerson); osPerson.Update(); MsgSender.PushMsg(GroupNum, 0, $"你贩卖了 {key}\r\n你当前拥有金币 {osPerson.Golds}", BindAi); }
public void ListDataTest() { using (var trans = TransHelper.NewScope()) { // arrange var expected1 = ReturDepositDataFactory(); _returDepositDal.Insert(expected1); var expected2 = expected1.CloneObject(); expected2.ReturDepositID = "A2"; _returDepositDal.Insert(expected2); var expected = new List <ReturDepositModel> { expected1, expected2 }; // act var actual = _returDepositDal.ListData(expected1.Tgl, expected1.Tgl); // assert actual.Should().BeEquivalentTo(expected, config => config .Excluding(x => x.PihakKeduaName) .Excluding(x => x.JenisKasName)); } }
private int Run(WFTEventEntity eventEntity) { var taskEntity = _WFTask.GetTaskById(eventEntity.Taskid); var taskSetting = _WFTask.GetTaskInfo(taskEntity); var tinsEntity = _WFTask.GetTinsById(eventEntity.Tinsid); var fins = _WorkFlowIns.GetFlowInstance(eventEntity.Finsid); var bisJsonData = GetBisData(taskEntity, eventEntity.Dataid, fins.ServiceId, eventEntity.Tinsid, out bool isMultipleNextTask); if (isMultipleNextTask && string.IsNullOrWhiteSpace(bisJsonData)) { throw new Exception("获取远端数据异常,请检查远端应用是否正常 "); } taskEntity.ReplaceTemplateInfo(bisJsonData); using (var tran = TransHelper.BeginTrans()) { //1、执行具体任务,并更新信息 var continueRun = taskSetting.RunTask(taskEntity, fins, tinsEntity, eventEntity); eventEntity.State = EDBEntityState.Modified; eventEntity.Status = 1; eventEntity.ProcessDate = DateTime.Now; _DataAccess.Update(eventEntity); if (continueRun) { //2、更新任务实例 tinsEntity.State = EDBEntityState.Modified; tinsEntity.Edate = DateTime.Now; _DataAccess.Update(tinsEntity); //3、生成下一个节点任务实例、并执行流转 var nextTasks = _WFTask.GetNextTasks(taskEntity, tinsEntity, bisJsonData); //如果下一个节点是聚合节点,则需要加锁,防止与回调冲突。默认等待10S if (nextTasks.Length == 1 && nextTasks[0].Type == ETaskType.JuHe) { var lockKey = $"{MutexConfig.WORKFLOWLOCKPRE}{fins.Dataid}"; var success = ExeWithLock(lockKey, MutexConfig.WORKFLOWLOCKTIMEOUT, () => { ExeNextTask(fins, nextTasks); tran.Commit(); }); if (!success) { throw new Exception($"未获取独占锁,请重试,dataid:{fins.Dataid }"); } } else { ExeNextTask(fins, nextTasks); tran.Commit(); } } else { tran.Commit(); } } return(1); }
public ReturDepositModel Save(ReturDepositModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } // validate depositID var deposit = _depositBL.GetData(model.DepositID); if (deposit == null) { throw new ArgumentException("DepositID invalid"); } else { model.PihakKeduaName = deposit.PihakKeduaName; } // validate jenisKas var jenisKas = _jenisKasBL.GetData(model.JenisKasID); if (jenisKas == null) { throw new ArgumentException("JenisKasID invalid"); } else { model.JenisKasName = jenisKas.JenisKasName; } // cek nilai retur harus antara 0 dan sisa deposit if (model.NilaiReturDeposit > model.NilaiSisaDeposit) { throw new ArgumentException("NilaiReturDeposit Invalid"); } if (model.NilaiReturDeposit <= 0) { throw new ArgumentException("NilaiReturDeposit Invalid minus"); } // proses simpan using (var trans = TransHelper.NewScope()) { if (model.ReturDepositID.Trim() == "") { model.ReturDepositID = GenNewID(); } // hapus data lama _returDepositDal.Delete(model.ReturDepositID); // simpan data baru _returDepositDal.Insert(model); trans.Complete(); } return(model); }
private async Task <JObject> asyncApplyGas(List <string> targetAddress, decimal amount, Dictionary <string, List <Utxo> > dir) { // 转换私钥 byte[] prikey = accountInfo.prikey; byte[] pubkey = accountInfo.pubkey; string address = accountInfo.address; // 获取余额 string id_gas = assetid; //Dictionary<string, List<Utxo>> dir2 = await TransHelper.GetBalanceByAddress(nelJsonRpcUrl, address); if (dir == null || dir[id_gas] == null) { // 余额不足 return(insufficientBalance()); } List <Utxo> balanceUtxo = dir[id_gas]; if (balanceUtxo.Sum(p => p.value) < amount * targetAddress.Count()) { // 余额不足 return(insufficientBalance()); } // 构造并发送交易 ThinNeo.Transaction tran = TransHelper.makeTran(dir[id_gas], targetAddress, new ThinNeo.Hash256(id_gas), amount); tran.type = ThinNeo.TransactionType.ContractTransaction; byte[] msg = tran.GetMessage(); byte[] signdata = ThinNeo.Helper.Sign(msg, prikey); tran.AddWitness(signdata, pubkey, address); string txid = tran.GetHash().ToString(); byte[] data = tran.GetRawData(); string rawdata = ThinNeo.Helper.Bytes2HexString(data); byte[] postdata; try { string url = TransHelper.MakeRpcUrlPost(nelJsonRpcUrl, "sendrawtransaction", out postdata, new MyJson.JsonNode_ValueString(rawdata)); var result = await TransHelper.HttpPost(url, postdata); Console.WriteLine("result:" + result); if (JObject.Parse(result)["result"] == null) { return(txFail(txid)); } JObject res = (JObject)(((JArray)(JObject.Parse(result)["result"]))[0]); string flag = res["sendrawtransactionresult"].ToString(); if (flag != "True" && res["txid"].ToString() != txid) { return(txFail(txid)); } return(txSucc(txid)); } catch (Exception) { return(txFail(txid)); } }
public void 雾雨() { var sellingItems = TransHelper.GetDailySellItems(); var item = sellingItems.RandElement(); var record = ItemCollectionRecord.Get(SelfQQNum); var msg = record.ItemIncome(item.Name); MsgSender.PushMsg(GroupNum, 0, $"你获得了:{item.Name}\r\n{msg}", BindAi); }
public void Void(string id) { using (var trans = TransHelper.NewScope()) { _stokAdjustment2Dal.Delete(id); _stokAdjustmentDal.Delete(id); trans.Complete(); } }
public void Delete(string id) { using (var trans = TransHelper.NewScope()) { _lunasPiutangDetilDal.Delete(id); _lunasPiutangDal.Delete(id); trans.Complete(); } }
public bool Buy(MsgInformationEx MsgDTO, object[] param) { var name = param[0] as string; var vipSvc = DailyVipShopSvc[name]; if (vipSvc != null) { DailyVipShopSvc.Serve(MsgDTO, name); return(false); } if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "快晴")) { MsgSender.PushMsg(MsgDTO, "你无法进行该操作!(快晴)"); return(false); } var sellingItems = TransHelper.GetDailySellItems(); var todayRec = DailySellItemRareRecord.GetToday(); if (DateTime.Now.Hour >= todayRec.Hour && DateTime.Now.Hour <= todayRec.Hour + 2) { sellingItems = sellingItems.Concat(todayRec.Items); } var sellItem = sellingItems.FirstOrDefault(si => si.Name == name); if (sellItem == null) { MsgSender.PushMsg(MsgDTO, "此物品未在商店中售卖!"); return(false); } var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ); if (osPerson.Golds < sellItem.Price) { MsgSender.PushMsg(MsgDTO, "你持有的金币不足以购买此物品!"); return(false); } var price = OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "极光") ? sellItem.Price * 80 / 100 : sellItem.Price; if (!WaiterSvc.WaitForConfirm_Gold(MsgDTO, price)) { MsgSender.PushMsg(MsgDTO, "交易取消!"); return(false); } var record = ItemCollectionRecord.Get(MsgDTO.FromQQ); var incomeMsg = record.ItemIncome(sellItem.Name); OSPerson.GoldConsume(osPerson.QQNum, price); MsgSender.PushMsg(MsgDTO, $"{incomeMsg}\r\n购买成功!你当前剩余的金币为 {(osPerson.Golds - sellItem.Price).CurencyFormat()}"); return(true); }
public void Void(string id) { using (var trans = TransHelper.NewScope()) { _penjualan2Dal.Delete(id); _penjualanDal.Delete(id); trans.Complete(); } }
public SuratDinasModel Propose(SuratDinasAddDto suratDinas) { // CHECK ARGUMENT suratDinas.Empty().Throw("Data Surat Dinas kosong"); // CONVERT DTO >> MODEL var sd = new SuratDinasModel { TglJamCreate = DateTime.Now, PegID = suratDinas.PegID, NoSurat = suratDinas.NoSurat, NoKontrak = suratDinas.NoKontrak, TglMulai = suratDinas.TglMulai, TglSelesai = suratDinas.TglSelesai, Keperluan = suratDinas.Keperluan, TransportID = suratDinas.TransportID, KMAwal = suratDinas.KMAwal, RSID = suratDinas.RSID, JenisBiayaID = suratDinas.JenisBiayaID, KasBon = suratDinas.KasBon, ListApproval = from c in suratDinas.ListApproval select new SuratDinasApprovalModel { PegID = c.PegID, ApprovalTypeID = c.ApprovalTypeID, } }; // VALIDATE MODEL Validate(sd); // UPDATE REPO using (var trans = TransHelper.NewScope()) { // generate id sd.SuratDinasID = _paramNoBL.GenNewID("LG", ParamNoLengthEnum.Code_13); foreach (var item in sd.ListApproval) { item.SuratDinasID = sd.SuratDinasID; } // insert ke db _suratDinasDal.Insert(sd); _suratDinasApprovalDal.Delete(sd); foreach (var item in sd.ListApproval) { _suratDinasApprovalDal.Insert(item); } // commit changes trans.Complete(); } return(sd); }
public void Delete(string id) { using (var trans = TransHelper.NewScope()) { _customerDal.Delete(id); _pihakKeduaBL.Delete(id); trans.Complete(); } }
public void Delete(string id) { using (var trans = TransHelper.NewScope()) { _dep.PriceQtyDal.Delete(id); _dep.PriceQtyDal.Delete(id); trans.Complete(); } }
public void Void(string id) { using (var trans = TransHelper.NewScope()) { _orderJual2Dal.Delete(id); _orderJualDal.Delete(id); trans.Complete(); } }
private BPHutangModel Save(BPHutangModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } // validate pihak kedua; var pihakKedua = _pihakKeduaBL.GetData(model.PihakKeduaID); if (pihakKedua == null) { throw new ArgumentException("PihakKeduaID invalid"); } else { model.PihakKeduaName = pihakKedua.PihakKeduaName; } // update nilai total di header model.NilaiHutang = model.ListLunas.Sum(x => x.NilaiHutang); model.NilaiLunas = model.ListLunas.Sum(x => x.NilaiLunas); // nilai pelunasan tidak boleh lebih dari hutang if (model.NilaiLunas > model.NilaiHutang) { throw new ArgumentException("Nilai Pelunasan melebihi hutang"); } // update BPHutangID dan BPHutangDetilID di detil lunas int noUrut = 0; foreach (var item in model.ListLunas.OrderBy(x => x.Tgl.ToTglYMD() + x.Jam)) { noUrut++; item.BPHutangID = model.BPHutangID; item.BPHutangDetilID = model.BPHutangID + '-' + noUrut.ToString().PadLeft(2, '0'); } // delete data lama using (var trans = TransHelper.NewScope()) { _bpHutangDetilDal.Delete(model.BPHutangID); _bpHutangDal.Delete(model.BPHutangID); _bpHutangDal.Insert(model); foreach (var item in model.ListLunas) { _bpHutangDetilDal.Insert(item); } trans.Complete(); } return(model); }
public void DeleteTest() { using (var trans = TransHelper.NewScope()) { // arrange // act _purchaseDal.Delete("A1"); } }
public override FunctionVerifier GetFunctionVerifier(string fileName, TransHelper.TransEnv env, Microsoft.FSharp.Collections.FSharpList<CAST.Top> decls) { Init(env, fileName); decls = env.ApplyTransformers(decls); return new VccFunctionVerifier(this, decls, env); }
public abstract VC.ConditionGeneration.Outcome VerifyImpl(TransHelper.TransEnv env, VC.VCGen vcgen, Implementation impl, Program prog, VerifierCallback reporter);
private void Init(TransHelper.TransEnv env, string filename) { RegisterStopwatches(); foreach (var s in env.Stopwatches) this.RegisterStopwatch(s); Transformers.init(env); Transformers.processPipeOptions(env); options = ((VccOptionWrapper)env.Options).VccOptions; this.BvdModelFileName = options.SaveModelForBvd ? AddOutputDirIfRequested(Path.ChangeExtension(filename, "model")) : null; }
public override void Verify(string fileName, TransHelper.TransEnv env, Microsoft.FSharp.Collections.FSharpList<CAST.Top> decls) { // this really only dumps the code to the .bpl file Init(env, fileName); decls = env.ApplyTransformers(decls); if (options.NoVerification) return; if (env.ShouldContinue) { if (env.Options.AggressivePruning && env.Options.Functions.Count() > 0) { decls = TransUtil.pruneBy(env, env.Options.Functions.First(), decls); } var boogieDecls = Translator.translate(null, env, () => VccCommandLineHost.StandardPrelude(options), decls); var p = TranslateToBoogie(boogieDecls); if (env.ShouldContinue) { try { swSaveBPL.Start(); CommandLineOptions.Install(new CommandLineOptions()); using (var writer = new TokenTextWriter(AddOutputDirIfRequested(Path.ChangeExtension(fileName, ".bpl")))) { p.Emit(writer); } } finally { swSaveBPL.Stop(); } } } }
internal VccFunctionVerifier(VccPlugin parent, Microsoft.FSharp.Collections.FSharpList<CAST.Top> currentDecls, TransHelper.TransEnv env) : base(env, currentDecls) { this.currentDecls = currentDecls; this.parent = parent; this.env = env; if (!this.InitBoogie()) this.env.Error(Token.NoToken, 1000, "Boogie initialization failed."); }