Skip to content

Commit

Permalink
beta 3 checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaCluster committed Jul 16, 2019
1 parent 0117850 commit b32973f
Show file tree
Hide file tree
Showing 27 changed files with 1,630 additions and 684 deletions.
11 changes: 5 additions & 6 deletions AVM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
<Compile Include="src\NodeEditor.Designer.cs">
<DependentUpon>NodeEditor.cs</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="src\AboutBox.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -110,11 +109,11 @@
</Compile>
<Compile Include="src\Types\Node.cs">
</Compile>
<Compile Include="src\mainForm.cs">
<Compile Include="src\MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="src\mainForm.Designer.cs">
<DependentUpon>mainForm.cs</DependentUpon>
<Compile Include="src\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="src\Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -137,8 +136,8 @@
<DependentUpon>Importer.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="src\mainForm.resx">
<DependentUpon>mainForm.cs</DependentUpon>
<EmbeddedResource Include="src\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
Expand Down
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[assembly: AssemblyTitle("AVM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicholas Omann")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("A Video Manager")]
[assembly: AssemblyCopyright("Copyright © 2008-2009")]
[assembly: AssemblyTrademark("")]
Expand Down
2 changes: 1 addition & 1 deletion src/AboutBox.Designer.cs

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

2 changes: 1 addition & 1 deletion src/AboutBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public AboutBox()
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
//this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = AssemblyDescription;
}

Expand Down
4 changes: 2 additions & 2 deletions src/AboutBox.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
<data name="logoPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAHgAAAEGCAIAAAAhWcaAAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwQAA
DsEBuJFr7QAAcQNJREFUeF7tfQdclFfa/ez/K/tlExUVmN7ovQ1D74Kg2BWs2CvYEVEEG0VALHTpAip2
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwAAA
DsABataJCQAAcQNJREFUeF7tfQdclFfa/ez/K/tlExUVmN7ovQ1D74Kg2BWs2CvYEVEEG0VALHTpAip2
xd57jzHGmF5MsokxdbPV/XY13//c9xleX2YAMTGJZnfy/PiNiATOnDn3POXe+xtZpew3v/mNCP/9v9/8
5j9+g4+i/xDhyf/7z//HnvzXb0T/yf7InuOvfiNij/8TiR6KRN+L/u/h/7EnDwTPv2fP2Sf/T/T9599/
//r3D28/nDFsRp8+fezt7f8f98D/zuiBb8l+hl/3A0DLK+WKKoWyWqmsUapqVeqNanW9WrNJo23Sardp
Expand Down
46 changes: 26 additions & 20 deletions src/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace AVM
public class Database
{
private SQLiteConnection _database;
private string _databasePath;
private long parentOfCurrentGroup = 0;
private long currentGroup = 0;

Expand Down Expand Up @@ -116,7 +115,7 @@ public Database(string databasePath)
"watched INTEGER DEFAULT 0," + // number of times watched
"type INTEGER," + // 0 means nothing 1:youtube 2: hulu
"url TEXT," + // original url for hulu or youtube video
"embeded TEXT," + // embeded info for hulu or youtube
"embedded TEXT," + // embedded info for hulu or youtube
"comment TEXT," + // stores the comment section for DVDs
"episode_number INTEGER," +
"season_number INTEGER," +
Expand All @@ -135,7 +134,6 @@ public Database(string databasePath)
SQLiteConnectionStringBuilder dbBuilder = new SQLiteConnectionStringBuilder();
dbBuilder.DataSource = databasePath;
_database = new SQLiteConnection(dbBuilder.ConnectionString);
_databasePath = databasePath;
}
#endregion

