Skip to content

Commit

Permalink
Added check update
Browse files Browse the repository at this point in the history
Added traditional Chinese
  • Loading branch information
rxaa committed Jun 3, 2019
1 parent e45129d commit 29523f7
Show file tree
Hide file tree
Showing 24 changed files with 712 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
MediaMux
=============

MediaMux is a windows tool for converting/muxing/split/concat videos.
MediaMux is a windows tool for converting/muxing/split/concat videos. https://mediamux.net/

Based on FFmpeg and .net 4.5

Expand Down
2 changes: 1 addition & 1 deletion mediaMux/CfgPropertyConvert.cs
Expand Up @@ -48,7 +48,7 @@ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
var files = Directory.GetFiles(AppLanguage.LangMenu);
return new StandardValuesCollection(files.Select(it => Path.GetFileNameWithoutExtension(it)).ToList());
return new StandardValuesCollection(files.Select(it => Path.GetFileNameWithoutExtension(it).Split(',')[0]).ToList());
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
Expand Down
7 changes: 7 additions & 0 deletions mediaMux/ConfigFile.cs
Expand Up @@ -22,6 +22,13 @@ public class ConfigFile
[DescriptionDf("font_descr")]
public Font font_ui { get; set; } = null;


[CategoryDf("GUI")]
[DisplayNameDf("check_update")]
[DescriptionDf("check_update_descr")]
[TypeConverterAttribute(typeof(YesNoConverter))]
public string check_update { get; set; } = "1";

[CategoryDf("Subtitle")]
[DisplayNameDf("subtitle_font")]
[DescriptionDf("subtitle_font_descr")]
Expand Down
1 change: 1 addition & 0 deletions mediaMux/FormDetails.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions mediaMux/FormDetails.cs
Expand Up @@ -24,6 +24,11 @@ public void setText(string str)
{
richTextBox1.Text = str;
}
public void addText(string str)
{

richTextBox1.AppendText(str);
}

public void addText(string str, Color c, Font f = null)
{
Expand All @@ -42,5 +47,11 @@ private void FormDetails_Load(object sender, EventArgs e)
{
richTextBox1.AutoWordSelection = false;
}

private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)
{
// Call Process.Start method to open a browser, with link text as URL
System.Diagnostics.Process.Start(e.LinkText); // call default browser
}
}
}
2 changes: 2 additions & 0 deletions mediaMux/FormEditTitle.cs
Expand Up @@ -67,6 +67,8 @@ private void buttonAdd_Click(object sender, EventArgs e)
if (this.textBoxTitle.Text == "")
{
dfv.msgERR(com.lang.dat.Please_input_title);
textBoxTitle.Focus();
textBoxTitle.SelectAll();
return;
}

Expand Down
62 changes: 31 additions & 31 deletions mediaMux/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 41 additions & 3 deletions mediaMux/FormMain.cs
Expand Up @@ -332,12 +332,34 @@ void bindConvert(ConvertMedia ca)
}


async void checkUpdate()
{
try
{
var ver = await Http.HttpGetJson(com.homeUrl() + "media/version?lang=" + System.Threading.Thread.CurrentThread.CurrentCulture.Name, new Version());
if (ver.needUpdate())
{
var fw = new FormWeb(true);
fw.Text = com.lang.dat.New_version;
fw.setDocumentText(ver.context);
fw.Show();
}
}
catch (Exception)
{

}
}

private void Form1_Load(object sender, EventArgs e)
{
#if DEBUG

#endif

if (com.cfg.dat.check_update != "")
this.checkUpdate();

flowLayoutPanelProp.Enabled = false;

comboBoxCon.Items.AddRange(new string[] { com.lang.dat.Dont_change, "mkv", "mp4" });
Expand Down Expand Up @@ -853,7 +875,7 @@ private void buttonCfgList_Click(object sender, EventArgs e)
if (!codeList.startSelect())
return;


stream.convert = codeList.convert;
bindConvert(stream.convert);
}
Expand Down Expand Up @@ -1174,8 +1196,11 @@ private async void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
var fd = new FormDetails();
fd.Text = com.lang.dat.About;
var f = new Font(this.Font.FontFamily, this.Font.Size + 1, FontStyle.Bold);
fd.addText("MediaMux " + com.lang.dat.version + " " + com.getVer() + "\r\n", Color.Black, f);
fd.addText("MediaMux " + com.lang.dat.version + " " + com.getVer() + "\r\n\r\n", Color.Black, f);


fd.addText("Web site:\r\n", Color.Black, f);
fd.addText(com.homeUrl() + "\r\n\r\n");
fd.addText("Email:\r\n", Color.Black, f);
fd.addText("zyxdde@gmail.com\r\n\r\n", Color.Blue);

Expand All @@ -1188,7 +1213,20 @@ private void helpToolStripMenuItem_Click(object sender, EventArgs e)
{
var fw = new FormWeb();
fw.Text = com.lang.dat.Help;
fw.setUrl(Application.StartupPath + "\\help\\help_zh-CN.html");

var fs = Directory.GetFiles(Application.StartupPath + "\\help\\");
var langStr = com.getLangStr();
foreach (var f in fs)
{
if (f.ToLower().IndexOf(langStr.ToLower()) >= 0)
{
fw.setUrl(f);
fw.Show();
return;
}
}

fw.setUrl(fs + "help_english.html");
fw.Show();
}

Expand Down
5 changes: 3 additions & 2 deletions mediaMux/FormWeb.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion mediaMux/FormWeb.cs
Expand Up @@ -12,19 +12,34 @@ namespace MediaMux
{
public partial class FormWeb : Form
{
public FormWeb()
public FormWeb(bool small = false)
{
InitializeComponent();
if (small)
{
Size = new Size(this.Size.Width / 2, (int)(Size.Height / 1.5));
}

com.init(this);
}

public void setUrl(string str)
{
this.webBrowser1.Navigate(str);
}

public void setDocumentText(string str)
{
this.webBrowser1.DocumentText = str;
}
private void FormWeb_Load(object sender, EventArgs e)
{

}

private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{

}
}
}
4 changes: 4 additions & 0 deletions mediaMux/LanguageFile.cs
Expand Up @@ -70,8 +70,12 @@ public class LanguageFile : LangDfv

public string Convert_all_stream = "Convert all streams";

public string New_version = "New version";


public string check_update = "Check update";
public string check_update_descr = "Check new Release when startup.";

public string Config = "Config";
public string Stop = "Stop";
public string Open_location = "Open location";
Expand Down
4 changes: 2 additions & 2 deletions mediaMux/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// 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.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
36 changes: 36 additions & 0 deletions mediaMux/Version.cs
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MediaMux
{
class Version
{
public string version { get; set; } = "";

public string context { get; set; } = "";

public int lang { get; set; } = 1;


public bool needUpdate()
{
if (version == null || version == "")
return false;
var verNew = version.Split('.');
var verOld = com.getVer().Split('.');

for (int i = 0; i < verOld.Length; i++)
{
if (i >= verNew.Length)
return false;
if (int.Parse(verNew[i]) > int.Parse(verOld[i]))
return true;
}

return false;
}
}
}

0 comments on commit 29523f7

Please sign in to comment.