Parcourir la source

fixed csv files not loading

implemention option to open files while starting the program
tags/Drag-Drop-Open
DragonSkills99 il y a 5 ans
Parent
révision
f50c312e6d
5 fichiers modifiés avec 96 ajouts et 38 suppressions
  1. 34
    26
      Funscripta/Form1.cs
  2. 8
    2
      Funscripta/FunScript.cs
  3. 4
    6
      Funscripta/Funscripta.csproj
  4. 34
    3
      Funscripta/Program.cs
  5. 16
    1
      README.md

+ 34
- 26
Funscripta/Form1.cs Voir le fichier

private long Frame { get; set; } = 0; private long Frame { get; set; } = 0;


private DirectoryInfo libDirectory = new DirectoryInfo( Path.Combine( ".", "libvlc", IntPtr.Size == 4 ? "x86" : "x64" ) ); 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(); if ( !libDirectory.Exists ) libDirectory.Create();
InitializeComponent(); InitializeComponent();
framesPerStep.Text = Properties.Settings.Default.FramesPerStep.ToString(); framesPerStep.Text = Properties.Settings.Default.FramesPerStep.ToString();
track1.FunScript = new FunScript(); track1.FunScript = new FunScript();
track1.FrameChanged += Track1_FrameChanged; track1.FrameChanged += Track1_FrameChanged;
if ( videoFile != null ) openVideoFile( videoFile );
if ( scriptFile != null ) openFunScript( scriptFile );
} }


private void Track1_FrameChanged( long frame, Track.Action sender ) private void Track1_FrameChanged( long frame, Track.Action sender )
{ {
if ( ofdv.ShowDialog() == DialogResult.OK ) 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 );
} }
} }



+ 8
- 2
Funscripta/FunScript.cs Voir le fichier

var fs = new FunScript(); var fs = new FunScript();
foreach( var line in File.ReadAllLines( file ) ) { foreach( var line in File.ReadAllLines( file ) ) {
if ( line.StartsWith( "#" ) ) continue; 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 ) 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; return fs;

+ 4
- 6
Funscripta/Funscripta.csproj Voir le fichier

<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</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> <Install>true</Install>
<InstallFrom>Web</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode> <UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval> <UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<InstallUrl>http://scripts.dragonskills99.de/projects/funscripta/</InstallUrl>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage> <WebPage>publish.htm</WebPage>
<ApplicationRevision>1</ApplicationRevision> <ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>

+ 34
- 3
Funscripta/Program.cs Voir le fichier



namespace Funscripta namespace Funscripta
{ {
static class Program
public static class Program
{ {
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [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.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false ); 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 ) public static void MayInvoke( this Control c, Action a )
var mod = Math.Pow( 10, decimals ); var mod = Math.Pow( 10, decimals );
return Math.Round( f * mod ) / mod; 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;
}
}
} }
} }

+ 16
- 1
README.md Voir le fichier



A little Windows Application for creating funscript files and/or converting them to the corresponding csv format. 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>


Chargement…
Annuler
Enregistrer