示例#1
0
        public void TestSaveMethod()
        {
            ConversationFile conversationFile = new ConversationFile();

            conversationFile.Load(TEST_FILE);

            MemoryStream savedStream = new MemoryStream();

            conversationFile.Save(savedStream);
            savedStream.Seek(0, SeekOrigin.Begin);

            ConversationFile savedConversationFile = new ConversationFile();

            savedConversationFile.Load(savedStream);
            savedStream.Close();

            for (int i = 0; i < conversationFile.Functions.Length; i++)
            {
                Assert.AreEqual(conversationFile.Functions[i].Name, savedConversationFile.Functions[i].Name, "Function names do not match");
                Assert.AreEqual(conversationFile.Functions[i].IsEnabled, savedConversationFile.Functions[i].IsEnabled, "Function is enabled values do not match");
            }

            Assert.AreEqual(conversationFile.Messages.Count, savedConversationFile.Messages.Count, "Message counts do not match");

            for (int i = 0; i < conversationFile.Messages.Count; i++)
            {
                Assert.AreEqual(conversationFile.Messages[i].ID, savedConversationFile.Messages[i].ID, "Message ID values do not match");
                Assert.AreEqual(conversationFile.Messages[i].Type, savedConversationFile.Messages[i].Type, "Message type values do not match");
                Assert.AreEqual(conversationFile.Messages[i].TargetWindow, savedConversationFile.Messages[i].TargetWindow, "Message target window values do not match");
                Assert.AreEqual(conversationFile.Messages[i].Condition, savedConversationFile.Messages[i].Condition, "Message condition values do not match");
                Assert.AreEqual(conversationFile.Messages[i].Action, savedConversationFile.Messages[i].Action, "Message action values do not match");
                Assert.AreEqual(conversationFile.Messages[i].StringID, savedConversationFile.Messages[i].StringID, "Message string ID values do not match");
            }

            Assert.AreEqual(conversationFile.Menus.Count, savedConversationFile.Menus.Count, "Menu counts do not match");

            for (int i = 0; i < conversationFile.Menus.Count; i++)
            {
                Assert.AreEqual(conversationFile.Menus[i].Messages.Count, savedConversationFile.Menus[i].Messages.Count, "Menu message counts do not match");

                for (int j = 0; j < conversationFile.Menus[i].Messages.Count; j++)
                {
                    Assert.AreEqual(conversationFile.Menus[i].Messages[j].ID, savedConversationFile.Menus[i].Messages[j].ID, "Menu message ID values do not match");
                    Assert.AreEqual(conversationFile.Menus[i].Messages[j].Type, savedConversationFile.Menus[i].Messages[j].Type, "Menu message type values do not match");
                    Assert.AreEqual(conversationFile.Menus[i].Messages[j].TargetWindow, savedConversationFile.Menus[i].Messages[j].TargetWindow, "Menu message target window values do not match");
                    Assert.AreEqual(conversationFile.Menus[i].Messages[j].Condition, savedConversationFile.Menus[i].Messages[j].Condition, "Menu message condition values do not match");
                    Assert.AreEqual(conversationFile.Menus[i].Messages[j].Action, savedConversationFile.Menus[i].Messages[j].Action, "Menu message action values do not match");
                    Assert.AreEqual(conversationFile.Menus[i].Messages[j].StringID, savedConversationFile.Menus[i].Messages[j].StringID, "Menu message string ID values do not match");
                }
            }

            Assert.AreEqual(conversationFile.Script, savedConversationFile.Script, "Script values do not match");
        }
