public void ComplexType()
 {
     var sut = new StateSerializer(new Dictionary<string, string>());
     TestField = "bar";
     sut["foo"] = this;
     Assert.AreEqual("bar", ((StateSerializerTests)sut["foo"]).TestField);
 }
 public void Remove()
 {
     var sut = new StateSerializer(new Dictionary<string, string>());
     sut["foo"] = "bar";
     Assert.IsTrue(sut.Remove("foo"));
     Assert.IsFalse(sut.ContainsKey("foo"));
 }
Exemple #3
0
    public override void StoreData()
    {
        data.mobName = mobName;
        data.health  = _health;
        data.xPos    = transform.position.x;
        data.yPos    = transform.position.y;
        data.zPos    = transform.position.z;
        data.yRot    = transform.rotation.eulerAngles.y;

        StateSerializer ss = new StateSerializer();

        ss.SaveState(this);
        data.state = ss;

        GameManager.Instance.Data.mobs.Add(data);
    }
Exemple #4
0
        public BinaryIngressStreamablePassive(Stream binaryStream, StreamProperties <TKey, TPayload> inputProperties, bool readPropertiesFromStream, QueryContainer container, string identifier)
            : base((inputProperties ?? StreamProperties <TKey, TPayload> .Default).SetQueryContainer(container))
        {
            if (readPropertiesFromStream)
            {
                var propSer = StreamableSerializer.Create <SerializedProperties>();
                var props   = propSer.Deserialize(binaryStream);
                this.properties = props.ToStreamProperties <TKey, TPayload>();
            }

            this.stream                = binaryStream;
            this.serializer            = StreamableSerializer.Create <QueuedMessage <StreamMessage <TKey, TPayload> > >(new SerializerSettings());
            this.container             = container;
            this.IngressSiteIdentifier = identifier ?? Guid.NewGuid().ToString();
            container?.RegisterIngressSite(identifier);
            this.restored = container == null;
        }
        public void EmptyState_ShouldDeserializeNullValuesAsEmptyValues()
        {
            using var stream = new MemoryStream();
            var state = new TestState();

            StateSerializer.Serialize(stream, state, true, true);
            stream.Position = 0;
            var resultingState = new TestState();

            StateSerializer.Deserialize(resultingState, stream);

            Assert.IsTrue(
                state.TestProperty1 == null && resultingState.TestProperty1 == "" &&
                state.ArrayTestProperty == null && resultingState.ArrayTestProperty != null && resultingState.ArrayTestProperty.Length == 0 &&
                state.MapTestProperty == null && resultingState.MapTestProperty != null && resultingState.MapTestProperty.Count == 0,
                "Deserialized state does not convert null values to empty values.");
        }
        public void TestState_IgnoreAttribute_ShouldNotBeSerialized()
        {
            using var stream = new MemoryStream();
            var state = new TestState_IgnoreAttribute();

            state.Serialized    = 100;
            state.NotSerialized = 100;

            StateSerializer.Serialize(stream, state, true, true);
            stream.Position = 0;
            var resultingState = StateSerializer.Deserialize <TestState_IgnoreAttribute>(stream);

            Assert.IsTrue(state.Serialized == resultingState.Serialized,
                          "Public field in DataClass without Ignore attribute is not serialized.");
            Assert.IsTrue(resultingState.NotSerialized == 0,
                          "Public field in DataClass with Ignore attribute is serialized.");
        }
        private void MergeButton_Click(object sender, RoutedEventArgs e)
        {
            EditorSubsystemManaged.getInstance().QueueActionAndBlock(new Action(() =>
            {
                StateSerializer ss   = new StateSerializer();
                BaseState cur_state  = GSM.getInstance().getStateUnderActive();
                BaseState new_state  = GSM.getInstance().getActiveState();
                BoolVector mergeMask = new BoolVector();
                foreach (var obj in objects)
                {
                    mergeMask.Add(obj.ShouldMerge);
                }

                ss.MergeStates(new_state, cur_state, mergeMask);
            }));

            this.Close();
        }
