convert scripts to c#