示例#2
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            int counter = 0;

            foreach (PrepareRecord prepareRecord in prepareRecords)
            {
                prepareRecord.process();
                ++counter;
                backgroundWorker.ReportProgress(counter);
            }
            ;
            Dictionary <string, string>           jsonUpdatedContent = new Dictionary <string, string>();
            Dictionary <string, ConversationFile> convUpdatedContent = new Dictionary <string, ConversationFile>();

            foreach (PrepareRecord prepareRecord in prepareRecords)
            {
                if (prepareRecord.updated)
                {
                    if (Path.GetExtension(prepareRecord.jsonPath).ToUpper() == ".JSON")
                    {
                        JObject json = prepareRecord.content as JObject;
                        if (json != null)
                        {
                            jsonUpdatedContent.Add(prepareRecord.jsonPath, json.ToString(Formatting.Indented));
                        }
                        ;
                    }
                    else if (Path.GetExtension(prepareRecord.jsonPath).ToUpper() == ".BYTES")
                    {
                        ConversationFile cfile = prepareRecord.content as ConversationFile;
                        if (cfile != null)
                        {
                            convUpdatedContent.Add(prepareRecord.jsonPath, cfile);
                        }
                        ;
                    }
                }
                ;
                ++counter;
                backgroundWorker.ReportProgress(counter);
            }
            foreach (var uJsons in jsonUpdatedContent)
            {
                File.WriteAllText(uJsons.Key, uJsons.Value);
            }
            foreach (var uConv in convUpdatedContent)
            {
                uConv.Value.Save();
            }
        }
示例#3
0
 private void SendLineMessage(ConversationFile data)
 {
     LineModel.LineReply rb = new LineModel.LineReply()
     {
         replyToken = data.ConversationId,
         messages   = new List <LineModel.SendMessage>()
         {
             new LineModel.SendMessage()
             {
                 text = "test", type = "text"
             }
         },
     };
     LineMessagesController.Reply reply = new LineMessagesController.Reply(rb);
     reply.Send();
 }
示例#4
0
        public void TestLoadMethod()
        {
            Stream stream = File.OpenRead(TEST_FILE);

            stream.Seek(0, SeekOrigin.End);
            long fileSize = stream.Position;

            stream.Seek(0, SeekOrigin.Begin);

            ConversationFile conversationFile = new ConversationFile();

            conversationFile.Load(stream);

            long streamPosition = stream.Position;

            stream.Close();

            Assert.AreEqual(fileSize, streamPosition, "Not all of the file was read");
        }
示例#5
0
 private static void CheckState(ConversationFile conversationFile, List <ConversationNode <INodeGui> > state)
 {
     Assert.That(conversationFile.Nodes, Is.EquivalentTo(state));
 }
示例#6
0
        public static void Test()
        {
            IEnumerable <GraphAndUI <NodeUIData> > nodes = Enumerable.Empty <GraphAndUI <NodeUIData> >();
            List <NodeGroup>               groups        = new List <NodeGroup>();
            MemoryStream                   rawData       = new MemoryStream();
            DocumentPath                   file          = DocumentPath.FromPath("DeleteMe.txt", new DirectoryInfo("."));
            ISerializer <TData>            serializer    = null;
            ReadOnlyCollection <LoadError> errors        = new ReadOnlyCollection <LoadError>(new List <LoadError>());
            INodeFactory                   nodeFactory   = null;
            GenerateAudio                  generateAudio = null;
            var source = new DynamicEnumParameter.Source();
            Func <IDynamicEnumParameter, object, DynamicEnumParameter.Source> getDocumentSource = (a, b) => source;
            IAudioLibrary audioProvider = new DummyAudioLibrary();

            List <List <ConversationNode> > states = new List <List <ConversationNode <INodeGui> > >
            {
                new List <ConversationNode>()
            };

            Random r = new Random(0);

            UpToDateFile.BackEnd backend = new UpToDateFile.BackEnd();
            var id = Id <FileInProject> .Parse("6a1bd06a-0028-4099-a375-475f1a5320db");

            using (ConversationFile conversationFile = new ConversationFile(id, nodes, groups, rawData, file, serializer, errors, nodeFactory, generateAudio, getDocumentSource, audioProvider, backend))
            {
                for (int i = 0; i < 10; i++)
                {
                    var node  = MakeNode();
                    var state = states[i].ToList();
                    state.Add(node);
                    conversationFile.Add(new[] { node }, Enumerable.Empty <NodeGroup>(), null);
                    CheckState(conversationFile, state);
                    states.Add(state);
                }

                Action <ConversationNode> CheckNode = node =>
                {
                    var connector = conversationFile.UIInfo(node.Data.Connectors.First(), false);
                    Assert.That(connector.Area.Value, Is.EqualTo(TopPosition(node.Renderer.Area)));
                };

                for (int n = 0; n < 10000; n++)
                {
                    var node = states.Last().Last();
                    node.Renderer.MoveTo(new PointF((float)r.NextDouble() * 1000, (float)r.NextDouble() * 1000));
                    CheckNode(node);
                }

                for (int i = 9; i >= 0; i--)
                {
                    conversationFile.UndoableFile.UndoQueue.Undo();
                    var state = states[i];
                    CheckState(conversationFile, state);
                }
                for (int i = 1; i <= 10; i++)
                {
                    conversationFile.UndoableFile.UndoQueue.Redo();
                    var state = states[i];
                    CheckState(conversationFile, state);
                }
            }
            Assert.Inconclusive();
        }
