using System;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Diagnostics;
using EasiReports.Report;
using Common;
namespace EasiReports.Algorithms
{
/// <summary>
/// Summary description for AlgorithmsMemoryAssembly.
/// </summary>
[ Serializable ]
internal abstract class AlgorithmsMemoryAssembly : MemoryAssembly, ISerializable
{
public AlgorithmsMemoryAssembly( MemoryLanguage language, string displayName ) : base( language, displayName )
{
AddAssemblyReference( ".\\EasiReports.dll" );
}
public AlgorithmsMemoryAssembly( AlgorithmsMemoryAssembly o ) : base( o )
{
// AddAssemblyReference( "EasiReports.dll" );
}
//-----------------------------------------------------------------------------
// Serialization
// Save
/// <summary>Populates a SerializationInfo with the data needed to serialize the target object.</summary>
/// <param name="info">The SerializationInfo to populate with data.</param>
/// <param name="context">The destination for this serialization.</param>
/// <remarks>
/// <p>This method is called during serialization.</p>
/// <p>Do not call this method directly.</p>
/// </remarks>
[ SecurityPermission( SecurityAction.Demand, SerializationFormatter = true ) ]
public override void GetObjectData( SerializationInfo info, StreamingContext context )
{
SerializationHelper.WriteLine( "AlgorithmsMemoryAssemblyVersion" );
base.GetObjectData( info, context );
try
{
info.AddValue( "AlgorithmsMemoryAssemblyVersion" , 2 );
}
catch ( SerializationException e )
{
MessageBox.Show( e.ToString() );
}
}
// Load
/// <summary>Initializes a new instance of the class during deserialization.</summary>
/// <param name="info">The SerializationInfo populated with data.</param>
/// <param name="context">The source for this serialization.</param>
/// <remarks>
/// <p>This method is called during deserialization.</p>
/// <p>Do not call this method directly.</p>
/// </remarks>
protected AlgorithmsMemoryAssembly( SerializationInfo info, StreamingContext context ) : base( info, context )
{
try
{
int iVersion = 0;
if ( SerializationHelper.IsPresent( info, "AlgorithmsMemoryAssemblyVersion" ) )
iVersion = info.GetInt32( "AlgorithmsMemoryAssemblyVersion" );
if ( iVersion < 2 )
{
AddAssemblyReference( ".\\EasiReports.dll" );
}
}
catch ( SerializationException e )
{
MessageBox.Show( e.ToString() );
}
}
//-----------------------------------------------------------------------------
//
protected static string InsertCode( ref string sCode, int iLocation, string sNew )
{
// while ( sCode[ iLocation ] != '\n' && iLocation > 0 ) iLocation--;
// if ( iLocation > 0 ) iLocation++;
//
// StringBuilder sb = new StringBuilder( sCode );
// sb.Insert( iLocation, sNew );
// sCode = sb.ToString();
return sNew;
}
//-----------------------------------------------------------------------------
// public string Name( string method )
// {
// return Table + "." + method;
// }
// public abstract string Table { get; }
// public abstract string Class { get; }
// public abstract string TwoLetterLanguage { get; }
// public abstract Language Language { get; }
//-----------------------------------------------------------------------------
public abstract string InsertAlgorithmData ( ref string sCode, int iLocation, string sResultType, string sAlgorithmName );
public abstract string InsertAlgorithmFormatSection ( ref string sCode, int iLocation, string sAlgorithmName );
public abstract string InsertAlgorithmFormatControl ( ref string sCode, int iLocation, string sAlgorithmName );
public abstract string InsertAlgorithmOnSetDataSource ( ref string sCode, int iLocation );
public abstract string InsertAlgorithmOnQueryPageSettings ( ref string sCode, int iLocation );
public abstract string InsertAlgorithmOnBeginPrint ( ref string sCode, int iLocation );
public abstract string InsertAlgorithmOnEndPrint ( ref string sCode, int iLocation );
public abstract string InsertVariableData ( ref string sCode, int iLocation, Type resultType, string sVariableName, string name );
public abstract string InsertVariableAggregate ( ref string sCode, int iLocation, Type resultType, string sVariableName, string name, AggregateFunction eAggregate, int iLevel );
//-----------------------------------------------------------------------------
}
}