Skip to content

Commit

Permalink
better settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Anime4000 committed Oct 8, 2015
1 parent 891d13a commit e594739
Show file tree
Hide file tree
Showing 10 changed files with 313 additions and 70 deletions.
2 changes: 1 addition & 1 deletion hfrgen/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.*")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.2")]
20 changes: 14 additions & 6 deletions hfrgen/Properties/Resources.Designer.cs

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

12 changes: 7 additions & 5 deletions hfrgen/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,17 @@
<value>..\Resources\lightning_go.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ScriptHFR" xml:space="preserve">
<value>Cores={0}
<value>{0}
Cores={1}
SetMemoryMax(512)
SetMTMode(3, Cores)
PluginPath = "{1}\"
LoadPlugin(PluginPath+"svpflow1.dll")
LoadPlugin(PluginPath+"svpflow2.dll")
Import(PluginPath+"InterFrame2.avsi")
DirectShowSource("{2}").ConvertToYV12()
SetMTMode(2)
InterFrame(Cores=Cores, Preset="{3}", Tuning="{4}", FrameDouble={5}, GPU={6}, InputType="{7}"{8})</value>
</data>
<data name="ScriptPlugin" xml:space="preserve">
<value>LoadPlugin("{0}")
LoadPlugin("{1}")
Import("{2}")</value>
</data>
</root>
46 changes: 41 additions & 5 deletions hfrgen/Properties/Settings.Designer.cs

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

11 changes: 10 additions & 1 deletion hfrgen/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="hfrgen.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="DirPluginHfr" Type="System.String" Scope="User">
<Setting Name="FilePluginAvsi" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="FilePluginDll1" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="FilePluginDll2" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="UseFolderPlugin" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
11 changes: 10 additions & 1 deletion hfrgen/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@
</configSections>
<userSettings>
<hfrgen.Properties.Settings>
<setting name="DirPluginHfr" serializeAs="String">
<setting name="FilePluginAvsi" serializeAs="String">
<value />
</setting>
<setting name="FilePluginDll1" serializeAs="String">
<value />
</setting>
<setting name="FilePluginDll2" serializeAs="String">
<value />
</setting>
<setting name="UseFolderPlugin" serializeAs="String">
<value>False</value>
</setting>
</hfrgen.Properties.Settings>
</userSettings>
</configuration>
87 changes: 62 additions & 25 deletions hfrgen/frmMain.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

Expand All @@ -21,26 +16,64 @@ public partial class frmMain : Form
public frmMain(string file, string lang) // API, a value received from host
{
InitializeComponent();
this.Icon = Properties.Resources.lightning_go;
Icon = Properties.Resources.lightning_go;

_file = file;
_fileavs = Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file)) + ".avs";
}

private void HighFrameRate_Load(object sender, EventArgs e)
{
if (String.Equals(Path.GetExtension(_file), ".avs", IC))
if (string.Equals(Path.GetExtension(_file), ".avs", IC))
{
MessageBox.Show("Please select non AviSynth script.");
this.Close();
Close();
return;
}

SettingCheck();

cboPreset.SelectedIndex = 0;
cboTuning.SelectedIndex = 0;
cboInputType.SelectedIndex = 0;
}

private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (!Properties.Settings.Default.UseFolderPlugin)
{
SettingCheck();
}
}

void SettingCheck()
{
if (string.IsNullOrEmpty(Properties.Settings.Default.FilePluginAvsi))
Setting("InterFrame2.avsi");
else if (!File.Exists(Properties.Settings.Default.FilePluginAvsi))
Setting("InterFrame2.avsi");

if (string.IsNullOrEmpty(Properties.Settings.Default.FilePluginDll1))
Setting("svpflow1.dll");
else if (!File.Exists(Properties.Settings.Default.FilePluginDll1))
Setting("svpflow1.dll");

if (string.IsNullOrEmpty(Properties.Settings.Default.FilePluginDll2))
Setting("svpflow2.dll");
else if (!File.Exists(Properties.Settings.Default.FilePluginDll2))
Setting("svpflow2.dll");
}

void Setting(string file)
{
if (Properties.Settings.Default.UseFolderPlugin)
return;

MessageBox.Show($"\"{file}\" not found or not configured.\nPlease configure before use.");
Form frm = new frmSetting();
frm.ShowDialog();
}

private void cboPreset_SelectedIndexChanged(object sender, EventArgs e)
{
int i = cboPreset.SelectedIndex;
Expand Down Expand Up @@ -117,29 +150,33 @@ private void btnSetting_Click(object sender, EventArgs e)

private void btnOK_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(Properties.Settings.Default.DirPluginHfr))
string[] Plugin =
{
MessageBox.Show("Missing InterFrame AviSynth Autoload Script and Plugins, please settings first before save.");
return;
}
Properties.Settings.Default.FilePluginDll1,
Properties.Settings.Default.FilePluginDll2,
Properties.Settings.Default.FilePluginAvsi
};

string[] Data =
{
Properties.Settings.Default.UseFolderPlugin ? "# using installed plugin" : string.Format(Properties.Resources.ScriptPlugin, Plugin),
string.Format("{0}", Environment.ProcessorCount),
_file,
cboPreset.Text,
cboTuning.Text,
chkDoubleFps.Checked ? "true" : "false",
chkUseGPU.Checked ? "true" : "false",
cboInputType.Text,
chkFullFrame.Checked ? ", NewNum=60, NewDen=1" : null
};

string[] Data = { String.Format("{0}", Environment.ProcessorCount),
Properties.Settings.Default.DirPluginHfr,
_file,
cboPreset.Text,
cboTuning.Text,
chkDoubleFps.Checked ? "true" : "false",
chkUseGPU.Checked ? "true" : "false",
cboInputType.Text,
chkFullFrame.Checked ? ", NewNum=60, NewDen=1" : ""};

File.WriteAllText(_fileavs, String.Format(Properties.Resources.ScriptHFR, Data), UTF8);
this.Close();
File.WriteAllText(_fileavs, string.Format(Properties.Resources.ScriptHFR, Data), UTF8);
Close();
}

private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
Close();
}
}
}
1 change: 1 addition & 0 deletions hfrgen/frmMain.designer.cs

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

Loading

0 comments on commit e594739

Please sign in to comment.