First go at auto-gen master language file + language deserializer

This commit is contained in:
niksedk 2014-08-20 23:10:04 +02:00
parent 5a37f0a835
commit ea240a8c80
14 changed files with 313 additions and 117 deletions

View File

@ -192,6 +192,9 @@ Email: mailto:nikse.dk@gmail.com</AboutText1>
<ChangeSpeedInPercent>
<Title>Adjust speed in percent</Title>
<Info>Change speed of subtitle in percent</Info>
<Custom>Custom</Custom>
<ToDropFrame>To drop frame</ToDropFrame>
<FromDropFrame>From drop frame</FromDropFrame>
</ChangeSpeedInPercent>
<CheckForUpdates>
<Title>Check for updates</Title>

View File

@ -123,11 +123,11 @@ namespace Nikse.SubtitleEdit.Forms
}
else if (e.Shift && e.Control && e.Alt && e.KeyCode == Keys.L)
{
Configuration.Settings.Language.Save();
Configuration.Settings.Language.Save(null);
}
else if (e.Shift && e.Control && e.Alt && e.KeyCode == Keys.C)
{
LanguageDeserializerGenerator.GenerateCSharpXmlDeserializerForLanguage();
LanguageDeserializerGenerator.GenerateCSharpXmlDeserializerForLanguage(null);
}
else if (e.KeyCode == Keys.F1)
{

View File

@ -771,7 +771,7 @@ namespace Nikse.SubtitleEdit.Forms
else if (e.Control && e.Shift && e.Alt && e.KeyCode == Keys.L)
{
Cursor.Current = Cursors.WaitCursor;
Configuration.Settings.Language.Save();
Configuration.Settings.Language.Save(null);
Language.TranslateViaGoogle((comboBoxFrom.SelectedItem as ComboBoxItem).Value + "|" +
(comboBoxTo.SelectedItem as ComboBoxItem).Value);
Cursor.Current = Cursors.Default;

View File

@ -2374,7 +2374,7 @@ Keep changes?",
return LanguageDeserializer.CustomDeserializeLanguage(fileName);
}
public void Save()
public void Save(string fileName)
{
var s = new XmlSerializer(typeof(Language));
var sb = new StringBuilder();
@ -2387,7 +2387,9 @@ Keep changes?",
xml = xml.Replace("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ", string.Empty);
xml = xml.Replace("encoding=\"utf-16\"", "encoding=\"utf-8\"");
xml = xml.Replace("<TranslatedBy> </TranslatedBy>", "<TranslatedBy>Translated by Nikse</TranslatedBy>");
File.WriteAllText(Path.Combine(Configuration.BaseDirectory, "LanguageMaster.xml"), xml, Encoding.UTF8);
if (string.IsNullOrEmpty(fileName))
fileName = Path.Combine(Configuration.BaseDirectory, "LanguageMaster.xml");
File.WriteAllText(fileName, xml, Encoding.UTF8);
}
public static void TranslateViaGoogle(string languagePair)

View File

@ -17,113 +17,113 @@ namespace Nikse.SubtitleEdit.Logic
string name = string.Empty;
var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
var language = new Language();
language.General = new Nikse.SubtitleEdit.Logic.LanguageStructure.General();
language.About = new Nikse.SubtitleEdit.Logic.LanguageStructure.About();
language.AddToNames = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddToNames();
language.AddToOcrReplaceList = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddToOcrReplaceList();
language.AddToUserDictionary = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddToUserDictionary();
language.AddWaveForm = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddWaveForm();
language.AdjustDisplayDuration = new Nikse.SubtitleEdit.Logic.LanguageStructure.AdjustDisplayDuration();
language.ApplyDurationLimits = new Nikse.SubtitleEdit.Logic.LanguageStructure.ApplyDurationLimits();
language.AutoBreakUnbreakLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.AutoBreakUnbreakLines();
language.BatchConvert = new Nikse.SubtitleEdit.Logic.LanguageStructure.BatchConvert();
language.Beamer = new Nikse.SubtitleEdit.Logic.LanguageStructure.Beamer();
language.ChangeCasing = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeCasing();
language.ChangeCasingNames = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeCasingNames();
language.ChangeFrameRate = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeFrameRate();
language.ChangeSpeedInPercent = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeSpeedInPercent();
language.CheckForUpdates = new Nikse.SubtitleEdit.Logic.LanguageStructure.CheckForUpdates();
language.ChooseAudioTrack = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChooseAudioTrack();
language.ChooseEncoding = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChooseEncoding();
language.ChooseLanguage = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChooseLanguage();
language.ColorChooser = new Nikse.SubtitleEdit.Logic.LanguageStructure.ColorChooser();
language.ColumnPaste = new Nikse.SubtitleEdit.Logic.LanguageStructure.ColumnPaste();
language.CompareSubtitles = new Nikse.SubtitleEdit.Logic.LanguageStructure.CompareSubtitles();
language.DCinemaProperties = new Nikse.SubtitleEdit.Logic.LanguageStructure.DCinemaProperties();
language.DurationsBridgeGaps = new Nikse.SubtitleEdit.Logic.LanguageStructure.DurationsBridgeGaps();
language.DvdSubRip = new Nikse.SubtitleEdit.Logic.LanguageStructure.DvdSubRip();
language.DvdSubRipChooseLanguage = new Nikse.SubtitleEdit.Logic.LanguageStructure.DvdSubRipChooseLanguage();
language.EbuSaveOptions = new Nikse.SubtitleEdit.Logic.LanguageStructure.EbuSaveOptions();
language.EffectKaraoke = new Nikse.SubtitleEdit.Logic.LanguageStructure.EffectKaraoke();
language.EffectTypewriter = new Nikse.SubtitleEdit.Logic.LanguageStructure.EffectTypewriter();
language.ExportCustomText = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportCustomText();
language.ExportCustomTextFormat = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportCustomTextFormat();
language.ExportPngXml = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportPngXml();
language.ExportText = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportText();
language.ExtractDateTimeInfo = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExtractDateTimeInfo();
language.FindDialog = new Nikse.SubtitleEdit.Logic.LanguageStructure.FindDialog();
language.FindSubtitleLine = new Nikse.SubtitleEdit.Logic.LanguageStructure.FindSubtitleLine();
language.FixCommonErrors = new Nikse.SubtitleEdit.Logic.LanguageStructure.FixCommonErrors();
language.GetDictionaries = new Nikse.SubtitleEdit.Logic.LanguageStructure.GetDictionaries();
language.GetTesseractDictionaries = new Nikse.SubtitleEdit.Logic.LanguageStructure.GetTesseractDictionaries();
language.GoogleTranslate = new Nikse.SubtitleEdit.Logic.LanguageStructure.GoogleTranslate();
language.GoogleOrMicrosoftTranslate = new Nikse.SubtitleEdit.Logic.LanguageStructure.GoogleOrMicrosoftTranslate();
language.GoToLine = new Nikse.SubtitleEdit.Logic.LanguageStructure.GoToLine();
language.ImportImages = new Nikse.SubtitleEdit.Logic.LanguageStructure.ImportImages();
language.ImportSceneChanges = new Nikse.SubtitleEdit.Logic.LanguageStructure.ImportSceneChanges();
language.ImportText = new Nikse.SubtitleEdit.Logic.LanguageStructure.ImportText();
language.Interjections = new Nikse.SubtitleEdit.Logic.LanguageStructure.Interjections();
language.JoinSubtitles = new Nikse.SubtitleEdit.Logic.LanguageStructure.JoinSubtitles();
language.Main = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main();
language.Main.Menu = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu();
language.Main.Menu.File = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.FileMenu();
language.Main.Menu.Edit = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.EditMenu();
language.Main.Menu.Tools = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.ToolsMenu();
language.Main.Menu.Video = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.VideoMenu();
language.Main.Menu.SpellCheck = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.SpellCheckMenu();
language.Main.Menu.Synchronization = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.SynchronizationkMenu();
language.Main.Menu.AutoTranslate = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.AutoTranslateMenu();
language.Main.Menu.Options = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.OptionsMenu();
language.Main.Menu.Networking = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.NetworkingMenu();
language.Main.Menu.Help = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.HelpMenu();
language.Main.Menu.ToolBar = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.ToolBarMenu();
language.Main.Menu.ContextMenu = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.ListViewContextMenu();
language.Main.Controls = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainControls();
language.Main.VideoControls = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainVideoControls();
language.MatroskaSubtitleChooser = new Nikse.SubtitleEdit.Logic.LanguageStructure.MatroskaSubtitleChooser();
language.MeasurementConverter = new Nikse.SubtitleEdit.Logic.LanguageStructure.MeasurementConverter();
language.MergeDoubleLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.MergeDoubleLines();
language.MergedShortLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.MergeShortLines();
language.MergeTextWithSameTimeCodes = new Nikse.SubtitleEdit.Logic.LanguageStructure.MergeTextWithSameTimeCodes();
language.ModifySelection = new Nikse.SubtitleEdit.Logic.LanguageStructure.ModifySelection();
language.MultipleReplace = new Nikse.SubtitleEdit.Logic.LanguageStructure.MultipleReplace();
language.NetworkChat = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkChat();
language.NetworkJoin = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkJoin();
language.NetworkLogAndInfo = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkLogAndInfo();
language.NetworkStart = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkStart();
language.OpenVideoDvd = new Nikse.SubtitleEdit.Logic.LanguageStructure.OpenVideoDvd();
language.PluginsGet = new Nikse.SubtitleEdit.Logic.LanguageStructure.PluginsGet();
language.RegularExpressionContextMenu = new Nikse.SubtitleEdit.Logic.LanguageStructure.RegularExpressionContextMenu();
language.RemoveTextFromHearImpaired = new Nikse.SubtitleEdit.Logic.LanguageStructure.RemoveTextFromHearImpaired();
language.ReplaceDialog = new Nikse.SubtitleEdit.Logic.LanguageStructure.ReplaceDialog();
language.RestoreAutoBackup = new Nikse.SubtitleEdit.Logic.LanguageStructure.RestoreAutoBackup();
language.SeekSilence = new Nikse.SubtitleEdit.Logic.LanguageStructure.SeekSilence();
language.SetMinimumDisplayTimeBetweenParagraphs = new Nikse.SubtitleEdit.Logic.LanguageStructure.SetMinimumDisplayTimeBetweenParagraphs();
language.SetSyncPoint = new Nikse.SubtitleEdit.Logic.LanguageStructure.SetSyncPoint();
language.Settings = new Nikse.SubtitleEdit.Logic.LanguageStructure.Settings();
language.SetVideoOffset = new Nikse.SubtitleEdit.Logic.LanguageStructure.SetVideoOffset();
language.ShowEarlierLater = new Nikse.SubtitleEdit.Logic.LanguageStructure.ShowEarlierLater();
language.ShowHistory = new Nikse.SubtitleEdit.Logic.LanguageStructure.ShowHistory();
language.SpellCheck = new Nikse.SubtitleEdit.Logic.LanguageStructure.SpellCheck();
language.Split = new Nikse.SubtitleEdit.Logic.LanguageStructure.Split();
language.SplitLongLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.SplitLongLines();
language.SplitSubtitle = new Nikse.SubtitleEdit.Logic.LanguageStructure.SplitSubtitle();
language.StartNumberingFrom = new Nikse.SubtitleEdit.Logic.LanguageStructure.StartNumberingFrom();
language.Statistics = new Nikse.SubtitleEdit.Logic.LanguageStructure.Statistics();
language.SubStationAlphaProperties = new Nikse.SubtitleEdit.Logic.LanguageStructure.SubStationAlphaProperties();
language.SubStationAlphaStyles = new Nikse.SubtitleEdit.Logic.LanguageStructure.SubStationAlphaStyles();
language.PointSync = new Nikse.SubtitleEdit.Logic.LanguageStructure.PointSync();
language.TransportStreamSubtitleChooser = new Nikse.SubtitleEdit.Logic.LanguageStructure.TransportStreamSubtitleChooser();
language.UnknownSubtitle = new Nikse.SubtitleEdit.Logic.LanguageStructure.UnknownSubtitle();
language.VisualSync = new Nikse.SubtitleEdit.Logic.LanguageStructure.VisualSync();
language.VobSubEditCharacters = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubEditCharacters();
language.VobSubOcr = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcr();
language.VobSubOcrCharacter = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcrCharacter();
language.VobSubOcrCharacterInspect = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcrCharacterInspect();
language.VobSubOcrNewFolder = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcrNewFolder();
language.WaveForm = new Nikse.SubtitleEdit.Logic.LanguageStructure.WaveForm();
language.WaveFormGenerateTimeCodes = new Nikse.SubtitleEdit.Logic.LanguageStructure.WaveFormGenerateTimeCodes();
language.WebVttNewVoice = new Nikse.SubtitleEdit.Logic.LanguageStructure.WebVttNewVoice();
language.General = new Nikse.SubtitleEdit.Logic.LanguageStructure.General();
language.About = new Nikse.SubtitleEdit.Logic.LanguageStructure.About();
language.AddToNames = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddToNames();
language.AddToOcrReplaceList = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddToOcrReplaceList();
language.AddToUserDictionary = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddToUserDictionary();
language.AddWaveForm = new Nikse.SubtitleEdit.Logic.LanguageStructure.AddWaveForm();
language.AdjustDisplayDuration = new Nikse.SubtitleEdit.Logic.LanguageStructure.AdjustDisplayDuration();
language.ApplyDurationLimits = new Nikse.SubtitleEdit.Logic.LanguageStructure.ApplyDurationLimits();
language.AutoBreakUnbreakLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.AutoBreakUnbreakLines();
language.BatchConvert = new Nikse.SubtitleEdit.Logic.LanguageStructure.BatchConvert();
language.Beamer = new Nikse.SubtitleEdit.Logic.LanguageStructure.Beamer();
language.ChangeCasing = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeCasing();
language.ChangeCasingNames = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeCasingNames();
language.ChangeFrameRate = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeFrameRate();
language.ChangeSpeedInPercent = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChangeSpeedInPercent();
language.CheckForUpdates = new Nikse.SubtitleEdit.Logic.LanguageStructure.CheckForUpdates();
language.ChooseAudioTrack = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChooseAudioTrack();
language.ChooseEncoding = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChooseEncoding();
language.ChooseLanguage = new Nikse.SubtitleEdit.Logic.LanguageStructure.ChooseLanguage();
language.ColorChooser = new Nikse.SubtitleEdit.Logic.LanguageStructure.ColorChooser();
language.ColumnPaste = new Nikse.SubtitleEdit.Logic.LanguageStructure.ColumnPaste();
language.CompareSubtitles = new Nikse.SubtitleEdit.Logic.LanguageStructure.CompareSubtitles();
language.DCinemaProperties = new Nikse.SubtitleEdit.Logic.LanguageStructure.DCinemaProperties();
language.DurationsBridgeGaps = new Nikse.SubtitleEdit.Logic.LanguageStructure.DurationsBridgeGaps();
language.DvdSubRip = new Nikse.SubtitleEdit.Logic.LanguageStructure.DvdSubRip();
language.DvdSubRipChooseLanguage = new Nikse.SubtitleEdit.Logic.LanguageStructure.DvdSubRipChooseLanguage();
language.EbuSaveOptions = new Nikse.SubtitleEdit.Logic.LanguageStructure.EbuSaveOptions();
language.EffectKaraoke = new Nikse.SubtitleEdit.Logic.LanguageStructure.EffectKaraoke();
language.EffectTypewriter = new Nikse.SubtitleEdit.Logic.LanguageStructure.EffectTypewriter();
language.ExportCustomText = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportCustomText();
language.ExportCustomTextFormat = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportCustomTextFormat();
language.ExportPngXml = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportPngXml();
language.ExportText = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExportText();
language.ExtractDateTimeInfo = new Nikse.SubtitleEdit.Logic.LanguageStructure.ExtractDateTimeInfo();
language.FindDialog = new Nikse.SubtitleEdit.Logic.LanguageStructure.FindDialog();
language.FindSubtitleLine = new Nikse.SubtitleEdit.Logic.LanguageStructure.FindSubtitleLine();
language.FixCommonErrors = new Nikse.SubtitleEdit.Logic.LanguageStructure.FixCommonErrors();
language.GetDictionaries = new Nikse.SubtitleEdit.Logic.LanguageStructure.GetDictionaries();
language.GetTesseractDictionaries = new Nikse.SubtitleEdit.Logic.LanguageStructure.GetTesseractDictionaries();
language.GoogleTranslate = new Nikse.SubtitleEdit.Logic.LanguageStructure.GoogleTranslate();
language.GoogleOrMicrosoftTranslate = new Nikse.SubtitleEdit.Logic.LanguageStructure.GoogleOrMicrosoftTranslate();
language.GoToLine = new Nikse.SubtitleEdit.Logic.LanguageStructure.GoToLine();
language.ImportImages = new Nikse.SubtitleEdit.Logic.LanguageStructure.ImportImages();
language.ImportSceneChanges = new Nikse.SubtitleEdit.Logic.LanguageStructure.ImportSceneChanges();
language.ImportText = new Nikse.SubtitleEdit.Logic.LanguageStructure.ImportText();
language.Interjections = new Nikse.SubtitleEdit.Logic.LanguageStructure.Interjections();
language.JoinSubtitles = new Nikse.SubtitleEdit.Logic.LanguageStructure.JoinSubtitles();
language.Main = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main();
language.Main.Menu = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu();
language.Main.Menu.File = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.FileMenu();
language.Main.Menu.Edit = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.EditMenu();
language.Main.Menu.Tools = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.ToolsMenu();
language.Main.Menu.Video = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.VideoMenu();
language.Main.Menu.SpellCheck = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.SpellCheckMenu();
language.Main.Menu.Synchronization = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.SynchronizationkMenu();
language.Main.Menu.AutoTranslate = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.AutoTranslateMenu();
language.Main.Menu.Options = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.OptionsMenu();
language.Main.Menu.Networking = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.NetworkingMenu();
language.Main.Menu.Help = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.HelpMenu();
language.Main.Menu.ToolBar = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.ToolBarMenu();
language.Main.Menu.ContextMenu = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainMenu.ListViewContextMenu();
language.Main.Controls = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainControls();
language.Main.VideoControls = new Nikse.SubtitleEdit.Logic.LanguageStructure.Main.MainVideoControls();
language.MatroskaSubtitleChooser = new Nikse.SubtitleEdit.Logic.LanguageStructure.MatroskaSubtitleChooser();
language.MeasurementConverter = new Nikse.SubtitleEdit.Logic.LanguageStructure.MeasurementConverter();
language.MergeDoubleLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.MergeDoubleLines();
language.MergedShortLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.MergeShortLines();
language.MergeTextWithSameTimeCodes = new Nikse.SubtitleEdit.Logic.LanguageStructure.MergeTextWithSameTimeCodes();
language.ModifySelection = new Nikse.SubtitleEdit.Logic.LanguageStructure.ModifySelection();
language.MultipleReplace = new Nikse.SubtitleEdit.Logic.LanguageStructure.MultipleReplace();
language.NetworkChat = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkChat();
language.NetworkJoin = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkJoin();
language.NetworkLogAndInfo = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkLogAndInfo();
language.NetworkStart = new Nikse.SubtitleEdit.Logic.LanguageStructure.NetworkStart();
language.OpenVideoDvd = new Nikse.SubtitleEdit.Logic.LanguageStructure.OpenVideoDvd();
language.PluginsGet = new Nikse.SubtitleEdit.Logic.LanguageStructure.PluginsGet();
language.RegularExpressionContextMenu = new Nikse.SubtitleEdit.Logic.LanguageStructure.RegularExpressionContextMenu();
language.RemoveTextFromHearImpaired = new Nikse.SubtitleEdit.Logic.LanguageStructure.RemoveTextFromHearImpaired();
language.ReplaceDialog = new Nikse.SubtitleEdit.Logic.LanguageStructure.ReplaceDialog();
language.RestoreAutoBackup = new Nikse.SubtitleEdit.Logic.LanguageStructure.RestoreAutoBackup();
language.SeekSilence = new Nikse.SubtitleEdit.Logic.LanguageStructure.SeekSilence();
language.SetMinimumDisplayTimeBetweenParagraphs = new Nikse.SubtitleEdit.Logic.LanguageStructure.SetMinimumDisplayTimeBetweenParagraphs();
language.SetSyncPoint = new Nikse.SubtitleEdit.Logic.LanguageStructure.SetSyncPoint();
language.Settings = new Nikse.SubtitleEdit.Logic.LanguageStructure.Settings();
language.SetVideoOffset = new Nikse.SubtitleEdit.Logic.LanguageStructure.SetVideoOffset();
language.ShowEarlierLater = new Nikse.SubtitleEdit.Logic.LanguageStructure.ShowEarlierLater();
language.ShowHistory = new Nikse.SubtitleEdit.Logic.LanguageStructure.ShowHistory();
language.SpellCheck = new Nikse.SubtitleEdit.Logic.LanguageStructure.SpellCheck();
language.Split = new Nikse.SubtitleEdit.Logic.LanguageStructure.Split();
language.SplitLongLines = new Nikse.SubtitleEdit.Logic.LanguageStructure.SplitLongLines();
language.SplitSubtitle = new Nikse.SubtitleEdit.Logic.LanguageStructure.SplitSubtitle();
language.StartNumberingFrom = new Nikse.SubtitleEdit.Logic.LanguageStructure.StartNumberingFrom();
language.Statistics = new Nikse.SubtitleEdit.Logic.LanguageStructure.Statistics();
language.SubStationAlphaProperties = new Nikse.SubtitleEdit.Logic.LanguageStructure.SubStationAlphaProperties();
language.SubStationAlphaStyles = new Nikse.SubtitleEdit.Logic.LanguageStructure.SubStationAlphaStyles();
language.PointSync = new Nikse.SubtitleEdit.Logic.LanguageStructure.PointSync();
language.TransportStreamSubtitleChooser = new Nikse.SubtitleEdit.Logic.LanguageStructure.TransportStreamSubtitleChooser();
language.UnknownSubtitle = new Nikse.SubtitleEdit.Logic.LanguageStructure.UnknownSubtitle();
language.VisualSync = new Nikse.SubtitleEdit.Logic.LanguageStructure.VisualSync();
language.VobSubEditCharacters = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubEditCharacters();
language.VobSubOcr = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcr();
language.VobSubOcrCharacter = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcrCharacter();
language.VobSubOcrCharacterInspect = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcrCharacterInspect();
language.VobSubOcrNewFolder = new Nikse.SubtitleEdit.Logic.LanguageStructure.VobSubOcrNewFolder();
language.WaveForm = new Nikse.SubtitleEdit.Logic.LanguageStructure.WaveForm();
language.WaveFormGenerateTimeCodes = new Nikse.SubtitleEdit.Logic.LanguageStructure.WaveFormGenerateTimeCodes();
language.WebVttNewVoice = new Nikse.SubtitleEdit.Logic.LanguageStructure.WebVttNewVoice();
using (XmlReader reader = XmlReader.Create(stream))
{
@ -621,6 +621,15 @@ namespace Nikse.SubtitleEdit.Logic
case "ChangeSpeedInPercent/Info":
language.ChangeSpeedInPercent.Info = reader.Value;
break;
case "ChangeSpeedInPercent/Custom":
language.ChangeSpeedInPercent.Custom = reader.Value;
break;
case "ChangeSpeedInPercent/ToDropFrame":
language.ChangeSpeedInPercent.ToDropFrame = reader.Value;
break;
case "ChangeSpeedInPercent/FromDropFrame":
language.ChangeSpeedInPercent.FromDropFrame = reader.Value;
break;
case "CheckForUpdates/Title":
language.CheckForUpdates.Title = reader.Value;
break;

View File

@ -8,7 +8,7 @@ namespace Nikse.SubtitleEdit.Logic
public static class LanguageDeserializerGenerator
{
public static void GenerateCSharpXmlDeserializerForLanguage()
public static void GenerateCSharpXmlDeserializerForLanguage(string fileName)
{
var sb = new StringBuilder();
sb.AppendLine(@"using System.IO;
@ -70,7 +70,10 @@ namespace Nikse.SubtitleEdit.Logic
sb.AppendLine("\t\t}");
sb.AppendLine("\t}");
sb.AppendLine("}");
System.IO.File.WriteAllText(@"C:\Data\subtitleedit\subtitleedit\src\Logic\LanguageDeserializer.cs", sb.ToString().Replace("[NewObjects]", newObjectsString.ToString()));
if (string.IsNullOrEmpty(fileName))
fileName = @"C:\Data\subtitleedit\subtitleedit\src\Logic\LanguageDeserializer.cs";
System.IO.File.WriteAllText(fileName, sb.ToString().Replace("[NewObjects]", newObjectsString.ToString().Replace("\t", " ")));
}
private static string SubElementDeserializer(Type classType, string currentName, string xmlPath, StringBuilder newObjectsString)

View File

@ -1892,13 +1892,14 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>"$(ProjectDir)..\update_rev.bat"</PreBuildEvent>
<PreBuildEvent>"$(ProjectDir)..\update_rev.bat"
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>COPY /Y /V "$(ProjectDir)Dlls\Hunspellx86.dll" "$(TargetDir)"
COPY /Y /V "$(ProjectDir)Dlls\Hunspellx64.dll" "$(TargetDir)"
COPY /Y /V "$(ProjectDir)Dlls\Interop.QuartzTypeLib.dll" "$(TargetDir)"
</PostBuildEvent>
"$(ProjectDir)..\update_lang.bat"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubtitleEdit", "SubtitleEdit.csproj", "{511A5B59-1C35-4719-8536-23B19AF9B21A}"
ProjectSection(ProjectDependencies) = postProject
@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateAssemblyInfo", "UpdateAssemblyInfo\UpdateAssemblyInfo.csproj", "{DBD4656C-5F40-4067-A70B-C4460DE20F77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateLanguageFiles", "UpdateLanguageFiles\UpdateLanguageFiles.csproj", "{36BCA2A7-EE6B-45FD-AF90-D3F76A84DA76}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -36,6 +38,10 @@ Global
{DBD4656C-5F40-4067-A70B-C4460DE20F77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBD4656C-5F40-4067-A70B-C4460DE20F77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBD4656C-5F40-4067-A70B-C4460DE20F77}.Release|Any CPU.Build.0 = Release|Any CPU
{36BCA2A7-EE6B-45FD-AF90-D3F76A84DA76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36BCA2A7-EE6B-45FD-AF90-D3F76A84DA76}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36BCA2A7-EE6B-45FD-AF90-D3F76A84DA76}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36BCA2A7-EE6B-45FD-AF90-D3F76A84DA76}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -50,6 +50,7 @@ namespace UpdateAssemblyInfo
return 1;
}
Console.WriteLine("Updating assembly info...");
string workingFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
string template = args[0];
string target = args[1];

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>

View File

@ -0,0 +1,43 @@
using System;
using System.IO;
namespace UpdateLanguageFiles
{
class Program
{
private static void DoUpdateAssembly(string source, string gitHash, string template, string target)
{
string templateData = File.ReadAllText(template);
string fixedData = templateData.Replace(source, gitHash);
File.WriteAllText(target, fixedData);
}
static int Main(string[] args)
{
string errorFileName = System.Reflection.Assembly.GetEntryAssembly().Location.Replace(".exe", "_error.txt");
if (args.Length != 2)
{
Console.WriteLine("UpdateLanguageFiles - wrong number of arguments: " + args.Length);
File.WriteAllText(errorFileName, "Wrong number of arguments: " + args.Length);
return 1;
}
Console.WriteLine("Updating language files...");
try
{
Nikse.SubtitleEdit.Logic.Configuration.Settings.Language.Save(args[0]);
Nikse.SubtitleEdit.Logic.LanguageDeserializerGenerator.GenerateCSharpXmlDeserializerForLanguage(args[1]);
return 0;
}
catch (Exception ex)
{
Console.WriteLine("UpdateLanguageFiles - " + ex.Message);
File.WriteAllText(errorFileName, ex.Message);
return 2;
}
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UpdateAssemblyDescription")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UpdateAssemblyDescription")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("07219928-b0da-484d-a7de-b3d9470e2e57")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<AppDesignerFolder>Properties</AppDesignerFolder>
<AssemblyName>UpdateLanguageFiles</AssemblyName>
<FileAlignment>512</FileAlignment>
<OutputType>Exe</OutputType>
<ProjectGuid>{36BCA2A7-EE6B-45FD-AF90-D3F76A84DA76}</ProjectGuid>
<RootNamespace>UpdateLanguageFiles</RootNamespace>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<PlatformTarget>AnyCPU</PlatformTarget>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<PlatformTarget>AnyCPU</PlatformTarget>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SubtitleEdit.csproj">
<Project>{511a5b59-1c35-4719-8536-23b19af9b21a}</Project>
<Name>SubtitleEdit</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

21
update_lang.bat Normal file
View File

@ -0,0 +1,21 @@
@ECHO OFF
SETLOCAL
PUSHD %~dp0
IF EXIST "src\UpdateLanguageFiles\bin\Release\UpdateLanguageFiles.exe" (
"src\UpdateLanguageFiles\bin\Release\UpdateLanguageFiles.exe" "LanguageMaster.xml" "src\Logic\LanguageDeserializer.cs"
) ELSE (
"src\UpdateLanguageFiles\bin\Debug\UpdateLanguageFiles.exe" "LanguageMaster.xml" "src\Logic\LanguageDeserializer.cs"
)
IF %ERRORLEVEL% NEQ 0 GOTO SubError
:END
POPD
ENDLOCAL
EXIT /B
:SubError
ECHO Something went wrong when generating the language files.
EXIT /B