Sub To Srt Converter. This is the source code of this program. It is made in C# with.net 2.0.

Similar documents
Blank Form. Industrial Programming. Discussion. First Form Code. Lecture 8: C# GUI Development

this.openfiledialog = new System.Windows.Forms.OpenFileDialog(); this.label4 = new System.Windows.Forms.Label(); this.

CIS 3260 Sample Final Exam Part II

LISTING PROGRAM. //Find the maximum and minimum values in the array int maxvalue = integers[0]; //start with first element int minvalue = integers[0];

Avoiding KeyStrokes in Windows Applications using C#

Visual Studio Windows Form Application #1 Basic Form Properties

SMITE API Developer Guide TABLE OF CONTENTS

User-Defined Controls

LISTING PROGRAM. // // TODO: Add constructor code after the InitializeComponent()

1. Windows Forms 2. Event-Handling Model 3. Basic Event Handling 4. Control Properties and Layout 5. Labels, TextBoxes and Buttons 6.

Classes in C# namespace classtest { public class myclass { public myclass() { } } }

ListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list

This is the start of the server code

C# and.net (1) cont d

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer

ABSTRACT. In Windows Operating system, Registry is core component and it contains

Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic

Nasosoft Barcode for.net

Tutorial 5 Completing the Inventory Application Introducing Programming

Lampiran B. Program pengendali

CALCULATOR APPLICATION

