Beispiel #1
0
        void StoreValue(StoreValue message)
        {
            IncrementChangeCounter();
            string json = this.FastInvoke <FileStorageEngine, string>(new[] { message.DocumentType }, "Serialize", message.Value);

            _storage.Store(message.DocumentType.ToString(), message.Key, Encoding.UTF8.GetBytes(json));
        }
        private void AddCategoryToMenuStrip(ContextMenuStrip parentMenuStrip, PackFormat.TacO.PathingCategory newCategory)
        {
            var newCategoryMenuItem = parentMenuStrip.AddMenuItem(newCategory.DisplayName);

            _moduleControls.Add(newCategoryMenuItem);

            StoreValue <bool> categoryStoreState = _pathableToggleStates.GetOrSetValue(newCategory.Namespace, true);

            newCategory.Visible = categoryStoreState.Value;

            newCategoryMenuItem.CanCheck = true;
            newCategoryMenuItem.Checked  = newCategory.Visible;

            newCategoryMenuItem.CheckedChanged += delegate(object sender, CheckChangedEvent e) {
                newCategory.Visible      = e.Checked;
                categoryStoreState.Value = e.Checked;
            };

            if (newCategory.Any())
            {
                var childMenuStrip = new ContextMenuStrip();

                _moduleControls.Add(childMenuStrip);

                newCategoryMenuItem.Submenu = childMenuStrip;

                foreach (var childCategory in newCategory)
                {
                    AddCategoryToMenuStrip(childMenuStrip, childCategory);
                }
            }
        }
        public void ParseTest1()
        {
            var    test  = new ParseGCodeStream();
            var    actor = new StoreValue();
            string lines = @"G1 Y2
G1 X10";

            using (var str = new MemoryStream(Encoding.ASCII.GetBytes(lines))) {
                Assert.AreEqual(test.Parse(str, actor), true);
            }
            Assert.AreEqual(actor.preCount, 0);
            Assert.AreEqual(actor.postCount, 2);
            Assert.AreEqual(actor.values.Count, 2);
            Assert.AreEqual(actor.values[0], "G1 Y2");
            Assert.AreEqual(actor.values[1], "G1 X10");
        }