Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > Delphi .NET
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 25.11.2009, 20:18
Аватар для BROOKS
BROOKS BROOKS вне форума
Прохожий
 
Регистрация: 25.11.2009
Сообщения: 15
Репутация: 4
По умолчанию Помогите немного исправить....

Всем добрый вечер!
Помогите пожалуйста, есть готовая база данных (шифратор), нужно в базе данных удалить не только с формы, но и в самом коде:
1. Вкладку Настройки - как в коде так и в форме.
2. Во вкладке Операции удалить "Разницу" - как в коде так и в форме.
3. В основной форме удалить "Разделить" - так же в коде и на форме.

Очень нужна помощь, спасибо за внимание...)

База данных....
http://upwap.ru/644857

Извините, не нашел как выложить сюда базу, пришлось ссылкой
Ответить с цитированием
  #2  
Старый 25.11.2009, 20:32
Аватар для NIch
NIch NIch вне форума
Продвинутый
 
Регистрация: 02.06.2008
Адрес: Бендеры ПМР
Сообщения: 754
Репутация: 2446
По умолчанию

Сделай знаешь как, удали с формы то что тебе не нужно...компилируй проект...и те места где компилятор будет ругаться просто удаляй...но внимательно "не вылей с грязной водой ребенка"...
__________________
В начале был Бит, потом Байт и только потом появилось Слово...
Ответить с цитированием
  #3  
Старый 25.11.2009, 21:08
Аватар для BROOKS
BROOKS BROOKS вне форума
Прохожий
 
Регистрация: 25.11.2009
Сообщения: 15
Репутация: 4
По умолчанию

Цитата:
Сообщение от NIch
Сделай знаешь как, удали с формы то что тебе не нужно...компилируй проект...и те места где компилятор будет ругаться просто удаляй...но внимательно "не вылей с грязной водой ребенка"...


