コード例 #1
0
        public void QueryTwo()
        {
            var procedures = ProceduralDb.Query("nonsense", ".*", ".*", ".*", ".*",
                                                ".*", ".*");

            Assert.AreEqual(0, procedures.Count);
        }
コード例 #2
0
        public void TempName()
        {
            string tempName = ProceduralDb.TempName();

            Assert.IsNotNull(tempName);
            Assert.Greater(tempName.Length, 0);
        }
コード例 #3
0
        public void QueryOne()
        {
            var procedures = ProceduralDb.Query(".*", ".*", ".*", ".*", ".*", ".*",
                                                ".*");

            Assert.Greater(procedures.Count, 0);
            Assert.IsTrue(procedures.All(p => ProceduralDb.ProcExists(p)));
        }
コード例 #4
0
        public void GetData(VariableSet variables)
        {
            var data = ProceduralDb.GetData(_name);

            if (data != null)
            {
                var stream = new MemoryStream(data);
                variables.ForEach(v => v.Deserialize(_formatter, stream));
            }
        }
コード例 #5
0
        public void SetData(VariableSet variables)
        {
            var stream = new MemoryStream();

            variables.ForEach(v => v.Serialize(_formatter, stream));
            if (stream.Length != 0)
            {
                ProceduralDb.SetData(_name, stream.GetBuffer());
            }
        }
コード例 #6
0
        public void GetDataSize()
        {
            string identifier = ProceduralDb.TempName();
            var    encoding   = new System.Text.ASCIIEncoding();

            const string testString = "This is a test";
            var          data       = encoding.GetBytes(testString);

            ProceduralDb.SetData(identifier, data);

            Assert.AreEqual(data.Length, ProceduralDb.GetDataSize(identifier));
        }
コード例 #7
0
        public void GetData()
        {
            var data = ProceduralDb.GetData(_name);

            if (data != null)
            {
                var memoryStream = new MemoryStream(data);
                var type         = _plugin.GetType();

                foreach (var attribute in new SaveAttributeSet(type))
                {
                    var field = attribute.Field;
                    field.SetValue(_plugin, _formatter.Deserialize(memoryStream));
                }
            }
        }
コード例 #8
0
        public void SetData()
        {
            var memoryStream = new MemoryStream();

            var type = _plugin.GetType();

            foreach (var attribute in new SaveAttributeSet(type))
            {
                var field = attribute.Field;
                _formatter.Serialize(memoryStream, field.GetValue(_plugin));
            }

            if (memoryStream.Length != 0)
            {
                ProceduralDb.SetData(_name, memoryStream.GetBuffer());
            }
        }
コード例 #9
0
 static public bool Exists(string name)
 {
     return(ProceduralDb.ProcExists(name));
 }
コード例 #10
0
 static public bool Exists(string name) => ProceduralDb.ProcExists(name);
コード例 #11
0
 public void Exists()
 {
     Assert.IsFalse(ProceduralDb.ProcExists("nonsense"));
     Assert.IsTrue(ProceduralDb.ProcExists("gimp-image-new"));
 }