示例#7
0
        /// <summary>
        /// 送出透過Bot Framework所連接的訊息
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private async Task SendBotFrameworkMessage(ConversationFile data)
        {
            var userAccount = new ChannelAccount(data.FromId, data.FromName);
            var botAccount  = new ChannelAccount(data.RecipientId, data.RecipientName);
            var connector   = new ConnectorClient(new Uri(data.ServiceUrl));

            MicrosoftAppCredentials.TrustServiceUrl(data.ServiceUrl);

            // 取得要送出的訊息內容物件
            List <PushObj.GetPushFileResult> push = new PushObj().GetPushFile();

            for (int p = 0; p < push.Count; p++)
            {
                IMessageActivity message = Activity.CreateMessageActivity();
                message.ChannelId    = data.ChannelId;
                message.From         = botAccount;
                message.Recipient    = userAccount;
                message.Conversation = new ConversationAccount(id: data.ConversationId);
                message.Locale       = "zh-tw";

                // 放入推送訊息內容
                message.Text = push[p].MainMessage;

                // 放入card
                for (int t = 0; t < push[p].cards.Count; t++)
                {
                    List <CardImage>  cardImages  = new List <CardImage>();
                    List <CardAction> cardButtons = new List <CardAction>();

                    // 放入圖片
                    cardImages.Add(new CardImage(url: push[p].cards[t].ImageUrl));

                    // 放入Button
                    for (int b = 0; b < push[p].cards[t].buttons.Count; b++)
                    {
                        CardAction plButton = new CardAction()
                        {
                            Value = push[p].cards[t].buttons[b].Url,
                            Type  = push[p].cards[t].buttons[b].ActionType,
                            Title = push[p].cards[t].buttons[b].Title,
                        };
                        cardButtons.Add(plButton);
                    }

                    if (push[p].PushType == "Thumbnail")
                    {
                        // 放入ThumbnailCard
                        ThumbnailCard plCard = new ThumbnailCard()
                        {
                            Title    = push[p].cards[t].Title,
                            Subtitle = push[p].cards[t].SubTitle,
                            Images   = cardImages,
                            Buttons  = cardButtons
                        };
                        Attachment plAttachment = plCard.ToAttachment();
                        message.Attachments.Add(plAttachment);
                    }
                    else if (push[p].PushType == "Hero")
                    {
                        HeroCard plCard = new HeroCard()
                        {
                            Title    = push[p].cards[t].Title,
                            Subtitle = push[p].cards[t].SubTitle,
                            Images   = cardImages,
                            Buttons  = cardButtons,
                        };
                        Attachment plAttachment = plCard.ToAttachment();
                        message.Attachments.Add(plAttachment);
                    }
                }

                message.AttachmentLayout = push[p].Layout;

                // 送出訊息
                await connector.Conversations.SendToConversationAsync((Activity)message);
            }
        }
