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

相关文章
相关标签/搜索