crashanalysercmd/UI/CrashServer/CACommandLineEntryPoint.cs
author Matti Laitinen <matti.t.laitinen@nokia.com>
Thu, 11 Feb 2010 15:50:58 +0200
changeset 0 818e61de6cd1
permissions -rw-r--r--
Add initial version of Crash Analyser cmdline under EPL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
*
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
*
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
* Contributors:
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
*
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
* Description: 
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
*
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
*/
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
using System;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
using System.Collections.Generic;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
using System.Text;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    20
using SymbianUtils.FileSystem;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    21
using SymbianUtils.FileSystem.Utilities;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    22
using CrashAnalyserServerExe.Engine;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    23
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    24
namespace CrashAnalyserServerExe
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
{
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
    class EntryPoint
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
    {
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
        static int Main( string[] aArguments )
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
        {
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
            int error = CACmdLineException.KErrNone;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
            //
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    32
            using ( FSLog log = new FSLog( true ) )
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    33
            {
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
                try
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
                {
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    36
                    FSUtilities.ClearTempPath();
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
                    //
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
                    CACommandLineUI commandLineUi = new CACommandLineUI( aArguments, log );
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
                    error = commandLineUi.Run();
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    40
                    //
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    41
                    if ( error != CACmdLineException.KErrNone )
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    42
                    {
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    43
                        SymbianUtils.SymDebug.SymDebugger.Break();
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
                    }
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    45
                }
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    46
                catch ( Exception e )
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
                {
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    48
                    log.TraceAlways( "CrashAnalyserServerExe.Main() - EXCEPTION: " + e.Message );
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    49
                    log.TraceAlways( "CrashAnalyserServerExe.Main() - STACK:     " + e.StackTrace );
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
                    SymbianUtils.SymDebug.SymDebugger.Break();
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    51
                    error = -1;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
                }
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
                //
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
                if ( error != 0 )
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    55
                {
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    56
                    log.TraceAlways( "CA completed with error: " + error );
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    57
                }
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
            }
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
            //
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    60
            return error;
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
        }
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
    }
818e61de6cd1 Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    63
}