public static void GeneratorCreate(SqlString code, SqlInt64 seed, SqlInt32 offset)
        {
            CheckSystemLock();
            if (code.IsNull)
            {
                throw new ArgumentException("code");
            }
            if (seed.IsNull)
            {
                throw new ArgumentException("seed");
            }
            if (offset.IsNull)
            {
                throw new ArgumentException("offset");
            }

            var filename = Path.Combine(GeneratorsDirectory, code.Value + ".xml");

            if (File.Exists(filename))
            {
                throw new Exception("generator with given code already existed");
            }
            using (var f = new FileLock(filename)) {
                f.WriteFile(DefineGeneratorXml(seed.Value, offset.Value).ToString());
            }
            SqlContext.Pipe.Send("generator created sucessfully");
        }
        public static SqlInt64 GeneratorNext(SqlString code)
        {
            if (code.IsNull)
            {
                throw new ArgumentException("code");
            }
            CheckSystemLock();

            var filename = Path.Combine(GeneratorsDirectory, code.Value + ".xml");

            if (!File.Exists(filename))
            {
                throw new Exception("generator not existed");
            }
            long result = 0;

            using (var f = new FileLock(filename)) {
                var x      = XElement.Parse(f.ReadFile());
                var value  = Convert.ToInt64(x.Attr("value"));
                var offset = Convert.ToInt32(x.Attr("offset"));
                result = value + offset;
                x.SetAttributeValue("value", result);
                f.WriteFile(x.ToString());
            }
            return(result);
        }
		public static void GeneratorCreate(SqlString code, SqlInt64 seed, SqlInt32 offset) {
			CheckSystemLock();
			if (code.IsNull) {
				throw new ArgumentException("code");
			}
			if (seed.IsNull) {
				throw new ArgumentException("seed");
			}
			if (offset.IsNull) {
				throw new ArgumentException("offset");
			}

			var filename = Path.Combine(GeneratorsDirectory, code.Value + ".xml");
			if (File.Exists(filename)) {
				throw new IOException("generator with given code already existed");
			}
			using (var f = new FileLock(filename)) {
				f.WriteFile(DefineGeneratorXml(seed.Value, offset.Value).ToString());
			}
			SqlContext.Pipe.Send("generator created sucessfully");
		}
		public static SqlInt64 GeneratorNext(SqlString code) {
			if (code.IsNull) {
				throw new ArgumentException("code");
			}
			CheckSystemLock();

			var filename = Path.Combine(GeneratorsDirectory, code.Value + ".xml");

			if (!File.Exists(filename)) {
				throw new IOException("generator not existed");
			}
			long result = 0;
			using (var f = new FileLock(filename)) {
				var x = XElement.Parse(f.ReadFile());
				var value = Convert.ToInt64(x.Attr("value"));
				var offset = Convert.ToInt32(x.Attr("offset"));
				result = value + offset;
				x.SetAttributeValue("value", result);
				f.WriteFile(x.ToString());
			}
			return result;
		}