示例#8
0
        //private void PrepareMods_Click(object sender, EventArgs e) {
        //  saveFileDialog.OverwritePrompt = false;
        //  HashSet<string> statistics = new HashSet<string>();
        //  GoogleTranslate t = new GoogleTranslate();
        //  int debugCounter = 0;
        //  int debugCounterMax = 5;
        //  if (saveFileDialog.ShowDialog() == DialogResult.OK) {
        //    string current_file = string.Empty;
        //    try {
        //      bool fileExists = File.Exists(saveFileDialog.FileName);
        //      string baseFile = saveFileDialog.FileName;
        //      LocalizationFile locFile = new LocalizationFile(saveFileDialog.FileName);
        //      List<ModRecord> mods = modsList.CheckedItems.OfType<ModRecord>().ToList<ModRecord>();
        //      Dictionary<string, string> jsonUpdatedContent = new Dictionary<string, string>();
        //      Dictionary<string, ConversationFile> convUpdatedContent = new Dictionary<string, ConversationFile>();
        //      foreach (ModRecord mod in mods) {
        //        if (debugCounter > debugCounterMax) { break; }
        //        string modName = Normilize(mod.Name);
        //        List<string> jsonsPath = new List<string>();
        //        GetAllJsons(mod.Path, ref jsonsPath, 0);
        //        foreach (string jsonPath in jsonsPath) {
        //          current_file = jsonPath;
        //          bool updated = false;
        //          //MessageBox.Show(jsonPath);
        //          string filename = Normilize(Path.GetFileNameWithoutExtension(jsonPath));
        //          object content = null;
        //          if (Path.GetFileName(jsonPath).ToUpper() == "LOCALIZATION.JSON") { continue; }
        //          if (Path.GetExtension(jsonPath).ToUpper() == ".JSON") {
        //            string jsonCont = File.ReadAllText(jsonPath);
        //            content = JObject.Parse(jsonCont);
        //          } else if (Path.GetExtension(jsonPath).ToUpper() == ".BYTES") {
        //            content = new ConversationFile(jsonPath);
        //          }
        //          foreach (var jtproc in partsList.CheckedItems) {
        //            if (debugCounter > debugCounterMax) { break; }
        //            jtProcGeneric jtProc = jtproc as jtProcGeneric;
        //            if (jtProc == null) { continue; }
        //            Dictionary<string, string> replaced = new Dictionary<string, string>();
        //            jtProc.proc(modName, filename, ref content, replaced, false);
        //            foreach (var replacements in replaced) {
        //              if (debugCounter > debugCounterMax) { break; }
        //              if (string.IsNullOrEmpty(replacements.Value) == false) {
        //                CustomTranslation.TranslateRecord nTr = new CustomTranslation.TranslateRecord();
        //                nTr.FileName = jsonPath.Substring(GameBaseSelector.SelectedPath.Length);
        //                nTr.Name = replacements.Key;
        //                nTr.Original = replacements.Value;
        //                //nTr.Localization.Add(Localize.Strings.Culture.CULTURE_EN_US, replacements.Value);
        //                foreach (Localize.Strings.Culture locLang in langsList.CheckedItems.OfType<Localize.Strings.Culture>().ToList<Localize.Strings.Culture>()) {
        //                  string val = replacements.Value;
        //                  string nval = Normilize(val);
        //                  if (locLang == Localize.Strings.Culture.CULTURE_RU_RU) {
        //                    if (val.Length > 30) {
        //                      if (translationCache.ContainsKey(nval) == false) {
        //                        statistics.Add(val);
        //                        MessageBox.Show(val);
        //                        val = GoogleTranslate.Translate(val);
        //                        translationCache.Add(nval, val);
        //                        Log.Debug.Write(0, "'" + replacements.Value + "' - '" + val + "'\n", true);
        //                        MessageBox.Show(val);
        //                        ++debugCounter;
        //                      } else {
        //                        val = translationCache[nval];
        //                      }
        //                    }
        //                  }
        //                  nTr.Localization.Add(locLang, val);
        //                }
        //                locFile.Merge(nTr);
        //                updated = true;
        //              } else {
        //                if (locFile.map.ContainsKey(replacements.Key)) {
        //                  string original = locFile.map[replacements.Key].Original;
        //                  if (string.IsNullOrEmpty(original)) {
        //                    original = locFile.map[replacements.Key].Localization[Localize.Strings.Culture.CULTURE_EN_US];
        //                  }
        //                  if (string.IsNullOrEmpty(original) == false) {
        //                    CustomTranslation.TranslateRecord nTr = new CustomTranslation.TranslateRecord();
        //                    nTr.FileName = jsonPath.Substring(GameBaseSelector.SelectedPath.Length); ;
        //                    nTr.Name = replacements.Key;
        //                    nTr.Original = original;
        //                    foreach (Localize.Strings.Culture locLang in langsList.CheckedItems.OfType<Localize.Strings.Culture>().ToList<Localize.Strings.Culture>()) {
        //                      if (locFile.map[replacements.Key].Localization.ContainsKey(locLang) == false) {
        //                        string val = original;
        //                        string nval = Normilize(val);
        //                        statistics.Add(val);
        //                        if (locLang == Localize.Strings.Culture.CULTURE_RU_RU) {
        //                          if (val.Length > 30) {
        //                            if (translationCache.ContainsKey(nval) == false) {
        //                              statistics.Add(val);
        //                              MessageBox.Show(val);
        //                              val = GoogleTranslate.Translate(val);
        //                              translationCache.Add(nval, val);
        //                              Log.Debug.Write(0, "'" + replacements.Value + "' - '" + val + "'\n", true);
        //                              MessageBox.Show(val);
        //                              ++debugCounter;
        //                            } else {
        //                              val = translationCache[nval];
        //                            }
        //                          }
        //                        }
        //                        nTr.Localization.Add(locLang, val);
        //                      }
        //                    }
        //                    locFile.Merge(nTr);
        //                  }
        //                }
        //              }
        //            }
        //          }
        //          if (updated) {
        //            if (Path.GetExtension(jsonPath).ToUpper() == ".JSON") {
        //              JObject json = content as JObject;
        //              if (json != null) { jsonUpdatedContent.Add(jsonPath, json.ToString(Formatting.Indented)); };
        //            } else if (Path.GetExtension(jsonPath).ToUpper() == ".BYTES") {
        //              ConversationFile cfile = content as ConversationFile;
        //              if (cfile != null) { convUpdatedContent.Add(jsonPath, cfile); };
        //            }
        //          };
        //        }
        //        current_file = string.Empty;
        //      }
        //      if (fileExists == false) {
        //        locFile.Save();
        //      } else {
        //        saveFileDialog.InitialDirectory = Path.GetDirectoryName(baseFile);
        //        if (saveFileDialog.ShowDialog() == DialogResult.OK) {
        //          if (saveFileDialog.FileName == baseFile) {
        //            //MessageBox.Show("Same file");
        //            locFile.Save();
        //          } else {
        //            //MessageBox.Show("Different file");
        //            locFile.filename = saveFileDialog.FileName;
        //            locFile.removeOtherTranslations(langsList.CheckedItems.OfType<Localize.Strings.Culture>().ToList<Localize.Strings.Culture>());
        //            locFile.Save(true);
        //          }
        //        }
        //      }
        //      foreach (var uJsons in jsonUpdatedContent) {
        //        File.WriteAllText(uJsons.Key, uJsons.Value);
        //      }
        //      foreach (var uConv in convUpdatedContent) {
        //        uConv.Value.Save();
        //      }
        //      int overralCharsLength = 0;
        //      foreach (string str in statistics) { overralCharsLength += str.Length; }
        //      MessageBox.Show("Done. Strings: " + statistics.Count + ". Characters:" + overralCharsLength);
        //    } catch (Exception ex) {
        //      MessageBox.Show("in file:" + current_file + "\n" + ex.ToString());
        //    }
        //    string trCache = JsonConvert.SerializeObject(translationCache, Formatting.Indented);
        //    File.WriteAllText(translationCache_filename, trCache);
        //  }
        //}
        private void PrepareMods_Click(object sender, EventArgs e)
        {
            saveFileDialog.OverwritePrompt = false;
            HashSet <string> statistics  = new HashSet <string>();
            GoogleTranslate  t           = new GoogleTranslate();
            int  debugCounter            = 0;
            int  debugCounterMax         = 5;
            bool deleteOtherTranslations = false;

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string current_file = string.Empty;
                try {
                    bool             fileExists = File.Exists(saveFileDialog.FileName);
                    LocalizationFile locFile    = new LocalizationFile(saveFileDialog.FileName);
                    if (File.Exists(locFile.filename))
                    {
                        saveFileDialog.InitialDirectory = Path.GetDirectoryName(locFile.filename);
                        if (saveFileDialog.ShowDialog() == DialogResult.OK)
                        {
                            if (saveFileDialog.FileName != locFile.filename)
                            {
                                locFile.MergeFile(saveFileDialog.FileName);
                                locFile.filename        = saveFileDialog.FileName;
                                deleteOtherTranslations = true;
                            }
                        }
                    }
                    //locFile.DebugLogDump();
                    //Application.Exit();
                    List <ModRecord>                      mods = modsList.CheckedItems.OfType <ModRecord>().ToList <ModRecord>();
                    Dictionary <string, string>           jsonUpdatedContent = new Dictionary <string, string>();
                    Dictionary <string, ConversationFile> convUpdatedContent = new Dictionary <string, ConversationFile>();
                    List <PrepareRecord>                  prepareRecords     = new List <PrepareRecord>();
                    foreach (ModRecord mod in mods)
                    {
                        if (debugCounter > debugCounterMax)
                        {
                            break;
                        }
                        List <string> jsonsPath = new List <string>();
                        GetAllJsons(mod.Path, ref jsonsPath, 0);
                        foreach (string jsonPath in jsonsPath)
                        {
                            current_file = jsonPath;
                            object content = null;
                            if (Path.GetFileName(jsonPath).ToUpper() == "LOCALIZATION.JSON")
                            {
                                continue;
                            }
                            if (Path.GetExtension(jsonPath).ToUpper() == ".JSON")
                            {
                                string jsonCont = File.ReadAllText(jsonPath);
                                content = JObject.Parse(jsonCont);
                            }
                            else if (Path.GetExtension(jsonPath).ToUpper() == ".BYTES")
                            {
                                content = new ConversationFile(jsonPath);
                            }
                            foreach (var jtproc in partsList.CheckedItems)
                            {
                                if (debugCounter > debugCounterMax)
                                {
                                    break;
                                }
                                jtProcGeneric jtProc = jtproc as jtProcGeneric;
                                if (jtProc == null)
                                {
                                    continue;
                                }
                                prepareRecords.Add(new PrepareRecord(mod, jsonPath, jtProc,
                                                                     langsList.CheckedItems.OfType <Localize.Strings.Culture>().ToList <Localize.Strings.Culture>(), translationCache, content, locFile, GameBaseSelector.SelectedPath
                                                                     ));
                            }
                        }
                        current_file = string.Empty;
                    }
                    ProcessForm processForm = new ProcessForm();
                    processForm.DeleteOtherTranslations = deleteOtherTranslations;
                    processForm.prepareRecords          = prepareRecords;
                    processForm.progressBar.Maximum     = prepareRecords.Count * 2;
                    processForm.backgroundWorker.RunWorkerAsync();
                    processForm.ShowDialog();
                    if (deleteOtherTranslations)
                    {
                        locFile.removeOtherTranslations(langsList.CheckedItems.OfType <Localize.Strings.Culture>().ToList <Localize.Strings.Culture>());
                    }
                    locFile.Save(deleteOtherTranslations);
                    foreach (PrepareRecord pr in prepareRecords)
                    {
                        if (pr.updated)
                        {
                            if (Path.GetExtension(pr.jsonPath).ToUpper() == ".JSON")
                            {
                                JObject json = pr.content as JObject;
                                if (json != null)
                                {
                                    if (jsonUpdatedContent.ContainsKey(pr.jsonPath) == false)
                                    {
                                        jsonUpdatedContent.Add(pr.jsonPath, json.ToString(Formatting.Indented));
                                    }
                                }
                                ;
                            }
                            else if (Path.GetExtension(pr.jsonPath).ToUpper() == ".BYTES")
                            {
                                ConversationFile cfile = pr.content as ConversationFile;
                                if (cfile != null)
                                {
                                    if (convUpdatedContent.ContainsKey(pr.jsonPath) == false)
                                    {
                                        convUpdatedContent.Add(pr.jsonPath, cfile);
                                    }
                                    ;
                                }
                                ;
                            }
                        }
                        ;
                    }
                    foreach (var uJsons in jsonUpdatedContent)
                    {
                        File.WriteAllText(uJsons.Key, uJsons.Value);
                    }
                    foreach (var uConv in convUpdatedContent)
                    {
                        uConv.Value.Save();
                    }
                    MessageBox.Show("Compleete");
                } catch (Exception ex) {
                    MessageBox.Show("in file:" + current_file + "\n" + ex.ToString());
                }
                string trCache = JsonConvert.SerializeObject(translationCache, Formatting.Indented);
                File.WriteAllText(translationCache_filename, trCache);
            }
        }
