Beispiel #1
0
        public void TestForestDBViewNameEscaping()
        {
            var invalidName = "#@vuName!!/crazy:��";
            var escapedName = ForestDBViewStore.ViewNameToFilename(invalidName);

            Assert.AreEqual("@23@40vuName@21@21@2fcrazy@3a��.viewindex", escapedName);

            var unescapedName = ForestDBViewStore.FileNameToViewName(escapedName);

            Assert.AreEqual(invalidName, unescapedName);
        }
        public IViewStore GetViewStorage(string name, bool create)
        {
            var view = _views[name];
            if (view == null) {
                try {
                    view = new ForestDBViewStore(this, name, create);
                    _views[name] = view;
                } catch(InvalidOperationException) {
                    return null;
                } catch(Exception e) {
                    Log.E(TAG, String.Format("Error creating view storage for {0}", name), e);
                    return null;
                }
            }

            return view;
        }