Click here to Skip to main content
15,884,298 members
Home / Discussions / C#
   

C#

 
QuestionOracle Data Provider 11g: combining UDT and associated Array ??? Pin
faehne10-Mar-08 9:19
faehne10-Mar-08 9:19 
QuestionStrange Assembly Reference Issue Pin
classNoob10-Mar-08 8:36
classNoob10-Mar-08 8:36 
GeneralRe: Strange Assembly Reference Issue Pin
classNoob10-Mar-08 9:43
classNoob10-Mar-08 9:43 
GeneralRe: Strange Assembly Reference Issue Pin
classNoob10-Mar-08 10:05
classNoob10-Mar-08 10:05 
AnswerRe: Strange Assembly Reference Issue Pin
classNoob10-Mar-08 10:37
classNoob10-Mar-08 10:37 
QuestionStreamWriter reformatting output??? Pin
LongRange.Shooter10-Mar-08 8:29
LongRange.Shooter10-Mar-08 8:29 
GeneralRe: StreamWriter reformatting output??? Pin
Christian Graus10-Mar-08 10:25
protectorChristian Graus10-Mar-08 10:25 
GeneralRe: StreamWriter reformatting output??? Pin
LongRange.Shooter11-Mar-08 16:42
LongRange.Shooter11-Mar-08 16:42 
Christian,
Trust me, I've been saying the same thing myself. Below is the code. I commented the line where I verified the format was still dateTtime and then looked at the output that was put to the file in notepad to see that the format was now data time AM. Messed up my head something fierce.

public sealed class Serialize:IDisposable
{
    static StreamWriter output;
    //static FileStream output;

    /// <summary>
    /// Writes an opening Xml node to the stream
    /// </summary>
    /// <param name="fieldName"></param>
    public static void WriteOpen(string fieldName)
    {
        string buffer = String.Format("<{0}>", fieldName);
        //output.Write(Encoding.UTF8.GetBytes(buffer),0,buffer.Length);
        output.Write( buffer );
    }

    /// <summary>
    /// Writes a closing Xml node to the stream
    /// </summary>
    /// <param name="fieldName"></param>
    public static void WriteClose(string fieldName)
    {
        string buffer = String.Format("</{0}>", fieldName);
        //output.Write(Encoding.UTF8.GetBytes(buffer),0,buffer.Length);
        output.Write( buffer );
    }

    /// <summary>
    /// Writes a raw line of data to the stream
    /// </summary>
    /// <param name="rawData"></param>
    public static void WriteRaw(string rawData)
    {
        //output.Write(Encoding.UTF8.GetBytes(rawData), 0, rawData.Length);
        output.Write( rawData );
    }

    /// <summary>
    /// Writes a formatted Xml line of data to the stream
    /// </summary>
    /// <param name="fieldName"></param>
    /// <param name="value"></param>
    public static void WriteLine(string fieldName, string value)
    {
        if (value.Length.Equals(0))
        {
            string buffer = String.Format("<{0} />", fieldName);
            //output.Write(Encoding.UTF8.GetBytes(buffer),0,buffer.Length);
            output.Write( buffer );
        }
        else
        {
            string buffer = String.Format("<{0}>{1}</{0}>", fieldName, value);
            //output.Write(Encoding.UTF8.GetBytes(buffer),0,buffer.Length);
            // THIS IS WHERE I BROKE THE CODE AND  VERIFIED THE BUFFER DATA PASSED TO THE STREAMWRITER
            output.Write( buffer );
        }
    }

    /// <summary>
    /// Entry point for outputting an object to a FileStream in an Xml-ish format
    /// </summary>
    /// <param name="stream"></param>
    /// <param name="value"></param>
    public static void OutputXmlStream(FileStream stream, Object value)
    {
        output = stream;
        string buffer = "<?xml version=\"1.0\" encoding=\"UTF-16\" ?>";
        output.Write(Encoding.UTF8.GetBytes(buffer),0,buffer.Length);

        Type baseObjectType = value.GetType();
        WriteOpen(value.GetType().Name);
        PropertyInfo[] propertyList = baseObjectType.GetProperties();

        foreach (PropertyInfo embeddedProperty in propertyList)
        {
            if (embeddedProperty.DeclaringType.ToString().StartsWith("SourceOne"))
                ObjectWalker.Walk(embeddedProperty.GetValue(value, null));
            else if (embeddedProperty.GetValue(value, null) is ArrayList)
                IEnumerableWalker.Walk( (ArrayList)embeddedProperty.GetValue(value, null));
        }

        WriteClose(value.GetType().Name);
    }

    #region IDisposable Members

    public void Dispose()
    {
        Dispose(true);
    }
    internal void Dispose(bool disposing)
    {
        if (disposing)
        {
        }
        GC.SuppressFinalize(this);
    }

    #endregion
}

Generalsomething weird is going on Pin
damianrda10-Mar-08 8:04
damianrda10-Mar-08 8:04 
GeneralRe: something weird is going on Pin
LongRange.Shooter10-Mar-08 8:32
LongRange.Shooter10-Mar-08 8:32 
GeneralAdding picturebox [modified] Pin
netJP12L10-Mar-08 7:41
netJP12L10-Mar-08 7:41 
GeneralRe: Adding picturebox Pin
Judah Gabriel Himango10-Mar-08 8:01
sponsorJudah Gabriel Himango10-Mar-08 8:01 
GeneralRe: Adding picturebox Pin
netJP12L10-Mar-08 8:10
netJP12L10-Mar-08 8:10 
AnswerRe: Adding picturebox Pin
Eslam Afifi10-Mar-08 9:00
Eslam Afifi10-Mar-08 9:00 
QuestionHow to force DataGridView to Draw empty rows Pin
josip cagalj10-Mar-08 6:40
josip cagalj10-Mar-08 6:40 
AnswerRe: How to force DataGridView to Draw empty rows Pin
Eslam Afifi10-Mar-08 9:17
Eslam Afifi10-Mar-08 9:17 
GeneralRe: How to force DataGridView to Draw empty rows Pin
josip cagalj10-Mar-08 22:16
josip cagalj10-Mar-08 22:16 
Questionhow to get all properties of all users of ad [modified] Pin
stephan_00710-Mar-08 6:18
stephan_00710-Mar-08 6:18 
AnswerRe: how to get all properties of all users of ad Pin
stephan_00711-Mar-08 4:09
stephan_00711-Mar-08 4:09 
QuestionWebBrowser email Pin
cechode10-Mar-08 6:03
cechode10-Mar-08 6:03 
QuestionHow to intercept Graphics.DrawString() method call Pin
njhy10-Mar-08 5:15
njhy10-Mar-08 5:15 
GeneralRe: How to intercept Graphics.DrawString() method call Pin
Judah Gabriel Himango10-Mar-08 7:09
sponsorJudah Gabriel Himango10-Mar-08 7:09 
GeneralRe: How to intercept Graphics.DrawString() method call Pin
njhy10-Mar-08 7:52
njhy10-Mar-08 7:52 
Questionwhat is the best way to store and search a huge file? Pin
cheq32610-Mar-08 5:01
cheq32610-Mar-08 5:01 
GeneralRe: what is the best way to store and search a huge file? Pin
PIEBALDconsult10-Mar-08 5:08
mvePIEBALDconsult10-Mar-08 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.