File: OldFiles.cpp

package info (click to toggle)
libmediainfo 25.04%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,532 kB
  • sloc: cpp: 253,735; ansic: 6,551; asm: 2,100; xml: 1,476; cs: 1,189; sh: 1,169; java: 1,032; python: 653; makefile: 442; pascal: 197; javascript: 169
file content (141 lines) | stat: -rw-r--r-- 4,329 bytes parent folder | download | duplicates (6)
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
//---------------------------------------------------------------------------
//#include <wx/wxprec.h>
#ifdef __BORLANDC__
    #pragma hdrstop
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/*
#include <wx/filename.h>
#include <wx/datetime.h>
#include <wx/file.h>
*/
#include <ZenLib/Ztring.h>
#include "PreRelease/OldFiles.h"
using namespace ZenLib;
//---------------------------------------------------------------------------

Ztring Version; //X.X.X.X
Ztring Version_Short; //X.X
Ztring ToShow; //What to show to the user
char C[1000000];
/*
wxFile F;
wxFileName FN;
int I;
Ztring Z;
wxDateTime Access;
*/

int Test_Version(char* FileName_, char* Begin, char* End)
{
/*
    wxString FileName=Ztring().From_Local(FileName_).c_str();
    //Opening File
    F.Open(FileName);
    I=F.Read(C, 1000000);
    if (!I)
    {
        ToShow+=__T("Error opening ")+FileName;
        return -1;
    }

    //Getting information
    C[I]=0;
    Z.From_Local(C);
    Z=Z.SubString(Ztring().From_Local(Begin), Ztring().From_Local(End));

    //deleting extra bytes
    if (Z[Z.size()-1]=='\n')
        Z.resize(Z.size()-1);
    if (Z[Z.size()-1]=='\r')
        Z.resize(Z.size()-1);

    //Testing validity
    if (Z.size()!=3 && Z.size()!=7) //non long, no short
    {
        ToShow+=__T("Error reading ")+FileName;
        return -2;
    }

    //Reformtation information
    Z.FindAndReplace(__T(","), __T("."), 0, Ztring_Recursive);

    if (Z!=Version && Z!=Version_Short)
    {
        ToShow+=FileName;
        ToShow+=__T(" is not good : version is marked ");
        ToShow+=Z;
        ToShow+=__T("\r\n");
    }
*/
    return 0;
}
//---------------------------------------------------------------------------

/*
int Test_Date(wxString FileName)
{
    FN.Assign(FileName);
    if (!FN.FileExists())
    {
        ToShow+=FileName;
        ToShow+=__T(" does not exist");
        return -1;
    }
    if (!FN.GetTimes(&Access, NULL, NULL))
    {
        ToShow+=__T("Error getting date of ");
        ToShow+=FileName;
        return -1;
    }
    wxTimeSpan TS=wxDateTime::Now()-Access;
    if (TS.GetWeeks()>0 || TS.GetDays()>0 || TS.GetHours()>0 || TS.GetMinutes()>0)
    {
        ToShow+=FileName;
        ToShow+=__T(" is old : was compiled");
        ToShow+=TS.Format().c_str();
        ToShow+=__T(" ago\r\n");
    }
    return 0;
}
*/
//---------------------------------------------------------------------------

Ztring OldFiles_Test ()
{
/*
    //Checking version in Info_Version
    ToShow+=__T("Version checked : ");
    F.Open(__T("../Source/MediaInfo/MediaInfo_Config.cpp"));
    I=F.Read(C, 1000000);
    if (!I)
    {
        ToShow+=__T("Error opening ../Source/MediaInfo/MediaInfo_Config.cpp");
        return ToShow;
    }
    C[I]=0;
    Z.From_Local(C);
    Version=Z.SubString(__T("MediaInfoLib - v"), __T("\")"));
    if (Version.size()!=7)
    {
        ToShow+=__T("Error reading ../Source/MediaInfo/MediaInfo.cpp : \"MediaInfoLib - vX.X.X.X - \" not found");
        return ToShow;
    }
    Version_Short=Version; Version_Short.resize(3);
    ToShow+=Version+__T("\r\n");

    //Checking version in MediaInfo.h
    if (Test_Version("../Source/MediaInfo/MediaInfo.h", "@version ", "\n")) return ToShow;
    if (Test_Version("../Source/MediaInfo/MediaInfoList.h", "@version ", "\n")) return ToShow;
    if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " FILEVERSION ", "\n")) return ToShow;
    if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " PRODUCTVERSION ", "\n")) return ToShow;
    if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", "            VALUE \"FileVersion\", \"", "\"")) return ToShow;
    if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", "            VALUE \"ProductVersion\", \"", "\"")) return ToShow;
    if (Test_Version("../History.txt", "Version ", " ")) return ToShow;
    if (Test_Date(__T("MSVC/Library/MediaInfo.lib"))) return ToShow;
    if (Test_Date(__T("MSVC/Dll/MediaInfo.dll"))) return ToShow;
*/
    return ToShow;
}
//---------------------------------------------------------------------------