public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(DependencyProperty.UnsetValue); } DetectType detType = (DetectType)value; string strDetType = null; switch (detType) { case DetectType.UnKnown: strDetType = "尚未统计"; break; case DetectType.TrueDet: strDetType = "正检"; break; case DetectType.FalseDet: strDetType = "误检"; break; case DetectType.Ignore: strDetType = "不作统计"; break; } return(strDetType); }
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { DetectType t = (DetectType)int.Parse(parameter.ToString()); object[] objs = new object[2]; double val = (double)value; objs[0] = (int)val; objs[1] = t; return(objs); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values[0] != DependencyProperty.UnsetValue && values[1] != DependencyProperty.UnsetValue) { DetectType t = (DetectType)int.Parse(parameter.ToString()); int val = (int)values[0]; DetectType state = (DetectType)values[1]; return(t == state ? (double)val : 0); } return(0.0); }
public Cell(AxialCoord axialCoord, ITerrainDef def) { this.axialCoord = axialCoord; this.terrainType = def.type; this.terrainCode = def.code; this.detectType = DetectType.UN_VISIBLE; this._components = new List <IComponent>(); Intergrate(); }
private static String ProcessDirectory(String appPath, DetectType detectType) { switch (detectType) { case DetectType.Application: return(Search(appPath, SourceCodeAnalysisCommonDefs.AppFilename)); case DetectType.PrepareScript: return(Search(appPath, SourceCodeAnalysisCommonDefs.AppPrepareFilename)); default: return(null); } }
private static String ProcessFile(String appPath, DetectType detectType) { String appFilename = Path.GetFileName(appPath); switch (detectType) { case DetectType.Application: return(String.Equals(appFilename, SourceCodeAnalysisCommonDefs.AppFilename) ? appPath : null); case DetectType.PrepareScript: return(String.Equals(appFilename, SourceCodeAnalysisCommonDefs.AppPrepareFilename) ? appPath : null); default: return(null); } }
/// <summary> /// here in UpdateDynamic i want make it to work dynamically /// instead of create same block for each dataType etc... /// [Edit: This will be need to create each method because all data type has its body and properties] /// </summary> /// <param name="ID"></param> /// <param name="pathObj"></param> /// <returns></returns> public DBResultClass UpdateDynamic(int ID, object pathObj) { //Dy will be the type of path object param //DetectType.dName(pathObj) will be name of class Type Dy; Dy = DetectType.dType(pathObj); DBResultClass result = null; try { result = new DBResultClass(DBResultClass.DBResult.Success, DetectType.dName(pathObj) + " Updated Successfully"); } catch (SqlException ex) { result = new DBResultClass(DBResultClass.DBResult.Failed, ex.Message); } return(result); }
public void FindTypeTest() { var fileName = "this is a movie.avi"; var expected = MediaPathFileModel.MediaPathFileType.Movie; var actual = DetectType.FindType(fileName, false, true); Assert.AreEqual(expected, actual); fileName = "this is a movie.avi"; expected = MediaPathFileModel.MediaPathFileType.Movie; actual = DetectType.FindType(fileName, true, false); Assert.AreNotEqual(expected, actual); fileName = "this is a tv show.s01e02.avi"; expected = MediaPathFileModel.MediaPathFileType.TV; actual = DetectType.FindType(fileName, true, false); Assert.AreEqual(expected, actual); fileName = "this is a tv show.s01e02.avi"; expected = MediaPathFileModel.MediaPathFileType.TV; actual = DetectType.FindType(fileName, false, true); Assert.AreNotEqual(expected, actual); }
public static String DetectApp(String appPath, DetectType detectType) { if (String.IsNullOrEmpty(appPath)) { return(null); } const Char environmentBorderChar = '%'; String expandedPath = Environment.ExpandEnvironmentVariables(appPath); if (expandedPath.IndexOf(environmentBorderChar) != -1) { return(null); } if (File.Exists(appPath)) { return(ProcessFile(appPath, detectType)); } if (Directory.Exists(appPath)) { return(ProcessDirectory(appPath, detectType)); } return(null); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values[0] != DependencyProperty.UnsetValue && values[1] != DependencyProperty.UnsetValue) { DetectType state = (DetectType)values[0]; int count = (int)values[1]; switch (state) { case DetectType.UnKnown: return("State: 未统计"); case DetectType.TrueDet: return("State: 正检 [" + count.ToString() + "]"); case DetectType.FalseDet: return("State: 误检 [" + count.ToString() + "]"); case DetectType.Ignore: return("State: 不作统计"); } } return(null); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { DetectType state = (DetectType)value; return(state == (DetectType)int.Parse(parameter.ToString())); }
public DetectByImageFileRequest(DetectType detectType, System.IO.FileInfo imageFile, string loc = "0-0-1-1") : this(detectType, loc) { this.ImageFile = imageFile; }
public DetectByImageFileRequest(DetectType detectType, string loc = "0-0-1-1") : base(_detectServiceDicts[(int)detectType].ServiceType, _detectServiceDicts[(int)detectType].ServiceId, loc) { }
public DetectByImageUrlRequest(DetectType detectType, string url, string loc = "0-0-1-1") : this(detectType, loc) { this.Url = url; }