예제 #1
0
        /// <summary>
        /// Adds the given <paramref name="unitReference"/>, the corresponding file name and its data to the given
        /// <paramref name="unitBundleTable"/>.
        /// </summary>
        /// <param name="unitReference">Unit reference to process</param>
        /// <param name="unitBundleTable">Unit bundle table to update</param>
        /// <returns>The name of the TDIL file</returns>
        /// <exception cref="UnitBundlerException">If something went wrong</exception>
        private string AddUnitReferenceToBundleTable(string unitReference, UnitBundleTable unitBundleTable)
        {
            UnitName unitName     = new UnitName(unitReference);
            string   unitFilePath = iImportPathProvider.GetPath(unitName);

            try {
                string unitFileName    = Path.GetFileName(unitFilePath);
                string fileContent     = File.ReadAllText(unitFilePath);
                byte[] unitFileContent = Encoding.UTF8.GetBytes(fileContent);
                unitBundleTable.AddEntry(unitFileName, unitFileContent);
                return(unitFileName);
            } catch (Exception ex) {
                throw new UnitBundlerException(string.Format("Error on adding unit reference '{0}' to package table", unitReference), ex);
            }
        }
예제 #2
0
        /// <inheritdoc />
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, null))
            {
                return(false);
            }
            if (ReferenceEquals(obj, this))
            {
                return(true);
            }

            UnitName unitName = obj as UnitName;

            if (unitName == null)
            {
                return(false);
            }

            if (!Equals(ApplicationFragment, unitName.ApplicationFragment))
            {
                return(false);
            }
            if (!Equals(VersionFragment, unitName.VersionFragment))
            {
                return(false);
            }
            if (!Equals(UseCaseFragment, unitName.UseCaseFragment))
            {
                return(false);
            }
            if (!Equals(ScenarioFragment, unitName.ScenarioFragment))
            {
                return(false);
            }

            return(true);
        }