public MySqlParameter(string parameterName, GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType dbType, int size, string sourceColumn) : this(parameterName, dbType) { this.size = size; this.direction = ParameterDirection.Input; this.sourceColumn = sourceColumn; this.sourceVersion = DataRowVersion.Current; }
internal MySqlParameter(string name, GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType type, ParameterDirection dir, string col, DataRowVersion ver, object val) : this(name, type) { this.direction = dir; this.sourceColumn = col; this.sourceVersion = ver; this.Value = val; }
/// <summary> /// Sends a raw packet throgh this device /// </summary> /// <param name="p">The packet to send</param> public virtual void SendPacket(GodLesZ.Library.Network.Packet.Packet p) { SendPacket(p.Bytes); }
void TaskControls_SkinChanged(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { #if (!XBOX && !XBOX_FAKE) prgMain.Cursor = Manager.Skin.Cursors["Busy"].Resource; #endif }
/// <summary> /// Initializes a new instance of the <see cref="LoggingEvent" /> class /// from the supplied parameters. /// </summary> /// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is /// the stack boundary into the logging system for this call.</param> /// <param name="repository">The repository this event is logged in.</param> /// <param name="loggerName">The name of the logger of this event.</param> /// <param name="level">The level of this event.</param> /// <param name="message">The message of this event.</param> /// <param name="exception">The exception for this event.</param> /// <remarks> /// <para> /// Except <see cref="TimeStamp"/>, <see cref="Level"/> and <see cref="LoggerName"/>, /// all fields of <c>LoggingEvent</c> are filled when actually needed. Call /// <see cref="FixVolatileData()"/> to cache all data locally /// to prevent inconsistencies. /// </para> /// <para>This method is called by the GodLesZ.Library.Logging framework /// to create a logging event. /// </para> /// </remarks> public LoggingEvent(Type callerStackBoundaryDeclaringType, GodLesZ.Library.Logging.Repository.ILoggerRepository repository, string loggerName, Level level, object message, Exception exception) { m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; m_message = message; m_repository = repository; m_thrownException = exception; m_data.LoggerName = loggerName; m_data.Level = level; // Store the event creation time m_data.TimeStamp = DateTime.Now; }
/// <summary> /// Initializes a new instance of the <see cref="LoggingEvent" /> class /// using specific data. /// </summary> /// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is /// the stack boundary into the logging system for this call.</param> /// <param name="repository">The repository this event is logged in.</param> /// <param name="data">Data used to initialize the logging event.</param> /// <remarks> /// <para> /// This constructor is provided to allow a <see cref="LoggingEvent" /> /// to be created independently of the GodLesZ.Library.Logging framework. This can /// be useful if you require a custom serialization scheme. /// </para> /// <para> /// Use the <see cref="GetLoggingEventData(FixFlags)"/> method to obtain an /// instance of the <see cref="LoggingEventData"/> class. /// </para> /// <para> /// This constructor sets this objects <see cref="Fix"/> flags to <see cref="FixFlags.All"/>, /// this assumes that all the data relating to this event is passed in via the <paramref name="data"/> /// parameter and no other data should be captured from the environment. /// </para> /// </remarks> public LoggingEvent(Type callerStackBoundaryDeclaringType, GodLesZ.Library.Logging.Repository.ILoggerRepository repository, LoggingEventData data) : this(callerStackBoundaryDeclaringType, repository, data, FixFlags.All) { }
void trkMain_ValueChanged(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { if (lblTrack != null) { lblTrack.Text = trkMain.Value.ToString() + "/" + trkMain.Range.ToString(); } }
/// <summary> /// Called when a service is called. /// </summary> /// <param name="connection">The connection object.</param> /// <param name="call">The call object.</param> /// <returns>true to allow, false to deny.</returns> public bool ServiceCall(IConnection connection, GodLesZ.Library.Amf.Messaging.Api.Service.IServiceCall call) { return _canCallService; }
void btnDisable_Click(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { if (txtEdit.Enabled) { btnDisable.Text = "Enable"; btnDisable.TextColor = Color.FromNonPremultiplied(64, 255, 32, 200); } else { btnDisable.Text = "Disable"; btnDisable.TextColor = Color.FromNonPremultiplied(255, 64, 32, 200); } ClientArea.Enabled = !ClientArea.Enabled; BottomPanel.Enabled = true; prgMain.Enabled = ClientArea.Enabled; }
void btnProgress_Click(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { if (prgMain.Mode == EProgressBarMode.Default) prgMain.Mode = EProgressBarMode.Infinite; else prgMain.Mode = EProgressBarMode.Default; lstMain.Items.Add(new Random().Next().ToString()); lstMain.ItemIndex = lstMain.Items.Count - 1; cmbMain.Text = "!!!"; }
void chkBorders_CheckedChanged(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { txtEdit.DrawBorders = !chkBorders.Checked; }
void chkReadOnly_CheckedChanged(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { txtEdit.ReadOnly = chkReadOnly.Checked; }
void ModeChanged(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { if (sender == rdbNormal) { txtEdit.Mode = ETextBoxMode.Normal; } else if (sender == rdbPassword) { txtEdit.Mode = ETextBoxMode.Password; } }
public MySqlParameter(string parameterName, GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) : this(parameterName, dbType, size, sourceColumn) { this.direction = direction; this.sourceVersion = sourceVersion; this.Value = value; }
//Handles incoming messages static void MessageCallBack(object sender, GodLesZ.Library.XMPP.protocol.client.Message msg, object data) { if (msg.Body != null) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("{0}>> {1}", msg.From.User, msg.Body); Console.ForegroundColor = ConsoleColor.Green; } }
void Central_Click(object sender, GodLesZ.Library.XNA.WindowLibrary.Controls.EventArgs e) { ((sender as Button).Root as Window).Close(); }
/// <summary> /// Constructor /// </summary> /// <param name="linkLayerType"> /// A <see cref="GodLesZ.Library.Network.Packet.LinkLayers"/> /// </param> /// <param name="snapshotLength"> /// A <see cref="System.Nullable<System.Int32>"/> /// </param> /// <param name="captureFilename"> /// A <see cref="System.String"/> /// </param> /// <param name="mode"> /// A <see cref="FileMode"/> /// </param> public CaptureFileWriterDevice(GodLesZ.Library.Network.Packet.LinkLayers linkLayerType, int? snapshotLength, string captureFilename, FileMode mode) { m_pcapFile = captureFilename; // append isn't possible without some difficulty and not implemented yet if (mode == FileMode.Append) { throw new System.InvalidOperationException("FileMode.Append is not supported, please contact the developers if you are interested in helping to implementing it"); } if (!snapshotLength.HasValue) { snapshotLength = Pcap.MAX_PACKET_SIZE; } else if (snapshotLength > Pcap.MAX_PACKET_SIZE) { throw new System.InvalidOperationException("snapshotLength > Pcap.MAX_PACKET_SIZE"); } // set the device handle PcapHandle = LibPcapSafeNativeMethods.pcap_open_dead((int)linkLayerType, snapshotLength.Value); m_pcapDumpHandle = LibPcapSafeNativeMethods.pcap_dump_open(PcapHandle, captureFilename); if (m_pcapDumpHandle == IntPtr.Zero) throw new PcapException("Error opening dump file '" + LastError + "'"); }
public bool HandleEvent(GodLesZ.Library.Amf.Messaging.Api.Event.IEvent evt) { return false; }
private void SetMySqlDbType(GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType mysql_dbtype) { this.mySqlDbType = mysql_dbtype; switch (this.mySqlDbType) { case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Decimal: this.dbType = System.Data.DbType.Decimal; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Byte: this.dbType = System.Data.DbType.SByte; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int16: this.dbType = System.Data.DbType.Int16; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int32: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int24: this.dbType = System.Data.DbType.Int32; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Float: this.dbType = System.Data.DbType.Single; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Double: this.dbType = System.Data.DbType.Double; return; case (GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Float | GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int16): case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.VarString: case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1f8): case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1f9): case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1fa): case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1fb): break; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Timestamp: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.DateTime: this.dbType = System.Data.DbType.DateTime; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int64: this.dbType = System.Data.DbType.Int64; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Date: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Year: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Newdate: this.dbType = System.Data.DbType.Date; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Time: this.dbType = System.Data.DbType.Time; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Bit: this.dbType = System.Data.DbType.UInt64; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Enum: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Set: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.VarChar: this.dbType = System.Data.DbType.String; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.TinyBlob: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.MediumBlob: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.LongBlob: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Blob: this.dbType = System.Data.DbType.Object; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.String: this.dbType = System.Data.DbType.StringFixedLength; break; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UByte: this.dbType = System.Data.DbType.Byte; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt16: this.dbType = System.Data.DbType.UInt16; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt32: case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt24: this.dbType = System.Data.DbType.UInt32; return; case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt64: this.dbType = System.Data.DbType.UInt64; return; default: return; } }
/// <summary> /// Initializes a new instance of the <see cref="LoggingEvent" /> class /// using specific data. /// </summary> /// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is /// the stack boundary into the logging system for this call.</param> /// <param name="repository">The repository this event is logged in.</param> /// <param name="data">Data used to initialize the logging event.</param> /// <param name="fixedData">The fields in the <paranref name="data"/> struct that have already been fixed.</param> /// <remarks> /// <para> /// This constructor is provided to allow a <see cref="LoggingEvent" /> /// to be created independently of the GodLesZ.Library.Logging framework. This can /// be useful if you require a custom serialization scheme. /// </para> /// <para> /// Use the <see cref="GetLoggingEventData(FixFlags)"/> method to obtain an /// instance of the <see cref="LoggingEventData"/> class. /// </para> /// <para> /// The <paramref name="fixedData"/> parameter should be used to specify which fields in the /// <paramref name="data"/> struct have been preset. Fields not specified in the <paramref name="fixedData"/> /// will be captured from the environment if requested or fixed. /// </para> /// </remarks> public LoggingEvent(Type callerStackBoundaryDeclaringType, GodLesZ.Library.Logging.Repository.ILoggerRepository repository, LoggingEventData data, FixFlags fixedData) { m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; m_repository = repository; m_data = data; m_fixFlags = fixedData; }
public MySqlParameter(string parameterName, GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType dbType) : this(parameterName, null) { this.MySqlDbType = dbType; }
private void DoEditAction(ScriptTextEditorControl editor, GodLesZ.eAthenaEditor.Library.Actions.IEditAction action) { if (editor != null && action != null) { var area = editor.ActiveTextAreaControl.TextArea; editor.BeginUpdate(); try { lock (editor.Document) { action.Execute(area); if (area.SelectionManager.HasSomethingSelected && area.AutoClearSelection /*&& caretchanged*/) { if (area.Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { area.SelectionManager.ClearSelection(); } } } } finally { editor.EndUpdate(); area.Caret.UpdateCaretPosition(); } } }
public MySqlParameter(string parameterName, GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType dbType, int size) : this(parameterName, dbType) { this.size = size; }
/// <summary> /// Sends a raw packet throgh this device /// </summary> /// <param name="p">The packet to send</param> /// <param name="size">The number of bytes to send</param> public virtual void SendPacket(GodLesZ.Library.Network.Packet.Packet p, int size) { SendPacket(p.Bytes, size); }
override protected void Append(GodLesZ.Library.Logging.Core.LoggingEvent loggingEvent) { if (m_consoleOutputWriter != null) { IntPtr consoleHandle = IntPtr.Zero; if (m_writeToErrorStream) { // Write to the error stream consoleHandle = GetStdHandle(STD_ERROR_HANDLE); } else { // Write to the output stream consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); } // Default to white on black ushort colorInfo = (ushort)Colors.White; // see if there is a specified lookup LevelColors levelColors = m_levelMapping.Lookup(loggingEvent.Level) as LevelColors; if (levelColors != null) { colorInfo = levelColors.CombinedColor; } // Render the event to a string string strLoggingMessage = RenderLoggingEvent(loggingEvent); // get the current console color - to restore later CONSOLE_SCREEN_BUFFER_INFO bufferInfo; GetConsoleScreenBufferInfo(consoleHandle, out bufferInfo); // set the console colors SetConsoleTextAttribute(consoleHandle, colorInfo); // Using WriteConsoleW seems to be unreliable. // If a large buffer is written, say 15,000 chars // Followed by a larger buffer, say 20,000 chars // then WriteConsoleW will fail, last error 8 // 'Not enough storage is available to process this command.' // // Although the documentation states that the buffer must // be less that 64KB (i.e. 32,000 WCHARs) the longest string // that I can write out a the first call to WriteConsoleW // is only 30,704 chars. // // Unlike the WriteFile API the WriteConsoleW method does not // seem to be able to partially write out from the input buffer. // It does have a lpNumberOfCharsWritten parameter, but this is // either the length of the input buffer if any output was written, // or 0 when an error occurs. // // All results above were observed on Windows XP SP1 running // .NET runtime 1.1 SP1. // // Old call to WriteConsoleW: // // WriteConsoleW( // consoleHandle, // strLoggingMessage, // (UInt32)strLoggingMessage.Length, // out (UInt32)ignoreWrittenCount, // IntPtr.Zero); // // Instead of calling WriteConsoleW we use WriteFile which // handles large buffers correctly. Because WriteFile does not // handle the codepage conversion as WriteConsoleW does we // need to use a System.IO.StreamWriter with the appropriate // Encoding. The WriteFile calls are wrapped up in the // System.IO.__ConsoleStream internal class obtained through // the System.Console.OpenStandardOutput method. // // See the ActivateOptions method below for the code that // retrieves and wraps the stream. // The windows console uses ScrollConsoleScreenBuffer internally to // scroll the console buffer when the display buffer of the console // has been used up. ScrollConsoleScreenBuffer fills the area uncovered // by moving the current content with the background color // currently specified on the console. This means that it fills the // whole line in front of the cursor position with the current // background color. // This causes an issue when writing out text with a non default // background color. For example; We write a message with a Blue // background color and the scrollable area of the console is full. // When we write the newline at the end of the message the console // needs to scroll the buffer to make space available for the new line. // The ScrollConsoleScreenBuffer internals will fill the newly created // space with the current background color: Blue. // We then change the console color back to default (White text on a // Black background). We write some text to the console, the text is // written correctly in White with a Black background, however the // remainder of the line still has a Blue background. // // This causes a disjointed appearance to the output where the background // colors change. // // This can be remedied by restoring the console colors before causing // the buffer to scroll, i.e. before writing the last newline. This does // assume that the rendered message will end with a newline. // // Therefore we identify a trailing newline in the message and don't // write this to the output, then we restore the console color and write // a newline. Note that we must AutoFlush before we restore the console // color otherwise we will have no effect. // // There will still be a slight artefact for the last line of the message // will have the background extended to the end of the line, however this // is unlikely to cause any user issues. // // Note that none of the above is visible while the console buffer is scrollable // within the console window viewport, the effects only arise when the actual // buffer is full and needs to be scrolled. char[] messageCharArray = strLoggingMessage.ToCharArray(); int arrayLength = messageCharArray.Length; bool appendNewline = false; // Trim off last newline, if it exists if (arrayLength > 1 && messageCharArray[arrayLength - 2] == '\r' && messageCharArray[arrayLength - 1] == '\n') { arrayLength -= 2; appendNewline = true; } // Write to the output stream m_consoleOutputWriter.Write(messageCharArray, 0, arrayLength); // Restore the console back to its previous color scheme SetConsoleTextAttribute(consoleHandle, bufferInfo.wAttributes); if (appendNewline) { // Write the newline, after changing the color scheme m_consoleOutputWriter.Write(s_windowsNewline, 0, 2); } } }