首页 > Web开发 > 详细

Visual Studio .NET项目转换器(ProjectConverter)修改

时间:2014-04-02 18:39:27      阅读:759      评论:0      收藏:0      [点我收藏+]

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),并在必要时进行反向转换。

 原始程序:

bubuko.com,布布扣

这个程序的不方便之处:

1、不支持文件拖放,每次点击后面按钮流量项目解决文件还要找半天。

2、启动不在屏幕最中央。

3、不置顶。

针对以上情况修改完善,打开.NET Reflector导出工程源码,修复编译错误,

添加拖放支持:

bubuko.com,布布扣
        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;
            }
        }
bubuko.com,布布扣

置顶和屏幕居中:

bubuko.com,布布扣
        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;
        }
bubuko.com,布布扣
bubuko.com,布布扣
        [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();
        }
bubuko.com,布布扣

修改完成后将原始程序的图标添加为资源,.NET Reflector导出的工程没有图标的,编译成功通过截图:

bubuko.com,布布扣

现在支持:

1、启动后屏幕居中显示。

2、置顶显示。

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

编译后的exe文件放在csdn资源下载站:

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

修改后的C#源代码工程文件(可编译)也放在csdn资源下载站:

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

Visual Studio .NET项目转换器(ProjectConverter)修改,布布扣,bubuko.com

Visual Studio .NET项目转换器(ProjectConverter)修改

原文:http://www.cnblogs.com/daxingxing/p/3641148.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!