Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial import of the Mono Add-in for Visual Studio 2005

svn path=/trunk/wintools/; revision=69450
  • Loading branch information...
commit a2a44254e4d07f895fc06e6cf8562ca0703eb3b6 1 parent d347925
Francisco T. Martinez authored
Showing with 6,887 additions and 0 deletions.
  1. +1 −0  vsAddIn2005/AUTHORS
  2. BIN  vsAddIn2005/BinandLib/CreateZipFromSln.exe
  3. BIN  vsAddIn2005/BinandLib/monoLaunchC.exe
  4. BIN  vsAddIn2005/BinandLib/monoLaunchW.exe
  5. BIN  vsAddIn2005/BinandLib/prj2makesharpWin32.exe
  6. +343 −0 vsAddIn2005/COPYING
  7. +6 −0 vsAddIn2005/ChangeLog
  8. +25 −0 vsAddIn2005/CreateZipFile/AssemblyInfo.cs
  9. +116 −0 vsAddIn2005/CreateZipFile/CreateZipFile.csproj
  10. +20 −0 vsAddIn2005/CreateZipFile/CreateZipFile.sln
  11. +254 −0 vsAddIn2005/CreateZipFile/Drive.cs
  12. +34 −0 vsAddIn2005/CreateZipFile/MainOpts.cs
  13. +37 −0 vsAddIn2005/CreateZipFile/Makefile.mcs.nmake
  14. +92 −0 vsAddIn2005/CreateZipFile/ZipCompressor.cs
  15. +3 −0  vsAddIn2005/INSTALL
  16. +170 −0 vsAddIn2005/Prj2MakeWin32/CsprojInfo.cs
  17. +188 −0 vsAddIn2005/Prj2MakeWin32/CsprojInfo2005.cs
  18. +45 −0 vsAddIn2005/Prj2MakeWin32/Makefile.mcs.nmake
  19. +362 −0 vsAddIn2005/Prj2MakeWin32/MdPrjHelper.cs
  20. +910 −0 vsAddIn2005/Prj2MakeWin32/MsPrjHelper.cs
  21. +92 −0 vsAddIn2005/Prj2MakeWin32/PrjHelper.cs
  22. +197 −0 vsAddIn2005/Prj2MakeWin32/PrjxInfo.cs
  23. +162 −0 vsAddIn2005/Prj2MakeWin32/csprog2005.xsd
  24. +282 −0 vsAddIn2005/Prj2MakeWin32/csproj_ver2003.cs
  25. +300 −0 vsAddIn2005/Prj2MakeWin32/csproj_ver2005.cs
  26. +38 −0 vsAddIn2005/Prj2MakeWin32/cui/AssemblyInfo.cs
  27. +31 −0 vsAddIn2005/Prj2MakeWin32/cui/Main.cs
  28. +128 −0 vsAddIn2005/Prj2MakeWin32/cui/MainMod.cs
  29. +28 −0 vsAddIn2005/Prj2MakeWin32/cui/MainOpts.cs
  30. +97 −0 vsAddIn2005/Prj2MakeWin32/pkgconfiginvoker.cs
  31. +139 −0 vsAddIn2005/Prj2MakeWin32/prj2makesharp.csproj
  32. +20 −0 vsAddIn2005/Prj2MakeWin32/prj2makesharp.sln
  33. +117 −0 vsAddIn2005/Prj2MakeWin32/sharp_d_cmbx.cs
  34. +326 −0 vsAddIn2005/Prj2MakeWin32/sharp_d_prjx.cs
  35. +51 −0 vsAddIn2005/README
  36. +61 −0 vsAddIn2005/README.txt
  37. +61 −0 vsAddIn2005/ReleaseNotes.txt
  38. +32 −0 vsAddIn2005/monoaddin.sln
  39. BIN  vsAddIn2005/monoaddin.suo
  40. BIN  vsAddIn2005/monoaddin/AssemblyInfo.cs
  41. +47 −0 vsAddIn2005/monoaddin/ClassDiagram1.cd
  42. +424 −0 vsAddIn2005/monoaddin/CommandBar.resx
  43. BIN  vsAddIn2005/monoaddin/Connect.cs
  44. +109 −0 vsAddIn2005/monoaddin/CreateZipHelper.cs
  45. +110 −0 vsAddIn2005/monoaddin/MonoLaunchHelper.cs
  46. +499 −0 vsAddIn2005/monoaddin/OptionsDlg.cs
  47. +436 −0 vsAddIn2005/monoaddin/OptionsDlg.resx
  48. +174 −0 vsAddIn2005/monoaddin/Prj2MakeHelper.cs
  49. +204 −0 vsAddIn2005/monoaddin/RegistryHelper.cs
  50. BIN  vsAddIn2005/monoaddin/codekey/vsprj2make.snk
  51. BIN  vsAddIn2005/monoaddin/monoaddin.AddIn
  52. +116 −0 vsAddIn2005/monoaddin/monoaddin.csproj
  53. BIN  vsAddIn2005/reflib/ICSharpCode.SharpZipLib.dll
  54. BIN  vsAddIn2005/reflib/Mono.GetOptions.dll
