private static Boolean HexNumberToInt32(ref NumberBuffer number, ref Int32 value) { UInt32 passedValue = 0; Boolean returnValue = HexNumberToUInt32(ref number, ref passedValue); value = (Int32)passedValue; return returnValue; }
/// <summary> /// Converts a <see cref="Int32"/> to big endian notation. /// </summary> /// <param name="input">The <see cref="Int32"/> to convert.</param> /// <returns>The converted <see cref="Int32"/>.</returns> public static Int32 BigEndian(Int32 input) { if (!BitConverter.IsLittleEndian) return input; return Swap(input); }
//Initializes, attaches it to archive internal ZipArchiveEntry(ZipArchive archive, ZipCentralDirectoryFileHeader cd) { _archive = archive; _originallyInArchive = true; _diskNumberStart = cd.DiskNumberStart; _versionToExtract = (ZipVersionNeededValues)cd.VersionNeededToExtract; _generalPurposeBitFlag = (BitFlagValues)cd.GeneralPurposeBitFlag; CompressionMethod = (CompressionMethodValues)cd.CompressionMethod; _lastModified = new DateTimeOffset(ZipHelper.DosTimeToDateTime(cd.LastModified)); _compressedSize = cd.CompressedSize; _uncompressedSize = cd.UncompressedSize; _offsetOfLocalHeader = cd.RelativeOffsetOfLocalHeader; /* we don't know this yet: should be _offsetOfLocalHeader + 30 + _storedEntryNameBytes.Length + extrafieldlength * but entryname/extra length could be different in LH */ _storedOffsetOfCompressedData = null; _crc32 = cd.Crc32; _compressedBytes = null; _storedUncompressedData = null; _currentlyOpenForWrite = false; _everOpenedForWrite = false; _outstandingWriteStream = null; FullName = DecodeEntryName(cd.Filename); _lhUnknownExtraFields = null; //the cd should have these as null if we aren't in Update mode _cdUnknownExtraFields = cd.ExtraFields; _fileComment = cd.FileComment; _compressionLevel = null; }
/// <summary> /// Find suffixes in the pattern. /// </summary> /// <param name="pattern">Pattern for search.</param> /// <returns>Suffix array.</returns> private static Int32[] FindSuffixes(String pattern) { Int32 f = 0, g; Int32 patternLength = pattern.Length; Int32[] suffixes = new Int32[pattern.Length + 1]; suffixes[patternLength - 1] = patternLength; g = patternLength - 1; for (Int32 i = patternLength - 2; i >= 0; --i) { if (i > g && suffixes[i + patternLength - 1 - f] < i - g) { suffixes[i] = suffixes[i + patternLength - 1 - f]; } else { if (i < g) { g = i; } f = i; while (g >= 0 && (pattern[g] == pattern[g + patternLength - 1 - f])) { --g; } suffixes[i] = f - g; } } return suffixes; }
private static void VerifyInt32ImplicitCastToComplex(Int32 value) { Complex c_cast = value; if (false == Support.VerifyRealImaginaryProperties(c_cast, value, 0.0)) { Console.WriteLine("Int32ImplicitCast ({0})" + value); Assert.True(false, "Verification Failed"); } else { if (value != Int32.MaxValue) { Complex c_cast_plus = c_cast + 1; if (false == Support.VerifyRealImaginaryProperties(c_cast_plus, value + 1, 0.0)) { Console.WriteLine("PLuS + Int32ImplicitCast ({0})" + value); Assert.True(false, "Verification Failed"); } } if (value != Int32.MinValue) { Complex c_cast_minus = c_cast - 1; if (false == Support.VerifyRealImaginaryProperties(c_cast_minus, value - 1, 0.0)) { Console.WriteLine("Minus - Int32ImplicitCast + 1 ({0})" + value); Assert.True(false, "Verification Failed"); } } } }
public void Enter() { // If calling thread already owns the lock, increment recursion count and return Int32 threadId = Thread.CurrentThread.ManagedThreadId; if (threadId == m_owningThreadId) { m_recursion++; return; } // The calling thread doesn't own the lock, try to get it SpinWait spinwait = new SpinWait(); for (Int32 spinCount = 0; spinCount < m_spincount; spinCount++) { // If the lock was free, this thread got it; set some state and return if (Interlocked.CompareExchange(ref m_waiters, 1, 0) == 0) goto GotLock; // Black magic: give other threads a chance to run // in hopes that the lock will be released spinwait.SpinOnce(); } // Spinning is over and the lock was still not obtained, try one more time if (Interlocked.Increment(ref m_waiters) > 1) { // Still contention, this thread must wait m_waiterLock.WaitOne(); // Wait for the lock; performance hit // When this thread wakes, it owns the lock; set some state and return } GotLock: // When a thread gets the lock, we record its ID and // indicate that the thread owns the lock once m_owningThreadId = threadId; m_recursion = 1; }
public static Money[] Distribute(this Money money, FractionReceivers fractionReceivers, RoundingPlaces roundingPlaces, Int32 count) { return new MoneyDistributor(money, fractionReceivers, roundingPlaces).Distribute(count); }
public override void Write(Int32 val) { val = Utilities.SwapBytes(val); base.Write(val); if (AutoFlush) Flush(); }
public Document( Int16 _TypeId, Int64 _Serial, Int32 _SignedUser, DateTime _Date, Boolean _Printed, String _DocumentShortName, String _DocumentFullName, String _MedexDataTable, String _DocumentBody, String _DocumentHeader, Boolean _SetDeleted ) { TypeId = _TypeId; Serial = _Serial; SignedUser = _SignedUser; Date = _Date; Printed = _Printed; DocumentShortName = _DocumentShortName; DocumentFullName = _DocumentFullName; MedexDataTable = _MedexDataTable; DocumentBody = _DocumentBody; DocumentHeader = _DocumentHeader; SetDeleted = _SetDeleted; }
private void OnSuggest(IPeerWireClient client, Int32 pieceIndex) { if (SuggestPiece != null) { SuggestPiece(client, pieceIndex); } }
public Task<bool> WaitAsync(Int32 duration, CancellationToken token) { VerboseLog("{0:000}|{1}|async wait requested", Thread.CurrentThread.Id, _id); CheckDisposed(); token.ThrowIfCancellationRequested(); if (_sem.TryAcquire()) { VerboseLog("{0:000}|{1}|async wait immediate success", Thread.CurrentThread.Id,_id); return Task.FromResult(true); } if(duration == 0) return Task.FromResult(false); if (_asyncWaiters == null) { lock (this) { if (_asyncWaiters == null) _asyncWaiters = new ConcurrentLinkedQueue<AsyncWaiter>(); } } AsyncWaiter waiter = new AsyncWaiter(); TaskCompletionSource<bool> task = new TaskCompletionSource<bool>(); waiter.Task = task; if (duration != -1) { waiter.CancelDelay = new CancellationTokenSource(); waiter.Delay = Task.Delay(duration, waiter.CancelDelay.Token); waiter.Delay.ContinueWith(new ActionContinuation(() => TimeoutAsync(waiter))); } if (token != CancellationToken.None) { waiter.CancelRegistration = token.Register(() => CancelAsync(waiter)); } _asyncWaiters.Add(waiter); VerboseLog("{0:000}|{1}|async wait enqued: {2:X}; {3}", Thread.CurrentThread.Id, _id, waiter.GetHashCode(), waiter.Task.Task.Id); if (_wasDisposed || token.IsCancellationRequested || waiter.Delay != null && waiter.Delay.IsCompleted) { // Mitigate the above race where a finishing condition occured // before where able to add our waiter to the waiters list. if (_asyncWaiters.Remove(waiter)) { CleanUpWaiter(waiter); } } return task.Task; }
/// <include file='doc\XmlQualifiedName.uex' path='docs/doc[@for="XmlQualifiedName.GetHashCode"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public override int GetHashCode() { if (_hash == 0) { _hash = Name.GetHashCode() /*+ Namespace.GetHashCode()*/; // for perf reasons we are not taking ns's hashcode. } return _hash; }
public RpcHeader RequestAdd(Int32 a, Int32 b) { var packetId = Interlocked.Increment(ref globalPacketId); return w.Request(() => { w.Write(a); w.Write(b); }, length => new RpcHeader((int)MethodId.Add, (uint)packetId, length)); }
public static UInt32 UInt32(byte[] bytes, Int32 start, Endianness e = Endianness.Machine) { byte[] intBytes = Utils.GetBytes(bytes, start, 4); if (NeedsFlipping(e)) Array.Reverse(intBytes); return BitConverter.ToUInt32(intBytes, 0); }
public static void SetInt32(this Byte[] buffer, Int32 value, Int32 pos) { Byte[] copybuffer; copybuffer = BitConverter.GetBytes(value); Array.Reverse(copybuffer); Array.Copy(copybuffer, 0, buffer, pos, 4); }
public AnnounceInfo(IEnumerable<EndPoint> peers, Int32 a, Int32 b, Int32 c) { Peers = peers; WaitTime = a; Seeders = b; Leachers = c; }
public static byte[] Int32(Int32 i, Endianness e = Endianness.Machine) { byte[] bytes = BitConverter.GetBytes(i); if (NeedsFlipping(e)) Array.Reverse(bytes); return bytes; }
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public override int GetHashCode() { // TODO: make sure randomized hashing is enabled by default if (_hash == 0) { _hash = Name.GetHashCode() /*+ Namespace.GetHashCode()*/; // for perf reasons we are not taking ns's hashcode. } return _hash; }
internal RegexTree(RegexNode root, Dictionary<Int32, Int32> caps, Int32[] capnumlist, int captop, Dictionary<String, Int32> capnames, String[] capslist, RegexOptions opts) { _root = root; _caps = caps; _capnumlist = capnumlist; _capnames = capnames; _capslist = capslist; _captop = captop; _options = opts; }
public User(string login, UInt64 passwordHash, Int32 ID) { pLogin = login; pPassword = new Password(passwordHash); pID = ID; pStaticAddressess = new List<UnifiedAddress>(); pDynamicAddressess = new List<UnifiedAddress>(); pCurrentAddress = null; }
public static UInt32 GetUInt32(this Byte[] buffer, Int32 pos) { Byte[] copybuffer; copybuffer = new Byte[4]; Array.Copy(buffer, pos, copybuffer, 0, 4); Array.Reverse(copybuffer); return BitConverter.ToUInt32(copybuffer, 0); }
internal RegexTree(RegexNode root, Hashtable caps, Int32[] capnumlist, int captop, Hashtable capnames, String[] capslist, RegexOptions opts) { _root = root; _caps = caps; _capnumlist = capnumlist; _capnames = capnames; _capslist = capslist; _captop = captop; _options = opts; }
public static void Write(this BinaryWriter writer, Int32 value, bool invertEndian = false) { if (invertEndian) { writer.WriteInvertedBytes(BitConverter.GetBytes(value)); } else { writer.Write(value); } }
public static IBuffer Create(Int32 capacity) { if (capacity < 0) throw new ArgumentOutOfRangeException(nameof(capacity)); Contract.Ensures(Contract.Result<IBuffer>() != null); Contract.Ensures(Contract.Result<IBuffer>().Length == unchecked((UInt32)0)); Contract.Ensures(Contract.Result<IBuffer>().Capacity == unchecked((UInt32)capacity)); Contract.EndContractBlock(); return new WindowsRuntimeBuffer(capacity); }
/// <summary>Returns the next token in <paramref name="str"/> from position <paramref name="start"/>. Barring whitespace, it returns the sequence of characters from <paramref name="start"/> that share the same unicode category.</summary> public static String Tok(this String str, ref Int32 start) { if(start >= str.Length) throw new ArgumentOutOfRangeException("start"); Int32 i = start; StringBuilder sb = new StringBuilder(); Char c = str[i]; // skip whitespace while( i < str.Length ) { c = str[ i ]; if( !Char.IsWhiteSpace( c ) ) break; i++; } if( Char.IsWhiteSpace( c ) ) { start = str.Length; return null; // then it's got some trailing whitespace left, and it's at the end } Boolean doneRadixPoint = false; UnicodeCategory currentCat, initialCat; Char initialChar = c; initialCat = currentCat = Char.GetUnicodeCategory( c ); // special case for ( and ) if( initialChar == '(' || initialChar == ')' ) { start = i + 1; return initialChar.ToString(); } while( i < str.Length && CategoryEquals(initialCat, currentCat) ) { c = str[i]; sb.Append( str[i++] ); if( i >= str.Length ) break; currentCat = Char.GetUnicodeCategory(str, i); // special case exception for radix points, there can only be 1 if( initialCat == UnicodeCategory.DecimalDigitNumber && str[i] == '.' && !doneRadixPoint) { currentCat = UnicodeCategory.DecimalDigitNumber; doneRadixPoint = true; } } start = i; return sb.ToString(); }
public User(String login, string password, Int32 ID) { Random random = new Random(); pLogin = login ; pPassword = new Password(password); pID = ID; pStaticAddressess = new List<UnifiedAddress>(); pDynamicAddressess = new List<UnifiedAddress>(); pCurrentAddress = null; }
public static void SetColor(this Byte[] buffer, Color value, Int32 pos) { Byte[] copybuffer; copybuffer = new Byte[4]; copybuffer[3] = value.A; copybuffer[0] = value.R; copybuffer[1] = value.G; copybuffer[2] = value.B; Array.Copy(copybuffer, 0, buffer, pos, 4); }
private static String GetPath(String path, Int32 mode) { // 处理路径分隔符,兼容Windows和Linux var sep = Path.DirectorySeparatorChar; var sep2 = sep == '/' ? '\\' : '/'; path = path.Replace(sep2, sep); var dir = ""; switch (mode) { case 1: dir = BaseDirectory; break; case 2: dir = AppDomain.CurrentDomain.BaseDirectory; break; case 3: dir = Environment.CurrentDirectory; break; default: break; } if (dir.IsNullOrEmpty()) return Path.GetFullPath(path); // 考虑兼容Linux if (!NewLife.Runtime.Mono) { //if (!Path.IsPathRooted(path)) //!!! 注意:不能直接依赖于Path.IsPathRooted判断,/和\开头的路径虽然是绝对路径,但是它们不是驱动器级别的绝对路径 if (path[0] == sep || path[0] == sep2 || !Path.IsPathRooted(path)) { path = path.TrimStart('~'); path = path.TrimStart(sep); path = Path.Combine(dir, path); } } else { if (!path.StartsWith(dir)) { // path目录存在,不用再次拼接 if (!Directory.Exists(path)) { path = path.TrimStart(sep); path = Path.Combine(dir, path); } } } return Path.GetFullPath(path); }
public static Color GetColor(this Byte[] buffer, Int32 pos) { Byte[] copybuffer; copybuffer = new Byte[4]; Array.Copy(buffer, pos, copybuffer, 0, 4); return Color.FromArgb( copybuffer[3], copybuffer[0], copybuffer[1], copybuffer[2]); }
public static IBuffer AsBuffer(this Byte[] source, Int32 offset, Int32 length) { if (source == null) throw new ArgumentNullException(nameof(source)); if (offset < 0) throw new ArgumentOutOfRangeException(nameof(offset)); if (length < 0) throw new ArgumentOutOfRangeException(nameof(length)); if (source.Length - offset < length) throw new ArgumentException(SR.Argument_InsufficientArrayElementsAfterOffset); Contract.Ensures(Contract.Result<IBuffer>() != null); Contract.Ensures(Contract.Result<IBuffer>().Length == unchecked((UInt32)length)); Contract.Ensures(Contract.Result<IBuffer>().Capacity == unchecked((UInt32)length)); Contract.EndContractBlock(); return AsBuffer(source, offset, length, length); }
public bool TwipsFromFont(string fontName, Int32 size, Int32 weight, bool italic, bool underline, Int32 cch, string caption, Int32 maxWidthCch, Int32 dx, Int32 dy) { object[] paramsArray = Invoker.ValidateParamsArray(fontName, size, weight, italic, underline, cch, caption, maxWidthCch, dx, dy); object returnItem = Invoker.MethodReturn(this, "TwipsFromFont", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
public ResultObject(Int32 resultNumber, TimeSpan spentTime) { this.resultNumber = resultNumber; this.spentTime = spentTime; }
public void CreateDataPageControl(string dpName, string ctlName, Int32 typ, string section, Int32 sectionType, string appletCode, Int32 x, Int32 y, Int32 dx, Int32 dy) { object[] paramsArray = Invoker.ValidateParamsArray(dpName, ctlName, typ, section, sectionType, appletCode, x, y, dx, dy); Invoker.Method(this, "CreateDataPageControl", paramsArray); }
public NetOffice.MSHTMLApi.IHTMLElement2 item(Int32 index) { return(Factory.ExecuteBaseReferenceMethodGet <NetOffice.MSHTMLApi.IHTMLElement2>(this, "item", index)); }
private void ProcessFrame(object sender, EventArgs arg) { Image<Bgr, Byte> ImageFrame = this.cameracapture.getFrame(); if (ImageFrame != null) { countframes += 1; Image<Gray, byte> grayframe = cameracapture.getGrayFrame(ImageFrame); grayframe._EqualizeHist(); MCvAvgComp[][] facesDetected = this.face.detectFace(grayframe, haarface); if (facesDetected[0].Length == 1) { MCvAvgComp face = facesDetected[0][0]; //Set the region of interest on the faces // Our Region of interest where find eyes will start with a sample estimation using face metric Int32 yCoordStartSearchEyes = face.rect.Top + (face.rect.Height * 3 / 11); Point startingPointSearchEyes = new Point(face.rect.X, yCoordStartSearchEyes); Point endingPointSearchEyes = new Point((face.rect.X + face.rect.Width), yCoordStartSearchEyes); Size searchEyesAreaSize = new Size(face.rect.Width, (face.rect.Height * 2 / 9)); Point lowerEyesPointOptimized = new Point(face.rect.X, yCoordStartSearchEyes + searchEyesAreaSize.Height); Size eyeAreaSize = new Size(face.rect.Width / 2, (face.rect.Height * 2 / 9)); Point startingLeftEyePointOptimized = new Point(face.rect.X + face.rect.Width / 2, yCoordStartSearchEyes); Rectangle possibleROI_eyes = new Rectangle(startingPointSearchEyes, searchEyesAreaSize); Rectangle possibleROI_rightEye = new Rectangle(startingPointSearchEyes, eyeAreaSize); Rectangle possibleROI_leftEye = new Rectangle(startingLeftEyePointOptimized, eyeAreaSize); grayframe.ROI = possibleROI_leftEye; MCvAvgComp[][] leftEyesDetected = this.eye.detectEyes(grayframe, haareyes); grayframe.ROI = Rectangle.Empty; grayframe.ROI = possibleROI_rightEye; MCvAvgComp[][] rightEyesDetected = this.eye.detectEyes(grayframe, haareyes); grayframe.ROI = Rectangle.Empty; //If we are able to find eyes inside the possible face, it should be a face, maybe we find also a couple of eyes if (leftEyesDetected[0].Length != 0 && rightEyesDetected[0].Length != 0) { eyes_count += 1; //draw the face ImageFrame.Draw(face.rect, new Bgr(Color.Red), 2); MCvAvgComp eyeLeft = leftEyesDetected[0][0]; MCvAvgComp eyeRight = leftEyesDetected[0][0]; // Draw the Left Eye Rectangle eyeRectL = eyeLeft.rect; eyeRectL.Offset(startingLeftEyePointOptimized.X, startingLeftEyePointOptimized.Y); ImageFrame.Draw(eyeRectL, new Bgr(Color.Red), 2); //Draw the Right Eye Rectangle eyeRectR = eyeRight.rect; eyeRectR.Offset(startingPointSearchEyes.X, startingPointSearchEyes.Y); ImageFrame.Draw(eyeRectR, new Bgr(Color.Red), 2); } imageBox1.Image = ImageFrame; } } }
public bool FIsFEWch(Int32 wch) { object[] paramsArray = Invoker.ValidateParamsArray(wch); object returnItem = Invoker.MethodReturn(this, "FIsFEWch", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
public void SetWizGlob(Int32 lWhich, object vValue) { object[] paramsArray = Invoker.ValidateParamsArray(lWhich, vValue); Invoker.Method(this, "SetWizGlob", paramsArray); }
protected void DataGridRicerca_PageIndexChanged_1(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) { ///Imposto la Nuova Pagina this.DataGridRicerca.CurrentPageIndex = e.NewPageIndex; this.Ricerca(Int32.Parse(this.wo_id)); }
public Int32 OpenScript(string script, string label, Int32 openMode, Int32 extra, Int32 version) { object[] paramsArray = Invoker.ValidateParamsArray(script, label, openMode, extra, version); object returnItem = Invoker.MethodReturn(this, "OpenScript", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); }
/// <summary> /// Sets the status code by providing the integer value. /// </summary> /// <param name="code">The integer representing the code.</param> /// <returns>The current instance.</returns> public VirtualResponse Status(Int32 code) { return(Status((HttpStatusCode)code)); }
public void Delete(Int32 index) { object[] paramArray = new object[1]; paramArray[0] = index; Invoker.Method(this, "Delete", paramArray); }
public Boolean runTest() { Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; String strBaseLoc = "Loc_0000oo_"; Int32 in4a = (Int32)0; Int32 in4b = (Int32)0; String strOut = null; String str2 = null; Int32[] in4TestValues = { Int32.MinValue, -1000, -99, -5, -0, 0, 5, 13, 101, 1000, Int32.MaxValue }; NumberFormatInfo nfi1 = new NumberFormatInfo(); nfi1.CurrencySymbol = "&"; nfi1.CurrencyDecimalDigits = 3; nfi1.NegativeSign = "^"; nfi1.NumberDecimalDigits = 3; try { LABEL_860_GENERAL: do { strBaseLoc = "Loc_1100ds_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_293qu! , i==" + i + " in4a==" + in4a); } } strBaseLoc = "Loc_1200er_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("G", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_347ew! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_1300we_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("G10", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_349ex! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_1400fs_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("C", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_832ee! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_1500ez_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("C4", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_273oi! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_1600nd_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("D", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_901sn! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_1700eu_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("D4", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_172sn! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_1800ns_"; for (int i = 1; i < in4TestValues.Length - 1; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("E", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_347sq! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_1900wq_"; for (int i = 1; i < in4TestValues.Length - 1; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("e4", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_873op! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_2000ne_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("N", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_129we! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_2100qu_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("N4", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_321sj! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_2500qi_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("F", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_815jd! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strBaseLoc = "Loc_2600qi_"; for (int i = 0; i < in4TestValues.Length; i++) { strLoc = strBaseLoc + i.ToString(); iCountTestcases++; strOut = in4TestValues[i].ToString("F4", nfi1); in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); if (in4a != in4TestValues[i]) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_193jd! , i==" + i + " in4a==" + in4a + " strOut==" + strOut); } } strOut = null; iCountTestcases++; try { in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_273qp! , in4a==" + in4a); } catch (ArgumentException aExc) {} catch (Exception exc) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_982qo! ,exc==" + exc); } strOut = "2147483648"; iCountTestcases++; try { in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_481sm! , in4a==" + in4a); } catch (OverflowException fExc) {} catch (Exception exc) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_523eu! ,exc==" + exc); } strOut = "-2147483649"; iCountTestcases++; try { in4a = Int32.Parse(strOut, NumberStyles.Any, nfi1); iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_382er! ,in4a==" + in4a); } catch (FormatException fExc) {} catch (Exception exc) { iCountErrors++; Console.WriteLine(s_strTFAbbrev + "Err_371jy! ,exc==" + exc); } } while (false); } catch (Exception exc_general) { ++iCountErrors; Console.WriteLine(s_strTFAbbrev + " Error Err_8888yyy! strLoc==" + strLoc + ", exc_general==" + exc_general); } if (iCountErrors == 0) { Console.Error.WriteLine("paSs. " + s_strTFPath + " " + s_strTFName + " ,iCountTestcases==" + iCountTestcases); return(true); } else { Console.Error.WriteLine("FAiL! " + s_strTFPath + " " + s_strTFName + " ,iCountErrors==" + iCountErrors + " , BugNums?: " + s_strActiveBugNums); return(false); } }
public Pago(Int32 id, Int32 id_colaborador, DateTime fecha, Decimal salarioBruto, Decimal salarioNeto, Decimal rebajo, Decimal horasLaboradas, Decimal horasExtra, String transferencia, Boolean estado, Decimal bono, Boolean proceso, Decimal vacaciones, Decimal aguinaldo, Decimal adelanto, Decimal seguro, Int32 id_planilla) { this.Id = id; this.Id_colaborador = id_colaborador; this.FechaPago = fecha; this.SalarioBruto = salarioBruto; this.SalarioNeto = salarioNeto; this.Rebajo = rebajo; this.HorasLaboradas = horasLaboradas; this.HorasExtra = horasExtra; this.TransferenciaPago = transferencia; this.EstadoPago = estado; this.Bono = bono; this.ProcesoPago = proceso; this.Vacaciones = vacaciones; this.Aguinaldo = aguinaldo; this.Adelanto = adelanto; this.Seguro = seguro; this.Id_planilla = id_planilla; }
static public Mp4BoxMDHD CreateMDHDBox(DateTime CreationTime, DateTime ModificationTime, Int32 TimeScale, Int64 Duration, string LanguageCode) { byte version = 0x01; char[] array = LanguageCode.ToCharArray(); if ((array != null) && (array.Length == 3)) { Int16 Lang = 0; Lang |= (Int16)(((array[0] - 0x60) & 0x01F) << 10); Lang |= (Int16)(((array[1] - 0x60) & 0x01F) << 5); Lang |= (Int16)(((array[2] - 0x60) & 0x01F) << 0); Mp4BoxMDHD box = new Mp4BoxMDHD(); if (box != null) { box.Length = 8 + 4 + 8 + 8 + 4 + 8 + 2 + 2; box.Type = "mdhd"; byte[] Buffer = new byte[box.Length - 8]; if (Buffer != null) { WriteMp4BoxByte(Buffer, 0, version); WriteMp4BoxInt24(Buffer, 1, 0); WriteMp4BoxInt64(Buffer, 4, GetMp4BoxTime(CreationTime)); WriteMp4BoxInt64(Buffer, 12, GetMp4BoxTime(ModificationTime)); WriteMp4BoxInt32(Buffer, 20, TimeScale); WriteMp4BoxInt64(Buffer, 24, Duration); WriteMp4BoxInt16(Buffer, 32, Lang); WriteMp4BoxInt16(Buffer, 34, 0); box.Data = Buffer; return(box); } } } return(null); }
public bool TranslateExpression(string _in, string _out, Int32 parseFlags, Int32 translateFlags) { object[] paramsArray = Invoker.ValidateParamsArray(_in, _out, parseFlags, translateFlags); object returnItem = Invoker.MethodReturn(this, "TranslateExpression", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
protected void OnSalva(object sender, System.EventArgs e) { this.UpdateWr(); this.Ricerca(Int32.Parse(this.wo_id)); this.ActiveForm = Form1; }
public bool WizHelp(string helpFile, Int32 wCmd, Int32 contextID) { object[] paramsArray = Invoker.ValidateParamsArray(helpFile, wCmd, contextID); object returnItem = Invoker.MethodReturn(this, "WizHelp", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
public bool IsMemberSafe(Int32 dispid) { object[] paramsArray = Invoker.ValidateParamsArray(dispid); object returnItem = Invoker.MethodReturn(this, "IsMemberSafe", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
public bool BracketString(string _string, Int32 flags) { object[] paramsArray = Invoker.ValidateParamsArray(_string, flags); object returnItem = Invoker.MethodReturn(this, "BracketString", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
public Int32 WizMsgBox(string bstrText, string bstrCaption, Int32 wStyle, Int32 idHelpID, string bstrHelpFileName) { object[] paramsArray = Invoker.ValidateParamsArray(bstrText, bstrCaption, wStyle, idHelpID, bstrHelpFileName); object returnItem = Invoker.MethodReturn(this, "WizMsgBox", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); }
public ObservableCollection<Entidad_Relacionados> GetAllDepositoTemporalByCliente(Int32 ENTC_Codigo) { try { if (ENTC_Codigo == null) { return null; } return SelectAllDepositoTemporalByCliente(ENTC_Codigo); } catch (Exception) { throw; } }
public bool FirstDbcDataObject(string name, NetOffice.AccessApi.Enums.AcObjectType objType, Int32 attribs) { object[] paramsArray = Invoker.ValidateParamsArray(name, objType, attribs); object returnItem = Invoker.MethodReturn(this, "FirstDbcDataObject", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
public bool SaveScriptString(Int32 hScr, Int32 scriptColumn, string value) { object[] paramsArray = Invoker.ValidateParamsArray(hScr, scriptColumn, value); object returnItem = Invoker.MethodReturn(this, "SaveScriptString", paramsArray); return NetRuntimeSystem.Convert.ToBoolean(returnItem); }
static void Main() { Console.Write("Enter N: "); int n = Int32.Parse(Console.ReadLine()); int[,] matrix = new int[n, n]; int row = 0, col = 0, direction = 0; for (int i = 1; i <= n * n; i++) { switch (direction) { case 0: if (col > n - 1 || matrix[row, col] != 0) { direction = 1; col--; row++; } break; case 1: if (row > n - 1 || matrix[row, col] != 0) { direction = 2; row--; col--; } break; case 2: if (col < 0 || matrix[row, col] != 0) { direction = 3; col++; row--; } break; case 3: if (row < 0 || matrix[row, col] != 0) { direction = 0; row++; col++; } break; } matrix[row, col] = i; switch (direction) { case 0: col++; break; case 1: row++; break; case 2: col--; break; case 3: row--; break; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (matrix[i, j] < 10) { Console.Write("{0} ", matrix[i, j]); } else { Console.Write("{0} ", matrix[i, j]); } } Console.WriteLine(); } }
public Int32 ArgsOfActid(Int32 actid) { object[] paramsArray = Invoker.ValidateParamsArray(actid); object returnItem = Invoker.MethodReturn(this, "ArgsOfActid", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); }
protected void Page_Load(object sender, EventArgs e) { FilmId = Convert.ToInt32(Session["FilmId"]); }
private void CheckMessage(string message) { if (message.Contains("LOGINSUCESS")) { if (message.Contains("PLAYER1")) { message = message.Replace("LOGINSUCESSPLAYER1", ""); // LOGINSUCESS"ID" 부터 LOGINSUCESS를 지워서 ID만 남게 만듬 GameManager.instance.SetPlayer1(); string[] result = message.Split(new char[] { '/' }); int socket = Int32.Parse(result[0]); string id = result[1]; Debug.Log("Login Sucess connect id is " + message + " socket = " + socket); // 서버로부터 로그인 성공을 전달 받음 GameManager.instance.SelectScene(id, socket); } else if (message.Contains("PLAYER2")) { message = message.Replace("LOGINSUCESSPLAYER2", ""); // LOGINSUCESS"ID" 부터 LOGINSUCESS를 지워서 ID만 남게 만듬 GameManager.instance.SetPlayer2(); string[] result = message.Split(new char[] { '/' }); int socket = Int32.Parse(result[0]); string id = result[1]; Debug.Log("Login Sucess connect id is " + message + " socket = " + socket); // 서버로부터 로그인 성공을 전달 받음 GameManager.instance.SelectScene(id, socket); } } else if (message.Contains("SELECTCHARACTER")) { Debug.Log(message); message = message.Replace("SELECTCHARACTER:", ""); string[] result = message.Split(new char[] { '/' }); string id = result[0]; string characterID = result[1]; Debug.Log("Select charter ID : " + characterID); GameManager.instance.LinkWorld(id, characterID); } else { if (message.Contains("MOVESTOP")) { GameManager.instance.ChracterMove(Vector3.zero); } else if (message.Contains("MOVERIGHT")) { GameManager.instance.ChracterMove(Vector3.right); } else if (message.Contains("MOVELEFT")) { count++; Debug.Log("Left count(Recevie) = " + count); GameManager.instance.ChracterMove(Vector3.left); } else if (message.Contains("MOVEUP")) { GameManager.instance.ChracterMove(Vector3.up); } else if (message.Contains("MOVEDOWN")) { GameManager.instance.ChracterMove(Vector3.down); } else if (message.Contains("ATTACK")) { string id = message.Replace("CHARACTERATTACK", ""); GameManager.instance.CharacterAttack(id); } } }
public static extern bool GetTokenInformation( SafeTokenHandle hToken, TOKEN_INFORMATION_CLASS tokenInfoClass, IntPtr pTokenInfo, Int32 tokenInfoLength, out Int32 returnLength);
protected void RDL_Click(Object sender, CommandEventArgs e) { // DataGridRicerca.SelectedItem string argument = (string)e.CommandArgument; string delimStr = ":"; char [] delimiter = delimStr.ToCharArray(); string[] parameter = argument.Split(delimiter, 3); this.rdl_id = parameter[0]; int Stato = Int32.Parse(parameter[1]); RadioButtonList Opt; ((System.Web.UI.MobileControls.Label)pnlDettagli.Controls[0].FindControl("lblCalendario")).Text = DateTime.Now.ToShortDateString(); switch ((TheSite.AslMobile.Class.StateType)Stato) { case TheSite.AslMobile.Class.StateType.AttivitaCompletata: //Imposto l'Option Opt = (RadioButtonList)pnlDettagli.Controls[0].Controls[0].FindControl("RadioButtonList1"); Opt.Items[0].Selected = true; Opt.Items[1].Selected = false; Opt.Enabled = false; if (parameter[2] != " ") { this.SetValue(pnlDettagli, "TextBox2", parameter[2]); } // ((System.Web.UI.WebControls.TextBox)pnlDettagli.Controls[0].FindControl("TextBox2")).Text=parameter[2]; ((System.Web.UI.WebControls.TextBox)pnlDettagli.Controls[0].FindControl("TextBox2")).Enabled = false; break; case TheSite.AslMobile.Class.StateType.EmessaInLavorazione: //Imposto l'Option Opt = (RadioButtonList)pnlDettagli.Controls[0].Controls[0].FindControl("RadioButtonList1"); Opt.Items[0].Selected = true; Opt.Items[1].Selected = false; Opt.Enabled = true; if (parameter[2] != " ") { this.SetValue(pnlDettagli, "TextBox2", parameter[2]); } // ((System.Web.UI.WebControls.TextBox)pnlDettagli.Controls[0].FindControl("TextBox2")).Text=parameter[2]; ((System.Web.UI.WebControls.TextBox)pnlDettagli.Controls[0].FindControl("TextBox2")).Enabled = false; break; case TheSite.AslMobile.Class.StateType.RichiestaSospesa: //Imposto l'Option Opt = (RadioButtonList)pnlDettagli.Controls[0].Controls[0].FindControl("RadioButtonList1"); Opt.Items[1].Selected = true; Opt.Items[0].Selected = false; Opt.Enabled = true; if (parameter[2] != " ") { this.SetValue(pnlDettagli, "TextBox2", parameter[2]); } // ((System.Web.UI.MobileControls.TextBox)pnlDettagli.Controls[0].FindControl("TextBox1")).Text=parameter[2]; break; } this.ActiveForm = Form2; }
public Int32 GetFileName2(Int32 hwndOwner, string appName, string dlgTitle, string openTitle, string file, string initialDir, string filter, Int32 filterIndex, Int32 view, Int32 flags, bool fOpen, object fFileSystem) { object[] paramsArray = Invoker.ValidateParamsArray(hwndOwner, appName, dlgTitle, openTitle, file, initialDir, filter, filterIndex, view, flags, fOpen, fFileSystem); object returnItem = Invoker.MethodReturn(this, "GetFileName2", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); }