Exemplo n.º 1
0
        public static void SaveXML(TalkerMakerProject talkerMakerProject, string xml_file, bool isJSON)
        {
            //This currently outputs crap made of shit and doesn't match standard.
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(TalkerMakerProject));
            XmlDocument   xmlDoc        = null;

            using (MemoryStream xmlStream = new MemoryStream())
            {
                xmlSerializer.Serialize(xmlStream, talkerMakerProject);

                xmlStream.Position = 0;

                XmlReaderSettings settings = new XmlReaderSettings();
                settings.IgnoreWhitespace = true;

                using (var xtr = XmlReader.Create(xmlStream, settings))
                {
                    xmlDoc = new XmlDocument();
                    xmlDoc.Load(xtr);
                }
            }
            string jsonText = JsonConvert.SerializeXmlNode(xmlDoc, Newtonsoft.Json.Formatting.Indented, true);

            jsonText = Regex.Replace(jsonText, "(?<=\")(@)(?!.*\":\\s )", string.Empty, RegexOptions.IgnoreCase);
            File.WriteAllText(xml_file, jsonText);
        }
Exemplo n.º 2
0
        public static void SaveXML(TalkerMakerProject talkerMakerProject, string xml_file)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(TalkerMakerProject));
            StreamWriter  streamWriter  = new StreamWriter(xml_file, false, System.Text.Encoding.UTF8);

            xmlSerializer.Serialize(streamWriter, talkerMakerProject);
            streamWriter.Close();
        }
Exemplo n.º 3
0
        private List<ConversationItem> AddConversations(TalkerMakerProject project)
        {
            List<ConversationItem> conversations = new List<ConversationItem>();
            foreach(Conversation conversation in project.Assets.Conversations)
            {
                ConversationItem conv = new ConversationItem();
                conv.lblConvID.Content = conversation.ID;
                conv.lblNodeCount.Content = conversation.DialogEntries.Count();
                foreach(Field field in conversation.Fields)
                {
                    switch(field.Title)
                    {
                        case "Title":
                            conv.lblConvTitle.Text = field.Value;
                            break;
                        case "Actor":
                            conv.lblConvActorID.Content = field.Value;
                            CharacterItem chara = lstCharacters.Items[Convert.ToInt16(field.Value)-1] as CharacterItem;
                            conv.lblConvActor.Text = chara.lblActorName.Text;
                            break;
                        case "Conversant":
                            conv.lblConvConversantID.Content = field.Value;
                            chara = lstCharacters.Items[Convert.ToInt16(field.Value)-1] as CharacterItem;
                            conv.lblConvConversant.Text = chara.lblActorName.Text;
                            break;
                        case "Description":
                            conv.lblConvDescription.Content = field.Value;
                            break;
                        case "Scene":
                            conv.lblconvScene.Content = field.Value;
                            break;
                    }
                }

                conversations.Add(conv);
            }

            return conversations;
        }
Exemplo n.º 4
0
        private List<VariableItem> AddVariables(TalkerMakerProject project)
        {
            List<VariableItem> variables = new List<VariableItem>();
            foreach (UserVariable variable in project.Assets.UserVariables)
            {
                VariableItem var = new VariableItem();
                foreach (Field field in variable.Fields)
                {
                    switch (field.Title)
                    {
                        case "Name":
                            var.lblVarName.Text = field.Value;
                            break;
                        case "Description":
                            var.lblVarDescription.Content = field.Value;
                            break;
                        case "Initial Value":
                            var.lblVarType.Content = field.Type;
                            var.lblVarValue.Content = field.Value;
                            break;
                    }
                }

                variables.Add(var);
            }

            return variables;
        }
Exemplo n.º 5
0
        private List<CharacterItem> AddActors(TalkerMakerProject project)
        {
            List<CharacterItem> actors = new List<CharacterItem>();
            foreach (Actor actor in project.Assets.Actors)
            {
                CharacterItem chara = new CharacterItem();
                //chara.pictureRow.Width = new GridLength(pictureWidth);
                chara.lblActorID.Content = actor.ID;
                chara.lblActorDescription.Content = "";
                chara.lblActorAge.Content = "";
                chara.lblActorGender.Content = "";
                chara.lblActorPicture.Content = "";
                chara.Name = "actor_" + actor.ID;
                foreach (Field field in actor.Fields)
                {
                    switch (field.Title)
                    {
                        case "Name":
                            chara.lblActorName.Text = field.Value;
                            break;
                        case "Age":
                            chara.lblActorAge.Content = field.Value;
                            break;
                        case "Gender":
                            chara.lblActorGender.Content = field.Value;
                            break;
                        case "IsPlayer":
                            chara.lblActorIsPlayer.Content = field.Value;
                            break;
                        case "Description":
                            chara.lblActorDescription.Content = field.Value;
                            break;
                        case "Pictures":
                            if(IsBase64(field.Value))
                            {
                                chara.imgActorImage.Source = Base64ToImage(field.Value);
                                chara.lblActorPicture.Content = field.Value;
                            }
                            break;
                    }
                }
                actors.Add(chara);
            }

            return actors;
        }