示例#9
0
 private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try {
         List <ModRecord>                      mods = ModRecord.GatherMods(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), ".."));
         Dictionary <string, string>           jsonUpdatedContent = new Dictionary <string, string>();
         Dictionary <string, ConversationFile> convUpdatedContent = new Dictionary <string, ConversationFile>();
         int modcounter = 0;
         foreach (ModRecord mod in mods)
         {
             backgroundWorker.ReportProgress((int)Math.Round((float)modcounter * 100.0f / (float)mods.Count)); ++modcounter;
             string modName = ModRecord.Normilize(mod.Name);
             //MessageBox.Show(modName);
             List <string> jsonsPath = new List <string>();
             ModRecord.GetAllJsons(mod.Path, ref jsonsPath, 0);
             foreach (string jsonPath in jsonsPath)
             {
                 bool updated = false;
                 //MessageBox.Show(jsonPath);
                 string filename = ModRecord.Normilize(Path.GetFileNameWithoutExtension(jsonPath));
                 object content  = null;
                 if (Path.GetFileName(jsonPath).ToUpper() == "LOCALIZATION.JSON")
                 {
                     continue;
                 }
                 if (Path.GetExtension(jsonPath).ToUpper() == ".JSON")
                 {
                     string jsonCont = File.ReadAllText(jsonPath);
                     content = JObject.Parse(jsonCont);
                 }
                 else if (Path.GetExtension(jsonPath).ToUpper() == ".BYTES")
                 {
                     content = new ConversationFile(jsonPath);
                 }
                 foreach (var jtproc in partsList)
                 {
                     jtProcGeneric jtProc = jtproc as jtProcGeneric;
                     if (jtProc == null)
                     {
                         continue;
                     }
                     Dictionary <string, string> replaced = new Dictionary <string, string>();
                     jtProc.proc(modName, filename, ref content, replaced, true);
                     foreach (var replacements in replaced)
                     {
                         if (string.IsNullOrEmpty(replacements.Value) == false)
                         {
                             updated = true;
                         }
                     }
                 }
                 if (updated)
                 {
                     if (Path.GetExtension(jsonPath).ToUpper() == ".JSON")
                     {
                         JObject json = content as JObject;
                         if (json != null)
                         {
                             jsonUpdatedContent.Add(jsonPath, json.ToString(Formatting.Indented));
                         }
                         ;
                     }
                     else if (Path.GetExtension(jsonPath).ToUpper() == ".BYTES")
                     {
                         ConversationFile cfile = content as ConversationFile;
                         if (cfile != null)
                         {
                             convUpdatedContent.Add(jsonPath, cfile);
                         }
                         ;
                     }
                 }
                 ;
             }
         }
         foreach (var uJsons in jsonUpdatedContent)
         {
             File.WriteAllText(uJsons.Key, uJsons.Value);
         }
         foreach (var uConv in convUpdatedContent)
         {
             uConv.Value.Save();
         }
     } catch (Exception ex) {
         MessageBox.Show(ex.ToString());
     }
 }