private void TranslateUsingOtherFile(object sender, RoutedEventArgs e) { int count = 0; OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == true) { var ai = new AIFile() { InAnotherThread = false }; ai.Read(ofd.FileName); for (int i = 0; i < Aipolicy.Controllers.Count; ++i) { for (int j = 0; j < Aipolicy.Controllers[i].Triggers.Count; ++j) { for (int k = 0; k < Aipolicy.Controllers[i].Triggers[j].Operations.Count; ++k) { if (Aipolicy.Controllers[i].Triggers[j].Operations[k].OperID == 2) { var f1 = ai.Controllers.Where(x => x.ID == Aipolicy.Controllers[i].ID).ToList(); if (f1.Count > 0) { var f2 = f1.First().Triggers.Where(x => x.ID == Aipolicy.Controllers[i].Triggers[j].ID).ToList(); if (f2.Count > 0) { if (f2.First().Operations.Count > k && f2.First().Operations[k].OperID == 2) { Aipolicy.Controllers[i].Triggers[j].Operations[k] = f2.First().Operations[k]; } var f3 = f2.First().Operations.Where(x => x.OperID == 2).ToList(); if (f3.Count > 0) { Aipolicy.Controllers[i].Triggers[j].Operations[k] = f3.First(); ++count; } } } } } } } } Utils.ShowMessage($"{MainWindow.Provider.GetLocalizedString("TranslateUsingOtherFileCount")}: {count}"); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { try { Settings.Load(); Provider.ChangeLanguage(Settings.Language); Aipolicy = new AIFile(); DataContext = Aipolicy; Condition.IsCentral = true; SearchFlyout.Aipolicy = Aipolicy; #region Custom editors Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(SkillID), Editor = new SkillSelector() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(NpcID), Editor = new NpcSelector() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(MobID), Editor = new MobSelector() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(MineID), Editor = new MineSelector() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(TalkTextAppendDataMask), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(FactionPVPPointType), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(OperatorType), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(VarType), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(MonsterPatrolSpeedType), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(MonsterPatrolType), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(SummoneeDisppearType), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(ChatChannels2), Editor = new TranslatedEnumEditor() }); Operation.CustomEditorCollection.Add(new Syncfusion.Windows.PropertyGrid.CustomEditor() { HasPropertyType = true, PropertyType = typeof(TargetParam), Editor = new TargetEditor() }); #endregion } catch (Exception ex) { Utils.ShowMessage($"Send to developer\n\n{ex.Message}\n\n{ex.Source}\n\n{ex.StackTrace}"); } }