📄 trydecrypt006doc.cpp
字号:
// TryDecrypt006Doc.cpp : implementation of the CTryDecrypt006Doc class
//
#include "stdafx.h"
#include "TryDecrypt006.h"
#include "TryDecrypt006Doc.h"
#include "TryDecrypt006View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CEdit* PMyEdit;
extern CTry006View* PTry006View;
extern CTryDecrypt006Doc* PTryDecrypt006Doc;
/////////////////////////////////////////////////////////////////////////////
// CTryDecrypt006Doc
IMPLEMENT_DYNCREATE(CTryDecrypt006Doc, CDocument)
BEGIN_MESSAGE_MAP(CTryDecrypt006Doc, CDocument)
//{{AFX_MSG_MAP(CTryDecrypt006Doc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTryDecrypt006Doc construction/destruction
CTryDecrypt006Doc::CTryDecrypt006Doc()
{
// TODO: add one-time construction code here
PTryDecrypt006Doc=this;
}
CTryDecrypt006Doc::~CTryDecrypt006Doc()
{
}
BOOL CTryDecrypt006Doc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
//PMyEdit->SetWindowText("");
//extern PTry006View;
PTry006View->m_edit.SetWindowText("");
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CTryDecrypt006Doc serialization
void CTryDecrypt006Doc::Serialize(CArchive& ar)
{
// TODO: add loading code here
char* editStr;
if (ar.IsStoring())
{
// TODO: add storing code here
CString editCStr;
PMyEdit->GetWindowText(editCStr);
editStr=editCStr.GetBuffer(editCStr.GetLength());
CFile* ThisFile=ar.GetFile();
ThisFile->SetLength(0);
ThisFile->SeekToBegin();
ThisFile->Write(editStr,editCStr.GetLength());
editCStr.ReleaseBuffer();
}
else
{
CFileStatus rStatus;
CFile* ThisFile=ar.GetFile();
ThisFile->GetStatus(rStatus);
editStr=new char[rStatus.m_size+5];
//UINT editStrLen=::strlen(editStr)+50;
//if (editStrLen>31000)
// PMyEdit->SetLimitText(editStrLen);
//else
// PMyEdit->SetLimitText(31000);
ThisFile->SeekToBegin();
ThisFile->ReadHuge(editStr,rStatus.m_size);
*(editStr+rStatus.m_size)=0;
//从UNIX格式转换为Windows格式。
int i,i2,count0xa=0;
for(i=0;i<rStatus.m_size;i++)
{
if(*(editStr+i)==0x0A&&*(editStr+i+1)!=0x0D) count0xa++;
}
char* editStr2;
editStr2=new char[rStatus.m_size+count0xa+10];
for(i=0,i2=0;*(editStr+i)!=0;i++,i2++)
{
*(editStr2+i2)=*(editStr+i);
if(*(editStr+i)==0x0A&&*(editStr+i+1)!=0x0D)
{
*(editStr2+i2)=0x0D;
*(editStr2+(++i2))=0x0A;
}
}
*(editStr2+i2)=0;
PMyEdit->SetWindowText(editStr2);
delete editStr2;
delete editStr;
//editStr=CTry006View.m_edit.SetWindowText(editStr);
}
}
/////////////////////////////////////////////////////////////////////////////
// CTryDecrypt006Doc diagnostics
#ifdef _DEBUG
void CTryDecrypt006Doc::AssertValid() const
{
CDocument::AssertValid();
}
void CTryDecrypt006Doc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTryDecrypt006Doc commands
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -