Пример #1
0
 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);
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }