- Olbert_Utilities.zip
- Olbert.Utilities
- CryptorLib
- documentation
- bin
- Content Layout.content
- Creative Commons Attribution Share Alike.aml
- Cryptor Overview.aml
- GLPL.aml
- GPL.aml
- Licenses.aml
- Miscellaneous Utilities Overview.aml
- nHydrate Installer Overview.aml
- nHydrate Utilities.aml
- Olbert.Utils.shfbproj
- Open Source License v3.aml
- overview.aml
- Release Notes.aml
- Wizard Framework.aml
- WPF Utilities.aml
- MiscUtilities
- MiscUtilitiesCore
- nHydrateInstaller
- nHydrateUtils
- NotMine
- NotMineWPF
- OlbertUtilities.sln
- OlbertUtilities.suo
- WPFUtilities
- WPFWizard
|
/*
* Olbert.Utilities.nHydrate
* utilities for simplifying the use of nHydrate entities in WPF applications
* Copyright (C) 2011 Mark A. Olbert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Olbert.Utilities;
namespace Olbert.nHydrate
{
/// <summary>
/// A class which implements IComparer<ResourceSqlFile>, allowing
/// the ResourceSqlFile objects created by the nHydrate database configuration
/// system to be sorted by their version stamp (which is embedded in the file name)
/// </summary>
public class ResourceSqlFileComparer : IComparer<ResourceSqlFile>
{
/// <summary>
/// Implements the required interface to compare the version information
/// embedded in the supplied ResourceSqlFile objects.
/// </summary>
/// <param name="left">the left-hand side object being compared</param>
/// <param name="right">the right-hand side object being compared</param>
/// <returns>0 if the versions of the two files match, -1 if the left object's
/// version is less than the right object's, 1 if the left object's version
/// is greater than the right object's</returns>
public int Compare( ResourceSqlFile left, ResourceSqlFile right )
{
if( ( left == null ) && ( right == null ) ) return 0;
if( left == null ) return -1;
if( right == null ) return 1;
nHydrateVersion nhLeft = nHydrateVersion.GetFromFilePath(left.Name);
nHydrateVersion nhRight = nHydrateVersion.GetFromFilePath(right.Name);
return nhLeft.CompareTo(nhRight);
}
}
}
|
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.
Some people like to do crossword puzzles to hone their problem-solving skills. Me, I like to write software for the same reason.
A few years back I passed my 50th anniversary of programming. I believe that means it's officially more than a hobby or pastime. In fact, it may qualify as an addiction
.
I mostly work in C# and Windows. But I also play around with Linux (mostly Debian on Raspberry Pis) and Python.