Ejemplo n.º 1
0
 public static java.io.InputStream getJavaInputStreamFromSystemStream(System.IO.Stream stream)
 {
     byte[] buffer = new byte[stream.Length];
     stream.Read(buffer, 0, buffer.Length);
     java.io.ByteArrayInputStream byteStreams = new java.io.ByteArrayInputStream(buffer);
     return(byteStreams);
 }
Ejemplo n.º 2
0
 public TCPImageFetcher(int teamNumber)
 {
   base.\u002Ector();
   TCPImageFetcher tcpImageFetcher = this;
   this.m_sock = (Socket) null;
   this.m_sockistream = (InputStream) null;
   this.m_imgBuffer = (byte[]) null;
   this.m_maxImgBufferSize = 0;
   this.m_baistream = (ByteArrayInputStream) null;
   this.m_daistream = (DataInputStream) null;
   this.m_initialized = false;
   this.m_address = (byte[]) null;
   int num1 = (int) (sbyte) (teamNumber / 100);
   int num2 = teamNumber;
   int num3 = 100;
   int num4 = -1;
   int num5 = num3 != num4 ? (int) (sbyte) (num2 % num3) : 0;
   byte[] numArray = new byte[4];
   int index1 = 0;
   int num6 = 10;
   numArray[index1] = (byte) num6;
   int index2 = 1;
   int num7 = num1;
   numArray[index2] = (byte) num7;
   int index3 = 2;
   int num8 = num5;
   numArray[index3] = (byte) num8;
   int index4 = 3;
   int num9 = 2;
   numArray[index4] = (byte) num9;
   this.m_address = numArray;
 }
Ejemplo n.º 3
0
 public static java.io.InputStream getJavaInputStreamFromSystemStream(System.IO.Stream stream)
 {
     byte[] buffer = new byte[stream.Length];
     stream.Read(buffer, 0, buffer.Length);
     java.io.ByteArrayInputStream byteStreams = new java.io.ByteArrayInputStream(buffer);
     return byteStreams;
 }
        public __X509Certificate2(byte[] rawData)
        {
            try
            {
                var certFactory = CertificateFactory.getInstance("X.509");

                InputStream ins = new ByteArrayInputStream((sbyte[])(object)rawData);

                this.InternalElement = (X509Certificate)certFactory.generateCertificate(ins);
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 5
0
 public void ExpiredSelfSignedCertificate()
 {
     CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
     InputStream inputStream = new ByteArrayInputStream(Encoding.ASCII.GetBytes(ExpiredSelfSigned));
     X509Certificate cert = (X509Certificate) certFactory.generateCertificate(inputStream);
     const string hostName = "foo.secure.example.com";
     try
     {
         //no exception registered yet
         KeychainFactory.get().isTrusted(hostName, new[] {cert});
         Assert.Fail();
     }
     catch (EntryPointNotFoundException exception)
     {
     }
     //register exception
     Preferences.instance()
                .setProperty(hostName + ".certificate.accept", Keychain.ConvertCertificate(cert).SubjectName.Name);
     Assert.IsTrue(KeychainFactory.get().isTrusted(hostName, new[] {cert}));
 }
		public void save(IFile file) {
			try {
				var document = XmlHelper.load(new StringReader(EMPTY_DOC));
				var libs = (Element)document.getElementsByTagName("libraries").item(0);
				foreach (var lib in this.Libraries) {
					var e = document.createElement("library");
					libs.appendChild(e);
					e.setAttribute("name", lib.Path);
					if (!lib.Enabled) {
						e.setAttribute("enabled", "false");
					}
				}
				if (this.PreprocessorSymbols.any()) {
					var sb = new StringBuilder();
					var first = true;
					foreach (String s in this.PreprocessorSymbols) {
						if (first) {
							first = false;
						} else {
							sb.append(';');
						}
						sb.append(s);
					}
					var e = document.createElement("preprocessorSymbols");
					document.getDocumentElement().appendChild(e);
					e.setTextContent(sb.toString());
				}
				var outputElt = document.createElement("outputPath");
				document.getDocumentElement().appendChild(outputElt);
				outputElt.setTextContent(this.OutputPath);
				
	            var writer = new StringWriter();
				XmlHelper.save(document, writer);
	            var bytes = writer.toString().getBytes("UTF-8");
	            var stream = new ByteArrayInputStream(bytes);
	            if (file.exists()) {
	            	file.setContents(stream, IResource.FORCE, null);
	            } else {
	            	file.create(stream, true, null);
	            }
			} catch (Exception e) {
				Environment.logException(e);
			}
		}
Ejemplo n.º 7
0
 private void resizeBuffer([In] int obj0)
 {
   if (obj0 <= this.m_maxImgBufferSize)
     return;
   if (obj0 > 500000)
     obj0 = 500000;
   this.m_maxImgBufferSize = obj0 + 100;
   this.m_imgBuffer = new byte[this.m_maxImgBufferSize];
   this.m_baistream = new ByteArrayInputStream(this.m_imgBuffer);
 }