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 { strRefFileName = Path.Combine (strBasePathMono1_0, Path.GetFileName(rf.HintPath)); // Little Diagnostics -- remove later Console.WriteLine ("Reference that will be tested for existance: {0}", strRefFileName); // Test to see if file exist in GAC location // 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 ); } } strRefFileName = Path.Combine (strBasePathGtkSharp, Path.GetFileName(rf.HintPath)); // Little Diagnostics -- remove later Console.WriteLine ("Reference that will be tested for existance: {0}", strRefFileName); // Test to see if file exist in GAC location // 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 ); } } if(bIsWhereExpected == false) { rfOut.refto = Path.GetFileName(rf.HintPath); rfOut.type = Mfconsulting.General.Prj2Make.Schema.Prjx.ReferenceType.Gac; rfOut.localcopy = Mfconsulting.General.Prj2Make.Schema.Prjx.ReferenceLocalcopy.True; } } // increment the iterator value theReferences[i++] = rfOut; } else { rfOut.type = Mfconsulting.General.Prj2Make.Schema.Prjx.ReferenceType.Project; rfOut.refto = Path.GetFileName(rf.Name); rfOut.localcopy = Mfconsulting.General.Prj2Make.Schema.Prjx.ReferenceLocalcopy.True; // increment the iterator value theReferences[i++] = rfOut; } } return theReferences; }
protected Mfconsulting.General.Prj2Make.Schema.Prjx.File[] GetContents(Mfconsulting.General.Prj2Make.Schema.Csproj.File[] Include) { Mfconsulting.General.Prj2Make.Schema.Prjx.File[] theFiles = null; int i = 0; if(Include != null && Include.Length > 0) { theFiles = new Mfconsulting.General.Prj2Make.Schema.Prjx.File[Include.Length]; } else { return null; } // Iterate through the file collection of the csproj file foreach(Mfconsulting.General.Prj2Make.Schema.Csproj.File fl in Include) { Mfconsulting.General.Prj2Make.Schema.Prjx.File flOut = new Mfconsulting.General.Prj2Make.Schema.Prjx.File(); flOut.name = String.Format(".{0}{1}", Path.DirectorySeparatorChar, fl.RelPath); switch(fl.SubType) { case "Code": flOut.subtype = Mfconsulting.General.Prj2Make.Schema.Prjx.FileSubtype.Code; break; } switch(fl.BuildAction) { case Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.Compile: flOut.buildaction = Mfconsulting.General.Prj2Make.Schema.Prjx.FileBuildaction.Compile; break; case Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.Content: flOut.buildaction = Mfconsulting.General.Prj2Make.Schema.Prjx.FileBuildaction.Exclude; break; case Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.EmbeddedResource: flOut.buildaction = Mfconsulting.General.Prj2Make.Schema.Prjx.FileBuildaction.EmbedAsResource; break; case Mfconsulting.General.Prj2Make.Schema.Csproj.FileBuildAction.None: flOut.buildaction = Mfconsulting.General.Prj2Make.Schema.Prjx.FileBuildaction.Exclude; break; } flOut.dependson = fl.DependentUpon; flOut.data = ""; // increment the iterator value theFiles[i++ ] = flOut; } return theFiles; }