Expand All @@ -144,8 +142,10 @@ public Database(string databasePath)
/// Fills listBox with the group that is currently selected.
/// </summary>
/// <param name="listBox">ListBox to be filled with groups.</param>
public void refreshGroups(System.Windows.Forms.ListBox listBox)
public void refreshGroups(System.Windows.Forms.ListBox listBox,
ref List<AVM.Types.Group> groups)
{
groups.Clear();
_database.Open();
SQLiteTransaction trans = _database.BeginTransaction();
listBox.Items.Clear();
Expand All @@ -162,6 +162,7 @@ public void refreshGroups(System.Windows.Forms.ListBox listBox)
reader.GetInt64(1),
parentOfCurrentGroup);
listBox.Items.Add(tempGroup);
groups.Add(tempGroup);
}
trans.Rollback();
_database.Close();
Expand Down Expand Up @@ -373,7 +374,6 @@ private void recursiveRemoveGroup(AVM.Types.Group group,
" AND group_id > 0;",
_database, trans);
SQLiteDataReader reader = command.ExecuteReader();
List<AVM.Types.Group> groupList = new List<AVM.Types.Group>();
if (reader.HasRows)
while (reader.Read())
{
Expand Down Expand Up @@ -426,7 +426,12 @@ public long getLastGroupId()
_database, trans);
SQLiteDataReader reader = command.ExecuteReader();
reader.Read();
last_id = reader.GetInt64(0);

// If there is nothing in groups yet use default.
if (reader.IsDBNull(0))
last_id = 0;
else
last_id = reader.GetInt64(0);
_database.Close();

return last_id;
Expand Down Expand Up @@ -479,9 +484,9 @@ public void gotoParent()
{
tempNode.Url = reader.GetString(4);
if (reader.IsDBNull(5))
tempNode.Embeded = null;
tempNode.embedded = null;
else
tempNode.Embeded = reader.GetString(5);
tempNode.embedded = reader.GetString(5);
}

if (!reader.IsDBNull(6))
Expand Down Expand Up @@ -510,6 +515,7 @@ public void gotoParent()
if (!reader.IsDBNull(14))
tempNode.File.Container = reader.GetString(14);
}
tempNode.ParentId = reader.GetInt64(15);
list.Add(tempNode);
}
trans.Rollback();
Expand Down Expand Up @@ -546,9 +552,9 @@ public void gotoParent()
{
tempNode.Url = reader.GetString(4);
if (reader.IsDBNull(5))
tempNode.Embeded = null;
tempNode.embedded = null;
else
tempNode.Embeded = reader.GetString(5);
tempNode.embedded = reader.GetString(5);
}