if (say==0) { k.commandtext = "Insert into kullanici(k_adi,sifre) values('" + textbox3.text + "','" + textbox4.text + "')"; k.

create database ABCD use ABCD create table bolumler ( bolumkodu int primary key, bolumadi varchar(20) )

CHAPTER 3. Writing Windows C# Programs. Objects in C#

Web Services in.net (2)

Inheriting Windows Forms with Visual C#.NET

Object oriented lab /second year / review/lecturer: yasmin maki

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer..

namespace Tst_Form { private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components;

Class Test 4. Question 1. Use notepad to create a console application that displays a stick figure. See figure 1. Question 2

Operatii pop si push-stiva

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

In order to create your proxy classes, we have provided a WSDL file. This can be located at the following URL:

Convertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un

UNIT-3. Prepared by R.VINODINI 1

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1

Representing Recursive Relationships Using REP++ TreeView

CSIS 1624 CLASS TEST 6

You can call the project anything you like I will be calling this one project slide show.

BackgroundWorker Component Overview 1 Multithreading with the BackgroundWorker Component 3 Walkthrough Running an Operation in the Background 10 How

Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects

Introduction to.net. Andrew Cumming, SoC. Introduction to.net. Bill Buchanan, SoC. W.Buchanan (1)

UNIT III APPLICATION DEVELOPMENT ON.NET

// Program 2 - Extra Credit // CIS // Spring // Due: 3/11/2015. // By: Andrew L. Wright. //Edited by : Ben Spalding

Now find the button component in the tool box. [if toolbox isn't present click VIEW on the top and click toolbox]

Introduction to.net. Andrew Cumming, SoC. Introduction to.net. Bill Buchanan, SoC. W.Buchanan (1)

IBSDK Quick Start Tutorial for C# 2010

Classes and Objects. Andrew Cumming, SoC. Introduction to.net. Bill Buchanan, SoC. W.Buchanan (1)

Writing Your First Autodesk Revit Model Review Plug-In

Classes and Objects. Andrew Cumming, SoC. Introduction to.net. Bill Buchanan, SoC. W.Buchanan (1)

First start a new Windows Form Application from C# and name it Interest Calculator. We need 3 text boxes. 4 labels. 1 button

Towards More Comprehensive Information Retrieval Systems: Entity Extraction Using XSLT

Visual Basic/C# Programming (330)

Experiment 5 : Creating a Windows application to interface with 7-Segment LED display

Lucrare pentru colocviu de practică

Create your own Meme Maker in C#

LAMPIRAN A : LISTING PROGRAM

Eyes of the Dragon - XNA Part 37 Map Editor Revisited

XNA 4.0 RPG Tutorials. Part 24. Level Editor Continued

Answer on Question# Programming, C#

C:\homeworks\PenAttention_v13_src\PenAttention_v13_src\PenAttention4\PenAttention\PenAttention.cs 1 using System; 2 using System.Diagnostics; 3 using

Using Template Bookmarks for Automating Microsoft Word Reports

// Precondition: None // Postcondition: The address' name has been set to the // specified value set;

Start Visual Studio and create a new windows form application under C# programming language. Call this project YouTube Alarm Clock.

Windows Forms in Action by Erik Brown Chapter 3. Copyright 2006 Manning Publications

Computer measurement and control

For this example, we will set up a small program to display a picture menu for a fast food take-away shop.

XNA 4.0 RPG Tutorials. Part 11b. Game Editors

PS2 Random Walk Simulator

Visual Basic/C# Programming (330)

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below.

Brian Kiser November Vigilant C# 2.5. Commonwealth of Kentucky Frankfort, Kentucky

Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK.

// Specify SEF file to load. oschema = (edischema) oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

pojedinačnom elementu niza se pristupa imeniza[indeks] indeks od 0 do n-1

Form Properties Window

Lecture 8 Building an MDI Application

private void Form1_Load(object sender, EventArgs e) {

Appendix A Programkod

string spath; string sedifile = "277_005010X228.X12"; string sseffile = "277_005010X228.SemRef.EVAL0.SEF";

Introduction to.net. Andrew Cumming, SoC. Introduction to.net. Bill Buchanan, SoC. W.Buchanan (1)

How to create a simple ASP.NET page to create/search data on baan using baan logic from the BOBS client sample.

Click on the empty form and apply the following options to the properties Windows.

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them.

We are going to use some graphics and found a nice little batman running GIF, off course you can use any image you want for the project.

.NET XML Web Services

#pragma comment(lib, "irrklang.lib") #include <windows.h> namespace SuperMetroidCraft {

Web Services in.net (6) cont d

LIGHT_P_TOGGLE, LIGHT_N_TOGGLE, BATTERY_TOGGLE, ALTERNATOR_TOGGLE, AVIONICS_TOGGLE, FLOAT_RETRACT, FLOAT_EXTEND }

namespace csharp_gen277x214 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

เว บแอพล เคช น. private void Back_Click(object sender, EventArgs e) { this.webbrowser2.goback(); }

Start Visual Studio, create a new project called Helicopter Game and press OK

C# winforms gridview

Conventions in this tutorial

// Specify SEF file to load. edischema oschema = oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

LISTING PROGRAM. // // TODO: Add constructor code after the InitializeComponent() call. //

} } public void getir() { DataTable dt = vt.dtgetir("select* from stok order by stokadi");

The contents of this document are directly taken from the EPiServer SDK. Please see the SDK for further technical information about EPiServer.

Step 1: Start a GUI Project. Start->New Project->Visual C# ->Windows Forms Application. Name: Wack-A-Gopher. Step 2: Add Content

APÉNDICE J. CÓDIGO DEL ARCHIVO FORM1.CS EN LENGUAJE C# Comprende:

Transcription:

Sub To Srt Converter This is the source code of this program. It is made in C# with.net 2.0. form1.css /* * Name: Sub to srt converter * Programmer: Paunoiu Alexandru Dumitru * Date: 5.11.2007 * Description: This program converts a.sub file (MicroDVD subtitle) in a.srt file (Subrip subtitle) * Version: 0.1 */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace subtosrt public partial class Form1 : Form public Form1() InitializeComponent(); private void btnconvert_click(object sender, EventArgs e) this.converts(); private void Converts() try label3.text = "Status: Working..."; StreamReader g = new StreamReader(textBox1.Text,Encoding.Default); string nfile=""; process filename and return the path to write string[] v = textbox1.text.split('.'); for (int i = 0; i < v.length - 1; i++) nfile += v[i] + "."; nfile += "srt"; end StreamWriter f = new StreamWriter(nfile,false,Encoding.Default);

string tmp; double x = Convert.ToDouble(textBox2.Text); int k=0; read and write while (!g.endofstream) tmp = g.readline(); v = tmp.split('', ''); k++; double i, j; i = Convert.ToDouble(v[1]); j = Convert.ToDouble(v[3]); tmp = tmp.substring(v[1].length + v[3].length + 4); tmp = tmp.replace(" ", "\r\n"); if (tmp[0] == '') tmp = tmp.replace("y:i", "<i>"); tmp = tmp + "</i>"; i = i / x; j = j / x; int h, m, s, mil; double part; part = Convert.ToDouble (i.tostring().split('.')[0]); if (i - part > 0) mil = Convert.ToInt32((Convert.ToString(i - part).split('.')[1] + "000").Substring(0, 3)); else mil = 0; s = (int)part % 60; m = (int)((part - s) % 3600)/60; h = (int)(part - s - m * 60) / 3600; f.writeline(k.tostring()); f.write( ((h.tostring().length < 2)? "0" + h.tostring() : h.tostring()) + ":" + ((m.tostring().length < 2)? "0" + m.tostring() : m.tostring()) + ":" + ((s.tostring().length < 2)? "0" + s.tostring() : s.tostring()) + "," + (mil.tostring() + "000").Substring(0,3) + " --> " ); part = Convert.ToDouble(j.ToString().Split('.')[0]); if (i - part > 0) mil = Convert.ToInt32((Convert.ToString(j - part).split('.')[1] + "000").Substring(0, 3)); else mil = 0; s = (int)part % 60; m = (int)((part - s) % 3600) / 60; h = (int)(part - s - m * 60) / 3600;

f.writeline( ((h.tostring().length < 2)? "0" + h.tostring() : h.tostring()) + ":" + ((m.tostring().length < 2)? "0" + m.tostring() : m.tostring()) + ":" + ((s.tostring().length < 2)? "0" + s.tostring() : s.tostring()) + "," + (mil.tostring() + "000").Substring(0, 3) ); f.writeline( tmp ); f.writeline(); f.close(); g.close(); label3.text = "Status: Done!"; catch (Exception ex) label3.text = "Status: Error!"; private void Exit_Click(object sender, EventArgs e) this.close(); e) private void btnopenfiledialog_click(object sender, EventArgs if (openfiledialog1.showdialog() == DialogResult.OK) textbox1.text = openfiledialog1.filename; form1.designer.cs namespace subtosrt partial class Form1 / <summary> / Required designer variable. / </summary> private System.ComponentModel.IContainer components = null; / <summary> / Clean up any resources being used.

/ </summary> / <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) if (disposing && (components!= null)) components.dispose(); base.dispose(disposing); #region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.btnconvert = new System.Windows.Forms.Button(); this.btnexit = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.textbox1 = new System.Windows.Forms.TextBox(); this.openfiledialog1 = new System.Windows.Forms.OpenFileDialog(); this.label3 = new System.Windows.Forms.Label(); this.btnopenfiledialog = new System.Windows.Forms.Button(); this.textbox2 = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.suspendlayout(); label1 this.label1.autosize = true; this.label1.forecolor = System.Drawing.Color.Red; this.label1.location = new System.Drawing.Point(9, 244); this.label1.name = "label1"; this.label1.size = new System.Drawing.Size(194, 13); this.label1.tabindex = 0; this.label1.text = "Copyright(c) Paunoiu Alexandru Dumitru"; btnconvert this.btnconvert.location = new System.Drawing.Point(12, 202); this.btnconvert.name = "btnconvert"; this.btnconvert.size = new System.Drawing.Size(75, 23); this.btnconvert.tabindex = 1; this.btnconvert.text = "Convert"; this.btnconvert.usevisualstylebackcolor = true; this.btnconvert.click += new System.EventHandler(this.btnConvert_Click); btnexit

this.btnexit.location = new System.Drawing.Point(93, 202); this.btnexit.name = "btnexit"; this.btnexit.size = new System.Drawing.Size(75, 23); this.btnexit.tabindex = 2; this.btnexit.text = "Exit"; this.btnexit.usevisualstylebackcolor = true; this.btnexit.click += new System.EventHandler(this.Exit_Click); label2 this.label2.autosize = true; this.label2.location = new System.Drawing.Point(9, 53); this.label2.name = "label2"; this.label2.size = new System.Drawing.Size(45, 13); this.label2.tabindex = 3; this.label2.text = "Sub file:"; textbox1 this.textbox1.location = new System.Drawing.Point(72, 50); this.textbox1.name = "textbox1"; this.textbox1.size = new System.Drawing.Size(172, 20); this.textbox1.tabindex = 4; openfiledialog1 this.openfiledialog1.filter = "Sub files(*.sub) *.sub"; this.openfiledialog1.title = "Open sub file"; label3 this.label3.autosize = true; this.label3.location = new System.Drawing.Point(69, 124); this.label3.name = "label3"; this.label3.size = new System.Drawing.Size(83, 13); this.label3.tabindex = 5; this.label3.text = "Status: Ready..."; btnopenfiledialog this.btnopenfiledialog.location = new System.Drawing.Point(249, 48); this.btnopenfiledialog.name = "btnopenfiledialog"; this.btnopenfiledialog.size = new System.Drawing.Size(37, 23); this.btnopenfiledialog.tabindex = 6; this.btnopenfiledialog.text = "..."; this.btnopenfiledialog.usevisualstylebackcolor = true; this.btnopenfiledialog.click += new System.EventHandler(this.btnOpenFileDialog_Click); textbox2 this.textbox2.location = new System.Drawing.Point(72, 87); this.textbox2.name = "textbox2";

this.textbox2.size = new System.Drawing.Size(48, 20); this.textbox2.tabindex = 7; this.textbox2.text = "25.000"; label4 this.label4.autosize = true; this.label4.location = new System.Drawing.Point(9, 90); this.label4.name = "label4"; this.label4.size = new System.Drawing.Size(57, 13); this.label4.tabindex = 8; this.label4.text = "Framerate:"; Form1 this.autoscaledimensions = new System.Drawing.SizeF(6F, 13F); this.autoscalemode = System.Windows.Forms.AutoScaleMode.Font; this.clientsize = new System.Drawing.Size(292, 266); this.controls.add(this.label4); this.controls.add(this.textbox2); this.controls.add(this.btnopenfiledialog); this.controls.add(this.label3); this.controls.add(this.textbox1); this.controls.add(this.label2); this.controls.add(this.btnexit); this.controls.add(this.btnconvert); this.controls.add(this.label1); this.formborderstyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.maximizebox = false; this.name = "Form1"; this.startposition = System.Windows.Forms.FormStartPosition.CenterScreen; this.text = "Sub to Srt Converter v 0.1"; this.resumelayout(false); this.performlayout(); #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btnconvert; private System.Windows.Forms.Button btnexit; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox textbox1; private System.Windows.Forms.OpenFileDialog openfiledialog1; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button btnopenfiledialog; private System.Windows.Forms.TextBox textbox2; private System.Windows.Forms.Label label4;