Exemple #8
0
 private void TestStartButton_Click(object sender, RoutedEventArgs e)
 {
     if ((DataContext as EngineManagerViewModel).IsConnected)
     {
         if (EditorSubsystem.getInstance().IsTesting())
         {
             return;
         }
         EditorSubsystemManaged.getInstance().QueueAction(() =>
         {
             StateSerializer ss = new StateSerializer(); ss.SaveCurrentState("_Testing_Temp.mocha");
         });
         EditorSubsystemManaged.getInstance().QueueAction(() =>
         {
             BeginTest();
         });
     }
 }
        public void TestState_DataAttribute_ShouldBeSerialized()
        {
            using var stream = new MemoryStream();
            var state = new TestState_DataAttribute();

            state.Serialized    = 100;
            state.NotSerialized = 100;

            StateSerializer.Serialize(stream, state, true, true);
            stream.Position = 0;
            var resultingState = new TestState_DataAttribute();

            StateSerializer.Deserialize(resultingState, stream);

            Assert.IsTrue(state.Serialized == resultingState.Serialized,
                          "Public field with Data attribute is not serialized.");
            Assert.IsTrue(resultingState.NotSerialized == 0,
                          "Public field without Data attribute is serialized.");
        }
 public void ValueTypes()
 {
     var sut = new StateSerializer(new Dictionary<string, string>());
     var someDate = DateTime.Now.AddDays(1);
     sut["foo"] = someDate;
     Assert.AreEqual(someDate, sut["foo"]);
     double floatingPointNumber = 1.5;
     sut["foo"] = floatingPointNumber;
     Assert.AreEqual(floatingPointNumber, sut["foo"]);
     int integerNumber = 2;
     sut["foo"] = integerNumber;
     Assert.AreEqual(integerNumber, sut["foo"]);
     var booleanValue = true;
     sut["foo"] = booleanValue;
     Assert.AreEqual(booleanValue, sut["foo"]);
     var someGuid = Guid.NewGuid();
     sut["foo"] = someGuid;
     Assert.AreEqual(someGuid, sut["foo"]);
 }
Exemple #11
0
        public void Compile_Greeting_Success()
        {
            // Arrange
            var muteCompiler = new Compiler();
            var result       = muteCompiler.Compile("module foo;\r\nlet s <- import 'greeting' as string;");

            var serializer         = new StateSerializer();
            var deserializer       = new StateDeserializer();
            var dependencyResolver = new DefaultDependencyResolver();

            dependencyResolver.Register <Transaction>(TransactionFactory.CreateNew(null), null);
            dependencyResolver.Register <ITimeService>(Substitute.For <ITimeService>(), null);
            dependencyResolver.Register("Hello World!", "greeting");

            // Act
            var state = result.Result(serializer, deserializer, dependencyResolver);

            // Assert
            Assert.True(result.Success);
        }
Exemple #12
0
        public void ThenTheBoardHasBlocksMatching(string definition)
        {
            Assert.NotNull(_context.BoardState, "Board State has not been initialized.");

            var testBoard = StateSerializer.ParseSideV1(StateManager.Create(), $"X:{definition}");

            var sb = new StringBuilder();

            var successful = 0;

            foreach (var location in State.AllBoardLocations)
            {
                if (!_context.BoardState[location].IsBlock() && !testBoard[location].IsBlock())
                {
                    continue;
                }

                if ((_context.BoardState[location] & ~(Cell.Locked | Cell.CursePending)) !=
                    (testBoard[location] &= ~(Cell.Locked | Cell.CursePending)))
                {
                    sb.AppendLine(
                        $"At {location}: Expected {testBoard[location] & ~(Cell.Locked | Cell.CursePending)}, " +
                        $"Got {_context.BoardState[location] & ~(Cell.Locked | Cell.CursePending)}");
                }
                else
                {
                    successful++;
                }
            }

            Console.WriteLine($"Successfully validated {successful} block{(successful == 1 ? "" : "s")}.");

            if (sb.Length > 0)
            {
                Assert.Fail($"The following board locations had different contents than expected:\r\n{sb}");
            }
        }
Exemple #13
0
    public void Load(string state)
    {
        if (state != null)
        {
            StateSerializer.Load(this, state.Trim(' ', '\n', '\r'));
            return;
        }

        var inputs = Console.ReadLine().Split(' ');

        PlayersNumber = int.Parse(inputs[0]); // total number of players (2 to 4).
        MyIndex       = int.Parse(inputs[1]); // your player number (0 to 3).

        for (int i = 0; i < PlayersNumber; i++)
        {
            var s = Console.ReadLine();
            inputs = s.Split(' ');
            int x0 = int.Parse(inputs[0]); // starting X coordinate of lightcycle (or -1)
            int y0 = int.Parse(inputs[1]); // starting Y coordinate of lightcycle (or -1)
            int x1 = int.Parse(inputs[2]); // starting X coordinate of lightcycle (can be the same as X0 if you play before this player)
            int y1 = int.Parse(inputs[3]); // starting Y coordinate of lightcycle (can be the same as Y0 if you play before this player)

            if (x1 >= 0)
            {
                Cells[x1, y1] = i;
                Cells[x0, y0] = i;
            }
            else if (Players[i].X >= 0)
            {
                Log.D("dead:", i);
                ClearPlayer(i);
            }

            Players[i].X = x1;
            Players[i].Y = y1;
        }
    }
