private UploadResult Upload()
        {
            IBlobstoreClient client = blobstoreClientFactory.Create();
            string           compiledBlobstoreID = client.Create(CompiledPackage);
            var    fiCompiledPackage             = new FileInfo(CompiledPackage);
            string compiledSha1 = fiCompiledPackage.Hexdigest();
            string compileLogID = client.Create(logFilePath); // TODO

            log.Info(Resources.CompilePackage_Uploaded_Fmt, packageName, packageVersion, compiledSha1, compiledBlobstoreID);
            return(new UploadResult(compiledSha1, compiledBlobstoreID, compileLogID));
        }
Esempio n. 2
0
        private void Publish(string replyTo, RemoteException exception)
        {
            // TODO UGLY!
            string blobstoreID = null;

            if (null != exception.Blob)
            {
                string tmpFile = Path.GetTempFileName();
                try
                {
                    File.WriteAllText(tmpFile, exception.Blob);
                    IBlobstoreClient bsc = blobstoreClientFactory.Create();
                    blobstoreID = bsc.Create(tmpFile);
                }
                finally
                {
                    if (File.Exists(tmpFile))
                    {
                        File.Delete(tmpFile);
                    }
                }
            }
            var    pMessage     = new JProperty("message", exception.Message);
            var    pBacktrace   = new JProperty("backtrace", exception.Backtrace);
            var    pBlobstoreID = new JProperty("blobstore_id", blobstoreID);
            var    jobj         = new JObject(new JProperty("exception", new JObject(pMessage, pBacktrace, pBlobstoreID)));
            string json;

            using (var sw = new StringWriter())
            {
                using (var writer = new JsonTextWriter(sw))
                {
                    jobj.WriteTo(writer);
                }
                json = sw.ToString();
            }
            Publish(replyTo, json);
        }