Exemple #1
0
        public string GetString(AlbumFileField field, string def)
        {
            var val = rowParser.GetFieldOrEmpty(cols, field);

            if (val == string.Empty)
            {
                return(def);
            }

            return(val);
        }
Exemple #2
0
        public string GetString(AlbumFileField field)
        {
            var val = rowParser.GetFieldOrEmpty(cols, field);

            if (val == string.Empty)
            {
                throw new InvalidOperationException("Required field " + field + " is empty");
            }

            return(val);
        }
Exemple #3
0
        public int GetIntOrDefault(AlbumFileField field, int def)
        {
            var val = rowParser.GetFieldOrEmpty(cols, field);

            if (val == string.Empty)
            {
                return(def);
            }

            int i;

            if (int.TryParse(val, out i))
            {
                return(i);
            }

            return(def);
        }
Exemple #4
0
        public string GetFieldOrEmpty(string[] cols, AlbumFileField field)
        {
            if (!IsConfigured)
            {
                throw new InvalidOperationException("Field column indices not configured");
            }

            if (!fieldCols.ContainsKey(field))
            {
                return(string.Empty);
            }

            var index = fieldCols[field];

            if (cols.Length <= index)
            {
                return(string.Empty);
            }

            return(cols[index]);
        }
		public string GetString(AlbumFileField field, string def) {

			var val = rowParser.GetFieldOrEmpty(cols, field);

			if (val == string.Empty)
				return def;

			return val;

		}
		public string GetString(AlbumFileField field) {

			var val = rowParser.GetFieldOrEmpty(cols, field);

			if (val == string.Empty)
				throw new InvalidOperationException("Required field " + field + " is empty");

			return val;

		}
		public int GetIntOrDefault(AlbumFileField field, int def) {

			var val = rowParser.GetFieldOrEmpty(cols, field);

			if (val == string.Empty)
				return def;

			int i;

			if (int.TryParse(val, out i))
				return i;

			return def;

		}
		public string GetFieldOrEmpty(string[] cols, AlbumFileField field) {

			if (!IsConfigured)
				throw new InvalidOperationException("Field column indices not configured");

			if (!fieldCols.ContainsKey(field))
				return string.Empty;

			var index = fieldCols[field];

			if (cols.Length <= index)
				return string.Empty;

			return cols[index];

		}