Example #1
0
        /*
         * Path structure:
         *
         *  [Project name]-* Backup DLL/TLB/reg files
         *-------------------------[Date and time as file name]-*Backup from last build
         *
         *
         */



        public MainForm()
        {
            InitializeComponent();

            splitContainer1.SplitterDistance = FileListcomboBox.Location.Y + 30;
            #region int Logger
            if (!Logger.LoggerIsOnline)
            {
                Logger.Instance.Stop();
                Logger.Instance.Start(Output.ADD_InnerException | Output.ADD_StackTrace);
            }
            Logger.Instance.OnLogMessage += Instance_OnLogMessage;
            #endregion

            Setting = Settings.Load("*.regdll");
            if (!String.IsNullOrWhiteSpace(Settings.LoadedFrom))
            {
                Setting.MainOptions.OptionPath = Settings.LoadedFrom;
            }
            if (Setting == null)
            {
                Setting = new Settings();
            }
            DllRegister.TestSettings(Setting);

            Logger.Instance.AdddLog(LogType.Info, Assembly.GetEntryAssembly().FullName + " Start!", this);
            if (Environment.Is64BitProcess)
            {
                Logger.Instance.AdddLog(LogType.Info, "This is a 64 bit proccess");
            }
        }
Example #2
0
        private void ViewRegFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            viewRegFileToolStripMenuItem.Checked = !viewRegFileToolStripMenuItem.Checked;

            if (viewRegFileToolStripMenuItem.Checked)
            {
                GetUiInput();
                if (!DllRegister.TestSettings(Setting))
                {
                    Logger.Instance.AdddLog(LogType.Error, "Project or file name or no write access? ", "DllRegister", "");
                    SetValuesToForm(false);
                }


                FileItem fileItem = FileListcomboBox.SelectedItem as FileItem;

                if (FileListcomboBox.SelectedItem != null &&
                    !string.IsNullOrWhiteSpace(fileItem.FullPath) &&
                    !string.IsNullOrWhiteSpace(Setting.OutputPath) &&
                    System.IO.Directory.Exists(Setting.OutputPath)
                    )
                {
                    string path = string.Empty;
                    if (!string.IsNullOrWhiteSpace(fileItem.RegBuildPath) && System.IO.File.Exists(fileItem.RegBuildPath))
                    {
                        path = fileItem.RegBuildPath;
                    }
                    else
                    {
                        path = Setting.OutputPath + System.IO.Path.GetFileNameWithoutExtension(fileItem.FullPath) + ".reg";
                        if (string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path))
                        {
                            path = string.Empty;
                        }
                    }


                    if (!string.IsNullOrWhiteSpace(path) && System.IO.File.Exists(path))
                    {
                        try
                        {
                            var lines = File.ReadAllText(path);
                            if (!string.IsNullOrWhiteSpace(lines))
                            {
                                logBufferText = fct_box.Text;
                                //logBuffer = fct_box.TextSource;

                                fct_box.Language = Language.CSharp;
                                fct_box.Text     = lines;
                                viewRegFileToolStripMenuItem.Text = "View Log file";
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.Instance.AdddLog(LogType.Error, ex.Message, this, "", ex);
                        }
                    }
                }

                viewRegFileToolStripMenuItem.Checked = false;
            }
            else
            {
                SetToViewRegFile();
            }
        }