initial oogynize check in _ this actually used to work!
This commit is contained in:
37
AddIns/AddIn.Common/CommonValidations.cs
Normal file
37
AddIns/AddIn.Common/CommonValidations.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace Foo.AddIn.Common
|
||||
{
|
||||
public static class Validate
|
||||
{
|
||||
/// <summary>
|
||||
/// Validate ArtifactLocation * We could later do much more work here *
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool IsValidArtifactLocation(string strArtifactLocation, ref FuncRetVal retVal)
|
||||
{
|
||||
// All URLs should contain that character (Files aren't allowed to contain it)
|
||||
bool bIsUrl = strArtifactLocation.Contains('/');
|
||||
|
||||
if (String.IsNullOrEmpty(strArtifactLocation))
|
||||
{
|
||||
retVal.Type = FuncRetValEnum.ParameterInvalid;
|
||||
return false;
|
||||
}
|
||||
else if (!bIsUrl && !File.Exists(strArtifactLocation))
|
||||
{
|
||||
// Check File existence (if it doesn't return false)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user