Exemple #14
0
        public static StatefulTable <TState, TSymbol> Load <TState, TSymbol>(XDocument document, TSymbol nullValue,
                                                                             StateSerializer <TState> stateSerializer, SymbolSerializer <TSymbol> symbolSerializer)
        {
            // Get symbols
            var symbols = new List <TSymbol>();

            symbols.Add(nullValue);
            foreach (var element in document.Root.Elements())
            {
                if ("symbols".Equals(element.Name.LocalName))
                {
                    for (int index = 0; index < element.Value.Length; index++)
                    {
                        symbols.Add(symbolSerializer.FromString($"{element.Value[index]}"));
                    }
                    break;
                }
            }

            // Get status
            var states       = new List <TState>();
            var initialState = default(TState);
            var finalStates  = new List <TState>();

            foreach (var element in document.Root.Elements())
            {
                if ("states".Equals(element.Name.LocalName))
                {
                    foreach (var stateTag in element.Elements())
                    {
                        bool isStart = false;
                        bool isHalt  = false;
                        if ("state".Equals(stateTag.Name.LocalName))
                        {
                            foreach (var attribute in stateTag.Attributes())
                            {
                                if ("start".Equals(attribute.Name.LocalName))
                                {
                                    isStart = "yes".Equals(attribute.Value);
                                }
                                else if ("halt".Equals(attribute.Name.LocalName))
                                {
                                    isHalt = "yes".Equals(attribute.Value);
                                }
                            }

                            var status = stateSerializer.FromString(stateTag.Value);
                            states.Add(status);

                            if (isStart)
                            {
                                initialState = status;
                            }

                            if (isHalt)
                            {
                                finalStates.Add(status);
                            }
                        }
                    }
                    break;
                }
            }

            // Create the table
            var table = new StatefulTable <TState, TSymbol>(states, symbols, initialState, finalStates);

            // Transition function
            foreach (var element in document.Root.Elements())
            {
                if ("transition-function".Equals(element.Name.LocalName))
                {
                    foreach (var mappingTag in element.Elements())
                    {
                        if ("mapping".Equals(mappingTag.Name.LocalName))
                        {
                            var currentState  = string.Empty;
                            var currentSymbol = string.Empty;
                            var nextState     = string.Empty;
                            var nextSymbol    = string.Empty;
                            var movement      = string.Empty;
                            foreach (var fromTag in mappingTag.Elements())
                            {
                                if ("from".Equals(fromTag.Name.LocalName))
                                {
                                    foreach (var attribute in fromTag.Attributes())
                                    {
                                        if ("current-state".Equals(attribute.Name.LocalName))
                                        {
                                            currentState = attribute.Value;
                                        }
                                        else if ("current-symbol".Equals(attribute.Name.LocalName))
                                        {
                                            currentSymbol = attribute.Value;
                                        }
                                    }
                                    break;
                                }
                            }
                            foreach (var toTag in mappingTag.Elements())
                            {
                                if ("to".Equals(toTag.Name.LocalName))
                                {
                                    foreach (var attribute in toTag.Attributes())
                                    {
                                        if ("next-state".Equals(attribute.Name.LocalName))
                                        {
                                            nextState = attribute.Value;
                                        }
                                        else if ("next-symbol".Equals(attribute.Name.LocalName))
                                        {
                                            nextSymbol = attribute.Value;
                                        }
                                        else if ("movement".Equals(attribute.Name.LocalName))
                                        {
                                            movement = attribute.Value;
                                        }
                                    }
                                    break;
                                }
                            }

                            var key = new TableKey <TState, TSymbol>(stateSerializer.FromString(currentState),
                                                                     symbolSerializer.FromString(currentSymbol));
                            var value = new TableValue <TState, TSymbol>(stateSerializer.FromString(nextState),
                                                                         symbolSerializer.FromString(nextSymbol), GetMoveActionFromString(movement));

                            table[key] = value;
                        }
                    }
                    break;
                }
            }
            return(table);
        }
