Ejemplo n.º 1
0
void WriteFileComment(const WString& name, bool doNotModify, StreamWriter& writer)
{
	writer.WriteLine(L"/***********************************************************************");
	writer.WriteLine(L"Vczh Library++ 3.0");
	writer.WriteLine(L"Developer: Zihan Chen(vczh)");
	writer.WriteLine(L"GacUI::" + name);
	writer.WriteLine(L"");
	writer.WriteLine(L"This file is generated by: Vczh GacUI Resource Code Generator");
	if (doNotModify)
	{
		writer.WriteLine(L"************************************************************************");
		writer.WriteLine(L"DO NOT MODIFY");
	}
	writer.WriteLine(L"***********************************************************************/");
	writer.WriteLine(L"");
}
Ejemplo n.º 2
0
void WriteFileComment(const WString& name, StreamWriter& writer)
{
	writer.WriteLine(L"/***********************************************************************");
	writer.WriteLine(L"Vczh Library++ 3.0");
	writer.WriteLine(L"Developer: Zihan Chen(vczh)");
	writer.WriteLine(L"Parser::"+name);
	writer.WriteLine(L"");
	writer.WriteLine(L"This file is generated by: Vczh Parser Generator");
	writer.WriteLine(L"***********************************************************************/");
	writer.WriteLine(L"");
}
Ejemplo n.º 3
0
	void Program::Run()
	{
		StreamWriter* sw = new StreamWriter(new String("test.txt"));
		sw->WriteLine(new String("Hi! I'm a stream writer"));
		sw->Flush();
		sw->Close();
		StreamReader* sr = new StreamReader(new String("test.txt"));
		String* text = sr->ReadToEnd();
		sr->Close();
		Console::WriteLine(text);
	}
Ejemplo n.º 4
0
WString WriteNamespace(List<WString>& currentNamespaces, List<WString>& namespaces, StreamWriter& writer)
{
	vint common = 0;
	for (vint i = 0; i < currentNamespaces.Count() && i < namespaces.Count(); i++)
	{
		if (currentNamespaces[i] == namespaces[i])
		{
			common++;
		}
		else
		{
			break;
		}
	}

	for (vint i = 0; i < currentNamespaces.Count() - common; i++)
	{
		WString prefix;
		for (vint j = 0; j < currentNamespaces.Count() - i - 1; j++)
		{
			prefix += L"\t";
		}
		writer.WriteLine(prefix + L"}");
	}

	WString prefix;
	FOREACH_INDEXER(WString, ns, i, namespaces)
	{
		if (i >= common)
		{
			writer.WriteLine(prefix + L"namespace " + ns);
			writer.WriteLine(prefix + L"{");
		}
		prefix += L"\t";
	}

	CopyFrom(currentNamespaces, namespaces);
	return prefix;
}
Ejemplo n.º 5
0
void
SessionImpl::WritePackageHistory ()
{
    if (packageHistoryFile.length() == 0)
    {
        return;
    }
    StreamWriter writer (File::Open(packageHistoryFile,
                                    FileMode::Append,
                                    FileAccess::Write));
    for (vector<FileInfoRecord>::const_iterator
            it = fileInfoRecords.begin();
            it != fileInfoRecords.end();
            ++ it)
    {
        if (it->packageName.length() > 0)
        {
            writer.WriteLine (it->packageName);
        }
    }
    writer.Close ();
}
Ejemplo n.º 6
0
///*************************************************************************
/// Method:		TestFault
/// Description: Tests the fault name specified
///
/// Parameters:
///	faultName - The name of the fault in faults.xml to be tested
///
/// Return Value: true if successful, false otherwise
///*************************************************************************
bool FaultsTest::TestFault(char *faultName){
	//OUTPUT PASSFAIL TO A FILE
	FileStream *FileStreamer;
	FileStreamer = new FileStream("FAULTSTEST.TXT", FileMode::Create  , FileAccess::Write);
	StreamWriter * pWriter = new StreamWriter(FileStreamer);

	Console::WriteLine("---------->TestFault Method Begins<----------\n");

	//Load the Faults xml file in memory using FaultsXMLFramework
	LoadFaultsXmlFile("faults.xml");
	//Load the Functions xml file in memory using FunctionsXMLFramework
	LoadFunctionsXmlFile("functions.xml");

	bool bSuccess=true;

	Hashtable *myHT = new Hashtable();
	myHT=dynamic_cast<Hashtable *>(faultNavigatorInstance->FaultTableByName->Clone());
	IDictionaryEnumerator *faultsEnum=myHT->GetEnumerator();
	Console::WriteLine("OUTPUT FILE:FAULTTEST.TXT\n");

	while (faultsEnum->MoveNext()){
		DWORD ReturnValue=0;
		DWORD ErrorCode=0;

		Fault *fault=dynamic_cast<Fault *>(faultsEnum->get_Value());
		ReturnValue=(Convert::ToInt32(fault->get_ReturnValue()));
		ErrorCode=(Convert::ToInt32(fault->get_ErrorCode()));

		if (System::String::Compare(fault->get_Name(),faultName)==0)
			{
			ArrayList *funcList=fault->Function;
			Console::WriteLine(S"{0} Fault has {1} functions",fault->Name,__box(funcList->Count));
			pWriter->WriteLine("\n-------->   {0} Fault has {1} functions    <-------\n", fault->Name,__box(funcList->Count));
			//cycle through all functions 
			for(int ifuncs=0;ifuncs<funcList->Count;ifuncs++)
				{
				FaultFunction *thisfunc=dynamic_cast<FaultFunction *>(funcList->get_Item(ifuncs));
					{
					//****Search for a specific function--->TEST
					//if (System::String::Compare(thisfunc->get_Name(),"WSARecv")==0)
					//	{
					if(thisfunc->get_OverrideErrorCode()!=NULL){
						ErrorCode=(Convert::ToInt32(thisfunc->get_OverrideErrorCode()));
						}
				if(thisfunc->get_OverrideReturnValue()!=NULL){
					ReturnValue=(Convert::ToInt32(thisfunc->get_OverrideReturnValue()));
					}

			ArrayList *matchArray=thisfunc->get_MatchParams();

			ArrayList *paramsToSendToCallFunction = FillParamArray(convertGCStringToNative(thisfunc->Name),matchArray);

			if (CallFunction(thisfunc->get_Name(),paramsToSendToCallFunction,ReturnValue,ErrorCode) == true)
				{
				//Console::WriteLine("The function {0} has Passed.",thisfunc->Name);
				pWriter->WriteLine("{0} has Passed!",thisfunc->Name);
				bSuccess=true;
				}
			else 
				{	
				//Console::WriteLine("The function {0} has Failed.",thisfunc->Name);
				pWriter->WriteLine("{0} has Failed!",thisfunc->Name);
				bSuccess=false;
				}

					}
				//}
			}
			}
		}

Console::WriteLine("\n---------->TestFault Method Ends<------------\n");
pWriter->Close();
return bSuccess;	
	}