Пример #1
0
void CCopyThread::DoCopyFile(string source, string dest)
{
	source = str_replaceallA(source,"\\\\","\\");
	dest = str_replaceallA(dest,"\\\\","\\");


	File_Size.QuadPart = File_Prog.QuadPart = 0;
	SetCurFile(source);

	if (Action == CDA_SDMODE)
	{
		//DebugMsg("Move %s to %s",source.c_str(),dest.c_str());
		if (MoveFile(source.c_str(),dest.c_str()))
			Total_FilesCopied++;
	} else {
		//DebugMsg("Copy %s to %s",source.c_str(),dest.c_str());
		if (CopyFileEx(source.c_str(),dest.c_str(),CopyProgressRoutine,(void*)this,NULL,0))
			Total_FilesCopied++;
	}

	if (Action == CDA_MOVEFILES)
	{
		//DebugMsg("_unlink %s",source.c_str());
		_unlink(source.c_str());
	}

	// add file progress to total progress and reset file stuff
	Total_Prog.QuadPart += File_Prog.QuadPart;
	File_Prog.QuadPart = 0;
	File_Size.QuadPart = 0;
}
Пример #2
0
bool GDocApp<OptionsFmt>::SetDirty(bool Dirty)
{
	if (IsAttached() && (d->Dirty ^ Dirty))
	{
		// Changing...
		if (Dirty)
		{
			// Setting dirty
			d->Dirty = true;
			SetCurFile(d->CurFile);
		}
		else
		{
			// Clearing dirty
			int Result = LgiMsg(this,
								LgiLoadString(L_DOCAPP_SAVE_CHANGE, "Do you want to save your changes?"),
								d->AppName,
								MB_YESNOCANCEL);
			if (Result == IDYES)
			{
				if (!ValidStr(d->CurFile))
				{
					GMru::OnCommand(IDM_SAVEAS);
				}
				else
				{
					_SaveFile(d->CurFile);
				}
			}
			else if (Result == IDCANCEL)
			{
				return false;
			}

			d->Dirty = false;
			SetCurFile(d->CurFile);
		}

		OnDirty(d->Dirty);
	}

	return true;
}
Пример #3
0
bool GDocApp<OptionsFmt>::_OpenFile(char *File, bool ReadOnly)
{
	bool Status = false;
	if (SetDirty(false))
	{
		char RealPath[256];
		if (ResolveShortcut(File, RealPath, sizeof(RealPath)))
		{
			File = RealPath;
		}

		Status = GMru::_OpenFile(File, ReadOnly);
		if (Status)
		{
			d->Dirty = false;
			SetCurFile(File);
		}
	}

	return Status;
}
Пример #4
0
bool GDocApp<OptionsFmt>::_SaveFile(char *File)
{
	char RealPath[256];
	if (ResolveShortcut(File, RealPath, sizeof(RealPath)))
	{
		File = RealPath;
	}
	else
	{
		strcpy_s(RealPath, sizeof(RealPath), File);
	}

	bool Status = GMru::_SaveFile(RealPath);
	if (Status)
	{
		d->Dirty = false;
		SetCurFile(RealPath);
		OnDirty(d->Dirty);
	}

	return Status;
}
Пример #5
0
void GDocApp<OptionsFmt>::_Close()
{
	Empty();
	SetCurFile(0);
}