Esempio n. 1
0
        private async Task PublishInformation(string title, string content)
        {
            string     strFileName = FileHelper.GenerateFileNameByUserName(userName);
            BlobHelper blob        = new BlobHelper();
            await blob.CreateContainer(encriptUserName);

            for (int i = 0; i < App.lstPicture.Count; ++i)
            {
                string fileUrl = strFileName + i;
                await blob.UploadFromStorageFile(App.lstPicture[i], encriptUserName, fileUrl);

                lstFileUrl.Add(FileHelper.GenerateFileUrl(fileUrl, encriptUserName));
            }
            InformationModel model = new InformationModel();

            model.title = title;
            if (txtWage.Text.Length <= 0)
            {
                model.wage = Constants.NegotiablePrice;
            }
            model.content       = FileHelper.GenerateXMLDocument(content, lstFileUrl);
            model.addTime       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            model.userName      = userName;
            model.viewCount     = "0";
            model.address       = address;
            model.isAcceptOrder = Constants.OrderStatus.NotAccept;
            string      jsonContent = JsonHelper.ObjectToJson(model);
            HttpService http        = new HttpService();
            await http.SendPostRequest(InterfaceUrl.CreateInformationUrl, jsonContent);
        }
Esempio n. 2
0
    public AudibleFileLoader(TableHelper tc,BlobHelper bh)
    {
        m_TableHelper = tc;
            m_LogBlob = bh;
            m_TableHelper.CreateTable("ISBN");

            m_LogBlob.CreateContainer("log");
            //m_LogBlob.SetContainerACL("log", "private");
            CloudBlobContainer container = m_LogBlob.BlobClient.GetContainerReference("log");
        /*
            CloudBlobContainer blobContainer = blobClient.GetContainerReference("azurecontainer");
            CloudBlob blob = Container.GetBlobReference(blobname + ".res");
            BlobStream bs = blob.OpenWrite();
            TextWriter tw = new StreamWriter(bs);
            string append = resultsLine + ", ";
            tw.WriteLine(append);
        */

            CloudBlob blob = container.GetBlobReference("AudibleLoader.Log");
            BlobStream bs = blob.OpenWrite();
            TextWriter tw = new StreamWriter(bs);
            tw.WriteLine("test");
            tw.Flush();
            //content = new UTF8Encoding().GetString(data);
            bs.Close();
            //BlobStream OpenWrite ()
    }
Esempio n. 3
0
    public GoogleLoader(TableHelper tc, BlobHelper bh)
    {
        m_TableHelper = tc;
        m_LogBlob = bh;
        m_TableHelper.CreateTable("ISBN");

        m_LogBlob.CreateContainer("log");
        CloudBlobContainer container = m_LogBlob.BlobClient.GetContainerReference("log");

        CloudBlob blob = container.GetBlobReference("AudibleLoader.Log");
        BlobStream bs = blob.OpenWrite();
        TextWriter tw = new StreamWriter(bs);
        tw.WriteLine("test");
        tw.Flush();
        //content = new UTF8Encoding().GetString(data);
        bs.Close();
        //BlobStream OpenWrite ()
    }
Esempio n. 4
0
        protected override void ProcessRecord()
        {
            StorageContext context       = Context;
            BlobHelper     storageHelper = new BlobHelper(context);

            CloudBlobContainer container;

            try
            {
                container = storageHelper.CreateContainer(Name).Result;
            }
            catch (System.AggregateException exception)
            {
                throw new System.AggregateException(exception.InnerException.GetBaseException().Message);
            }

            if (container == null)
            {
                throw new HaltCommandException("A container with that name already exists.");
            }

            WriteObject(container);
        }
 public virtual void BeforeBatch(string local, string remote)
 {
     BlobHelper.CreateContainer(remote);
     BlobHelper.CleanupContainer(remote);
 }
 public virtual void Before(string containerName, string fileName)
 {
     BlobHelper.CreateContainer(containerName);
     BlobHelper.DeleteBlob(containerName, fileName);
 }