Changeset 75

Show
Ignore:
Timestamp:
07/12/06 22:09:57 (2 years ago)
Author:
mayuki
Message:

ハンドルされていない例外をハンドルしてスタックトレースを保存する機能をつけた

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/MacFaceFloat/MacFaceApp.cs

    r73 r75  
    4444                public static void Main(string[] args) 
    4545                { 
     46                        AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 
    4647                        MacFaceApp app = new MacFaceApp(); 
    4748                        app.StartApplication(); 
     
    399400                        window.Show(); 
    400401                } 
     402 
     403                /// <summary> 
     404                /// �n���h���������Ȃ�������b�`���āA�X�^�b�N�g���[�X������ăf�o�b�O�ɖ𗧂Ă�          /// </summary> 
     405                /// <param name="sender"></param> 
     406                /// <param name="e"></param> 
     407                private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 
     408                { 
     409                        Exception ex = e.ExceptionObject as Exception; // Exception �ȊO����ł����͒�����ꍇ�̂݁B 
     410 
     411                        if (MessageBox.Show( 
     412                                String.Format("�A�v���P�[�V�����̎�s���ɗ\�����d���G���[���������܂����B\n\n�G���[��:\n{0}\n\n�G���[����@�C���ɕۑ����A�񍐂��Ă����������Ƃŕs��̉�ɖ𗧂‰”\�����������B�G���[����@�C���ɕۑ����܂���?", 
     413                                ((Exception)(e.ExceptionObject)).Message) 
     414                                , Application.ProductName 
     415                                , MessageBoxButtons.YesNo 
     416                                , MessageBoxIcon.Error 
     417                                , MessageBoxDefaultButton.Button1 
     418                                ) == DialogResult.Yes) 
     419                        { 
     420                                using (SaveFileDialog saveFileDialog = new SaveFileDialog()) 
     421                                { 
     422                                        saveFileDialog.DefaultExt = "txt"; 
     423                                        saveFileDialog.Filter = "�e�L�X�g�t�@�C��|*.txt"; 
     424                                        saveFileDialog.FileName = String.Format("macface4win_stacktrace_{0:yyyyMMdd_HHmmss}.txt", DateTime.Now); 
     425                                        if (saveFileDialog.ShowDialog() == DialogResult.OK) 
     426                                        { 
     427                                                using (Stream stream = saveFileDialog.OpenFile()) 
     428                                                using (StreamWriter sw = new StreamWriter(stream)) 
     429                                                { 
     430                                                        sw.WriteLine("��������: {0}", DateTime.Now); 
     431                                                        sw.WriteLine(); 
     432                                                        sw.WriteLine("MacFace for Windows:"); 
     433                                                        sw.WriteLine("========================"); 
     434                                                        sw.WriteLine("�o�[�W����: {0}", Application.ProductVersion); 
     435                                                        sw.WriteLine("�A�Z���u��: {0}", Assembly.GetExecutingAssembly().FullName); 
     436                                                        sw.WriteLine(); 
     437                                                        sw.WriteLine("�‹���:"); 
     438                                                        sw.WriteLine("========================"); 
     439                                                        sw.WriteLine("�I�y���[�e�B���O�V�X�e��: {0}", Environment.OSVersion); 
     440                                                        sw.WriteLine("Microsoft .NET Framework: {0}", Environment.Version); 
     441                                                        sw.WriteLine(); 
     442                                                        sw.WriteLine("�n���h���������Ȃ���: "); 
     443                                                        sw.WriteLine("========================="); 
     444                                                        sw.WriteLine(ex.ToString()); 
     445                                                } 
     446                                        } 
     447                                } 
     448                                 
     449                        } 
     450                } 
    401451        } 
    402452} 
  • trunk/MacFaceLibrary/MemoryStatistics.cs

    r73 r75  
    55{ 
    66        /// <summary> 
    7         /// MemoryStatistics nngY 
     7        /// MemoryStatistics 
    88        /// </summary> 
    99        public class MemoryStatistics