Exemplo n.º 6
0
        void PrepareProject(string project)
        {
            projie = XMLHandler.LoadXML(project);

            currentNode = "";
            editConditions.Text = "";
            editScript.Text = "";
            tabBlank.IsSelected = true;
            lstVariables.ItemsSource = AddVariables(projie);
            txtSettingAuthor.Text = projie.Author;
            txtSettingProjectTitle.Text = projie.Title;
            txtSettingVersion.Text = projie.Version;

            lstCharacters.SelectedItem = null;
            lstConversations.SelectedItem = null;
            lstDialogueActor.SelectedItem = null;
            lstDialogueConversant.SelectedItem = null;
            lstConvoActor.SelectedItem = null;
            lstConvoConversant.SelectedItem = null;
            lstVariables.SelectedItem = null;

            lstCharacters.ItemsSource = AddActors(projie);
            lstDialogueActor.ItemsSource = AddActors(projie);
            lstDialogueConversant.ItemsSource = AddActors(projie);
            lstConvoActor.ItemsSource = AddActors(projie);
            lstConvoConversant.ItemsSource = AddActors(projie);
            lstConversations.ItemsSource = AddConversations(projie);
            loadedConversation = 0;
            editConditions.Text = "";
            editScript.Text = "";
            LoadConversation(0);
        }
Exemplo n.º 7
0
        void PrepareProject()
        {
            Assembly _assembly = Assembly.GetExecutingAssembly();
            projie = XMLHandler.LoadXML(_assembly.GetManifestResourceStream("TalkerMakerDeluxe.NewProjectTemplate.xml"));

            currentNode = "";
            editConditions.Text = "";
            editScript.Text = "";
            tabBlank.IsSelected = true;
            txtSettingAuthor.Text = projie.Author;
            txtSettingProjectTitle.Text = projie.Title;
            txtSettingVersion.Text = projie.Version;

            lstCharacters.SelectedItem = null;
            lstConversations.SelectedItem = null;
            lstDialogueActor.SelectedItem = null;
            lstDialogueConversant.SelectedItem = null;
            lstConvoActor.SelectedItem = null;
            lstConvoConversant.SelectedItem = null;
            lstVariables.SelectedItem = null;

            lstCharacters.ItemsSource = AddActors(projie);
            lstDialogueActor.ItemsSource = AddActors(projie);
            lstDialogueConversant.ItemsSource = AddActors(projie);
            lstConvoActor.ItemsSource = AddActors(projie);
            lstConvoConversant.ItemsSource = AddActors(projie);
            lstConversations.ItemsSource = AddConversations(projie);
            lstVariables.ItemsSource = AddVariables(projie);
            loadedConversation = 0;
            editConditions.Text = "";
            editScript.Text = "";
            LoadConversation(0);
        }
Exemplo n.º 8
0
        public static void SaveXML(TalkerMakerProject talkerMakerProject, string xml_file, bool isJSON)
        {
            //This currently outputs crap made of shit and doesn't match standard.
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(TalkerMakerProject));
            XmlDocument xmlDoc = null;

            using (MemoryStream xmlStream = new MemoryStream())
            {
                xmlSerializer.Serialize(xmlStream, talkerMakerProject);

                xmlStream.Position = 0;

                XmlReaderSettings settings = new XmlReaderSettings();
                settings.IgnoreWhitespace = true;

                using (var xtr = XmlReader.Create(xmlStream, settings))
                {
                    xmlDoc = new XmlDocument();
                    xmlDoc.Load(xtr);
                }
            }
            string jsonText = JsonConvert.SerializeXmlNode(xmlDoc, Newtonsoft.Json.Formatting.Indented, true);
            jsonText = Regex.Replace(jsonText, "(?<=\")(@)(?!.*\":\\s )", string.Empty, RegexOptions.IgnoreCase);
            File.WriteAllText(xml_file, jsonText);
        }
Exemplo n.º 9
0
 public static void SaveXML(TalkerMakerProject talkerMakerProject, string xml_file)
 {
     XmlSerializer xmlSerializer = new XmlSerializer(typeof(TalkerMakerProject));
     StreamWriter streamWriter = new StreamWriter(xml_file, false, System.Text.Encoding.UTF8);
     xmlSerializer.Serialize(streamWriter, talkerMakerProject);
     streamWriter.Close();
 }