View
1  vsAddIn2005/AUTHORS
@@ -0,0 +1 @@
+Francisco "Paco" Martinez
View
BIN  vsAddIn2005/BinandLib/CreateZipFromSln.exe
Binary file not shown
View
BIN  vsAddIn2005/BinandLib/monoLaunchC.exe
Binary file not shown
View
BIN  vsAddIn2005/BinandLib/monoLaunchW.exe
Binary file not shown
View
BIN  vsAddIn2005/BinandLib/prj2makesharpWin32.exe
Binary file not shown
View
343 vsAddIn2005/COPYING
@@ -0,0 +1,343 @@
+You may use, distribute and copy vsprj2make under the terms of
+ GNU General Public License version 2, which is displayed below.
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
View
6 vsAddIn2005/ChangeLog
@@ -0,0 +1,6 @@
+2006-04-19 Francisco "Paco" Martinez <paco@mfcon.com>
+
+ * Initial import into mono's svn repository
+
+
+
View
25 vsAddIn2005/CreateZipFile/AssemblyInfo.cs
@@ -0,0 +1,25 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using Mono.GetOptions;
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+
+[assembly: AssemblyTitle("CreateZipFromSln")]
+[assembly: AssemblyDescription("Creates a Zip File from a MS Visual Studio .NET solution file.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("MFConsulting")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("(c) 2004")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: Mono.About("MFConsulting, (c) 2004")]
+[assembly: Mono.Author("Paco Martinez")]
+[assembly: Mono.UsageComplement("-f <input file path>")]
+[assembly: AssemblyVersion("0.95.1.0")]
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
+
View
116 vsAddIn2005/CreateZipFile/CreateZipFile.csproj
@@ -0,0 +1,116 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{7546314B-68AE-4067-B3F2-3D703AACED64}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>CreateZipFromSln</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>Mfconsulting.Vsprj2make</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>bin\Debug\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="ICSharpCode.SharpZipLib">
+ <Name>ICSharpCode.SharpZipLib</Name>
+ <HintPath>..\reflib\ICSharpCode.SharpZipLib.dll</HintPath>
+ </Reference>
+ <Reference Include="Mono.GetOptions">
+ <Name>Mono.GetOptions</Name>
+ <HintPath>..\reflib\Mono.GetOptions.dll</HintPath>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Drive.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="MainOpts.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ZipCompressor.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project>
View
20 vsAddIn2005/CreateZipFile/CreateZipFile.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateZipFile", "CreateZipFile.csproj", "{7546314B-68AE-4067-B3F2-3D703AACED64}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7546314B-68AE-4067-B3F2-3D703AACED64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7546314B-68AE-4067-B3F2-3D703AACED64}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7546314B-68AE-4067-B3F2-3D703AACED64}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7546314B-68AE-4067-B3F2-3D703AACED64}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
254 vsAddIn2005/CreateZipFile/Drive.cs
@@ -0,0 +1,254 @@
+using System;
+using System.Collections;
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace Mfconsulting.Vsprj2make
+{
+ /// <summary>
+ /// Summary description for Drive.
+ /// </summary>
+ public class Drive
+ {
+ static System.Collections.ArrayList g_straDirList = new ArrayList();
+ static System.Collections.ArrayList g_straFileList = new ArrayList();
+ static char []g_chaSeparator = {';'};
+ static string g_strBlacListedDirectories = "CVS;obj;.svn";
+ static string g_strBlacListedFiles = ".suo;.cvsignore;.vssscc;.vspscc";
+
+ public Drive()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ public static void Main(string[] args)
+ {
+ string strOutFile;
+ string strSolutionFile;
+ MainOpts optObj = new MainOpts();
+ ZipCompressor zcObj = new ZipCompressor();
+ int i;
+
+ // Handle command line arguments
+ optObj.ProcessArgs(args);
+
+ // Hangle no parameters being passed
+ if(args.Length < 1 || optObj.SolutionFile.Length < 1)
+ {
+ optObj.DoHelp();
+ return;
+ }
+
+ // Check for BlackListed Extensions being passed
+ if(optObj.Extensions.Length > 0)
+ {
+ g_strBlacListedFiles = optObj.Extensions;
+ }
+
+ // Check for BlackListed directories being passed
+ if(optObj.BlacListedDirectories.Length > 0)
+ {
+ g_strBlacListedDirectories = optObj.BlacListedDirectories;
+ }
+
+ strSolutionFile = optObj.SolutionFile;
+
+ if(optObj.OutputFilePath.Length > 0)
+ {
+ strOutFile = optObj.OutputFilePath;
+ }
+ else
+ {
+ strOutFile =
+ Path.Combine(
+ Path.GetDirectoryName(strSolutionFile),
+ (Path.GetFileNameWithoutExtension(strSolutionFile) + ".zip")
+ );
+ }
+
+ if(System.IO.Path.GetExtension(strSolutionFile).ToUpper().CompareTo(".SLN") != 0)
+ {
+ Console.WriteLine("The file you submited does not seem like a Visual Studio .NET Solution file.");
+ return;
+ }
+
+ // Parse solution
+ Drive.ParseSolution(strSolutionFile);
+
+ // build a string array of the base solution directory
+ // and the projects directory
+ string []straBaseDirs = new string[g_straDirList.Count];
+ for(i = 0; i < straBaseDirs.Length; i++)
+ {
+ straBaseDirs[i] = (string)g_straDirList[i];
+ AddFilesToFileList(straBaseDirs[i]);
+ }
+
+ // Clear the global Directory ArrayList
+ g_straDirList.Clear();
+
+ // Build the File ArrayList
+ string []straFilenames = new string[g_straFileList.Count];
+ for(i = 0; i < straFilenames.Length; i++)
+ {
+ straFilenames[i] = (string)g_straFileList[i];
+ }
+
+ // Clear the global File ArrayList
+ g_straFileList.Clear();
+
+ // Invoke the Programs main functionality and purpose
+ zcObj.CompressionLevel = optObj.Level;
+ zcObj.CreateZipFile(straFilenames, strOutFile);
+ }
+
+ #region Support functions
+
+ /// <summary>
+ /// Parse through all the projects in a given solution
+ /// </summary>
+ /// <param name="strFname">The fully qualified path to the solution file.</param>
+ static void ParseSolution(string strFname)
+ {
+ string strSolutionDir;
+ FileStream fis = new FileStream(
+ strFname,
+ FileMode.Open,
+ FileAccess.Read,
+ FileShare.Read
+ );
+
+ StreamReader reader = new StreamReader(fis);
+ Regex regex = new Regex(@"Project\(""\{(.*)\}""\) = ""(.*)"", ""(.*)"", ""(\{.*\})""");
+
+ // Get the solution directory and added
+ strSolutionDir = System.IO.Path.GetDirectoryName(strFname);
+
+ // Change the current directory to the solution directory
+ System.IO.Directory.SetCurrentDirectory(strSolutionDir);
+
+ Drive.g_straDirList.Add(strSolutionDir);
+
+ while (true)
+ {
+ string s = reader.ReadLine();
+ Match match;
+
+ match = regex.Match(s);
+ if (match.Success)
+ {
+ string projectName = match.Groups[2].Value;
+ string csprojPath = match.Groups[3].Value;
+ string projectGuid = match.Groups[4].Value;
+
+ if (csprojPath.StartsWith("http://"))
+ {
+ Console.WriteLine("WARNING: got http:// project, guessing actual path.");
+ csprojPath = Path.Combine(projectName, Path.GetFileName(csprojPath));
+ }
+ if (csprojPath.EndsWith (".csproj"))
+ {
+ string strProjDir = System.IO.Path.GetDirectoryName(
+ System.IO.Path.GetFullPath(csprojPath));
+
+ if(strProjDir.CompareTo(strSolutionDir) != 0)
+ {
+ Drive.g_straDirList.Add(strProjDir);
+ // Recurse to look for subdirs
+ ListSubDirs(strProjDir);
+ }
+ else
+ {
+ ListSubDirs(strProjDir);
+ }
+ }
+ }
+
+ if (s.StartsWith("Global"))
+ {
+ break;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Iterates through all of the directories (if any) that
+ /// are contained within a given directory
+ /// </summary>
+ /// <param name="strInDirPath">An imput string that
+ /// represents the directory to search in</param>
+ public static void ListSubDirs(string strInDirPath)
+ {
+ System.IO.DirectoryInfo di = new DirectoryInfo(strInDirPath);
+
+ foreach(System.IO.DirectoryInfo diObj in di.GetDirectories())
+ {
+ // Determine if is fit
+ if(IsDirBlackListed(diObj.Name) == false)
+ {
+ g_straDirList.Add(diObj.FullName);
+ ListSubDirs(diObj.FullName);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Determines if a directory name is listed on the ignore.
+ /// </summary>
+ /// <param name="strInDirName">String value that represents the name to check.</param>
+ /// <returns>Returns true if black listed or false otherwise</returns>
+ public static bool IsDirBlackListed(string strInDirName)
+ {
+ string []straBlackListItems = g_strBlacListedDirectories.Split(g_chaSeparator);
+
+ foreach(string strDirName in straBlackListItems)
+ {
+ if(strInDirName.ToUpper().CompareTo(strDirName.ToUpper()) == 0)
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Determines if a given file name is in the Black List
+ /// </summary>
+ /// <param name="strInFileName">The file name to check against the list</param>
+ /// <returns>Returns true if black listed or false otherwise</returns>
+ public static bool IsFileBlackListed(string strInFileName)
+ {
+ string []straBlackListItems = g_strBlacListedFiles.Split(g_chaSeparator);
+
+ foreach(string strExtention in straBlackListItems)
+ {
+ if(Path.GetExtension(strInFileName).ToUpper().CompareTo(strExtention.ToUpper()) == 0)
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Extract the list of files from a given directory and
+ /// inserts them into the global File ArrayList
+ /// </summary>
+ /// <param name="strInDirPath">The full directory path to look for files</param>
+ public static void AddFilesToFileList(string strInDirPath)
+ {
+ string []straFiles = Directory.GetFiles(strInDirPath);
+
+ foreach(string strFileName in straFiles)
+ {
+ // Check to see if blacklisted
+ if(IsFileBlackListed(strFileName) == false)
+ {
+ Drive.g_straFileList.Add(strFileName);
+ }
+ }
+ }
+
+ #endregion
+ }
+}
View
34 vsAddIn2005/CreateZipFile/MainOpts.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections;
+using Mono.GetOptions;
+
+namespace Mfconsulting.Vsprj2make
+{
+ class MainOpts : Options
+ {
+ [Option(1, "Compression level", 'l')]
+ public int Level = 4;
+
+ [Option(1, "Ignored extensions", "IgnoredExtensions")]
+ public string Extensions = ".suo,.cvsignore,.vssscc,.vspscc";
+
+ [Option(1, "Ignored directories", "IgnoredDirectories")]
+ public string BlacListedDirectories = "CVS,obj,.svn";
+
+ [Option(1, "Output file path", 'o')]
+ public string OutputFilePath = "";
+
+ [Option(1, "Input solution or project file", 'f')]
+ public string SolutionFile = "";
+
+ public MainOpts()
+ {
+ ParsingMode = OptionsParsingMode.Both;
+ BreakSingleDashManyLettersIntoManyOptions = false;
+ EndOptionProcessingWithDoubleDash = true;
+
+ if (System.IO.Path.DirectorySeparatorChar.CompareTo('/') == 0)
+ ParsingMode = OptionsParsingMode.Linux;
+ }
+ }
+}
View
37 vsAddIn2005/CreateZipFile/Makefile.mcs.nmake
@@ -0,0 +1,37 @@
+!if !defined (TARGET)
+TARGET=.\bin\Debug
+!else
+TARGET=.\bin\$(TARGET)
+!endif
+
+MCS=mcs
+!if !defined(RELEASE)
+MCSFLAGS=-debug --stacktrace
+!endif
+
+CREATEZIPFILE_EXE=$(TARGET)\CreateZipFromSln.exe
+CREATEZIPFILE_PDB=$(TARGET)\CreateZipFromSln.exe.mdb
+CREATEZIPFILE_SRC=AssemblyInfo.cs \
+ Drive.cs \
+ ZipCompressor.cs \
+ MainOpts.cs
+
+CREATEZIPFILE_RES=
+
+$(CREATEZIPFILE_EXE): $(CREATEZIPFILE_SRC)
+ -md $(TARGET)
+ $(MCS) $(MCSFLAGS) -r:System.dll -r:System.Data.dll -r:System.Xml.dll -r:ICSharpCode.SharpZipLib.dll -r:Mono.GetOptions.dll -target:exe -out:$(CREATEZIPFILE_EXE) $(CREATEZIPFILE_RES) $(CREATEZIPFILE_SRC)
+
+
+# common targets
+
+all: $(CREATEZIPFILE_EXE)
+
+clean:
+ -del "$(CREATEZIPFILE_EXE)" 2> nul
+ -del "$(CREATEZIPFILE_PDB)" 2> nul
+
+
+# project names as targets
+
+CreateZipFile: $(CREATEZIPFILE_EXE)
View
92 vsAddIn2005/CreateZipFile/ZipCompressor.cs
@@ -0,0 +1,92 @@
+using System;
+using System.IO;
+using ICSharpCode.SharpZipLib.Checksums;
+using ICSharpCode.SharpZipLib.Zip;
+using ICSharpCode.SharpZipLib.GZip;
+
+namespace Mfconsulting.Vsprj2make
+{
+ public class ZipCompressor
+ {
+ /// <summary>
+ /// Level of compression
+ /// </summary>
+ public int m_nCompressionLevel = 6;
+
+ /// <summary>
+ /// Level of compression
+ /// </summary>
+ public int CompressionLevel
+ {
+ get { return m_nCompressionLevel; }
+ set
+ {
+ if(value > 9)
+ {
+ m_nCompressionLevel = 9;
+ return;
+ }
+
+ if(value < 1)
+ {
+ m_nCompressionLevel = 1;
+ return;
+ }
+
+ m_nCompressionLevel = value;
+ }
+ }
+
+ public string GetFileNameWithoutDrive(string strInFullPath)
+ {
+ System.IO.DirectoryInfo diObj = null;
+ string strRetVal;
+ string strFileName = System.IO.Path.GetFileName(strInFullPath);
+ string strDirectory = System.IO.Path.GetDirectoryName(strInFullPath);
+
+ diObj = new DirectoryInfo(strDirectory);
+
+ strRetVal = String.Format("{0}{1}{2}",
+ diObj.FullName.Substring(diObj.Root.Name.Length),
+ System.IO.Path.DirectorySeparatorChar,
+ strFileName
+ );
+
+ return strRetVal.Replace("\\", "/");
+ }
+
+ public void CreateZipFile(string[] straFilenames, string strOutputFilename)
+ {
+ Crc32 crc = new Crc32();
+ ZipOutputStream zos = new ZipOutputStream(File.Create(strOutputFilename));
+
+ zos.SetLevel(m_nCompressionLevel);
+
+ foreach (string strFileName in straFilenames)
+ {
+ FileStream fs = File.OpenRead(strFileName);
+
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, buffer.Length);
+ ZipEntry entry = new ZipEntry(GetFileNameWithoutDrive(strFileName));
+
+ entry.DateTime = DateTime.Now;
+
+ entry.Size = fs.Length;
+ fs.Close();
+
+ crc.Reset();
+ crc.Update(buffer);
+
+ entry.Crc = crc.Value;
+
+ zos.PutNextEntry(entry);
+
+ zos.Write(buffer, 0, buffer.Length);
+ }
+
+ zos.Finish();
+ zos.Close();
+ }
+ }
+}
View
3  vsAddIn2005/INSTALL
@@ -0,0 +1,3 @@
+INSTALL.txt for monoaddin
+-------------------------------------------
+
View
170 vsAddIn2005/Prj2MakeWin32/CsprojInfo.cs
@@ -0,0 +1,170 @@
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Serialization;
+
+
+namespace Mfconsulting.General.Prj2Make
+{
+ class CsprojInfo
+ {
+ public readonly string name;
+ public readonly string guid;
+ public readonly string csprojpath;
+ public string makename;
+ public string makename_ext;
+ public string assembly_name;
+ public string res;
+ public string src;
+ private bool m_bAllowUnsafeCode;
+ private Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject m_projObject;
+
+ public string ext_refs = "";
+ public string switches = "";
+
+ public bool AllowUnsafeCode
+ {
+ get { return m_bAllowUnsafeCode; }
+ }
+
+ public Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject Proyecto
+ {
+ get { return m_projObject; }
+ }
+
+ // Project desirialization
+ protected Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject LoadPrjFromFile (string strIn)
+ {
+ FileStream fs = new FileStream (strIn, FileMode.Open);
+
+ XmlSerializer xmlSer = new XmlSerializer (typeof(Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject));
+ Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject prjObj = (Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject) xmlSer.Deserialize (fs);
+
+ fs.Close();
+
+ return (prjObj);
+ }
+
+ public CsprojInfo(bool isUnixMode, bool isMcsMode, string name, string guid, string csprojpath)
+ {
+ this.name = name;
+ this.guid = guid;
+ this.csprojpath = csprojpath;
+
+ makename = name.Replace('.','_').ToUpper();
+ makename_ext = makename + "_EXT";
+ m_bAllowUnsafeCode = false;
+
+ // convert backslashes to slashes
+ csprojpath = csprojpath.Replace("\\", "/");
+
+ // loads the file in order to deserialize and
+ // build the object graph
+ try
+ {
+ m_projObject = LoadPrjFromFile (csprojpath);
+ }
+
+ catch (Exception exc)
+ {
+ Console.WriteLine (
+ String.Format ("Could not load the file {0}\nException: {1}",
+ csprojpath,
+ exc.Message)
+ );
+ return;
+ }
+
+ // Establish if the allow unsafe code flag is true
+ foreach (Mfconsulting.General.Prj2Make.Schema.Csproj.Config cf in m_projObject.CSHARP.Build.Settings.Config)
+ {
+ if(cf.AllowUnsafeBlocks == true)
+ m_bAllowUnsafeCode = true;
+ }
+
+ switch (m_projObject.CSHARP.Build.Settings.OutputType)
+ {
+ case "Library":
+ makename_ext = makename + "_DLL";
+ assembly_name = m_projObject.CSHARP.Build.Settings.AssemblyName + ".dll";
+ switches += " -target:library";
+ break;
+
+ case "Exe":
+ makename_ext = makename + "_EXE";
+ assembly_name = m_projObject.CSHARP.Build.Settings.AssemblyName + ".exe";
+ switches += " -target:exe";
+ break;
+
+ case "WinExe":
+ makename_ext = makename + "_EXE";
+ assembly_name = m_projObject.CSHARP.Build.Settings.AssemblyName + ".exe";
+ switches += " -target:winexe";
+ break;
+
+ default:
+ throw new NotSupportedException("Unsupported OutputType: " + m_projObject.CSHARP.Build.Settings.OutputType);
+
+ }
+
+ src = "";
+ string basePath = Path.GetDirectoryName(csprojpath);
+ string s;
+
+ foreach (Mfconsulting.General.Prj2Make.Schema.Csproj.File fl in m_projObject.CSHARP.Files.Include)
+ {
+ if(fl.BuildAction == Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.Compile)
+ {
+ if (src != "")
+ {
+ src += " \\\n\t";
+ }
+
+ s = System.IO.Path.Combine(basePath, fl.RelPath);
+ s = s.Replace("\\", "/");
+ if (SlnMaker.slash != "/")
+ s = s.Replace("/", SlnMaker.slash);
+
+ // Test for spaces
+ if (isUnixMode == false) {
+ // We are in win32 using a cmd.exe or other
+ // DOS shell
+ if(s.IndexOf(' ') > -1) {
+ src += String.Format("\"{0}\"", s);
+ } else {
+ src += s;
+ }
+ } else {
+ // We are in *NIX or some other
+ // GNU like shell
+ src += s.Replace(" ", "\\ ");
+ }
+ }
+ }
+
+ res = "";
+ string rootNS = m_projObject.CSHARP.Build.Settings.RootNamespace;
+ string relPath;
+ foreach (Mfconsulting.General.Prj2Make.Schema.Csproj.File fl in m_projObject.CSHARP.Files.Include)
+ {
+ if(fl.BuildAction == Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.EmbeddedResource)
+ {
+ if (res != "") {
+ res += " \\\n\t";
+ }
+
+ relPath = fl.RelPath.Replace("\\", "/");
+ s = System.IO.Path.Combine(basePath, relPath);
+ s = String.Format("-resource:{0},{1}", s, rootNS + "." + relPath.Replace("/", "."));
+ s = s.Replace("\\", "/");
+ if (SlnMaker.slash != "/")
+ s = s.Replace("/", SlnMaker.slash);
+ res += s;
+ }
+ }
+ }
+ }
+}
View
188 vsAddIn2005/Prj2MakeWin32/CsprojInfo2005.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Diagnostics;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Serialization;
+
+
+namespace Mfconsulting.General.Prj2Make
+{
+ class CsprojInfo2005
+ {
+ public readonly string name;
+ public readonly string guid;
+ public readonly string csprojpath;
+ public string makename;
+ public string makename_ext;
+ public string assembly_name;
+ public string res;
+ public string src;
+ private bool m_bAllowUnsafeCode;
+ private Mfconsulting.General.Prj2Make.Schema.Csproj2005.Project m_projObject;
+
+ public string ext_refs = "";
+ public string switches = "";
+
+ public bool AllowUnsafeCode
+ {
+ get { return m_bAllowUnsafeCode; }
+ }
+
+ public Mfconsulting.General.Prj2Make.Schema.Csproj2005.Project Proyecto
+ {
+ get { return m_projObject; }
+ }
+
+ // Project desirialization
+ protected Mfconsulting.General.Prj2Make.Schema.Csproj2005.Project LoadPrjFromFile (string strIn)
+ {
+ FileStream fs = new FileStream (strIn, FileMode.Open);
+ Mfconsulting.General.Prj2Make.Schema.Csproj2005.Project prjObj = null;
+
+ try
+ {
+ XmlSerializer xmlSer = new XmlSerializer(typeof(Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject));
+ prjObj = (Mfconsulting.General.Prj2Make.Schema.Csproj2005.Project)xmlSer.Deserialize(fs);
+ }
+ catch (Exception exc)
+ {
+ Trace.WriteLine(String.Format("Error while deserializing file: {0}\n{1}", strIn, exc.Message));
+ }
+
+ fs.Close();
+
+ return (prjObj);
+ }
+
+ public CsprojInfo2005(bool isUnixMode, bool isMcsMode, string name, string guid, string csprojpath)
+ {
+ this.name = name;
+ this.guid = guid;
+ this.csprojpath = csprojpath;
+
+ makename = name.Replace('.','_').ToUpper();
+ makename_ext = makename + "_EXT";
+ m_bAllowUnsafeCode = false;
+
+ // convert backslashes to slashes
+ csprojpath = csprojpath.Replace("\\", "/");
+
+ // loads the file in order to deserialize and
+ // build the object graph
+ try
+ {
+ m_projObject = LoadPrjFromFile (csprojpath);
+ }
+
+ catch (Exception exc)
+ {
+ Console.WriteLine (
+ String.Format ("Could not load the file {0}\nException: {1}",
+ csprojpath,
+ exc.Message)
+ );
+ return;
+ }
+
+ // Establish if the allow unsafe code flag is true
+ foreach (Mfconsulting.General.Prj2Make.Schema.Csproj2005.PropertyGroup propGrp in m_projObject.PropertyGroup)
+ {
+ if (propGrp.AllowUnsafeBlocks == true)
+ m_bAllowUnsafeCode = true;
+ }
+
+ foreach (Mfconsulting.General.Prj2Make.Schema.Csproj2005.PropertyGroup propGrp in m_projObject.PropertyGroup)
+ {
+ switch (propGrp.OutputType)
+ {
+ case "Library":
+ makename_ext = makename + "_DLL";
+ assembly_name = m_projObject.PropertyGroup[0].AssemblyName + ".dll";
+ switches += " -target:library";
+ break;
+
+ case "Exe":
+ makename_ext = makename + "_EXE";
+ assembly_name = m_projObject.PropertyGroup[0].AssemblyName + ".exe";
+ switches += " -target:exe";
+ break;
+
+ case "WinExe":
+ makename_ext = makename + "_EXE";
+ assembly_name = m_projObject.PropertyGroup[0].AssemblyName + ".exe";
+ switches += " -target:winexe";
+ break;
+
+ default:
+ throw new NotSupportedException("Unsupported OutputType: " + propGrp.OutputType);
+ }
+ }
+
+ src = "";
+ string basePath = Path.GetDirectoryName(csprojpath);
+ string s;
+
+ foreach (object[][] itemGrpArray in m_projObject.ItemGroup)
+ {
+ foreach (object[] itemGrp in itemGrpArray)
+ {
+ }
+ }
+
+ //foreach (Mfconsulting.General.Prj2Make.Schema.Csproj.File fl in m_projObject.CSHARP.Files.Include)
+ //{
+ // if(fl.BuildAction == Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.Compile)
+ // {
+ // if (src != "")
+ // {
+ // src += " \\\n\t";
+ // }
+
+ // s = System.IO.Path.Combine(basePath, fl.RelPath);
+ // s = s.Replace("\\", "/");
+ // if (SlnMaker.slash != "/")
+ // s = s.Replace("/", SlnMaker.slash);
+
+ // // Test for spaces
+ // if (isUnixMode == false) {
+ // // We are in win32 using a cmd.exe or other
+ // // DOS shell
+ // if(s.IndexOf(' ') > -1) {
+ // src += String.Format("\"{0}\"", s);
+ // } else {
+ // src += s;
+ // }
+ // } else {
+ // // We are in *NIX or some other
+ // // GNU like shell
+ // src += s.Replace(" ", "\\ ");
+ // }
+ // }
+ //}
+
+ //res = "";
+ //string rootNS = m_projObject.CSHARP.Build.Settings.RootNamespace;
+ //string relPath;
+ //foreach (Mfconsulting.General.Prj2Make.Schema.Csproj.File fl in m_projObject.CSHARP.Files.Include)
+ //{
+ // if(fl.BuildAction == Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.EmbeddedResource)
+ // {
+ // if (res != "") {
+ // res += " \\\n\t";
+ // }
+
+ // relPath = fl.RelPath.Replace("\\", "/");
+ // s = System.IO.Path.Combine(basePath, relPath);
+ // s = String.Format("-resource:{0},{1}", s, rootNS + "." + relPath.Replace("/", "."));
+ // s = s.Replace("\\", "/");
+ // if (SlnMaker.slash != "/")
+ // s = s.Replace("/", SlnMaker.slash);
+ // res += s;
+ // }
+ //}
+ }
+ }
+}
View
45 vsAddIn2005/Prj2MakeWin32/Makefile.mcs.nmake
@@ -0,0 +1,45 @@
+!if !defined (TARGET)
+TARGET=.\bin\Debug
+!else
+TARGET=.\bin\$(TARGET)
+!endif
+
+MCS=mcs
+!if !defined(RELEASE)
+MCSFLAGS=-debug --stacktrace
+!endif
+
+PRJ2MAKESHARP_EXE=$(TARGET)\prj2makesharpWin32.exe
+PRJ2MAKESHARP_PDB=$(TARGET)\prj2makesharpWin32.exe.mdb
+PRJ2MAKESHARP_SRC=csproj_ver2003.cs \
+ CsprojInfo.cs \
+ MdPrjHelper.cs \
+ MsPrjHelper.cs \
+ pkgconfiginvoker.cs \
+ PrjHelper.cs \
+ PrjxInfo.cs \
+ sharp_d_cmbx.cs \
+ sharp_d_prjx.cs \
+ cui\AssemblyInfo.cs \
+ cui\Main.cs \
+ cui\MainMod.cs \
+ cui\MainOpts.cs
+PRJ2MAKESHARP_RES=
+
+$(PRJ2MAKESHARP_EXE): $(PRJ2MAKESHARP_SRC)
+ -md $(TARGET)
+ $(MCS) $(MCSFLAGS) -r:System.Xml.dll -r:Mono.GetOptions.dll -r:System.dll -target:exe -out:$(PRJ2MAKESHARP_EXE) $(PRJ2MAKESHARP_RES) $(PRJ2MAKESHARP_SRC)
+
+
+# common targets
+
+all: $(PRJ2MAKESHARP_EXE)
+
+clean:
+ -del "$(PRJ2MAKESHARP_EXE)" 2> nul
+ -del "$(PRJ2MAKESHARP_PDB)" 2> nul
+
+
+# project names as targets
+
+prj2makesharp: $(PRJ2MAKESHARP_EXE)
View
362 vsAddIn2005/Prj2MakeWin32/MdPrjHelper.cs
@@ -0,0 +1,362 @@
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Diagnostics;
+
+namespace Mfconsulting.General.Prj2Make
+{
+ public class CmbxMaker
+ {
+ public static string slash;
+ static Hashtable projNameInfo = new Hashtable();
+ static Hashtable projGuidInfo = new Hashtable();
+ private Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine m_cmbObject;
+ private bool m_bIsUnix;
+ private bool m_bIsMcs;
+ private bool m_bIsUsingLib;
+
+ // Flag use to determine if the LIB variable will be used in
+ // the Makefile that prj2make generates
+ public bool IsUsingLib
+ {
+ get{ return m_bIsUsingLib; }
+ set{ m_bIsUsingLib = value; }
+ }
+
+ // Determines if the makefile is intended for nmake or gmake for urposes of path separator character
+ public bool IsUnix
+ {
+ get{ return m_bIsUnix; }
+ set{ m_bIsUnix = value; }
+ }
+
+ // Determines if using MCS or CSC
+ public bool IsMcs
+ {
+ get{ return m_bIsMcs; }
+ set{ m_bIsMcs = value; }
+ }
+
+ public Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine Solucion {
+ get { return m_cmbObject; }
+ }
+
+ public CmbxMaker()
+ {
+ m_bIsUnix = false;
+ m_bIsMcs = false;
+ m_bIsUsingLib = false;
+ }
+
+ // Combine desirialization
+ protected Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine LoadCmbFromFile (string strIn)
+ {
+ FileStream fs = new FileStream (strIn, FileMode.Open);
+
+ XmlSerializer xmlSer = new XmlSerializer (typeof(Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine));
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine cmbObj = (Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine) xmlSer.Deserialize (fs);
+
+ fs.Close();
+
+ return (cmbObj);
+ }
+
+ protected void ParseMdCsProj(string fname)
+ {
+ string projectName;
+
+ PrjxInfo pi = new PrjxInfo(m_bIsUnix, m_bIsMcs, fname);
+ projectName = pi.name;
+ projNameInfo[projectName] = pi;
+ }
+
+ protected void ParseCombine(string fname)
+ {
+ string CombineFilePath = fname;
+
+ // convert backslashes to slashes
+ CombineFilePath = CombineFilePath.Replace("\\", "/");
+
+ // loads the file in order to deserialize and
+ // build the object graph
+ try {
+ m_cmbObject = LoadCmbFromFile (CombineFilePath);
+ } catch (Exception exc) {
+
+ Console.WriteLine (
+ String.Format ("Could not load the file {0}\nException: {1}",
+ CombineFilePath,
+ exc.Message)
+ );
+ return;
+ }
+
+ foreach(Mfconsulting.General.Prj2Make.Schema.Cmbx.Entry ent in m_cmbObject.Entries)
+ {
+ string projectName = System.IO.Path.GetFileNameWithoutExtension(ent.filename);
+ string csprojPath = ent.filename;
+
+ if (csprojPath.EndsWith(".prjx"))
+ {
+ PrjxInfo pi = new PrjxInfo(m_bIsUnix, m_bIsMcs, csprojPath);
+
+ projNameInfo[projectName] = pi;
+ }
+ }
+ }
+
+ public string MdCmbxHelper(bool isUnixMode, bool isMcsMode, bool isSln, string slnFile)
+ {
+ bool noCommonTargets = false;
+ bool noProjectTargets = false;
+ bool noFlags = false;
+ int nPos = -1;
+ StringBuilder MakefileBuilder = new StringBuilder();
+
+ m_bIsUnix = isUnixMode;
+ m_bIsMcs = isMcsMode;
+
+ if(m_bIsUnix == true && m_bIsMcs == true)
+ {
+ m_bIsUsingLib = true;
+ }
+
+ if (m_bIsUnix)
+ {
+ slash = "/";
+ }
+ else
+ {
+ slash = "\\";
+ }
+
+ try
+ {
+ string d = Path.GetDirectoryName(slnFile);
+
+ if (d != "")
+ Directory.SetCurrentDirectory(d);
+
+ if (isSln == true) {
+ // We invoke the ParseSolution
+ // by passing the file obtained
+ ParseCombine (slnFile);
+ } else {
+
+ // We invoke the ParseMsCsProj
+ // by passing the file obtained
+ ParseMdCsProj (slnFile);
+ }
+
+ if (!noFlags)
+ {
+ if (m_bIsUnix) // gmake
+ {
+ MakefileBuilder.Append("ifndef TARGET\n");
+ MakefileBuilder.Append("\tTARGET=./bin/Debug\n");
+ MakefileBuilder.Append("else\n");
+ MakefileBuilder.Append("\tTARGET=./bin/$(TARGET)\n");
+ MakefileBuilder.Append("endif\n\n");
+
+ if (m_bIsMcs == false)
+ {
+ MakefileBuilder.Append("MCS=csc\n");
+ MakefileBuilder.Append("MCSFLAGS=-nologo\n\n");
+ MakefileBuilder.Append("ifdef (RELEASE)\n");
+ MakefileBuilder.Append("\tMCSFLAGS=$(MCSFLAGS) -optimize+ -d:TRACE\n");
+ MakefileBuilder.Append("else\n");
+ MakefileBuilder.Append("\tMCSFLAGS=$(MCSFLAGS) -debug+ -d:TRACE,DEBUG\n");
+ MakefileBuilder.Append("endif\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("MCS=mcs\n");
+ MakefileBuilder.Append("ifndef (RELEASE)\n");
+ MakefileBuilder.Append("\tMCSFLAGS=-debug --stacktrace\n");
+ MakefileBuilder.Append("endif\n");
+ // Define and add the information used in the -lib: arguments passed to the
+ // compiler to assist in finding non-fullyqualified assembly references.
+ if(m_bIsUsingLib == true)
+ {
+ MakefileBuilder.AppendFormat("LIBS=-lib:{0}/mono/1.0 -lib:{1}/mono/gtk-sharp\n\n",
+ "`pkg-config --variable=libdir mono`",
+ "`pkg-config --variable=libdir gtk-sharp`"
+ );
+ }
+ }
+ }
+ else // nmake
+ {
+ MakefileBuilder.Append("!if !defined (TARGET)\n");
+ MakefileBuilder.Append("TARGET=.\\bin\\Debug\n");
+ MakefileBuilder.Append("!else\n");
+ MakefileBuilder.Append("TARGET=.\\bin\\$(TARGET)\n");
+ MakefileBuilder.Append("!endif\n\n");
+
+ if (m_bIsMcs == false)
+ {
+ MakefileBuilder.Append("MCS=csc\n");
+ MakefileBuilder.Append("MCSFLAGS=-nologo\n\n");
+ MakefileBuilder.Append("!if !defined(RELEASE)\n");
+ MakefileBuilder.Append("MCSFLAGS=$(MCSFLAGS) -optimize+ -d:TRACE\n");
+ MakefileBuilder.Append("!else\n");
+ MakefileBuilder.Append("MCSFLAGS=$(MCSFLAGS) -debug+ -d:TRACE,DEBUG\n");
+ MakefileBuilder.Append("!endif\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("MCS=mcs\n");
+ MakefileBuilder.Append("!if !defined(RELEASE)\n");
+ MakefileBuilder.Append("MCSFLAGS=-debug --stacktrace\n");
+ MakefileBuilder.Append("!endif\n");
+ }
+ }
+
+ MakefileBuilder.Append("\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("!if !defined(MCS)\n");
+ MakefileBuilder.Append("!error You must provide MCS when making\n");
+ MakefileBuilder.Append("!endif\n\n");
+ }
+
+ foreach (PrjxInfo prjI in projNameInfo.Values)
+ {
+ MakefileBuilder.AppendFormat("{0}=$(TARGET){1}{2}\n", prjI.makename_ext, slash, prjI.assembly_name);
+ MakefileBuilder.AppendFormat("{0}_PDB=$(TARGET){1}{2}\n", prjI.makename, slash, prjI.assembly_name.Replace(".dll",".pdb"));
+ MakefileBuilder.AppendFormat("{0}_SRC={1}\n", prjI.makename, prjI.src);
+ MakefileBuilder.AppendFormat("{0}_RES={1}\n\n", prjI.makename, prjI.res);
+ }
+
+
+ foreach (PrjxInfo pi in projNameInfo.Values)
+ {
+ string refs = "";
+ string deps = "";
+
+ foreach (Mfconsulting.General.Prj2Make.Schema.Prjx.Reference rf in pi.Proyecto.References)
+ {
+ if (refs != "")
+ refs += " ";
+
+ string assemblyName = rf.refto;
+
+ // HACK - under Unix filenames are case sensitive
+ // Under Windows there's no agreement on Xml vs XML ;-)
+ if (0 == String.Compare(assemblyName, "System.Xml", true))
+ {
+ assemblyName = "System.Xml";
+ }
+
+ // Check to see if there is a coma in the
+ // reference. This could indicate a GAC
+ // style reference
+ nPos = assemblyName.IndexOf(',');
+ if(nPos == -1)
+ {
+ if (System.IO.Path.GetExtension(assemblyName).ToUpper().CompareTo(".DLL") == 0)
+
+ {
+ refs += "-r:" + assemblyName;
+ }
+
+ else
+
+ {
+ refs += "-r:" + assemblyName + ".dll";
+ }
+ }
+ else
+ {
+ refs += "-r:" + assemblyName.Substring(0, nPos) + ".dll";
+ }
+ }
+
+ MakefileBuilder.AppendFormat("$({0}): $({1}_SRC) {2}\n", pi.makename_ext, pi.makename, deps);
+
+ if (isUnixMode)
+ {
+ MakefileBuilder.Append("\t-mkdir -p $(TARGET)\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("\t-md $(TARGET)\n");
+ }
+
+ MakefileBuilder.Append("\t$(MCS) $(MCSFLAGS)");
+
+ // Test to see if any configuratino has the Allow unsafe blocks on
+ if(pi.AllowUnsafeCode == true ) {
+ MakefileBuilder.Append(" -unsafe");
+ }
+
+ // Test for LIBS usage
+ if(m_bIsUsingLib == true) {
+ MakefileBuilder.Append(" $(LIBS)");
+ }
+
+ MakefileBuilder.AppendFormat(" {2}{3} -out:$({0}) $({1}_RES) $({1}_SRC)\n",
+ pi.makename_ext, pi.makename, refs, pi.switches);
+
+ MakefileBuilder.Append("\n");
+ }
+
+ if (!noCommonTargets)
+ {
+ MakefileBuilder.Append("\n");
+ MakefileBuilder.Append("# common targets\n\n");
+ MakefileBuilder.Append("all:\t");
+
+ bool first = true;
+
+ foreach (PrjxInfo pi in projNameInfo.Values)
+ {
+ if (!first)
+ {
+ MakefileBuilder.Append(" \\\n\t");
+ }
+ MakefileBuilder.AppendFormat("$({0})", pi.makename_ext);
+ first = false;
+ }
+ MakefileBuilder.Append("\n\n");
+
+ MakefileBuilder.Append("clean:\n");
+
+ foreach (PrjxInfo pi in projNameInfo.Values)
+ {
+ if (isUnixMode)
+ {
+ MakefileBuilder.AppendFormat("\t-rm -f \"$({0})\" 2> /dev/null\n", pi.makename_ext);
+ MakefileBuilder.AppendFormat("\t-rm -f \"$({0}_PDB)\" 2> /dev/null\n", pi.makename);
+ }
+ else
+ {
+ MakefileBuilder.AppendFormat("\t-del \"$({0})\" 2> nul\n", pi.makename_ext);
+ MakefileBuilder.AppendFormat("\t-del \"$({0}_PDB)\" 2> nul\n", pi.makename);
+ }
+ }
+ MakefileBuilder.Append("\n");
+ }
+
+ if (!noProjectTargets)
+ {
+ MakefileBuilder.Append("\n");
+ MakefileBuilder.Append("# project names as targets\n\n");
+ foreach (PrjxInfo pi in projNameInfo.Values)
+ {
+ MakefileBuilder.AppendFormat("{0}: $({1})\n", pi.name, pi.makename_ext);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("EXCEPTION: {0}\n", e);
+ return "";
+ }
+
+ return MakefileBuilder.ToString();
View
910 vsAddIn2005/Prj2MakeWin32/MsPrjHelper.cs
@@ -0,0 +1,910 @@
+using System;
+using System.Diagnostics;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Serialization;
+using Mfconsulting.General.Prj2Make.Schema.Prjx;
+using Mfconsulting.General.Prj2Make.Schema.Csproj;
+
+namespace Mfconsulting.General.Prj2Make
+{
+ public class SlnMaker
+ {
+ public static string slash;
+ static Hashtable projNameInfo = new Hashtable();
+ static Hashtable projGuidInfo = new Hashtable();
+ private string prjxFileName = null;
+ private string cmbxFileName = null;
+ private string m_strSlnVer;
+ private string m_strCsprojVer;
+ private bool m_bIsUnix;
+ private bool m_bIsMcs;
+ private bool m_bIsUsingLib;
+
+ // Flag use to determine if the LIB variable will be used in
+ // the Makefile that prj2make generates
+ public bool IsUsingLib
+ {
+ get{ return m_bIsUsingLib; }
+ set{ m_bIsUsingLib = value; }
+ }
+
+
+ // Determines if the makefile is intended for nmake or gmake for urposes of path separator character
+ public bool IsUnix
+ {
+ get{ return m_bIsUnix; }
+ set{ m_bIsUnix = value; }
+ }
+
+ // Determines if using MCS or CSC
+ public bool IsMcs
+ {
+ get{ return m_bIsMcs; }
+ set{ m_bIsMcs = value; }
+ }
+
+ public string SlnVersion
+ {
+ get { return m_strSlnVer; }
+ set { m_strSlnVer = value; }
+ }
+
+ public string CsprojVersion
+ {
+ get { return m_strCsprojVer; }
+ set { m_strCsprojVer = value; }
+ }
+
+ // Shuld contain the file name
+ // of the most resent prjx generation
+ public string PrjxFileName {
+ get { return prjxFileName; }
+ }
+
+ // Shuld contain the file name
+ // of the most resent cmbx generation
+ public string CmbxFileName {
+ get { return cmbxFileName; }
+ }
+
+ // Default constructor
+ public SlnMaker()
+ {
+ m_bIsUnix = false;
+ m_bIsMcs = false;
+ m_bIsUsingLib = false;
+ }
+
+ // Utility function to determine the sln file version
+ protected string GetSlnFileVersion(string strInSlnFile)
+ {
+ string strVersion = null;
+ string strInput = "";
+ Match match;
+ FileStream fis = new FileStream(strInSlnFile, FileMode.Open, FileAccess.Read, FileShare.Read);
+ StreamReader reader = new StreamReader(fis);
+ Regex regex = new Regex(@"Microsoft Visual Studio Solution File, Format Version (\d.\d\d)");
+
+ while (strInput.StartsWith("Microsoft Visual Studio Solution") == false && strInput != null)
+ {
+ strInput = reader.ReadLine();
+ }
+
+ match = regex.Match(strInput);
+ if (match.Success)
+ {
+ strVersion = match.Groups[1].Value;
+ }
+
+ // Close the stream
+ reader.Close();
+
+ // Close the File Stream
+ fis.Close();
+
+ return strVersion;
+ }
+
+ // Utility function to determine the csproj file version
+ protected string GetCsprojFileVersion(string strInCsprojFile)
+ {
+ string strRetVal = null;
+ XmlDocument xmlDoc = new XmlDocument();
+ XmlNode prodVerNode = null;
+ XmlNode firstPropGroupNode = null;
+
+ xmlDoc.Load(strInCsprojFile);
+
+ // Try assuming VS 2003
+ prodVerNode = xmlDoc.SelectSingleNode("/VisualStudioProject/CSHARP/@ProductVersion");
+ if (prodVerNode == null)
+ {
+ // Try assuming VS 2005
+ firstPropGroupNode = xmlDoc.FirstChild.FirstChild;
+ foreach (XmlNode theNode in firstPropGroupNode.ChildNodes)
+ {
+ if (theNode.Name.CompareTo("ProductVersion") == 0)
+ {
+ prodVerNode = theNode;
+ }
+ }
+
+ strRetVal = prodVerNode.InnerText;
+ }
+ else
+ {
+ strRetVal = prodVerNode.Value;
+ }
+
+ return strRetVal;
+ }
+
+ protected void ParseMsCsProj(string fname)
+ {
+ string projectName = System.IO.Path.GetFileNameWithoutExtension (fname);
+ string csprojPath = System.IO.Path.GetFileName (fname);
+ string projectGuid = "";
+
+ if (m_strCsprojVer.StartsWith("7.1"))
+ {
+ CsprojInfo pi = new CsprojInfo(m_bIsUnix, m_bIsMcs, projectName, projectGuid, csprojPath);
+
+ projNameInfo[projectName] = pi;
+ projGuidInfo[projectGuid] = pi;
+ }
+ else if(m_strCsprojVer.StartsWith("8"))
+ {
+ CsprojInfo2005 pi = new CsprojInfo2005(m_bIsUnix, m_bIsMcs, projectName, projectGuid, csprojPath);
+
+ projNameInfo[projectName] = pi;
+ projGuidInfo[projectGuid] = pi;
+ }
+ }
+
+ protected void ParseSolution(string fname)
+ {
+ FileStream fis = new FileStream(fname,FileMode.Open, FileAccess.Read, FileShare.Read);
+ StreamReader reader = new StreamReader(fis);
+ Regex regex = new Regex(@"Project\(""\{(.*)\}""\) = ""(.*)"", ""(.*)"", ""(\{.*\})""");
+
+ while (true)
+ {
+ string s = reader.ReadLine();
+ Match match;
+
+ match = regex.Match(s);
+ if (match.Success)
+ {
+ string projectName = match.Groups[2].Value;
+ string csprojPath = match.Groups[3].Value;
+ string projectGuid = match.Groups[4].Value;
+
+ if (csprojPath.EndsWith (".csproj") && !csprojPath.StartsWith("http://"))
+ {
+ CsprojInfo pi = new CsprojInfo (m_bIsUnix, m_bIsMcs, projectName, projectGuid, csprojPath);
+
+ projNameInfo[projectName] = pi;
+ projGuidInfo[projectGuid] = pi;
+ }
+ }
+
+ if (s.StartsWith("Global"))
+ {
+ break;
+ }
+ }
+ }
+
+ public string MsSlnHelper(bool isUnixMode, bool isMcsMode, bool isSln, string slnFile)
+ {
+ bool noCommonTargets = false;
+ bool noProjectTargets = false;
+ bool noFlags = false;
+ StringBuilder MakefileBuilder = new StringBuilder();
+
+ m_bIsUnix = isUnixMode;
+ m_bIsMcs = isMcsMode;
+
+ if(m_bIsUnix == true && m_bIsMcs == true)
+ {
+ m_bIsUsingLib = true;
+ }
+
+ if (m_bIsUnix)
+ {
+ slash = "/";
+ }
+ else
+ {
+ slash = "\\";
+ }
+
+ try
+ {
+ string d = Path.GetDirectoryName(slnFile);
+ if (d != "")
+ Directory.SetCurrentDirectory(d);
+
+ if (isSln == true)
+ {
+ // Get the sln file version
+ m_strSlnVer = GetSlnFileVersion(slnFile);
+
+ // We invoke the ParseSolution
+ // by passing the file obtained
+ ParseSolution (slnFile);
+ }
+ else
+ {
+ // Get the Csproj version
+ m_strCsprojVer = GetCsprojFileVersion(slnFile);
+
+ // We invoke the ParseMsCsProj
+ // by passing the file obtained
+ ParseMsCsProj (slnFile);
+ }
+
+ System.Reflection.Assembly curAssam = System.Reflection.Assembly.GetExecutingAssembly();
+ MakefileBuilder.AppendFormat("# Makefile created with Prj2MakeSharpWin32 ver. {0}\n# on {1}\n\n",
+ curAssam.GetName().Version.ToString(),
+ System.DateTime.Now.ToUniversalTime().ToString()
+ );
+
+ if (!noFlags)
+ {
+ if (m_bIsUnix) // gmake
+ {
+ MakefileBuilder.Append("ifndef TARGET\n");
+ MakefileBuilder.Append("\tTARGET=./bin/Debug\n");
+ MakefileBuilder.Append("else\n");
+ MakefileBuilder.Append("\tTARGET=./bin/$(TARGET)\n");
+ MakefileBuilder.Append("endif\n\n");
+
+ if (this.m_bIsMcs == false)
+ {
+ MakefileBuilder.Append("MCS=csc\n");
+ MakefileBuilder.Append("MCSFLAGS=-nologo\n\n");
+ MakefileBuilder.Append("ifdef (RELEASE)\n");
+ MakefileBuilder.Append("\tMCSFLAGS=$(MCSFLAGS) -optimize+ -d:TRACE\n");
+ MakefileBuilder.Append("else\n");
+ MakefileBuilder.Append("\tMCSFLAGS=$(MCSFLAGS) -debug+ -d:TRACE,DEBUG\n");
+ MakefileBuilder.Append("endif\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("MCS=mcs\n");
+ MakefileBuilder.Append("ifndef (RELEASE)\n");
+ MakefileBuilder.Append("\tMCSFLAGS=-debug --stacktrace\n");
+ MakefileBuilder.Append("endif\n");
+ // Define and add the information used in the -lib: arguments passed to the
+ // compiler to assist in finding non-fullyqualified assembly references.
+ if(m_bIsMcs == true)
+ {
+ MakefileBuilder.AppendFormat("LIBS=-lib:{0}/mono/1.0 -lib:{1}/mono/gtk-sharp\n\n",
+ "`pkg-config --variable=libdir mono`",
+ "`pkg-config --variable=libdir gtk-sharp`"
+ );
+ }
+ }
+ }
+ else // nmake
+ {
+ MakefileBuilder.Append("!if !defined (TARGET)\n");
+ MakefileBuilder.Append("TARGET=.\\bin\\Debug\n");
+ MakefileBuilder.Append("!else\n");
+ MakefileBuilder.Append("TARGET=.\\bin\\$(TARGET)\n");
+ MakefileBuilder.Append("!endif\n\n");
+
+ if (m_bIsMcs == false)
+ {
+ MakefileBuilder.Append("MCS=csc\n");
+ MakefileBuilder.Append("MCSFLAGS=-nologo\n\n");
+ MakefileBuilder.Append("!if !defined(RELEASE)\n");
+ MakefileBuilder.Append("MCSFLAGS=$(MCSFLAGS) -optimize+ -d:TRACE\n");
+ MakefileBuilder.Append("!else\n");
+ MakefileBuilder.Append("MCSFLAGS=$(MCSFLAGS) -debug+ -d:TRACE,DEBUG\n");
+ MakefileBuilder.Append("!endif\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("MCS=mcs\n");
+ MakefileBuilder.Append("!if !defined(RELEASE)\n");
+ MakefileBuilder.Append("MCSFLAGS=-debug --stacktrace\n");
+ MakefileBuilder.Append("!endif\n");
+ }
+ }
+
+ MakefileBuilder.Append("\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("!if !defined(MCS)\n");
+ MakefileBuilder.Append("!error You must provide MCS when making\n");
+ MakefileBuilder.Append("!endif\n\n");
+ }
+
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ MakefileBuilder.AppendFormat("{0}=$(TARGET){1}{2}\n", pi.makename_ext, slash, pi.assembly_name);
+ MakefileBuilder.AppendFormat("{0}_PDB=$(TARGET){1}{2}\n", pi.makename, slash, pi.assembly_name.Replace(".dll",".pdb"));
+ MakefileBuilder.AppendFormat("{0}_SRC={1}\n", pi.makename, pi.src);
+ MakefileBuilder.AppendFormat("{0}_RES={1}\n\n", pi.makename, pi.res);
+ }
+
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ string refs = "";
+ string deps = "";
+
+ foreach (Mfconsulting.General.Prj2Make.Schema.Csproj.Reference rf in pi.Proyecto.CSHARP.Build.References)
+ {
+ if(rf.Package == null || rf.Package.CompareTo("") == 0)
+ {
+ // Add space in between references as
+ // it becomes necessary
+ if (refs != "")
+ refs += " ";
+
+ string assemblyName = rf.AssemblyName;
+
+ // HACK - under Unix filenames are case sensitive
+ // Under Windows there's no agreement on Xml vs XML ;-)
+ if (0 == String.Compare(assemblyName, "System.Xml", true))
+ {
+ assemblyName = "System.Xml";
+ }
+ refs += "-r:" + assemblyName + ".dll";
+ }
+ else
+ {
+ try
+ {
+ CsprojInfo pi2 = (CsprojInfo)projGuidInfo[rf.Project];
+
+ if (refs != "")
+ refs += " ";
+
+ if (deps != "")
+ deps += " ";
+
+ refs += "-r:$(" + pi2.makename_ext + ")";
+ deps += "$(" + pi2.makename_ext + ")";
+ }
+ catch(System.NullReferenceException)
+ {
+ refs += String.Format("-r:{0}.dll", rf.Name);
+ deps += String.Format("# Missing dependency project {1} ID:{0}?", rf.Project,
+ rf.Name);
+ Console.WriteLine(String.Format(
+ "Warning: The project {0}, ID: {1} may be required and appears missing.",
+ rf.Name, rf.Project)
+ );
+ }
+ }
+ }
+
+ MakefileBuilder.AppendFormat("$({0}): $({1}_SRC) {2}\n", pi.makename_ext, pi.makename, deps);
+
+ if (isUnixMode)
+ {
+ MakefileBuilder.Append("\t-mkdir -p $(TARGET)\n");
+ }
+ else
+ {
+ MakefileBuilder.Append("\t-md $(TARGET)\n");
+ }
+
+ MakefileBuilder.Append("\t$(MCS) $(MCSFLAGS)");
+
+ // Test to see if any configuratino has the Allow unsafe blocks on
+ if(pi.AllowUnsafeCode == true ) {
+ MakefileBuilder.Append(" -unsafe");
+ }
+
+ // Test for LIBS usage
+ if(m_bIsUsingLib == true) {
+ MakefileBuilder.Append(" $(LIBS)");
+ }
+
+ MakefileBuilder.AppendFormat(" {2}{3} -out:$({0}) $({1}_RES) $({1}_SRC)\n",
+ pi.makename_ext, pi.makename, refs, pi.switches);
+
+ MakefileBuilder.Append("\n");
+ }
+
+ if (!noCommonTargets)
+ {
+ MakefileBuilder.Append("\n");
+ MakefileBuilder.Append("# common targets\n\n");
+ MakefileBuilder.Append("all:\t");
+
+ bool first = true;
+
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ if (!first)
+ {
+ MakefileBuilder.Append(" \\\n\t");
+ }
+ MakefileBuilder.AppendFormat("$({0})", pi.makename_ext);
+ first = false;
+ }
+ MakefileBuilder.Append("\n\n");
+
+ MakefileBuilder.Append("clean:\n");
+
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ if (isUnixMode)
+ {
+ MakefileBuilder.AppendFormat("\t-rm -f \"$({0})\" 2> /dev/null\n", pi.makename_ext);
+ MakefileBuilder.AppendFormat("\t-rm -f \"$({0}_PDB)\" 2> /dev/null\n", pi.makename);
+ }
+ else
+ {
+ MakefileBuilder.AppendFormat("\t-del \"$({0})\" 2> nul\n", pi.makename_ext);
+ MakefileBuilder.AppendFormat("\t-del \"$({0}_PDB)\" 2> nul\n", pi.makename);
+ }
+ }
+ MakefileBuilder.Append("\n");
+ }
+
+ if (!noProjectTargets)
+ {
+ MakefileBuilder.Append("\n");
+ MakefileBuilder.Append("# project names as targets\n\n");
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ MakefileBuilder.AppendFormat("{0}: $({1})\n", pi.name, pi.makename_ext);
+ }
+ }
+
+ return MakefileBuilder.ToString();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("EXCEPTION: {0}\n", e);
+ return "";
+ }
+ }
+
+ public void CreatePrjxFromCsproj(string csprojFileName)
+ {
+ int nCnt = 0;
+ FileStream fsIn = null;
+ XmlSerializer xmlDeSer = null;
+ FileStream fsOut = null;
+ XmlSerializer xmlSer = null;
+ Mfconsulting.General.Prj2Make.Schema.Csproj.VisualStudioProject csprojObj = null;
+ Mfconsulting.General.Prj2Make.Schema.Prjx.Project prjxObj = new Mfconsulting.General.Prj2Make.Schema.Prjx.Project();
+ string PrjxFileName = String.Format ("{0}.prjx",
+ Path.Combine(Path.GetDirectoryName(csprojFileName),
+ Path.GetFileNameWithoutExtension(csprojFileName))
+ );
+
+ // convert backslashes to slashes
+ csprojFileName = csprojFileName.Replace("\\", "/");
+ Console.WriteLine(String.Format("Will create project filename:{0}", PrjxFileName));
+
+ // Load the csproj
+ fsIn = new FileStream (csprojFileName, FileMode.Open);
+ xmlDeSer = new XmlSerializer (typeof(VisualStudioProject));
+ csprojObj = (VisualStudioProject) xmlDeSer.Deserialize (fsIn);
+ fsIn.Close();
+
+ // Begin prjxObj population
+ prjxObj.name = Path.GetFileNameWithoutExtension(csprojFileName);
+ prjxObj.description = "";
+ prjxObj.newfilesearch = "None";
+ prjxObj.enableviewstate = "True";
+ prjxObj.version = (decimal)1.1;
+ prjxObj.projecttype = "C#";
+
+ prjxObj.Contents = GetContents (csprojObj.CSHARP.Files.Include);
+ prjxObj.References = GetReferences(csprojObj.CSHARP.Build.References);
+ prjxObj.DeploymentInformation = new Mfconsulting.General.Prj2Make.Schema.Prjx.DeploymentInformation();
+ prjxObj.DeploymentInformation.target = "";
+ prjxObj.DeploymentInformation.script = "";
+ prjxObj.DeploymentInformation.strategy = "File";
+
+ nCnt = csprojObj.CSHARP.Build.Settings.Config.Length;
+ prjxObj.Configurations = new Configurations();
+ prjxObj.Configurations.Configuration = new Configuration[nCnt];
+ for(int i = 0; i < nCnt; i++)
+ {
+ prjxObj.Configurations.Configuration[i] = CreateConfigurationBlock(
+ csprojObj.CSHARP.Build.Settings.Config[i],
+ csprojObj.CSHARP.Build.Settings.AssemblyName,
+ csprojObj.CSHARP.Build.Settings.OutputType
+ );
+ }
+ prjxObj.Configurations.active = prjxObj.Configurations.Configuration[0].name;
+
+ prjxObj.Configuration = prjxObj.Configurations.Configuration[0];
+
+ // Serialize
+ fsOut = new FileStream (PrjxFileName, FileMode.Create);
+ xmlSer = new XmlSerializer (typeof(Project));
+ xmlSer.Serialize(fsOut, prjxObj);
+ fsOut.Close();
+
+ return;
+ }
+
+ public void MsSlnToCmbxHelper(string slnFileName)
+ {
+ int i = 0;
+ FileStream fsOut = null;
+ XmlSerializer xmlSer = null;
+ StringBuilder MakefileBuilder = new StringBuilder();
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine cmbxObj = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine();
+ string cmbxFileName = String.Format ("{0}.cmbx",
+ Path.Combine(Path.GetDirectoryName(slnFileName),
+ Path.GetFileNameWithoutExtension(slnFileName))
+ );
+
+ Console.WriteLine(String.Format("Will create combine filename:{0}", cmbxFileName));
+
+ try
+ {
+ string d = Path.GetDirectoryName(slnFileName);
+ if (d != "")
+ Directory.SetCurrentDirectory(d);
+
+ // We invoke the ParseSolution
+ // by passing the file obtained
+ ParseSolution (slnFileName);
+
+ // Create all of the prjx files form the csproj files
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ CreatePrjxFromCsproj(pi.csprojpath);
+ }
+
+
+ // Begin prjxObj population
+ cmbxObj.name = Path.GetFileNameWithoutExtension(slnFileName);
+ cmbxObj.description = "";
+ cmbxObj.fileversion = (decimal)1.0;
+
+ // Create and attach the StartMode element
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.StartMode startModeElem = new Mfconsulting.General.Prj2Make.Schema.Cmbx.StartMode();
+
+ // Create the array of Execute objects
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Execute[] executeElem = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Execute[projNameInfo.Count];
+
+ // Populate the Element objects instances
+ i = 0;
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Execute execElem = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Execute();
+ execElem.entry = pi.name;
+ execElem.type = "None";
+
+ executeElem[i++] = execElem;
+ }
+
+ startModeElem.startupentry = executeElem[0].entry;
+ startModeElem.single = "True";
+ startModeElem.Execute = executeElem;
+
+ // Attach the StartMode Object to the
+ // Combine object
+ cmbxObj.StartMode = startModeElem;
+
+ // Gnerate the entries array
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Entry[] entriesObj = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Entry[projNameInfo.Count];
+ // Populate the Entry objects instances
+ i = 0;
+ foreach (CsprojInfo pi in projNameInfo.Values)
+ {
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Entry entryObj = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Entry();
+ string PrjxFileName = String.Format (".{0}{1}.prjx",
+ Path.DirectorySeparatorChar,
+ Path.Combine(Path.GetDirectoryName(pi.csprojpath),
+ Path.GetFileNameWithoutExtension(pi.csprojpath))
+ );
+
+ entryObj.filename = PrjxFileName;
+
+ entriesObj[i++] = entryObj;
+ }
+
+ // Attach the Entries Object to the
+ // Combine object
+ cmbxObj.Entries = entriesObj;
+
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Configurations configurationsObj = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Configurations();
+
+ // Hack hardcoded configuration value must get the one
+ // from analyzing the different configuration entries
+ configurationsObj.active = "Debug";
+
+ // Hack hardcoded number of configuration object
+ // assuming 2 for Debug and Release
+ configurationsObj.Configuration = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Configuration[2];
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Configuration confObj1 = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Configuration();
+ configurationsObj.Configuration[0] = confObj1;
+ Mfconsulting.General.Prj2Make.Schema.Cmbx.Configuration confObj2 = new Mfconsulting.General.Prj2Make.Schema.Cmbx.Configuration();
+ configurationsObj.Configuration[1] = confObj2;
+
+ configurationsObj.Configuration[0].name = "Release";
+ configurationsObj.Configuration[0].Entry = CreateArrayOfConfEntries();
+ configurationsObj.Configuration[1].name = "Debug";
+ configurationsObj.Configuration[1].Entry = CreateArrayOfConfEntries();
+
+ // Attach the Configurations object to the
+ // Combine Object
+ cmbxObj.Configurations = configurationsObj;
+
+ // Serialize
+ fsOut = new FileStream (cmbxFileName, FileMode.Create);
+ xmlSer = new XmlSerializer (typeof(Mfconsulting.General.Prj2Make.Schema.Cmbx.Combine));
+ xmlSer.Serialize(fsOut, cmbxObj);
+ fsOut.Close();
+
+ return;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("EXCEPTION: {0}\n", e);
+ return;
+ }
+ }
+
+ protected Mfconsulting.General.Prj2Make.Schema.Prjx.Reference[] GetReferences(Mfconsulting.General.Prj2Make.Schema.Csproj.Reference[] References)
+ {
+ Mfconsulting.General.Prj2Make.Schema.Prjx.Reference[] theReferences = null;
+ int i = 0;
+
+ // Get the GAC path
+ string strBasePathMono1_0 = Path.Combine(
+ Mfconsulting.General.PkgConfigInvoker.GetPkgVariableValue("mono", "libdir").TrimEnd(),
+ "mono/1.0");
+
+ string strBasePathGtkSharp = Path.Combine(
+ Mfconsulting.General.PkgConfigInvoker.GetPkgVariableValue("mono", "libdir").TrimEnd(),
+ "mono/gtk-sharp");
+
+ // Little Diagnostics -- remove later
+ Console.WriteLine ("Base path: {0}", strBasePathMono1_0);
+ Console.WriteLine ("Base path: {0}", strBasePathGtkSharp);
+
+ if(References != null && References.Length > 0)
+ {
+ theReferences = new Mfconsulting.General.Prj2Make.Schema.Prjx.Reference[References.Length];
+ }
+ else
+ {
+ return null;
+ }
+
+ // Iterate through the reference collection of the csproj file
+ foreach(Mfconsulting.General.Prj2Make.Schema.Csproj.Reference rf in References)
+ {
+ Mfconsulting.General.Prj2Make.Schema.Prjx.Reference rfOut = new Mfconsulting.General.Prj2Make.Schema.Prjx.Reference();
+ string strRefFileName;
+
+ if(rf.Package == null || rf.Package.CompareTo("") == 0)
+ {
+ bool bIsWhereExpected = false;
+
+ // HACK - under Unix filenames are case sensitive
+ // Under Windows there's no agreement on Xml vs XML ;-)
+ if(Path.GetFileName(rf.HintPath).CompareTo("System.XML.dll") == 0)
+ {
+ strRefFileName = Path.Combine (strBasePathMono1_0, Path.GetFileName("System.Xml.dll"));
+
+ // Test to see if file exist in GAC location
+ if(System.IO.File.Exists(strRefFileName) == true) {
+ try {
+ rfOut.refto = System.Reflection.Assembly.LoadFrom(strRefFileName).FullName;
+ rfOut.type = Mfconsulting.General.Prj2Make.Schema.Prjx.ReferenceType.Gac;
+ rfOut.localcopy = Mfconsulting.General.Prj2Make.Schema.Prjx.ReferenceLocalcopy.True;
+ bIsWhereExpected = true;
+ } catch (Exception exc) {
+ Console.WriteLine ("Error doing Assembly.LoadFrom with File: {0}\nErr Msg: {1}",
+ strRefFileName,
+ exc.Message );
+ }
+ }
+ } else {