public void Invoke(HttpSessionState session, DataInputStream input) { HttpProcessor.GetClient <AskServiceSoapClient>(session).VoteForQuestion( input.ReadString(), input.ReadString(), input.ReadInt32(), input.ReadInt32()); }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient<CommentServiceSoapClient>(session).HasNewComments( input.ReadString(), input.ReadString(), input.ReadInt32(), input.ReadInt32(), input.ReadInt32()); }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient <AskServiceSoapClient>(session).SubmitQuestion( input.ReadString(), input.ReadString(), input.ReadString(), input.ReadInt32(), input.ReadInt32(), input.ReadStringArray(), input.ReadInt32(), input.ReadBoolean()); }
public void Invoke(HttpSessionState session, DataInputStream input) { HttpProcessor.GetClient <CommentServiceSoapClient>(session).RemoveComment( input.ReadString(), input.ReadString(), input.ReadInt32()); }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient <AskServiceSoapClient>(session).GetResponse( input.ReadString(), input.ReadString(), input.ReadInt32()); }
public void Invoke(HttpSessionState session, DataInputStream input) { _result = HttpProcessor.GetClient <PhotoServiceSoapClient>(session).GetPhotosForCollection( input.ReadString(), input.ReadString(), input.ReadInt32()); }
private static void ProcessPostRequest(HttpRequest request, HttpResponse response, HttpSessionState session) { response.ContentType = "application/octet-stream"; var memoryStream = new MemoryStream(); var output = new DataOutputStream(memoryStream); try { var input = new DataInputStream(request.InputStream); var version = request.Headers["version"]; if (version != null) { if (!HttpProcessor.PROTOCOL_VERSION.Equals(version, StringComparison.Ordinal)) { throw new IOException(String.Format( CultureInfo.CurrentCulture, Resources.IO_InvalidProtocolVersion, version, HttpProcessor.PROTOCOL_VERSION)); } } if (input.ReadInt16() == HttpProcessor.INVOCATION_CODE) { InvokeMethod(session, input.ReadInt32(), input, output); } input.Close(); } catch (Exception e) { if (output == null) { output = new DataOutputStream(response.OutputStream); } output.WriteInt16(HttpProcessor.RESULT_EXCEPTION); Debug.WriteLine(e.StackTrace); output.WriteString(e.ToString()); } response.SetContentLength(memoryStream.Length); try { var data = new Byte[memoryStream.Length]; memoryStream.Seek(0, SeekOrigin.Begin); memoryStream.Read(data, 0, data.Length); response.OutputStream.Write(data, 0, data.Length); } finally { if (output != null) { output.Close(); } response.OutputStream.Close(); } }
public static WebComment ReadWebComment(this DataInputStream input) { if (input == null) { throw new ArgumentNullException("input"); } return(new WebComment() { ID = input.ReadInt32(), ObjectID = input.ReadInt32(), Nickname = input.ReadString(), Text = input.ReadString(), DTCreated = input.ReadDateTime().Ticks.ToString(), InReplyToCommentID = input.ReadInt32(), ParentCommentID = input.ReadInt32(), CommentType = input.ReadInt32() }); }
public void Invoke(HttpSessionState session, DataInputStream input) { HttpProcessor.GetClient <AskServiceSoapClient>(session).AttachPhoto( input.ReadString(), input.ReadString(), input.ReadString(), input.ReadInt32(), Convert.ToBase64String(input.ReadByteArray())); }
public static String[] ReadStringArray(this DataInputStream input) { if (input == null) { throw new ArgumentNullException("input"); } var length = input.ReadInt32(); String[] result = new String[length]; for (var i = 0; i < length; i++) { result[i] = input.ReadString(); } return(result); }
public static Byte[] ReadByteArray(this DataInputStream input) { if (input == null) { throw new ArgumentNullException("input"); } var length = input.ReadInt32(); SByte[] result = new SByte[length]; for (var i = 0; i < length; i++) { result[i] = (SByte)input.ReadByte(); } _byte2SByteMap.SByteArray = result; return(_byte2SByteMap.ByteArray); }
public static void Main(String[] args) { int ident; int dirofs; int dirlen; int i; int numLumps; byte[] name = new byte[56]; string nameString; int filepos; int filelen; FileStream readLump; DataInputStream directory; string pakName; string pattern; if (args.length == 2) { if (!args[0].Equals("-list")) { Usage(); } pakName = args[1]; pattern = null; } else if (args.length == 3) { pakName = args[0]; pattern = args[1]; } else { pakName = null; pattern = null; Usage(); } try { directory = new DataInputStream(new FileInputStream(pakName)); readLump = new FileStream(pakName, "r"); ident = IntSwap(directory.ReadInt32()); dirofs = IntSwap(directory.ReadInt32()); dirlen = IntSwap(directory.ReadInt32()); if (ident != IDPAKHEADER) { System.Diagnostics.Debug.WriteLine(pakName + " is not a pakfile."); System.Exit(1); } directory.SkipBytes(dirofs - 12); numLumps = dirlen / 64; System.Diagnostics.Debug.WriteLine(numLumps + " lumps in " + pakName); for (i = 0; i < numLumps; i++) { directory.ReadFully(name); filepos = IntSwap(directory.ReadInt32()); filelen = IntSwap(directory.ReadInt32()); nameString = new string (name); nameString = nameString.Substring(0, nameString.IndexOf(0)); if (pattern == null) { System.Diagnostics.Debug.WriteLine(nameString + " : " + filelen + "bytes"); } else if (PatternMatch(pattern, nameString)) { File writeFile; DataOutputStream writeLump; byte[] buffer = new byte[filelen]; StringBuffer fixedString; string finalName; int index; System.Diagnostics.Debug.WriteLine("Unpaking " + nameString + " " + filelen + " bytes"); readLump.Seek(filepos); readLump.ReadFully(buffer); fixedString = new StringBuffer(args[2] + File.separator + nameString); for (index = 0; index < fixedString.Length; index++) { if (fixedString[index] == '/') { fixedString.Se[index, File.separatorChar]; } } finalName = fixedString.ToString(); index = finalName.LastIndexOf(File.separatorChar); if (index != -1) { string finalPath; File writePath; finalPath = finalName.Substring(0, index); writePath = new File(finalPath); writePath.Mkdirs(); } writeFile = new File(finalName); writeLump = new DataOutputStream(new FileOutputStream(writeFile)); writeLump.Write(buffer); writeLump.Close(); } } readLump.Close(); directory.Close(); } catch (IOException e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } }