Visual Studio .NET項目轉換器(ProjectConverter)修改

Visual Studio .NET 項目轉換器很是相似於ASP.NET版本轉換器,區別在於它用於轉換 Visual Studio 項目文件的版本。儘管在 .NET 框架的 1.0 版和 1.1 版之間只有很小的差別,但一旦將項目文件從 Visual Studio .NET 2002 轉換到 Visual Studio .NET 2003,將沒法再把它轉換回去。雖然這在大多數時候可能不會成爲問題(由於在 .NET 框架 1.0 版和 1.1 版之間幾乎沒有什麼破壞性的更改),但在某些時刻你可能須要將項目轉換回去。該轉換器能夠將任何解決方案或項目文件從 Visual Studio 7.1 (Visual Studio .NET 2003) 轉換到 Visual Studio 7.0 (Visual Studio .NET 2002),並在必要時進行反向轉換。框架

 原始程序:this

這個程序的不方便之處:spa

一、不支持文件拖放,每次點擊後面按鈕流量項目解決文件還要找半天。.net

二、啓動不在屏幕最中央。code

三、不置頂。orm

針對以上狀況修改完善,打開.NET Reflector導出工程源碼,修復編譯錯誤,blog

添加拖放支持:資源

        private void fmMain_DragDrop(object sender, DragEventArgs e)
        {
            this.tbSolutionFile.Text = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
            try{
                if ( this.VerifyVersion(this.GetVersion(this.tbSolutionFile.Text))==false ) {
                    this.tbSolutionFile.Text = "";
                }
            }catch (Exception exception1) {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Error reading the solution file\r" + exception.Message, MsgBoxStyle.Critical, "Error");
                ProjectData.ClearProjectError();
                this.tbSolutionFile.Text = "";
            }
        }

        private void fmMain_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
                e.Effect = DragDropEffects.Link;
            }else {
                e.Effect = DragDropEffects.None;
            }
        }

置頂和屏幕居中:get

        private void fmMain_Load(object sender, EventArgs e)
        {
            AllowDrop = true;
            CenterToScreen();
            if (MyProject.Application.CommandLineArgs.Count == 1)
            {
                this.tbSolutionFile.Text = MyProject.Application.CommandLineArgs[0];
                try
                {
                    this.VerifyVersion(this.GetVersion(this.tbSolutionFile.Text));
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    Interaction.MsgBox("Error reading the solution file\r" + exception.Message, MsgBoxStyle.Critical, "Error");
                    ProjectData.ClearProjectError();
                }
            }
            TopMost = true;
        }
        [DebuggerNonUserCode]
        public fmMain()
        {
            TopMost = true;
            base.Load += new EventHandler(this.fmMain_Load);
            base.DragEnter += new System.Windows.Forms.DragEventHandler(this.fmMain_DragEnter);
            base.DragDrop += new System.Windows.Forms.DragEventHandler(this.fmMain_DragDrop);
            __ENCList.Add(new WeakReference(this));
            this.InitializeComponent();
        }

修改完成後將原始程序的圖標添加爲資源,.NET Reflector導出的工程沒有圖標的,編譯成功經過截圖:源碼

如今支持:

一、啓動後屏幕居中顯示。

二、置頂顯示。

三、支持文件拖放,直接拖拽.sln文件到窗口便可。

編譯後的exe文件放在csdn資源下載站:

http://download.csdn.net/detail/asmcvc/7136663

修改後的C#源代碼工程文件(可編譯)也放在csdn資源下載站:

http://download.csdn.net/detail/asmcvc/7136693

相關文章
相關標籤/搜索