// create new object by index number /// <exception cref="Kirikiri.Tjs2.VariantException"></exception> /// <exception cref="Kirikiri.Tjs2.TJSException"></exception> public override int CreateNewByNum(int flag, int num, Holder<Dispatch2> result, Variant [] param, Dispatch2 objthis) { if (!GetValidity()) { return Error.E_INVALIDOBJECT; } ArrayNI ni = (ArrayNI)objthis.GetNativeInstance(ArrayClass.ClassID); if (ni == null) { return Error.E_NATIVECLASSCRASH; } int membercount = ni.mItems.Count; if (num < 0) { num = membercount + num; } if ((flag & Interface.MEMBERMUSTEXIST) != 0 && (num < 0 || membercount <= num)) { return Error.E_MEMBERNOTFOUND; } Variant val = new Variant((membercount <= num || num < 0) ? VoidValue : ni.mItems [num]); return DefaultCreateNew(flag, val, result, param, objthis); }
public static int ForeachBreak() { LinkedList<Holder> IntList = new LinkedList<Holder>(); for (int i = 1; i < 10; i++) { Holder h = new Holder(); h.value1 = 101 * i; h.value2 = 101 * i; h.value3 = 101 * i; IntList.AddLast(h); } int sum = 0; foreach (var item in IntList) { sum += item.value1; sum = sum + item.value2; sum = sum + item.value3; if (sum > 5000) break; } return sum; }
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception> /// <exception cref="Kirikiri.Tjs2.TJSException"></exception> public override int CreateNew(int flag, string membername, Holder<Dispatch2> result , Variant[] param, Dispatch2 objthis) { // CreateNew Dispatch2 dsp = CreateBaseTJSObject(); // instance initialization //int hr = funcCall( 0, null, null, null, dsp); // add member to dsp // 生成を高速化するためにメンバコピーを特别处理する形で实装 dsp.AddClassInstanveInfo(mClassName); NativeInstance nativeptr = CreateNativeInstance(); dsp.SetNativeInstance(mClassIDInternal, nativeptr); int hr = CopyAllMembers((CustomObject)dsp); if (hr < 0) { return hr; } hr = base.FuncCall(0, mClassName, null, param, dsp); // call constructor // call the constructor if (hr == Error.E_MEMBERNOTFOUND) { hr = Error.S_OK; } // missing constructor is OK ( is this ugly ? ) if (hr >= 0) { result.Set(dsp); } return hr; }
private AttributeCertificateInfo( Asn1Sequence seq) { if (seq.Count < 7 || seq.Count > 9) { throw new ArgumentException("Bad sequence size: " + seq.Count); } this.version = DerInteger.GetInstance(seq[0]); this.holder = Holder.GetInstance(seq[1]); this.issuer = AttCertIssuer.GetInstance(seq[2]); this.signature = AlgorithmIdentifier.GetInstance(seq[3]); this.serialNumber = DerInteger.GetInstance(seq[4]); this.attrCertValidityPeriod = AttCertValidityPeriod.GetInstance(seq[5]); this.attributes = Asn1Sequence.GetInstance(seq[6]); for (int i = 7; i < seq.Count; i++) { Asn1Encodable obj = (Asn1Encodable) seq[i]; if (obj is DerBitString) { this.issuerUniqueID = DerBitString.GetInstance(seq[i]); } else if (obj is Asn1Sequence || obj is X509Extensions) { this.extensions = X509Extensions.GetInstance(seq[i]); } } }
/// <exception cref="System.Exception"></exception> private void AssertNoAccidentalDeletes(bool cascadeOnUpdate, bool cascadeOnDelete ) { DeleteAll(typeof (Holder)); DeleteAll(typeof (Item)); var oc = Fixture().Config().ObjectClass(typeof (Holder )); oc.CascadeOnDelete(cascadeOnDelete); oc.CascadeOnUpdate(cascadeOnUpdate); Reopen(); var item = new Item(); var holder = new Holder(); holder.items = new[] {item}; Db().Store(holder); Db().Commit(); holder.items[0].item = "abrakadabra"; Db().Store(holder); if (!cascadeOnDelete && !cascadeOnUpdate) { // the only case, where we don't cascade Db().Store(holder.items[0]); } Assert.AreEqual(1, CountOccurences(typeof (Item))); Db().Commit(); Assert.AreEqual(1, CountOccurences(typeof (Item))); }
/// <exception cref="System.Exception"></exception> public virtual void TestExceptionInUpdateCallback() { var doThrow = new BooleanByRef(); EventRegistryFactory.ForObjectContainer(Db()).Updated += new _IEventListener4_42(doThrow).OnEvent; var holder = new Holder (); var item = new Item(); Store(holder); Store(item); Commit(); doThrow.value = true; holder.list = new ArrayList(); holder.list.Add(item); try { Db().Store(holder, int.MaxValue); } catch (Exception) { } // rex.printStackTrace(); Checkdb(); Commit(); Checkdb(); Reopen(); Checkdb(); }
public void CallContextPropagation_Thread () { bool passed = false; var t = new Thread (() => { var h = CallContext.GetData (SlotName) as Holder; passed = h == null; CallContext.FreeNamedDataSlot (SlotName); }); t.Start (); t.Join (); Assert.IsTrue (passed, "#1"); var holder = new Holder { Value = "Hello World" }; CallContext.SetData (SlotName, holder); t = new Thread (() => { var h = CallContext.GetData (SlotName) as Holder; passed = h == holder; CallContext.FreeNamedDataSlot (SlotName); }); t.Start (); t.Join (); CallContext.FreeNamedDataSlot (SlotName); Assert.IsTrue (passed, "#2"); }
protected override void Store(IObjectContainerAdapter objectContainer) { var holder = new Holder(); holder._values = CreateValues(); holder._arrays = CreateArrays(); objectContainer.Store(holder); }
private void AddItemsTo(Holder holder, int count) { for (int i = 0; i < count; ++i) { holder.Add(new Item(i)); } }
public AttributeCertificateHolder( X509Name issuerName, BigInteger serialNumber) { holder = new Holder( new IssuerSerial( GenerateGeneralNames(issuerName), new DerInteger(serialNumber))); }
// create new object /// <exception cref="Kirikiri.Tjs2.VariantException"></exception> /// <exception cref="Kirikiri.Tjs2.TJSException"></exception> public override int CreateNew(int flag, string memberName, Holder<Dispatch2> result , Variant[] param, Dispatch2 objThis) { if (IsNumber(memberName, Result)) { return CreateNewByNum(flag, Result[0], result, param, objThis); } return base.CreateNew(flag, memberName, result, param, objThis); }
private object NewHolder(string[] names) { var holder = new Holder (); for (var i = 0; i < names.Length; i++) { holder.Add(new Item(i, names[i])); } return holder; }
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception> /// <exception cref="Kirikiri.Tjs2.VariantException"></exception> public virtual int CreateNewByNum(int flag, int num, Holder<Dispatch2> result, Variant [] param, Dispatch2 objThis) { if (mObject == null) { throw new TJSException(Error.NullAccess); } return mObject.CreateNewByNum(flag, num, result, param, mObjThis != null ? mObjThis : (objThis != null ? objThis : mObject)); }
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception> /// <exception cref="Kirikiri.Tjs2.TJSException"></exception> public override int CreateNew(int flag, string membername, Holder<Dispatch2> result , Variant[] param, Dispatch2 objthis) { int hr = base.CreateNew(flag, membername, result, param, objthis); if (hr == Error.E_MEMBERNOTFOUND && (flag & Interface.MEMBERMUSTEXIST) == 0) { return Error.E_INVALIDTYPE; } // call operation for void return hr; }
public Holder ToHolder () { Holder holder = new Holder (token); holder.number = numero; holder.expiration = validade; holder.cvv = codigoSeguranca; holder.name = nomePortador; return holder; }
public static int ForeachBreak() { LinkedList<Holder> holderList = new LinkedList<Holder>(); for (int i = 1; i < 10; i++) { var p = new Holder(10 * i, 20 * i, 30 * i); holderList.AddLast(p); } var found = FindHolder(holderList); return (found.value1 + found.value2 + found.value3); }
public BankAccount(Holder accountHolder, decimal balance, string bankName, string iban, string bic, string[] cardNumbers) { this.accountHolder = accountHolder; this.balance = balance; this.bankName = bankName; this.iban = iban; this.bic = bic; this.cardNumbers = new string[cardNumbers.Length]; cardNumbers.CopyTo(this.cardNumbers, 0); }
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception> /// <exception cref="Kirikiri.Tjs2.TJSException"></exception> public virtual int CreateNewByNum(int flag, int num, Holder<Dispatch2> result, Variant [] param, Dispatch2 objthis) { Dispatch2 OBJ1 = ((objthis != null) ? (objthis) : (mDispatch1)); int hr = mDispatch1.CreateNewByNum(flag, num, result, param, OBJ1); if (hr == Error.E_MEMBERNOTFOUND && mDispatch1 != mDispatch2) { Dispatch2 OBJ2 = ((objthis != null) ? (objthis) : (mDispatch2)); return mDispatch2.CreateNewByNum(flag, num, result, param, OBJ2); } return hr; }
public void TestSingleFileProtocolHandler() { var filename = new Holder<string>(); using (var protocolHandler = new FileProtocolHandler(Context, "asset", FilenameProtocolHandler, (fn) => "text/html")) using (var window = new Window(Context)) { window.ChromeSend += (w, msg, args) => { if (msg == "filename") filename.Value = args[0]; }; window.NavigateTo("asset://test/foo.html"); WaitFor(filename, "test/foo.html", 5); } }
public AttributeCertificateHolder( X509Certificate cert) { X509Name name; try { name = PrincipalUtilities.GetIssuerX509Principal(cert); } catch (Exception e) { throw new CertificateParsingException(e.Message); } holder = new Holder(new IssuerSerial(GenerateGeneralNames(name), new DerInteger(cert.SerialNumber))); }
public virtual void TestSanity() { Assert.IsTrue(RamUsageEstimator.SizeOf("test string") > RamUsageEstimator.ShallowSizeOfInstance(typeof(string))); Holder holder = new Holder(); holder.Holder_Renamed = new Holder("string2", 5000L); Assert.IsTrue(RamUsageEstimator.SizeOf(holder) > RamUsageEstimator.ShallowSizeOfInstance(typeof(Holder))); Assert.IsTrue(RamUsageEstimator.SizeOf(holder) > RamUsageEstimator.SizeOf(holder.Holder_Renamed)); Assert.IsTrue(RamUsageEstimator.ShallowSizeOfInstance(typeof(HolderSubclass)) >= RamUsageEstimator.ShallowSizeOfInstance(typeof(Holder))); Assert.IsTrue(RamUsageEstimator.ShallowSizeOfInstance(typeof(Holder)) == RamUsageEstimator.ShallowSizeOfInstance(typeof(HolderSubclass2))); string[] strings = new string[] { "test string", "hollow", "catchmaster" }; Assert.IsTrue(RamUsageEstimator.SizeOf(strings) > RamUsageEstimator.ShallowSizeOf(strings)); }
public void RegisterChuzzlePrefab(ChuzzleColor color, Type type, GameObject prefab) { if (holders.Any(x => x.color == color && x.type == type)) { Debug.LogWarning("Already registered: "+color+" : "+type); return; } var holder = new Holder() { color = color, type = type, prefab = prefab }; holders.Add(holder); freeObjects[holder] = new List<GameObject>(); }
static void Main(string[] args) { string firstName = "Georgi"; string middleName = "Georgiev"; string lastName = "Yordanov"; decimal balance = 523.87M; string bankName = "BNP Paribas"; string iban = "CH93 0076 2011 6238 5295 7"; string bic = "DABADKKK"; string[] cardNumbers = new string[] { "1234-5678-9000-0000", "5678-1234-6500-0000", "4321-9876-6540-0000" }; Holder holder = new Holder(firstName, middleName, lastName); BankAccount bankAccount = new BankAccount(holder, balance, bankName, iban, bic, cardNumbers); Console.WriteLine(bankAccount); }
internal static void add(IntPtr instance, Object ptr = null) { Holder holder; if (!mObjectMap.TryGetValue(instance, out holder)) { holder = new Holder(); holder.count = 1; holder.ptr = ptr; mObjectMap.Add(instance, holder); } else { if (holder.ptr == null && ptr != null) holder.ptr = ptr; holder.count++; } }
public long NextId() { long incrementedCurrent = Interlocked.Increment(ref current); if (incrementedCurrent <= currentMax.Value) return incrementedCurrent; lock (generatorLock) { incrementedCurrent = Interlocked.Increment(ref current); if (incrementedCurrent <= currentMax.Value) return incrementedCurrent; if (current > currentMax.Value) { currentMax = new Holder(GetNextMax()); } return Interlocked.Increment(ref current); } }
public static void Run() { var statement = new Holder(@" a elem Integer; b elem Integer; c elem Integer; a^2 + b^2 = c^2; a gcd b = 1; c + a = x; c - a = y ").Statement; Tracer.FlaggedLine("Statement: " + statement.SmartDump(), FilePositionTag.Test); statement = statement.IsolateAndReplace(3); Tracer.FlaggedLine("Statement: " + statement.SmartDump(), FilePositionTag.Test); statement = statement.IsolateAndReplace(3); Tracer.FlaggedLine("Statement: " + statement.SmartDump(), FilePositionTag.Test); statement = statement.IsolateAndReplace(3); Tracer.FlaggedLine("Statement: " + statement.SmartDump(), FilePositionTag.Test); }
private ReplicationHiLo(DocumentDatabase database) { Database = database; // backward compatibility, read the hilo max then delete it, storing the value in the identity val var document = database.Documents.Get(RavenReplicationVersionHiLo, null); if (document == null) { currentMax = new Holder(0); current = 0; return; } var max = document.DataAsJson.Value<long>("Max"); currentMax = new Holder(max); current = max; GetNextMax(); // this saved the new max limit as part of its work database.Documents.Delete(RavenReplicationVersionHiLo, null, null); }
private View HeaderView(DrawerOption option, View view, ViewGroup parent) { Holder holder = null; if (view == null) { LayoutInflater inflater = ((Activity)context).LayoutInflater; holder = new Holder(); view = inflater.Inflate(headerId, parent, false); view.Tag = holder; } else { holder = (Holder)view.Tag; } return view; }
public virtual void TestBasic() { System.String string_Renamed = new System.Text.StringBuilder("test str").ToString(); RamUsageEstimator rue = new RamUsageEstimator(); long size = rue.EstimateRamUsage(string_Renamed); System.Console.Out.WriteLine("size:" + size); string_Renamed = new System.Text.StringBuilder("test strin").ToString(); size = rue.EstimateRamUsage(string_Renamed); System.Console.Out.WriteLine("size:" + size); Holder holder = new Holder(); holder.holder = new Holder("string2", 5000L); size = rue.EstimateRamUsage(holder); System.Console.Out.WriteLine("size:" + size); System.String[] strings = new System.String[]{new System.Text.StringBuilder("test strin").ToString(), new System.Text.StringBuilder("hollow").ToString(), new System.Text.StringBuilder("catchmaster").ToString()}; size = rue.EstimateRamUsage(strings); System.Console.Out.WriteLine("size:" + size); }
public static TokenRequest create(Merchant merchant, Holder holder) { var tokenRequest = new TokenRequest { id = Guid.NewGuid().ToString(), versao = Cielo.VERSION, dadosEc = new DadosEcElement { numero = merchant.id, chave = merchant.key }, dadosPortador = new DadosPortadorElement { numero = holder.number, validade = holder.expiration, nomePortador = holder.name } }; return tokenRequest; }
public ActionResult UploadFile(HttpPostedFileBase fileToCheck, enteredData enteredData) //HttpPostedFileBase FileUpload { if (Request != null) //control generico de existencia de archivo, que se ha seleccionado el archivo { //HttpPostedFileBase file = Request.Files["files"]; //leo el archivo subido por el usuario. Elnombre debe coincidir con el declarado en el la Vista try { if (fileToCheck.ContentLength > 0) //TAMAÑO DEL ARCHIVO MAYOR A 0 BYTES { if (validateFileExtension(fileToCheck)) //extension csv { var fileName = Path.GetFileName(fileToCheck.FileName); var docAux = db.enteredDatas.Where(a => a.nameEnteredData.Equals(fileName)).FirstOrDefault(); if (docAux == null) //si no existe un archivo en la bbdd con el mismo nombre, continúo subiendo { StreamReader csvReader = new StreamReader(fileToCheck.InputStream); Holder hold = validateFileStructure(csvReader, enteredData); //validación de estructura de archivo if (hold.status == true) { int idUser = int.Parse(Session["idSystemUser"].ToString()); var path = Path.Combine(Server.MapPath("~/UploadedFiles/TemporaryFiles"), fileName); fileToCheck.SaveAs(path); string finalName = "ORIGINAL-" + fileName; //Path.GetFileName(fileToCheck.FileName); string finalPath = Path.Combine(Server.MapPath("~/UploadedFiles"), finalName); BackgroundJob.Enqueue(() => saveFileData(fileName, path, finalPath, enteredData, idUser)); //, System.Web.HttpContext.Current)); Session.Add("message", "Upload process started. DO NOT close the website until this process finished!"); Session["error"] = null; Session["notification"] = null; } else { Session["error"] = hold.message; Session["message"] = null; Session["notification"] = null; return(RedirectToAction("UploadFile")); } } else { Session["error"] = "It seems that someone has already upload a file with the same name. Please verify it!"; Session["message"] = null; Session["notification"] = null; return(RedirectToAction("UploadFile")); } } else { Session["error"] = "The file must have an extension .csv"; Session["message"] = null; Session["notification"] = null; } return(RedirectToAction("UploadFile")); } } catch (Exception ex) { Session["error"] = ex.Message + "\nFile upload failed!" + " " + "Please verify that there are no NULL fields"; Session["message"] = null; Session["notification"] = null; return(RedirectToAction("UploadFile")); } } return(RedirectToAction("UploadFile")); }
// Start is called before the first frame update void Start() { chopperHolder = GetComponent <Holder>(); }
/// <summary> /// Initializes a new instance of the <see cref="GoldBankAccount"/> class. /// </summary> /// <param name="holder"> /// Bank account holder. /// </param> /// <param name="accountNumber"> /// Bank account number. /// </param> public GoldBankAccount(Holder holder, string accountNumber) : base(holder, accountNumber) { }
public override void Draw() { Holder.Render(RenderManager.SpriteBatch, HolderArea); Bar.Render(RenderManager.SpriteBatch, BarArea); }
private void ShowChallengeList() { if (ColosseumChallenge.m_CurrentIndex == 0) { this.m_PrevButton.Visible = false; } else { this.m_PrevButton.Visible = true; } int totalCount = COLOSSEUM_CHALLENGE_DATA.GetTotalCount(); int num = totalCount / 8; if (num - 1 == ColosseumChallenge.m_CurrentIndex) { this.m_NextButton.Visible = false; } else { this.m_NextButton.Visible = true; } switch (ColosseumChallenge.m_CurrentIndex) { case 0: { this.m_ExplainText.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1407")); string str = string.Format("UI/pvp/{0}{1}", "practice_01", NrTSingleton <UIDataManager> .Instance.AddFilePath); WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, NkBundleCallBack.UIBundleStackName); wWWItem.SetItemType(ItemType.USER_ASSETB); wWWItem.SetCallback(new PostProcPerItem(this.SetBackImage), "practice_01"); TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true); break; } case 1: { this.m_ExplainText.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1408")); string str2 = string.Format("UI/pvp/{0}{1}", "practice_02", NrTSingleton <UIDataManager> .Instance.AddFilePath); WWWItem wWWItem2 = Holder.TryGetOrCreateBundle(str2 + Option.extAsset, NkBundleCallBack.UIBundleStackName); wWWItem2.SetItemType(ItemType.USER_ASSETB); wWWItem2.SetCallback(new PostProcPerItem(this.SetBackImage), "practice_02"); TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem2, DownGroup.RUNTIME, true); break; } case 2: { this.m_ExplainText.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1409")); string str3 = string.Format("UI/pvp/{0}{1}", "practice_03", NrTSingleton <UIDataManager> .Instance.AddFilePath); WWWItem wWWItem3 = Holder.TryGetOrCreateBundle(str3 + Option.extAsset, NkBundleCallBack.UIBundleStackName); wWWItem3.SetItemType(ItemType.USER_ASSETB); wWWItem3.SetCallback(new PostProcPerItem(this.SetBackImage), "practice_03"); TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem3, DownGroup.RUNTIME, true); break; } } this.m_dicEcoGroupInfo.Clear(); int num2 = ColosseumChallenge.m_CurrentIndex + 1; int num3 = 8 * num2; int num4 = num3 - 8; for (int i = num4; i < num3; i++) { BASE_COLOSSEUM_CHALLENGE_DATA colosseumChallengeData = COLOSSEUM_CHALLENGE_DATA.GetColosseumChallengeData(i); if (colosseumChallengeData != null) { int num5 = i % 8; this.SetEcoHeroinfo(num5, colosseumChallengeData.m_i32EcoIndex, i); this.m_ChallengeControl[num5].m_Name.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface(colosseumChallengeData.m_i32InterfaceKey.ToString())); } } NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo(); long charSubData = myCharInfo.GetCharSubData(eCHAR_SUBDATA.CHAR_SUBDATA_COLOSSEUM_CHALLENGE); int num6; if (charSubData < 8L) { num6 = 0; } else if (charSubData < 16L) { num6 = 1; } else { num6 = 2; } int num7 = (int)charSubData % 8; if (num7 < 0) { return; } if (num6 == ColosseumChallenge.m_CurrentIndex) { this.m_ChallengeControl[num7].m_DisableMark.Visible = false; this.m_ChallengeControl[num7].m_DisableBG.Visible = false; } }
public AttributeCertificateHolder( X509Name principal) { holder = new Holder(GenerateGeneralNames(principal)); }