File: HowToUse_Dll.jsl

package info (click to toggle)
libmediainfo 25.10%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,472 kB
  • sloc: cpp: 272,822; ansic: 6,551; asm: 2,100; xml: 1,476; java: 1,245; sh: 1,203; cs: 1,189; python: 653; makefile: 444; pascal: 197; javascript: 169
file content (179 lines) | stat: -rw-r--r-- 6,293 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// MediaInfoDLL - All info about media files
// This software is provided 'as-is', without any express or implied
// warranty.  In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//    claim that you wrote the original software. If you use this software
//    in a product, an acknowledgment in the product documentation would be
//    appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//    misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Microsoft Visual J# example
//
// To make this example working, you must put MediaInfo.Dll and Example.ogg
// in the "./Bin/__ConfigurationName__" folder
// and add MediaInfoDll.jsl to your project
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

package Example;

import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;
import System.Text.*;

/**
 * Summary description for Form1.
 */
public class Form1 extends System.Windows.Forms.Form
{
    private System.Windows.Forms.RichTextBox richTextBox1;
    /**
     * Required designer variable.
     */
    private System.ComponentModel.Container components = null;

    public Form1()
    {
        //
        // Required for Windows Form Designer support
        //
        InitializeComponent();

        //
        // TODO: Add any constructor code after InitializeComponent call
        //
    }

    /**
     * Clean up any resources being used.
     */
    protected void Dispose(boolean disposing)
    {
        if (disposing)
        {
            if (components != null)
            {
                components.Dispose();
            }
        }
        super.Dispose(disposing);
    }

    #region Windows Form Designer generated code
    /**
     * Required method for Designer support - do not modify
     * the contents of this method with the code editor.
     */
    private void InitializeComponent()
    {
        this.richTextBox1 = new System.Windows.Forms.RichTextBox();
        this.SuspendLayout();
        //
        // richTextBox1
        //
        this.richTextBox1.set_Font(new System.Drawing.Font("Microsoft Sans Serif", 8.25F));
        this.richTextBox1.set_Location(new System.Drawing.Point(0, 0));
        this.richTextBox1.set_Name("richTextBox1");
        this.richTextBox1.set_Size(new System.Drawing.Size(768, 512));
        this.richTextBox1.set_TabIndex(0);
        this.richTextBox1.set_Text("");
        //
        // Form1
        //
        this.set_AutoScaleBaseSize(new System.Drawing.Size(5, 13));
        this.set_ClientSize(new System.Drawing.Size(774, 514));
        this.get_Controls().Add(this.richTextBox1);
        this.set_FormBorderStyle(System.Windows.Forms.FormBorderStyle.Fixed3D);
        this.set_Name("Form1");
        this.set_StartPosition(System.Windows.Forms.FormStartPosition.CenterScreen);
        this.set_Text("MediaInfo.Dll Example");
        this.add_Load( new System.EventHandler(this.Form1_Load) );
        this.ResumeLayout(false);

    }
    #endregion

    /**
     * The main entry point for the application.
     */

    public static void main(String[] args)
    {
        Application.Run(new Form1());
    }

    private void Form1_Load (Object sender, System.EventArgs e)
    {
        //Test if version of DLL is compatible : 3rd argument is "version of DLL tested;Your application name;Your application version"
        String ToDisplay;
        MediaInfo MI = new MediaInfo();

        ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_MSJS;0.7.0.0");
        if (ToDisplay.length() == 0)
        {
            richTextBox1.set_Text("MediaInfo.Dll: this version of the DLL is not compatible");
            return;
        }

        //Information about MediaInfo
        ToDisplay += "\r\n\r\nInfo_Parameters\r\n";
        ToDisplay += MI.Option("Info_Parameters");

        ToDisplay += "\r\n\r\nInfo_Capacities\r\n";
        ToDisplay += MI.Option("Info_Capacities");

        ToDisplay += "\r\n\r\nInfo_Codecs\r\n";
        ToDisplay += MI.Option("Info_Codecs");

        //An example of how to use the library
        ToDisplay += "\r\n\r\nOpen\r\n";
        MI.Open("Example.ogg");

        ToDisplay += "\r\n\r\nInform with Complete=false\r\n";
        MI.Option("Complete");
        ToDisplay += MI.Inform();

        ToDisplay += "\r\n\r\nInform with Complete=true\r\n";
        MI.Option("Complete", "1");
        ToDisplay += MI.Inform();

        ToDisplay += "\r\n\r\nCustom Inform\r\n";
        MI.Option("Inform", "General;Example : FileSize=%FileSize%");
        ToDisplay += MI.Inform();

        ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=//FileSize//\r\n";
        ToDisplay += MI.Get(StreamKind.General, 0, "FileSize");

        ToDisplay += "\r\n\r\nGetI with Stream=General and Parameter=46\r\n";
        ToDisplay += MI.Get(StreamKind.General, 0, 46);

        ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n";
        ToDisplay += MI.Count_Get(StreamKind.Audio);

        ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=//AudioCount//\r\n";
        ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount");

        ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter=//StreamCount//\r\n";
        ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount");

        ToDisplay += "\r\n\r\nClose\r\n";
        MI.Close();

        //Displaying the text
        richTextBox1.set_Text(ToDisplay);
    }
}