Exemple #15
0
        public void GivenIDefine(string boardName, Table table)
        {
            var boardText = string.Join("\r\n", table.Rows.Select(tr => tr[0]));

            _context.StateLibrary[boardName] = StateSerializer.FromString(boardText);
        }
Exemple #16
0
 public BinaryStreamObserver(StreamProperties <TKey, TPayload> streamProperties, Stream stream)
 {
     this.serializer = StreamableSerializer.Create <QueuedMessage <StreamMessage <TKey, TPayload> > >(new SerializerSettings());
     this.stream     = stream;
 }
 public void Indexer()
 {
     var sut = new StateSerializer(new Dictionary<string, string>());
     sut["foo"] = "bar";
     Assert.AreEqual("bar", sut["foo"]);
 }
Exemple #18
0
        public void Tick()
        {
            if (!hasInit)
            {
                Init();
            }

            while (actionQueue.Count != 0)
            {
                EditorAction a = actionQueue.Dequeue();
                //Dispatcher.CurrentDispatcher.Invoke(a, DispatcherPriority.Normal);
                if (a == null)  //wait frame
                {
                    break;
                }
                a.a();
                if (a.mres != null)
                {
                    a.mres.Set();
                    a.mres.Dispose();
                }
            }

            if (!EditorSubsystem.getInstance().IsTesting())
            {
                //draw grid lines
                if (EngineCommandBindings.DrawGrid && EngineCommandBindings.GridSize > 0)
                {
                    Vector3 camPos = EditorSubsystem.getInstance().EditorCamera().gameObject.transform.GetGlobalPosition();
                    float   startX = camPos.X;
                    float   startY = camPos.Y;
                    float   startZ = camPos.Z;
                    startX = startX - (startX % EngineCommandBindings.GridSize);
                    if (startY > 0)
                    {
                        startY = startY - (startY % EngineCommandBindings.GridSize);
                    }
                    else
                    {
                        startY = startY + (startY % EngineCommandBindings.GridSize);
                    }
                    startZ = startZ - (startZ % EngineCommandBindings.GridSize);

                    for (int y = (int)startY; y <= (int)startY + EngineCommandBindings.gridExtent / 2; y += EngineCommandBindings.GridSize)
                    {
                        //for every y, draw an x,z plane
                        for (int x = (int)startX - EngineCommandBindings.gridExtent; x <= (int)startX + EngineCommandBindings.gridExtent; x += EngineCommandBindings.GridSize)
                        {
                            //draw z
                            Renderer.getInstance().DrawLinePerma(new Vector3(x, y, startZ - EngineCommandBindings.gridExtent), new Vector3(x, y, startZ + EngineCommandBindings.gridExtent),
                                                                 new Color(0.39f, 0.60f, 0.93f, .5f));
                            for (int z = (int)startZ - EngineCommandBindings.gridExtent; z <= (int)startZ + EngineCommandBindings.gridExtent; z += EngineCommandBindings.GridSize)
                            {
                                //draw x
                                Renderer.getInstance().DrawLinePerma(new Vector3(x - EngineCommandBindings.gridExtent, y, z), new Vector3(x + EngineCommandBindings.gridExtent, y, z),
                                                                     new Color(.4f, .4f, 0.0f, .3f));
                            }
                        }
                    }
                }

                //save occasionally
                autoSaveTimer += FrameController.DT();
                if (autoSaveTimer > 30.0f)
                {
                    QueueAction(() =>
                    {
                        try
                        {
                            StateSerializer ss = new StateSerializer();
                            ss.DoRecoverySave();
                        }
                        catch (Exception e)
                        {
                            Logger.Log("FAILED TO SAVE RECOVERY SAVE: " + e.Message);
                        }
                    });
                    autoSaveTimer = 0;
                }

                //occasionally check for available assets
                ++checkforChangedAssetsTimer;
                if (checkforChangedAssetsTimer > CHECKFORCHANGEDASSETS_TIME)
                {
                    AssetManager.getInstance().CheckForChangedAssets();
                    checkforChangedAssetsTimer = 0;
                }

                //do standard updates
                if (Input.GetIsMouseInWindow(true) && EngineManagerViewModel.instance.EngineEmbedHasVisibility && EngineManagerViewModel.instance._isFocused)
                {
                    //run sub systems
                    auto_builder.Update();

                    //set tooltips
                    mouseTooltipText.gameObject.transform.SetPosition(Input.GetMouseX(true) - Engine.getInstance().GetGameWnd().GetWindowWidth() * 0.5f,
                                                                      -(Input.GetMouseY(true) - Engine.getInstance().GetGameWnd().GetWindowHeight() * 0.5f), 0);
                    editorStatusText.gameObject.transform.SetPosition(-Engine.getInstance().GetGameWnd().GetWindowWidth() * 0.49f,
                                                                      Engine.getInstance().GetGameWnd().GetWindowHeight() * 0.44f, 0);
                    editorStatusText.mText = "--- STATUS ---\\n" +
                                             "Arrow Keys Snap Prec.: " + arrowSnapPrecision.ToString("0.0") +
                                             "\\nFPS: " + (1.0f / FrameController.DT()).ToString("0.0") +
                                             "\\n---------------";

                    CCamera editorCamera = EditorSubsystem.getInstance().EditorCamera();
                    if (Input.GetTriggered(0, "F2") == 1.0f)
                    {
                        //duplicate
                        EngineCommandBindings.CMD_DuplicateObjects();
                    }

                    //select objects naively
                    GameObject gobj = GameObject.From(PhysicEngine.getInstance().RayCast3D(editorCamera.gameObject.transform.position,
                                                                                           editorCamera.gameObject.transform.GetForwardVector(), editorCamera, Input.GetMouseX(true),
                                                                                           Input.GetMouseY(true), 10000.0f));
                    if (gobj != null && gobj.GetFlag("ArtWidget"))
                    {
                        //select widget's actual object
                        gobj = GameObject.From(EditorSubsystem.getInstance().widgetManager.GetAttachedObjFromWidgetObj(gobj));
                    }
                    if (gobj != null && !gobj.GetFlag("Widget"))
                    {
                        //show tooltip if mouse over
                        mouseTooltipText.mText = gobj.GetName();

                        //select if clicked on
                        if (Input.GetTriggered(0, "MouseLClick") == 1.0f)
                        {
                            Application.Current.Dispatcher.Invoke(new Action(() =>
                            {
                                try
                                {
                                    if (Input.GetHeld(0, "AdditiveMod") == 1.0f)
                                    {
                                        GameObjectSelectionManager.RequestAdditiveSelect(gobj);
                                    }
                                    else
                                    {
                                        GameObjectSelectionManager.RequestSelect(gobj);
                                    }
                                }
                                catch (Exception e)
                                {
                                    Console.WriteLine("Consumed Error in Hierarchy: " + e.ToString());
                                }
                            }
                                                                             ));
                        }
                    }
                    else
                    {
                        mouseTooltipText.mText = "";
                    }

                    //rotate camera and move camera
                    float dt = FrameController.getInstance().GetDeltaTime();
                    if (Input.GetHeld(0, "MoveFaster") == 1.0f)
                    {
                        dt *= 3;
                    }
                    Vector3 velocityThisFrame = new Vector3();
                    if (Input.GetHeld(0, "MouseRCLick") == 1.0f)
                    {
                        float dx = 0.25f * (Input.GetMouseDeltaX() * (3.14f / 180.0f));
                        float dy = 0.25f * (Input.GetMouseDeltaY() * (3.14f / 180.0f));
                        editorCamera.Pitch(dy);
                        editorCamera.RotateY(dx);

                        float val = Input.GetValue(0, "up");
                        velocityThisFrame.Z += val;
                        val = Input.GetValue(0, "right");
                        velocityThisFrame.X += val;
                        val = Input.GetValue(0, "down");
                        velocityThisFrame.Z -= val;
                        val = Input.GetValue(0, "left");
                        velocityThisFrame.X -= val;
                        cameraVelocity      += velocityThisFrame;
                        //cameraVelocity = cameraVelocity.Add(velocityThisFrame);
                        //MathHelper.Clamp
                        cameraVelocity.X = MathHelper.Clamp(cameraVelocity.X, -6, 6);
                        cameraVelocity.Y = MathHelper.Clamp(cameraVelocity.Y, -6, 6);
                        cameraVelocity.Z = MathHelper.Clamp(cameraVelocity.Z, -6, 6);
                        //cameraVelocity.Clamp(-6.0f, 6.0f);
                    }
                    if (velocityThisFrame.X == 0)
                    {
                        cameraVelocity.X *= 0.9f;
                    }
                    if (velocityThisFrame.Z == 0)
                    {
                        cameraVelocity.Z *= 0.9f;
                    }
                    editorCamera.Walk(cameraVelocity.Z * dt);
                    editorCamera.Strafe(cameraVelocity.X * dt);

                    //look at
                    if (_lookTimer != 0)
                    {
                        _lookTimer += FrameController.DT();
                    }
                    if (_lookTimer > 1.3f)
                    {
                        _lookTimer = 0;
                    }
                    if (Input.GetTriggered(0, "LookAt") == 1.0f)
                    {
                        if (EngineManagerViewModel.instance.SelectedGameObjects.Count == 0)
                        {
                            return;
                        }
                        GameObject selobj = EngineManagerViewModel.instance.SelectedGameObjects[0];
                        if (_lookTimer == 0)
                        {
                            _lookTimer = 1; //force the setup
                            if (selobj != null)
                            {
                                editorCamera.gameObject.transform.LookAt(selobj.transform.position);
                            }
                        }
                        else
                        {
                            editorCamera.gameObject.transform.LookAt(selobj.transform.position);
                            Vector3 forw = editorCamera.gameObject.transform.GetForwardVector();
                            editorCamera.gameObject.transform.SetPosition(selobj.transform.position - (forw * 8));
                            _lookTimer = 0;
                        }
                    }

                    //arrow keys moving
                    if (Input.GetTriggered(0, "Add") > 0)
                    {
                        arrowSnapPrecision += 0.1f;
                    }
                    if (Input.GetTriggered(0, "Sub") > 0)
                    {
                        arrowSnapPrecision -= 0.1f;
                    }
                    if (Input.GetTriggered(0, "ArrowUp") > 0)
                    {
                        foreach (var selobj in EngineManagerViewModel.instance.SelectedGameObjects)
                        {
                            selobj.transform.SetPositionZ(selobj.transform.position.z + arrowSnapPrecision);
                        }
                    }
                    if (Input.GetTriggered(0, "ArrowDown") > 0)
                    {
                        foreach (var selobj in EngineManagerViewModel.instance.SelectedGameObjects)
                        {
                            selobj.transform.SetPositionZ(selobj.transform.position.z - arrowSnapPrecision);
                        }
                    }
                    if (Input.GetTriggered(0, "ArrowRight") > 0)
                    {
                        foreach (var selobj in EngineManagerViewModel.instance.SelectedGameObjects)
                        {
                            selobj.transform.SetPositionX(selobj.transform.position.x + arrowSnapPrecision);
                        }
                    }
                    if (Input.GetTriggered(0, "ArrowLeft") > 0)
                    {
                        foreach (var selobj in EngineManagerViewModel.instance.SelectedGameObjects)
                        {
                            selobj.transform.SetPositionX(selobj.transform.position.x - arrowSnapPrecision);
                        }
                    }
                }
            }
        }
        public static int gridExtent = 30;          //number of grid lines

        public static void CMD_SaveMap()
        {
            if (EditorSubsystem.getInstance().IsTesting())
            {
                Logger.Log("Cannot save in testing mode.");
                return;
            }
            //EngineManagerViewModel.instance.BusyMessage = "... Saving Map ...";
            EngineManagerViewModel.instance.SelectedGameObjects.Clear();     //safety check, remove the selected object so no weird binding happens
            string currentLoadedMap = EngineManagerViewModel.instance.currentLoadedMap;

            if (currentLoadedMap != null)
            {
                EditorSubsystemManaged.getInstance().QueueAction(() => { StateSerializer ss = new StateSerializer(); ss.SaveCurrentState(currentLoadedMap); });
            }
            else
            {
                System.Windows.MessageBox.Show("Save As, Before Saving...");
            }
            // EngineManagerViewModel.instance.BusyMessage = null;        }
        }
 private void btnExportBoard_Click(object sender, EventArgs e)
 {
     txtBoardData.Text = StateSerializer.ToString(_model.CommittedState);
 }
Exemple #21
0
 public string Serialize()
 {
     return(StateSerializer.Serialize(this));
 }
Exemple #22
0
        public static StatefulTable <TState, TSymbol> LoadFromString <TState, TSymbol>(string xml, TSymbol nullValue,
                                                                                       StateSerializer <TState> stateSerializer, SymbolSerializer <TSymbol> symbolSerializer)
        {
            byte[]       byteArray = Encoding.UTF8.GetBytes(xml);
            MemoryStream stream    = new MemoryStream(byteArray);
            var          document  = XDocument.Load(stream);

            return(Load(document, nullValue, stateSerializer, symbolSerializer));
        }
Exemple #23
0
 public SecureHost()
 {
     _serializer = new StateSerializer();
 }