public override bool Equals(object obj) { if (obj == null) // check if its null { return(false); } if (this.GetType() != obj.GetType()) // check if the type is the same { return(false); } UserAction action = (UserAction)obj; if (action == null) // check if it can be casted { return(false); } //UserAction action; //try //{ // action = (UserAction)obj; // if (action == null) // check if it can be casted // return false; //} //catch //{ // return false; //} if (this.Id > -1 && action.Id > -1) // id already specified { if (this.Id == action.Id) { return(true); } else { return(false); } } else { if (action.ActionType == UserActionType.FileMovedAction) { FileMovedAction f_action = (FileMovedAction)action; if (Path.GetDirectoryName(this._file) == Path.GetDirectoryName(f_action._file) && Path.GetExtension(this._file) == Path.GetExtension(f_action._file) && (Path.GetFileNameWithoutExtension(this._file) == Path.GetFileNameWithoutExtension(f_action._file) || Diff.IsDiffNumerical(Diff.DiffString(Path.GetFileNameWithoutExtension(this._file), Path.GetFileNameWithoutExtension(f_action._file))))) { return(true); } else { return(false); } } //else if (action.ActionType == UserActionType.FileDeletedAction) //{ // FileDeletedAction f_action = (FileDeletedAction)action; // if (Path.GetDirectoryName(this._file).Length > Path.GetDirectoryName(f_action.FileName).Length && // Path.GetFileName(this._file) == Path.GetFileName(f_action.FileName)) // return true; // else // return false; //} else { return(false); } } }
public override UserAction Merge(UserAction action) { return(null); }
public abstract bool Equals(UserAction action);
public abstract UserAction Merge(UserAction action);
public override UserAction Merge(UserAction action) { throw new NotImplementedException(); }