Example #1
0
        internal static void Write(int Level, string type, string s)
        {
            if (xWrite(Level,type,s))
            {
                return;
            }
            else
            {
                if (bFirstWrite)
                {

                    LogFile.LogFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName)+"\\Log";
                    if (!Directory.Exists(LogFile.LogFolder))
                    {
                        Directory.CreateDirectory(LogFile.LogFolder);
                    }
                    if (Directory.Exists(LogFile.LogFolder))
                    {
                        LogFile.LogFileName = "Log.txt";
                        LogFile.Log_File = LogFile.LogFolder + "\\" + LogFile.LogFileName;
                        if (xWrite(Level, type, s))
                        {
                            Settings.LogFile = LogFile.LogFileName;
                            Settings.LogFolder = LogFile.LogFolder;
                            Settings.Save();
                            return;
                        }
                    }
                    for (;;)
                    {
                        MessageBox.Show(lngRPM.s_LogFile.s + ":" + lngRPM.s_Error.s + ":" + lngRPM.s_CanNotWriteOrDeleteFileInFolder.s + ":\"" + Log_File + "\"");
                        ManageLogs_Form mng_log = new ManageLogs_Form(Image_Cancel);
                        if (mng_log.ShowDialog()==DialogResult.OK)
                        {
                            if (xWrite(Level, type, s))
                            {
                                return;
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
        }
Example #2
0
 public static Form LogManager(Form parentform,bool bDoModal)
 {
     if (ManageLogsDlg != null)
     {
         if (ManageLogsDlg.IsDisposed)
         {
             ManageLogsDlg = null;
         }
     }
     if (ManageLogsDlg == null)
     {
         ManageLogsDlg = new ManageLogs_Form(Image_Cancel);
         if (parentform!=null)
         {
             if (parentform.TopMost)
             {
                 ManageLogsDlg.TopMost = true;
             }
         }
         if (bDoModal)
         {
             ManageLogsDlg.ShowDialog();
         }
         else
         {
             ManageLogsDlg.Show();
         }
     }
     if (!bDoModal)
     {
         ManageLogsDlg.Activate();
     }
     return ManageLogsDlg;
 }