diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs
new file mode 100644
index 0000000..d915c31
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs
@@ -0,0 +1,168 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class VideoPlayer
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VideoPlayer));
+ this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
+ this.flcontrols = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnplay = new System.Windows.Forms.Button();
+ this.pgplaytime = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.addSongToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.wpaudio = new AxWMPLib.AxWindowsMediaPlayer();
+ this.toolStripContainer1.ContentPanel.SuspendLayout();
+ this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
+ this.toolStripContainer1.SuspendLayout();
+ this.flcontrols.SuspendLayout();
+ this.menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).BeginInit();
+ this.SuspendLayout();
+ //
+ // toolStripContainer1
+ //
+ //
+ // toolStripContainer1.ContentPanel
+ //
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.wpaudio);
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.flcontrols);
+ this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(805, 402);
+ this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.toolStripContainer1.LeftToolStripPanelVisible = false;
+ this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
+ this.toolStripContainer1.Name = "toolStripContainer1";
+ this.toolStripContainer1.RightToolStripPanelVisible = false;
+ this.toolStripContainer1.Size = new System.Drawing.Size(805, 426);
+ this.toolStripContainer1.TabIndex = 3;
+ this.toolStripContainer1.Text = "toolStripContainer1";
+ //
+ // toolStripContainer1.TopToolStripPanel
+ //
+ this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1);
+ //
+ // flcontrols
+ //
+ this.flcontrols.AutoSize = true;
+ this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flcontrols.Controls.Add(this.btnplay);
+ this.flcontrols.Controls.Add(this.pgplaytime);
+ this.flcontrols.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.flcontrols.Location = new System.Drawing.Point(0, 373);
+ this.flcontrols.Name = "flcontrols";
+ this.flcontrols.Size = new System.Drawing.Size(805, 29);
+ this.flcontrols.TabIndex = 0;
+ //
+ // btnplay
+ //
+ this.btnplay.AutoSize = true;
+ this.btnplay.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnplay.Location = new System.Drawing.Point(3, 3);
+ this.btnplay.Name = "btnplay";
+ this.btnplay.Size = new System.Drawing.Size(37, 23);
+ this.btnplay.TabIndex = 0;
+ this.btnplay.Text = "Play";
+ this.btnplay.UseVisualStyleBackColor = true;
+ this.btnplay.Click += new System.EventHandler(this.btnplay_Click);
+ //
+ // pgplaytime
+ //
+ this.pgplaytime.BlockSize = 5;
+ this.pgplaytime.Location = new System.Drawing.Point(46, 3);
+ this.pgplaytime.Maximum = 100;
+ this.pgplaytime.Name = "pgplaytime";
+ this.pgplaytime.Size = new System.Drawing.Size(749, 23);
+ this.pgplaytime.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
+ this.pgplaytime.TabIndex = 1;
+ this.pgplaytime.Tag = "keepbg";
+ this.pgplaytime.Text = "shiftedProgressBar1";
+ this.pgplaytime.Value = 0;
+ this.pgplaytime.MouseDown += new System.Windows.Forms.MouseEventHandler(this.startScrub);
+ this.pgplaytime.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseMove);
+ this.pgplaytime.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseUp);
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addSongToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(805, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // addSongToolStripMenuItem
+ //
+ this.addSongToolStripMenuItem.Name = "addSongToolStripMenuItem";
+ this.addSongToolStripMenuItem.Size = new System.Drawing.Size(81, 20);
+ this.addSongToolStripMenuItem.Text = "Open Video";
+ this.addSongToolStripMenuItem.Click += new System.EventHandler(this.addSongToolStripMenuItem_Click);
+ //
+ // wpaudio
+ //
+ this.wpaudio.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.wpaudio.Enabled = true;
+ this.wpaudio.Location = new System.Drawing.Point(0, 0);
+ this.wpaudio.Name = "wpaudio";
+ this.wpaudio.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wpaudio.OcxState")));
+ this.wpaudio.Size = new System.Drawing.Size(805, 373);
+ this.wpaudio.TabIndex = 2;
+ this.wpaudio.Visible = false;
+ //
+ // VideoPlayer
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.toolStripContainer1);
+ this.Name = "VideoPlayer";
+ this.Size = new System.Drawing.Size(805, 426);
+ this.toolStripContainer1.ContentPanel.ResumeLayout(false);
+ this.toolStripContainer1.ContentPanel.PerformLayout();
+ this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
+ this.toolStripContainer1.TopToolStripPanel.PerformLayout();
+ this.toolStripContainer1.ResumeLayout(false);
+ this.toolStripContainer1.PerformLayout();
+ this.flcontrols.ResumeLayout(false);
+ this.flcontrols.PerformLayout();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ private System.Windows.Forms.ToolStripContainer toolStripContainer1;
+ private System.Windows.Forms.FlowLayoutPanel flcontrols;
+ private System.Windows.Forms.Button btnplay;
+ private Controls.ShiftedProgressBar pgplaytime;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem addSongToolStripMenuItem;
+ private AxWMPLib.AxWindowsMediaPlayer wpaudio;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.cs b/ShiftOS.WinForms/Applications/VideoPlayer.cs
new file mode 100644
index 0000000..29c318f
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/VideoPlayer.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using System.IO;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [AppscapeEntry("Video Player", "Play .mp4 files or .wmv files as videos inside ShiftOS! Perfect for a shifted movie night.", 1524, 1000, "file_skimmer", "Entertainment")]
+ [DefaultTitle("Video Player")]
+ [Launcher("Video Player", false, null, "Entertainment")]
+ [WinOpen("video_player")]
+ public partial class VideoPlayer : UserControl, IShiftOSWindow
+ {
+ public VideoPlayer()
+ {
+ InitializeComponent();
+ }
+
+ public void OnLoad()
+ {
+ tmr.Interval = 50;
+ tmr.Tick += (o, a) =>
+ {
+ try
+ {
+ double end = wpaudio.currentMedia.duration;
+ double pos = wpaudio.Ctlcontrols.currentPosition;
+ pgplaytime.Maximum = (int)end;
+ pgplaytime.Value = (int)pos;
+ }
+ catch { }
+ };
+ tmr.Start();
+ }
+
+ public void OnSkinLoad()
+ {
+ wpaudio.uiMode = "none";
+ wpaudio.Show();
+ pgplaytime.Width = flcontrols.Width - btnplay.Width - 25;
+ wpaudio.enableContextMenu = false;
+ }
+
+ public bool OnUnload()
+ {
+ if(!string.IsNullOrWhiteSpace(filePath))
+ if (File.Exists(filePath))
+ File.Delete(filePath);
+ tmr.Stop();
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ Timer tmr = new Timer();
+
+ string filePath = null;
+
+ private void addSongToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".mp4", ".wmv" }, FileOpenerStyle.Open, (result) =>
+ {
+ var finf = ShiftOS.Objects.ShiftFS.Utils.GetFileInfo(result);
+ File.WriteAllBytes(finf.Name, ShiftOS.Objects.ShiftFS.Utils.ReadAllBytes(result));
+ filePath = finf.Name;
+ wpaudio.URL = filePath;
+ wpaudio.Ctlcontrols.play();
+ btnplay.Text = "Pause";
+ });
+ }
+
+ private void btnplay_Click(object sender, EventArgs e)
+ {
+ if(wpaudio.playState == WMPLib.WMPPlayState.wmppsPlaying)
+ {
+ wpaudio.Ctlcontrols.pause();
+ btnplay.Text = "Play";
+ }
+ else if(wpaudio.playState == WMPLib.WMPPlayState.wmppsPaused)
+ {
+ wpaudio.Ctlcontrols.play();
+ btnplay.Text = "Pause";
+ }
+ }
+
+ bool scrubbing = false;
+
+ private void startScrub(object sender, MouseEventArgs e)
+ {
+ scrubbing = true;
+ }
+
+ static public double linear(double x, double x0, double x1, double y0, double y1)
+ {
+ if ((x1 - x0) == 0)
+ {
+ return (y0 + y1) / 2;
+ }
+ return y0 + (x - x0) * (y1 - y0) / (x1 - x0);
+ }
+
+ private void pgplaytime_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (wpaudio.playState == WMPLib.WMPPlayState.wmppsPlaying || wpaudio.playState == WMPLib.WMPPlayState.wmppsPaused)
+ try
+ {
+ if (scrubbing)
+ {
+ double end = wpaudio.currentMedia.duration;
+ double result = linear(e.X, 0, pgplaytime.Width, 0, end);
+ wpaudio.Ctlcontrols.currentPosition = result;
+ }
+ }
+ catch { }
+ }
+
+ private void pgplaytime_MouseUp(object sender, MouseEventArgs e)
+ {
+ scrubbing = false;
+ }
+
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.resx b/ShiftOS.WinForms/Applications/VideoPlayer.resx
new file mode 100644
index 0000000..d484b91
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/VideoPlayer.resx
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
+ ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAtwAAAAIB
+ AAAAAQAAAAAAAAAAAAAAAKIAAAAAAwAACAAAAAAABQAAAAAAAADwPwMAAAAAAAUAAAAAAAAAAAAIAAIA
+ AAAAAAMAAQAAAAsA//8DAAAAAAALAP//CAACAAAAAAADADIAAAALAAAACAAKAAAAbgBvAG4AZQAAAAsA
+ AAALAAAACwD//wsA//8LAAAACAACAAAAAAAIAAIAAAAAAAgAAgAAAAAACAACAAAAAAALAAAAelIAAK4w
+ AAAL
+
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index dac803d..7c39078 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -244,6 +244,12 @@
UpdateManager.cs
+
+ UserControl
+
+
+ VideoPlayer.cs
+
UserControl
@@ -459,6 +465,9 @@
UpdateManager.cs
+
+ VideoPlayer.cs
+
WidgetManagerFrontend.cs
diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
index 17a6e4c..84783e5 100644
--- a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
+++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
@@ -79,6 +79,7 @@ namespace ShiftOS.WinForms.ShiftnetSites
var fl = new FlowLayoutPanel();
fl.Dock = DockStyle.Fill;
pnlappslist.Controls.Add(fl);
+ fl.AutoScroll = true;
fl.Show();
foreach(var upg in upgrades)
{
@@ -148,6 +149,20 @@ namespace ShiftOS.WinForms.ShiftnetSites
}
}
+ public bool DependenciesInstalled(ShiftoriumUpgrade upg)
+ {
+ string[] split = upg.Dependencies.Split(';');
+ foreach(var u in split)
+ {
+ if (!u.StartsWith("appscape_handled"))
+ {
+ if (!Shiftorium.UpgradeInstalled(u))
+ return false;
+ }
+ }
+ return true;
+ }
+
public void ViewMoreInfo(ShiftoriumUpgrade upg)
{
lbtitle.Text = upg.Name;
@@ -178,11 +193,11 @@ namespace ShiftOS.WinForms.ShiftnetSites
if (cp_value.Text != "Already Purchased.")
{
var more_info = new Button();
- more_info.Text = "More info";
+ more_info.Text = "Buy";
more_info.Click += (o, a) =>
{
//Detect if dependencies are installed.
- if (Shiftorium.DependenciesInstalled(upg))
+ if (DependenciesInstalled(upg))
{
//Detect sufficient codepoints
if (SaveSystem.CurrentSave.Codepoints >= upg.Cost)
@@ -210,6 +225,7 @@ namespace ShiftOS.WinForms.ShiftnetSites
var installation = new AppscapeInstallation(upg.Name, attrib.DownloadSize, upg.ID);
AppearanceManager.SetupWindow(installer);
installer.InitiateInstall(installation);
+ return;
}
}
}
@@ -237,6 +253,7 @@ namespace ShiftOS.WinForms.ShiftnetSites
more_info.Left = cp_display.Width - more_info.Width - 5;
cp_display.Controls.Add(more_info);
more_info.Show();
+ ControlManager.SetupControls(pnlappslist);
}
var desc = new Label();
@@ -311,38 +328,33 @@ namespace ShiftOS.WinForms.ShiftnetSites
public string ShiftoriumId { get; private set; }
public int Size { get; private set; }
- public string Name { get; private set; }
-
+
protected override void Run()
{
this.SetStatus("Downloading...");
SetProgress(0);
- new Thread(() =>
+ int i = 0;
+ while (i <= Size)
{
- int i = 0;
- while (i <= Size)
- {
- SetProgress((i / Size) * 100);
- i++;
- Thread.Sleep(100);
- }
- SetProgress(0);
- SetStatus("Installing...");
- i = 0;
- while (i <= Size)
- {
- SetProgress((i / Size) * 100);
- i++;
- Thread.Sleep(50);
- }
- Shiftorium.Buy(ShiftoriumId, 0);
- Desktop.InvokeOnWorkerThread(() =>
- {
- Infobox.Show("Install complete!", "The installation of " + Name + " has completed.");
- SaveSystem.SaveGame();
- });
- })
- { IsBackground = true }.Start();
+ SetProgress((i / Size) * 100);
+ i++;
+ Thread.Sleep(100);
+ }
+ SetProgress(0);
+ SetStatus("Installing...");
+ i = 0;
+ while (i <= Size)
+ {
+ SetProgress((i / Size) * 100);
+ i++;
+ Thread.Sleep(50);
+ }
+ Shiftorium.Buy(ShiftoriumId, 0);
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ Infobox.Show("Install complete!", "The installation of " + Name + " has completed.");
+ SaveSystem.SaveGame();
+ });
}
}
}
diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs
index a84271b..10fd7d7 100644
--- a/ShiftOS_TheReturn/Paths.cs
+++ b/ShiftOS_TheReturn/Paths.cs
@@ -208,7 +208,8 @@ namespace ShiftOS.Engine
foreach (var file in System.IO.Directory.GetFiles(folder))
{
string mfsDir = file.Replace(SharedFolder, $"{mount}:").Replace("\\", "/");
- WriteAllBytes(mfsDir, System.IO.File.ReadAllBytes(file));
+ if (!FileExists(mfsDir))
+ WriteAllBytes(mfsDir, System.IO.File.ReadAllBytes(file));
}
foreach (var directory in System.IO.Directory.GetDirectories(folder))
{