| @@ -30,7 +30,7 @@ namespace Funscripta | |||
| private long Frame { get; set; } = 0; | |||
| private DirectoryInfo libDirectory = new DirectoryInfo( Path.Combine( ".", "libvlc", IntPtr.Size == 4 ? "x86" : "x64" ) ); | |||
| public Form1() | |||
| public Form1( string videoFile, string scriptFile ) | |||
| { | |||
| if ( !libDirectory.Exists ) libDirectory.Create(); | |||
| InitializeComponent(); | |||
| @@ -40,6 +40,8 @@ namespace Funscripta | |||
| framesPerStep.Text = Properties.Settings.Default.FramesPerStep.ToString(); | |||
| track1.FunScript = new FunScript(); | |||
| track1.FrameChanged += Track1_FrameChanged; | |||
| if ( videoFile != null ) openVideoFile( videoFile ); | |||
| if ( scriptFile != null ) openFunScript( scriptFile ); | |||
| } | |||
| private void Track1_FrameChanged( long frame, Track.Action sender ) | |||
| @@ -89,34 +91,40 @@ namespace Funscripta | |||
| { | |||
| if ( ofdv.ShowDialog() == DialogResult.OK ) | |||
| { | |||
| try | |||
| openVideoFile( ofdv.FileName ); | |||
| } | |||
| } | |||
| private void openVideoFile( string videoFile ) | |||
| { | |||
| try | |||
| { | |||
| var fi = new FileInfo( videoFile ); | |||
| VFR.Open( videoFile ); | |||
| lastFrame = -1; | |||
| Frame = 0; | |||
| LoadFrame(); | |||
| frames.Text = $"Frames: { VFR.FrameCount }"; | |||
| framesPerSecond.Text = $"FPS: { VFR.FrameRate.Value }"; | |||
| track1.MaxFrames = VFR.FrameCount; | |||
| track1.FrameRate = ( long ) VFR.FrameRate.Value; | |||
| timer1.Start(); | |||
| var fname = fi.FullName.Substring( 0, fi.FullName.Length - fi.Extension.Length ); | |||
| if ( File.Exists( FileName = $"{ fname }.csv" ) || File.Exists( FileName = $"{ fname }.funscript" ) ) | |||
| { | |||
| var fi = new FileInfo( ofdv.FileName ); | |||
| VFR.Open( ofdv.FileName ); | |||
| lastFrame = -1; | |||
| Frame = 0; | |||
| LoadFrame(); | |||
| frames.Text = $"Frames: { VFR.FrameCount }"; | |||
| framesPerSecond.Text = $"FPS: { VFR.FrameRate.Value }"; | |||
| track1.MaxFrames = VFR.FrameCount; | |||
| track1.FrameRate = ( long ) VFR.FrameRate.Value; | |||
| timer1.Start(); | |||
| var fname = fi.FullName.Substring( 0, fi.FullName.Length - fi.Extension.Length ); | |||
| if ( File.Exists( FileName = $"{ fname }.csv" ) || File.Exists( FileName = $"{ fname }.funscript" ) ) | |||
| { | |||
| openFunScript( FileName ); | |||
| } | |||
| RawName = $"{ fname }.raw"; | |||
| if ( Zip != null ) | |||
| { | |||
| Zip.Dispose(); | |||
| Zip = null; | |||
| } | |||
| if ( File.Exists( $"{ fname }.rawc" ) ) Zip = new ZipFile( $"{ fname }.rawc" ); | |||
| } catch ( Exception ex ) | |||
| openFunScript( FileName ); | |||
| } | |||
| RawName = $"{ fname }.raw"; | |||
| if ( Zip != null ) | |||
| { | |||
| MessageBox.Show( ex.Message ); | |||
| Zip.Dispose(); | |||
| Zip = null; | |||
| } | |||
| if ( File.Exists( $"{ fname }.rawc" ) ) Zip = new ZipFile( $"{ fname }.rawc" ); | |||
| } | |||
| catch ( Exception ex ) | |||
| { | |||
| MessageBox.Show( ex.Message ); | |||
| } | |||
| } | |||
| @@ -172,10 +172,16 @@ namespace Funscripta | |||
| var fs = new FunScript(); | |||
| foreach( var line in File.ReadAllLines( file ) ) { | |||
| if ( line.StartsWith( "#" ) ) continue; | |||
| var match = Regex.Match( line, @"([0-9\.]+),([0-9\.]+)(,.*)?", RegexOptions.Multiline ); | |||
| var match = Regex.Match( line, @"([0-9\.]+),([0-9\.]+)(?:,.*)?", RegexOptions.Multiline ); | |||
| if ( match.Success ) | |||
| { | |||
| fs.Actions.AddLast( new Action( long.Parse( match.Groups[ 0 ].Value ), int.Parse( match.Groups[ 1 ].Value ) ) ); | |||
| try | |||
| { | |||
| fs.Actions.AddLast( new Action( long.Parse( match.Groups[ 1 ].Value ), int.Parse( match.Groups[ 2 ].Value ) ) ); | |||
| } catch ( Exception ex ) | |||
| { | |||
| var i = 0; | |||
| } | |||
| } | |||
| } | |||
| return fs; | |||
| @@ -14,19 +14,17 @@ | |||
| <Deterministic>true</Deterministic> | |||
| <NuGetPackageImportStamp> | |||
| </NuGetPackageImportStamp> | |||
| <IsWebBootstrapper>true</IsWebBootstrapper> | |||
| <PublishUrl>ftp://dragonskills99.de/var/www/html/scripts.dragonskills99.de/projects/funscripta/</PublishUrl> | |||
| <IsWebBootstrapper>false</IsWebBootstrapper> | |||
| <PublishUrl>publish\</PublishUrl> | |||
| <Install>true</Install> | |||
| <InstallFrom>Web</InstallFrom> | |||
| <UpdateEnabled>true</UpdateEnabled> | |||
| <InstallFrom>Disk</InstallFrom> | |||
| <UpdateEnabled>false</UpdateEnabled> | |||
| <UpdateMode>Foreground</UpdateMode> | |||
| <UpdateInterval>7</UpdateInterval> | |||
| <UpdateIntervalUnits>Days</UpdateIntervalUnits> | |||
| <UpdatePeriodically>false</UpdatePeriodically> | |||
| <UpdateRequired>false</UpdateRequired> | |||
| <MapFileExtensions>true</MapFileExtensions> | |||
| <InstallUrl>http://scripts.dragonskills99.de/projects/funscripta/</InstallUrl> | |||
| <CreateWebPageOnPublish>true</CreateWebPageOnPublish> | |||
| <WebPage>publish.htm</WebPage> | |||
| <ApplicationRevision>1</ApplicationRevision> | |||
| <ApplicationVersion>1.0.0.%2a</ApplicationVersion> | |||
| @@ -7,17 +7,33 @@ using System.Windows.Forms; | |||
| namespace Funscripta | |||
| { | |||
| static class Program | |||
| public static class Program | |||
| { | |||
| /// <summary> | |||
| /// The main entry point for the application. | |||
| /// </summary> | |||
| [STAThread] | |||
| static void Main() | |||
| static void Main( string[] args ) | |||
| { | |||
| args = new string[] { @"F:\VR\Animes\Lewd FRAGGY\Kantai Collection - Shimakaze Live Fire Dildo - Oculus Rift, HTC VIVE -.mp4" }; | |||
| var _args = ParseArguments( args ); | |||
| var video = _args.Get( "v" ); | |||
| var script = _args.Get( "s" ); | |||
| Application.EnableVisualStyles(); | |||
| Application.SetCompatibleTextRenderingDefault( false ); | |||
| Application.Run( new Form1() ); | |||
| Application.Run( new Form1( video, script ) ); | |||
| } | |||
| private static UnsafeDictionary<string, string> ParseArguments( string[] args ) | |||
| { | |||
| var _args = new UnsafeDictionary<string, string>(); | |||
| for ( var i = 0; i < args.Length; i++ ) | |||
| { | |||
| var arg = args[ i ]; | |||
| if ( i == 0 ) _args[ arg.ToLower().EndsWith( ".csv" ) || arg.ToLower().EndsWith( ".funscript" ) ? "s" : "v" ] = arg; | |||
| if ( arg != null && arg.StartsWith( "-" ) && ( i + 1 ) < args.Length ) _args[ arg.Substring( 1 ).ToLower() ] = args[ i + 1 ]; | |||
| } | |||
| return _args; | |||
| } | |||
| public static void MayInvoke( this Control c, Action a ) | |||
| @@ -41,5 +57,20 @@ namespace Funscripta | |||
| var mod = Math.Pow( 10, decimals ); | |||
| return Math.Round( f * mod ) / mod; | |||
| } | |||
| public class UnsafeDictionary<T, U> : Dictionary<T, U> where U : class | |||
| { | |||
| public U Get( T key ) | |||
| { | |||
| if ( this.ContainsKey( key ) ) return this[ key ]; | |||
| else return null; | |||
| } | |||
| public U GetOrDefault( T key, U def ) | |||
| { | |||
| if ( this.ContainsKey( key ) ) return this[ key ]; | |||
| else return def; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -2,4 +2,19 @@ | |||
| A little Windows Application for creating funscript files and/or converting them to the corresponding csv format. | |||
| <div>Icons erstellt von <a href="https://www.flaticon.com/de/autoren/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/de/" title="Flaticon">www.flaticon.com</a></div> | |||
| You can now open a script or video-file directly via drag 'n drop, send the file as first parameter or send a video file prefixed with `-v` and/or a script file prefixed with `-s` in cmd as parameter. | |||
| Prefixed parameters will take priority over the first parameter. | |||
| e.g.: | |||
| `Funscripta.exe "C:\MyVideos\MyNiceVideo.mp4"` or | |||
| `Funscripta.exe -v "C:\MyVideos\MyNiceVideo.mp4"` or | |||
| `Funscripta.exe -s "C:\MyVideos\MyNiceVideo.csv"` or | |||
| `Funscripta.exe -v "C:\MyVideos\MyNiceVideo.mp4" -s "C:\MyScripts\MyNiceVideo.csv"` | |||
| <div>Icons erstellt von <a href="https://www.flaticon.com/de/autoren/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/de/" title="Flaticon">www.flaticon.com</a></div> | |||