Уже так пробовал, первая мысль такая же пришла, ну ничего не получилось толком, наверно удалил что-то лишние(
Ответить с цитированием
  #4  
Старый 25.11.2009, 22:32
Аватар для NIch
NIch NIch вне форума
Продвинутый
 
Регистрация: 02.06.2008
Адрес: Бендеры ПМР
Сообщения: 754
Репутация: 2446
По умолчанию

Повтори еще раз, но
Цитата:
внимательно "не вылей с грязной водой ребенка"...
Так бы любой сделал, другого пути нет...
Вот тебе компилирующийся код, но нет гарантии, что логика работает корректно...
Код:
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
implementation
 uses unit2,unit3;
{$R *.dfm}
 
procedure TForm1.FormActivate(Sender: TObject); {Запуск формы}
begin
 tabcontrol1.Visible:=false;
 cod:=2;
 t:=0;
end;
 
procedure TForm1.N4Click(Sender: TObject); {Выбор шифрования}
begin
 label1.Caption:='Файл для шифровки';
 label2.Caption:='Файл для выхода';
 tabcontrol1.Visible:=true;
 label1.Visible:=true;
 edit1.Visible:=true;
 edit1.Text:='';
 button1.Visible:=true;
 label2.Visible:=true;
 edit2.Visible:=true;
 edit2.Text:='';
 button2.Visible:=true;
 t:=1;
 combobox1.Visible:=false;
 button3.Caption:='Выполнить';
 button3.Visible:=true;
 button5.Visible:=false;
 combobox2.Visible:=false;
 combobox2.ItemIndex:=0;
 label3.Visible:=false;
 label3.Caption:='Размер файла';
end;
 
procedure TForm1.N5Click(Sender: TObject);{Выбор дешифрования}
begin
 label1.Caption:='Файл для дешифровки';
 label2.Caption:='Файл для выхода';
 tabcontrol1.Visible:=true;
 label1.Visible:=true;
 edit1.Visible:=true;
 edit1.Text:='';
 button1.Visible:=true;
 label2.Visible:=true;
 edit2.Visible:=true;
 edit2.Text:='';
 button2.Visible:=true;
 t:=2;
 combobox1.Visible:=false;
 button3.Caption:='Выполнить';
 button3.Visible:=true;
 button5.Visible:=false;
 combobox2.Visible:=false;
 label3.Visible:=false;
 //checkbox1.Visible:=false;
end;
 
procedure TForm1.N2Click(Sender: TObject); {Выбор настройки}
begin
 tabcontrol1.Visible:=true;
 label1.Visible:=true;
 label1.Caption:='Типа параметры';
 edit1.Visible:=false;
 edit1.Text:='';
 button1.Visible:=false;
 label2.Visible:=false;
 edit2.Visible:=false;
 edit2.Text:='';
 button2.Visible:=false;
 combobox1.Visible:=true;
 button3.Caption:='Сохранить';
 button3.Visible:=true;
 t:=0;
 button5.Visible:=false;
 combobox2.Visible:=false;
 label3.Visible:=false;
 //checkbox1.Visible:=false;
end;
 
procedure TForm1.N3Click(Sender: TObject);  {Закрытие программы}
begin
 close
end;
 
procedure TForm1.Button1Click(Sender: TObject); {Выбор файла 1}
var f1:file;u:char;
begin
 If OpenDialog1.Execute then
  begin
   if Length(Opendialog1.Files[0])<>0 then
    edit1.Text:=opendialog1.FileName;
   if t=2 then
    begin
     assignfile(f1,edit1.Text);
     reset(f1,1);
     blockread(f1,u,sizeof(u));
     blockread(f1,u,sizeof(u));
     label3.Caption:='Кол-во частей: '+u;
     label3.Visible:=true;
    end;
     
  end;
end;
 
procedure TForm1.Button2Click(Sender: TObject);{Выбор файла 2}
begin
 If OpenDialog2.Execute then
  begin
   if Length(Opendialog2.Files[0])<>0 then
    edit2.Text:=opendialog2.FileName;
  end;
end;
 
procedure TForm1.Button3Click(Sender: TObject); {работа с файлами}
 var k:string;f1,f2:file;c:array[1..1024] of char;u:char;
 i,j,b,r,NumWritten,NumRead: Integer;
label ex;
begin
if t<>0 then
 begin
   if ((length(edit1.Text)=0) and (t=1)) then {проверка Поля1 для шифрования}
    begin
     showmessage('Не выбран файл для шифрования!');
     exit;
    end;
   if ((length(edit1.Text)=0) and (t=2)) then    {проверка Поля1 для дешифрования}
    begin
     showmessage('Не выбран файл для дешифрования!');
     exit;
    end;
   if length(edit2.Text)=0 then            {проверка Поля2 для выхода}
    begin
     showmessage('Не выбран выходной файл!');
     exit;
    end;
   assignfile(f1,edit1.text);
   {$I-}
   reset(f1,1);
   {$I+}
   if ioresult<>0 then
    begin
     showmessage('Ошибка чтения файла!');
     exit;
    end;
   if t=2 then
    begin
     blockread(f1,u,sizeof(u));  {код шифрования}
     case strtoint(u) of
      1:cod:=2;
      2:cod:=4;
      3:cod:=8;
      4:cod:=16;
      5:cod:=32;
      6:cod:=64;
      7:cod:=128;
      8:cod:=246;
     end;
     blockread(f1,u,sizeof(u)); {кол-во кусков}
     closefile(f1);
    end
   else
    begin
     assignfile(f2,edit2.text);
     {$I-}
     rewrite(f2,1);
     {$I+}
     if ioresult<>0 then
      begin
       showmessage('Ошибка записи файла!');
       exit;
      end;
     case cod of
      2:u:='1';
      4:u:='2';
      8:u:='3';
      16:u:='4';
      32:u:='5';
      64:u:='6';
      128:u:='7';
      256:u:='8';
     end;
     BlockWrite(f2, u, sizeof(u));
     BlockWrite(f2, u, sizeof(u));
     closefile(f2);
    end;
  m:=1;
  b:=1;
  if t=1 then
   begin
    fis:=edit2.Text;
    repeat
     BlockRead(f1, c, SizeOf(c), NumRead);
     k:=hextostr(strtohex(c,t));
     r:=GetFileSize(fis);
     for j:=1 to length(k) do
      c[j]:=k[j];
     reset(f2,1);
     seek (f2, FileSize(f2));
     BlockWrite(f2, c,numread, numwritten);
     closefile(f2);
    until(numread=0)or (NumWritten <> NumRead);
    closefile(f1);
   end
  else
   begin
    fis:=edit1.Text;
    assignfile(f2,edit2.Text);
    {$I-}
    rewrite(f2,1);
    {$I+}
    if ioresult <> 0 then
     begin
      showmessage('');
      exit;
     end;
    for i:=1 to strtoint(u) do
     begin
      assignfile(f1,fis);
      {$I-}
      reset(f1,1);
      {$I+}
      if ioresult<>0 then
      begin
       form3.ShowModal;
       if e=1 then
        goto ex
       else
        begin
         assignfile(f1,fis);
         reset(f1,1);
        end;
      end;
      if i=1 then
        seek(f1,2);
      repeat
       BlockRead(f1, c, SizeOf(c), NumRead);
       k:=hextostr(strtohex(c,t));
       for j:=1 to length(k) do
        c[j]:=k[j];
       reset(f2,1);
       seek (f2, FileSize(f2));
       BlockWrite(f2, c,numread, numwritten);
       closefile(f2);
      until(numread=0)or (NumWritten <> NumRead);
      closefile(f1);
      fis:=ExtractFilePath(edit1.Text)+ExtractFileName(edit1.Text)+' '+inttostr(i);
     end;
   end;
  showmessage('Выполнено!!!');
  tabcontrol1.Visible:=false;
  end
else
  begin
ex:   tabcontrol1.Visible:=false;
   t:=0;
   cod:=strtoint(combobox1.Text);
  end;
end;
 
procedure TForm1.Button4Click(Sender: TObject); {Отмена операций}
begin
tabcontrol1.Visible:=false;
t:=0;
end;
 
function TForm1.StrToHex(source: string; t:integer): string;{функция преоброзования строки -> HEX }
 var e,o,s:string; c:Char;i:integer;
begin
s := '';
  for i:=1 to Length(source) do begin
 c:=source[i];
 e:=IntToHex(Integer(c), 2);
 if m mod cod =0 then
  begin
   o:=e;
   case e[1] of
    'F': e[1]:='0';
    'E': e[1]:='1';
    'D': e[1]:='2';
    'C': e[1]:='3';
    'B': e[1]:='4';
    'A': e[1]:='5';
    '9': e[1]:='6';
    '8': e[1]:='7';
    '7': e[1]:='8';
    '6': e[1]:='9';
    '5': e[1]:='A';
    '4': e[1]:='B';
    '3': e[1]:='C';
    '2': e[1]:='D';
    '1': e[1]:='E';
    '0': e[1]:='F';
   end;
   case e[2] of
    'F': e[2]:='0';
    'E': e[2]:='1';
    'D': e[2]:='2';
    'C': e[2]:='3';
    'B': e[2]:='4';
    'A': e[2]:='5';
    '9': e[2]:='6';
    '8': e[2]:='7';
    '7': e[2]:='8';
    '6': e[2]:='9';
    '5': e[2]:='A';
    '4': e[2]:='B';
    '3': e[2]:='C';
    '2': e[2]:='D';
    '1': e[2]:='E';
    '0': e[2]:='F';
   end;
 
  end;
  s:=s+e;   m:=m+1;
  end;
{ result:=e;}
result:=s;
 
end;
 
function TForm1.HexToStr(hex: string): string; {функция преоброзования HEX -> строка}
 var i:integer;
begin
 s:='';
 for i:= 1 to Length(hex) div 2 do
 begin
  s:=s + Char(StrToInt('$' + Copy(hex, (i-1) * 2 + 1, 2)));
  end;
 result:=s;
end;
 
procedure TForm1.Button5Click(Sender: TObject);
 var c,d,cd:string; f1,f2,f3:textfile;
begin
 if length(edit1.Text)=0 then
  begin
   showmessage('Выберите файл1!');
   exit;
  end;
 assignfile(f1,edit1.Text);
 {$I-}
 reset(f1);
 {$I+}
  if ioresult<>0 then
   begin
    showmessage('Ошибка чтения файла1!');
    exit;
   end;
 if length(edit2.Text)=0 then
  begin
   showmessage('Выберите файл2!');
   exit;
  end;
 assignfile(f2,edit2.Text);
  {$I-}
 reset(f2);
 {$I+}
 if ioresult<>0 then
  begin
   showmessage('Ошибка чтения файла2!');
   exit;
  end;
 assignfile(f3,'raznita.txt');
 {$I-}
 rewrite(f3);
 {$I+}
  if ioresult<>0 then
   begin
    showmessage('Ошибка записи результата!');
    exit;
   end;
 while not eof(f1) do
  begin
   readln(f1,c);
   readln(f2,d);
   if c<>d then
    writeln(f3,c+'  '+d);
  end;
  cd:=getcurrentdir();
 showmessage('Результат записан в '+cd+'\разница.txt');
 closefile(f1);
 closefile(f2);
 closefile(f3);
end;
 
procedure TForm1.N6Click(Sender: TObject);
begin
 label1.Caption:='Файл 1:';
 label2.Caption:='Файл 2:';
 tabcontrol1.Visible:=true;
 label1.Visible:=true;
 edit1.Visible:=true;
 edit1.Text:='';
 button1.Visible:=true;
 label2.Visible:=true;
 edit2.Visible:=true;
 edit2.Text:='';
 button2.Visible:=true;
 combobox1.Visible:=false;
 button3.Visible:=false;
 button5.Visible:=true;
 combobox2.Visible:=false;
 label3.Visible:=false;
 //checkbox1.Visible:=false;
end;
__________________
В начале был Бит, потом Байт и только потом появилось Слово...
Ответить с цитированием
Ответ


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 01:32.


 

Сайт

Форум

FAQ

Соглашения

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2025