private void ProcessOssimPNGPlugin() { if (System.IO.Directory.Exists(theOssimPNGPath)) { status.AppendText("- Processing OSSIM PNG Plugin" + "\r\n"); string name = "ossim_pngplugin"; string destDir = System.IO.Path.Combine(theDestDir, name); string projPath = System.IO.Path.Combine(destDir, name + ".vcproj"); Directory.CreateDirectory(destDir); thePluginPNGPrj = new ProjectInfo(name, EvaluateRelativePath(theDestDir, projPath)); thePluginPNGPrj.FindFiles(theOssimPNGPath, theExtList); // load the application project template for changes. XmlDocument xDoc = new XmlDocument(); xDoc.Load(thePluginPNGTemplate); XmlNodeList xmlProject = xDoc.GetElementsByTagName("VisualStudioProject"); if (xmlProject.Count > 0) { // Name XmlNode Name = xmlProject[0].Attributes.GetNamedItem("Name"); Name.Value = thePluginPNGPrj.theName; xmlProject[0].Attributes.SetNamedItem(Name); // RootNamespace XmlNode RootNamespace = xmlProject[0].Attributes.GetNamedItem("RootNamespace"); RootNamespace.Value = thePluginPNGPrj.theName; xmlProject[0].Attributes.SetNamedItem(RootNamespace); // ProjectGUID XmlNode ProjectGUID = xmlProject[0].Attributes.GetNamedItem("ProjectGUID"); ProjectGUID.Value = "{" + thePluginPNGPrj.theGuid + "}"; xmlProject[0].Attributes.SetNamedItem(ProjectGUID); } // Files XmlNodeList xmlFiles = xDoc.GetElementsByTagName("Files"); if (xmlFiles.Count > 0) { foreach (FileSystemInfo entry in thePluginPNGPrj.theFiles) { string relPath = EvaluateRelativePath(destDir, entry.FullName); status.AppendText("+ " + entry.Name + "\r\n"); XmlNode fileNode = xDoc.CreateElement("File"); XmlAttribute relAttr = xDoc.CreateAttribute("RelativePath"); relAttr.Value = relPath; fileNode.Attributes.Append(relAttr); xmlFiles[0].AppendChild(fileNode); } } // save out the resulting XML, we're done! woot. FileStream fsxml = new FileStream(projPath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); xDoc.Save(fsxml); fsxml.Close(); } else { status.AppendText("- OSSIM PNG source not found, please check it out and try again." + "\r\n"); } status.AppendText("- Done Processing OSSIM PNG Plugin" + "\r\n"); }
// Process an application by taking the project template and overriding the // important GUIDs and names. Then we add all the proper files in the file // section of the project file. private void GenerateApplicationProj(string appName,string pathDir) { // make sure we have absolute path. pathDir = System.IO.Path.GetFullPath(pathDir); string destDir = System.IO.Path.Combine(theDestDir,"apps\\" + appName); string projPath = System.IO.Path.Combine(destDir,appName + ".vcproj"); Directory.CreateDirectory(destDir); status.AppendText("Application: " + appName + " @ (" + pathDir + ")" + "\r\n"); ProjectInfo project = new ProjectInfo(appName,EvaluateRelativePath(theDestDir, projPath)); project.FindFiles(pathDir,theExtList); theAppList.Add(project); // load the application project template for changes. XmlDocument xDoc = new XmlDocument(); xDoc.Load(theAppTemplate); XmlNodeList xmlProject = xDoc.GetElementsByTagName("VisualStudioProject"); if (xmlProject.Count>0) { // Name XmlNode Name=xmlProject[0].Attributes.GetNamedItem("Name"); Name.Value = appName; xmlProject[0].Attributes.SetNamedItem(Name); // RootNamespace XmlNode RootNamespace = xmlProject[0].Attributes.GetNamedItem("RootNamespace"); RootNamespace.Value = appName; xmlProject[0].Attributes.SetNamedItem(RootNamespace); // ProjectGUID XmlNode ProjectGUID = xmlProject[0].Attributes.GetNamedItem("ProjectGUID"); ProjectGUID.Value = "{" + project.theGuid + "}"; xmlProject[0].Attributes.SetNamedItem(ProjectGUID); } // Files XmlNodeList xmlFiles = xDoc.GetElementsByTagName("Files"); if (xmlFiles.Count > 0) { foreach (FileSystemInfo entry in project.theFiles) { string relPath = EvaluateRelativePath(destDir, entry.FullName); status.AppendText("+ " + entry.Name+"\r\n"); XmlNode fileNode=xDoc.CreateElement("File"); XmlAttribute relAttr=xDoc.CreateAttribute("RelativePath"); relAttr.Value = relPath; fileNode.Attributes.Append(relAttr); xmlFiles[0].AppendChild(fileNode); } } // save out the resulting XML, we're done! woot. FileStream fsxml = new FileStream(projPath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); xDoc.Save(fsxml); fsxml.Close(); }
private void ProcessOssimDLL() { status.AppendText("**** Processing OSSIM DLL ****" + "\r\n"); string destDir = System.IO.Path.Combine(theDestDir, "ossim"); string projPath = System.IO.Path.Combine(destDir, "ossim.vcproj"); theOssimDLLPrj = new ProjectInfo("ossim", EvaluateRelativePath(theDestDir, projPath)); Directory.CreateDirectory(destDir); status.AppendText("Writing ossim DLL project @ (" + projPath + ")" + "\r\n"); // load the application project template for changes. XmlDocument xDoc = new XmlDocument(); xDoc.Load(theDllTemplate); XmlNodeList xmlProject = xDoc.GetElementsByTagName("VisualStudioProject"); if (xmlProject.Count > 0) { // Name XmlNode Name = xmlProject[0].Attributes.GetNamedItem("Name"); Name.Value = theOssimDLLPrj.theName; xmlProject[0].Attributes.SetNamedItem(Name); // RootNamespace XmlNode RootNamespace = xmlProject[0].Attributes.GetNamedItem("RootNamespace"); RootNamespace.Value = theOssimDLLPrj.theName; xmlProject[0].Attributes.SetNamedItem(RootNamespace); // ProjectGUID XmlNode ProjectGUID = xmlProject[0].Attributes.GetNamedItem("ProjectGUID"); ProjectGUID.Value = "{" + theOssimDLLPrj.theGuid + "}"; xmlProject[0].Attributes.SetNamedItem(ProjectGUID); } // Files XmlNodeList xmlFiles = xDoc.GetElementsByTagName("Files"); if (xmlFiles.Count > 0) { foreach (ProjectInfo prj in theOssimList.Values) { XmlNode filterNode = xDoc.CreateElement("Filter"); XmlAttribute nameAttr = xDoc.CreateAttribute("Name"); nameAttr.Value = prj.theName; filterNode.Attributes.Append(nameAttr); foreach (FileSystemInfo entry in prj.theFiles) { string relPath = EvaluateRelativePath(destDir, entry.FullName); status.AppendText("+ " + entry.Name + "\r\n"); XmlNode fileNode = xDoc.CreateElement("File"); XmlAttribute relAttr = xDoc.CreateAttribute("RelativePath"); relAttr.Value = relPath; fileNode.Attributes.Append(relAttr); filterNode.AppendChild(fileNode); } xmlFiles[0].AppendChild(filterNode); } } // save out the resulting XML, we're done! woot. FileStream fsxml = new FileStream(projPath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); xDoc.Save(fsxml); fsxml.Close(); status.AppendText("**** Done Processing OSSIM DLL ****" + "\r\n"); }
private void FindCoreOSSIMFiles() { theOssimList.Clear(); status.AppendText("**** Finding core OSSIM files ****" + "\r\n"); // Process the directory list for the core src of OSSIM DirectoryInfo dir = new DirectoryInfo(theOssimSrcPath); foreach (FileSystemInfo entry in dir.GetFileSystemInfos()) { // make sure we are looking at a directory if ((entry.Attributes & FileAttributes.Directory) > 0) { // don't do anything to svn and CVS directories. if (entry.Name != ".svn" && entry.Name != "CVS") { // process the application folder. string tmpPath = System.IO.Path.Combine(theOssimSrcPath, entry.Name); ProjectInfo project = new ProjectInfo(entry.Name, ""); // insert a new project representing this core element // if we already have it, just add the new files. if (!theOssimList.ContainsKey(project.theName)) { project.FindFiles(tmpPath, theExtList); theOssimList.Add(project.theName,project); } else { ((ProjectInfo)theOssimList[project.theName]).FindFiles(tmpPath, theExtList); } } } } // Process the directory list for the core inc of OSSIM dir = new DirectoryInfo(theOssimIncPath); foreach (FileSystemInfo entry in dir.GetFileSystemInfos()) { // make sure we are looking at a directory if ((entry.Attributes & FileAttributes.Directory) > 0) { // don't do anything to svn and CVS directories. if (entry.Name != ".svn" && entry.Name != "CVS") { // process the application folder. string tmpPath = System.IO.Path.Combine(theOssimIncPath, entry.Name); ProjectInfo project = new ProjectInfo(entry.Name, ""); // insert a new project representing this core element // if we already have it, just add the new files. if (!theOssimList.ContainsKey(project.theName)) { project.FindFiles(tmpPath, theExtList); theOssimList.Add(project.theName, project); } else { ((ProjectInfo)theOssimList[project.theName]).FindFiles(tmpPath, theExtList); } } } } // tell the user how many files we found int total_files = 0; foreach (ProjectInfo prj in theOssimList.Values) { total_files += prj.theFiles.Count; } status.AppendText("We found "+total_files+" files in the core." + "\r\n"); status.AppendText("**** Done finding core OSSIM files ****" + "\r\n"); }