if (!reader.IsDBNull(6))
Expand Down Expand Up @@ -625,8 +631,8 @@ public void fillNodes(List<AVM.Types.Node> nodes)
foreach (AVM.Types.Node node in nodes)
{
// Create strings to make the data adapter
string identifiers = "name, node_id, parent_group_id, type, url, embeded, comment";
string data = "@name, @node_id, @parent_group_id, @type, @url, @embeded, @comment";
string identifiers = "name, node_id, parent_group_id, type, url, embedded, comment";
string data = "@name, @node_id, @parent_group_id, @type, @url, @embedded, @comment";
if (node.IsFile)
{
identifiers += ", uri, video_encoding, audio_encoding, container";
Expand All @@ -651,7 +657,7 @@ public void fillNodes(List<AVM.Types.Node> nodes)
adapter.InsertCommand.Parameters.AddWithValue("@parent_group_id", node.ParentId);
adapter.InsertCommand.Parameters.AddWithValue("@type", node.UrlType);
adapter.InsertCommand.Parameters.AddWithValue("@url", node.Url);
adapter.InsertCommand.Parameters.AddWithValue("@embeded", node.Embeded);
adapter.InsertCommand.Parameters.AddWithValue("@embedded", node.embedded);
adapter.InsertCommand.Parameters.AddWithValue("@comment", node.Comment);
if (node.IsFile)
{
Expand Down Expand Up @@ -687,8 +693,8 @@ public void addNode(AVM.Types.Node node)
SQLiteTransaction trans = _database.BeginTransaction();

// Create strings to make the data adapter.
string identifiers = "name, parent_group_id, type, url, embeded, comment";
string data = "@name, @parent_group_id, @type, @url, @embeded, @comment";
string identifiers = "name, parent_group_id, type, url, embedded, comment";
string data = "@name, @parent_group_id, @type, @url, @embedded, @comment";
if (node.IsFile)
{
identifiers += ", uri, video_encoding, audio_encoding, container";
Expand All @@ -712,7 +718,7 @@ public void addNode(AVM.Types.Node node)
adapter.InsertCommand.Parameters.AddWithValue("@parent_group_id", currentGroup);
adapter.InsertCommand.Parameters.AddWithValue("@type", node.UrlType);
adapter.InsertCommand.Parameters.AddWithValue("@url", node.Url);
adapter.InsertCommand.Parameters.AddWithValue("@embeded", node.Embeded);
adapter.InsertCommand.Parameters.AddWithValue("@embedded", node.embedded);
adapter.InsertCommand.Parameters.AddWithValue("@comment", node.Comment);
// If file populate the SQLiteDataAdapter with file data.
if (node.IsFile)
Expand Down Expand Up @@ -752,7 +758,7 @@ public void updateNode(AVM.Types.Node old_node,
string updateString = "name = @name" +
", type = @type" +
", url = @url" +
", embeded = @embeded" +
", embedded = @embedded" +
", comment = @comment";
if (node.IsFile)
{
Expand Down Expand Up @@ -780,7 +786,7 @@ public void updateNode(AVM.Types.Node old_node,
adapter.UpdateCommand.Parameters.AddWithValue("@name", node.Name);
adapter.UpdateCommand.Parameters.AddWithValue("@type", node.UrlType);
adapter.UpdateCommand.Parameters.AddWithValue("@url", node.Url);
adapter.UpdateCommand.Parameters.AddWithValue("@embeded", node.Embeded);
adapter.UpdateCommand.Parameters.AddWithValue("@embedded", node.embedded);
adapter.UpdateCommand.Parameters.AddWithValue("@comment", node.Comment);
// If file populate the SQLiteDataAdapter with file data.
if (node.IsFile)
Expand Down Expand Up @@ -888,9 +894,9 @@ public void searchNodes(ref List<AVM.Types.Node> nodes,
{
tempNode.Url = reader.GetString(4);
if (reader.IsDBNull(5))
tempNode.Embeded = null;
tempNode.embedded = null;
else
tempNode.Embeded = reader.GetString(5);
tempNode.embedded = reader.GetString(5);
}

if (!reader.IsDBNull(6))
Expand Down
39 changes: 33 additions & 6 deletions src/DeleteConfirmation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,54 @@ public partial class DeleteConfirmation : Form
{
private bool _delete = false;

public DeleteConfirmation()
#region Properties
/// <summary>
/// This returns true if the user wants to delete the selected video.
/// </summary>
public bool Delete
{
InitializeComponent();
get { return _delete; }
}
#endregion

public bool Delete
#region Constructors
/// <summary>
/// Creates the DeleteConfirmation form.
/// </summary>
public DeleteConfirmation()
{
get { return _delete; }
InitializeComponent();
}
#endregion

private void deleteButton_Click(object sender, EventArgs e)
#region Methods
/// <summary>
/// This is called when the "Delete" button is pressed.
/// It sets _delete to true and then closes the dialog.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void deleteButton_Click(object sender,
EventArgs e)
{
_delete = true;
Properties.Settings.Default.PromptOnDelete = !dontPromptCheckBox.Checked;
this.Close();
}

private void cancelButton_Click(object sender, EventArgs e)
/// <summary>
/// This is called when the "Cancel" button is pressed.
/// It sets _delete to false and then closes the dialog.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender,
EventArgs e)
{
_delete = false;
Properties.Settings.Default.PromptOnDelete = !dontPromptCheckBox.Checked;
this.Close();
}
#endregion
}
}
Loading

0 comments on commit b32973f

Please sign in to comment.