Click here to Skip to main content
12,767,702 members (42,792 online)
Click here to Skip to main content
Articles » Languages » C# » Utilities » Downloads

Stats

60.6K views
3.3K downloads
110 bookmarked
Posted 2 Nov 2007

Template Based Code Generator

, 20 Nov 2007 CPOL
A template based, command-line oriented .NET code generator
Arebis.CodeGeneration.dll
Arebis.CodeGeneration.VisualStudio.dll
Arebis.CodeGenerator.dll
CGen.exe
Arebis.CodeGeneration.dll
Arebis.CodeGeneration.VisualStudio.dll
Arebis.CodeGenerator.dll
CGen.exe
CGen.exe
Arebis.CodeGeneration.dll
Arebis.CodeGeneration.VisualStudio.dll
Arebis.CodeGenerator.dll
Arebis.CodeGeneration
Properties
Arebis.CodeGeneration.VisualStudio
Properties
Arebis.CodeGenerator
Extensions
Parsing
Properties
Resources
Templated
backup_v1.zip
_ClassDiagram.cd
CGen
Properties
Resources
backup_v1.zip
_ClassDiagram.cd
ClassDiagram.cd
Arebis.CodeGenerator.csproj.user
_ClassDiagram.cd
backup_v1.zip
Syntax
bin
Arebis.CodeGeneration.dll
Arebis.CodeGeneration.VisualStudio.dll
Arebis.CodeGenerator.dll
CGen.exe
BuildClasses.cst
Class.cst
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace Arebis.Utils
{
	/// <summary>
	/// Utility class containing several static utility related to the files or the file system.
	/// </summary>
	public static class FileUtils
	{
		/// <summary>
		/// Returns the full filepath of an existing file matching the given filename
		/// in one of the given path directories. Returns null if no file found.
		/// </summary>
		public static string FindInPath(string filename, string[] path)
		{
			// No filename results in null path:
			if ((filename == null) || (filename.Length == 0)) return null;

			// Search each path directory for the file:
			foreach (string dir in path)
			{ 
				string file = Path.Combine(dir, filename);
				if (File.Exists(file)) return file;
			}

			// Return null if not found:
			return null;
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Rudi Breedenraedt
Architect RealDolmen
Belgium Belgium
Rudi is a Software Architect at RealDolmen.

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 20 Nov 2007
Article Copyright 2007 by Rudi Breedenraedt
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid