public override bool Equals(object obj) { if (obj is RosType) { RosType other = obj as RosType; return(this.Namespace == other.Namespace && this.Type == other.Type); } return(false); }
protected RosFile(FileInfo file) { if (null == file) { throw new ArgumentNullException(nameof(file)); } if (!file.Exists) { throw new FileNotFoundException(file.FullName); } this.RosFileInfo = file; this.FileContent = File.ReadAllText(this.RosFileInfo.FullName); SetPackageDirectoryInfo(); string namespaceName = this.PackageDirectoryInfo.Name; string className = Path.GetFileNameWithoutExtension(this.RosFileInfo.Name); Type = new RosType(namespaceName, className); }
protected RosFile(string fileContent, string className, string namespaceName) { if (null == fileContent) { throw new ArgumentNullException(nameof(fileContent)); } //FileContent can be empty (service with no response) if (string.IsNullOrWhiteSpace(className)) { throw new ArgumentException("Parameter cannot be empty!", nameof(className)); } if (string.IsNullOrWhiteSpace(namespaceName)) { throw new ArgumentException("Parameter cannot be empty!", nameof(namespaceName)); } this.FileContent = fileContent; Type = new RosType(namespaceName, className); }