コード例 #1
0
ファイル: MessagingService.cs プロジェクト: xafdelta/xafdelta
        /// <summary>
        /// Creates the output package.
        /// </summary>
        /// <param name="objectSpace">The object space.</param>
        /// <param name="recipient">The recipient.</param>
        /// <param name="packageType">Type of the package.</param>
        /// <returns>Output package</returns>
        public Package CreateOutputPackage(IObjectSpace objectSpace, ReplicationNode recipient, PackageType packageType)
        {
            var result = objectSpace.CreateObject<Package>();

            result.ApplicationName = XafDeltaModule.XafApp.ApplicationName;
            result.SenderNodeId = Owner.CurrentNodeId;
            result.RecipientNodeId = recipient.NodeId;
            result.PackageType = packageType;

            // for broadcast package recipient node Id is "AllNodes"
            if (result.SenderNodeId == result.RecipientNodeId)
                result.RecipientNodeId = ReplicationNode.AllNodes;

            // assign package id
            if (packageType == PackageType.Snapshot)
            {
                recipient.SnapshotDateTime = DateTime.UtcNow;
                recipient.LastSavedSnapshotNumber++;
                result.PackageId = recipient.LastSavedSnapshotNumber;
            }
            else
            {
                recipient.LastSavedPackageNumber++;
                result.PackageId = recipient.LastSavedPackageNumber;
            }

            return result;
        }
コード例 #2
0
ファイル: CarePackage.cs プロジェクト: twils1337/CSharp
 public static Rigidbody SpawnCarePackage(ref Rigidbody CarePkgPrefab, Transform transform, PackageType CPtype, bool fromManager)
 {
     Rigidbody newCarePkg = Instantiate(CarePkgPrefab, transform.position, transform.rotation) as Rigidbody;
     newCarePkg.GetComponent<CarePackage>().m_Type = CPtype;
     newCarePkg.GetComponent<CarePackage>().m_WasSpawned = fromManager;
     return newCarePkg;
 }
コード例 #3
0
ファイル: CsPack.cs プロジェクト: bielawb/azure-sdk-tools
        public static void CreatePackage(ServiceDefinition definition, string rootPath, PackageType type, out string standardOutput, out string standardError)
        {
            string arguments;

            arguments = ConstructArgs(definition, rootPath, type);
            Execute(arguments, out standardOutput, out standardError);
        }
コード例 #4
0
 public ShowCardsHorizontal(CardTypeProb cardTypeProb, PackageType type)
 {
     InitializeComponent();
     _localCardTypeProb = cardTypeProb;
     _localPackageType = type;
     Loaded += ShowCards_Horizontal_Loaded;
 }
コード例 #5
0
ファイル: CsPack.cs プロジェクト: bielawb/azure-sdk-tools
        private static string ConstructArgs(ServiceDefinition serviceDefinition, string rootPath, PackageType type)
        {
            string arguments;
            string rolesArg = "";
            string sitesArg = "";

            if (serviceDefinition == null) throw new ArgumentNullException("serviceDefinition", string.Format(Resources.InvalidOrEmptyArgumentMessage, "Service definition"));
            if (string.IsNullOrEmpty(rootPath) || System.IO.File.Exists(rootPath)) throw new ArgumentException(Resources.InvalidRootNameMessage, "rootPath");

            if (serviceDefinition.WebRole != null)
            {
                foreach (WebRole webRole in serviceDefinition.WebRole)
                {
                    rolesArg += string.Format(Resources.RoleArgTemplate, webRole.name, rootPath);

                    foreach (Site site in webRole.Sites.Site)
                    {
                        sitesArg += string.Format(Resources.SitesArgTemplate, webRole.name, site.name, rootPath);
                    }
                }
            }

            if (serviceDefinition.WorkerRole != null)
            {
                foreach (WorkerRole workerRole in serviceDefinition.WorkerRole)
                {
                    rolesArg += string.Format(Resources.RoleArgTemplate, workerRole.name, rootPath);
                }
            }

            arguments = string.Format((type == PackageType.Local) ? Resources.CsPackLocalArg : Resources.CsPackCloudArg, rootPath, rolesArg, sitesArg);
            return arguments;
        }
コード例 #6
0
ファイル: MruManager.cs プロジェクト: grendello/nuget
 public void NotifyFileAdded(IPackageMetadata package, string filepath, PackageType packageType)
 {
     var item = new MruItem {
         Path = filepath.ToLowerInvariant(),
         Id = package.Id,
         Version = package.Version,
         PackageType = packageType
     };
     AddFile(item);
 }
コード例 #7
0
 public IvyModule GetPackage(PackageType type)
 {
     foreach (IvyModule module in this.modules)
     {
         if (module.Info.Type == type)
         {
             return module;
         }
     }
     return null;
 }
コード例 #8
0
ファイル: Package.cs プロジェクト: WinHuStudio/demo4winform
        public ClientPackage(string ps, string pc, PackageType pt, PackageContentType pct, string pr, string pcn)
        {
            _ps = ps;
            _pc = pc;
            _pr = pr;
            _pct = pct;
            _pt = pt;
            _pcn = pcn;

            _byte_content = new List<byte>();
            _byte_header = new List<byte>();
        }
コード例 #9
0
 public PackageVersionHistoryForm(string filename, PackageType pactype, string solutionname, string locPackagePath)
 {
     InitializeComponent();
     FileName = filename;
     PackageType = pactype;
     SolutionName = solutionname;
     LocalPackagePath = locPackagePath;
     switch (pactype)
     {
         case PackageType.Client: packagetype = "C"; break;
         case PackageType.Server: packagetype = "S"; break;
         case PackageType.WebClient: packagetype = "W"; break;
     }
 }
コード例 #10
0
ファイル: Package.cs プロジェクト: Gachl/RustRcon
        // Request
        /// <summary>
        /// Create a new request to send to the server. The content will be sent to the server.
        /// </summary>
        /// <param name="content">Message to send to the server</param>
        /// <param name="type">Message type, Normal, Auth or Validation</param>
        public Package(string content, PackageType type = PackageType.Normal)
        {
            this.id = Package.id_counter++;
            this.content = content;

            this.type = 2;
            if (type == PackageType.Auth)
                this.type = 3;

            if (type != PackageType.Validation)
                this.validationPackage = new Package("", PackageType.Validation);

            this.callbacks = new List<Action<Package>>();
        }
コード例 #11
0
ファイル: CarePackage.cs プロジェクト: twils1337/CSharp
 private void ProcessBuffPackage(ContactPoint contact, PackageType buffType)
 {
     TankHealth healthComponent = contact.otherCollider.GetComponent<TankHealth>();
     TankMovement movementComponent = contact.otherCollider.GetComponent<TankMovement>();
     switch (buffType)
     {
         case PackageType.Health:
             healthComponent.Heal(m_HealthBenefit);
             break;
         case PackageType.Speed:
             movementComponent.m_HasSpeedBuff = true;
             break;
         default:
             break;
     }
 }
コード例 #12
0
        public static byte[] encode(PackageType type, byte[] body)
        {
            int length = HEADER_LENGTH;

            if(body != null) length += body.Length;

            byte[] buf = new byte[length];

            int index = 0;

            buf[index++] = Convert.ToByte(type);
            buf[index++] = Convert.ToByte(body.Length>>16 & 0xFF);
            buf[index++] = Convert.ToByte(body.Length>>8 & 0xFF);
            buf[index++] = Convert.ToByte(body.Length & 0xFF);

            while(index < length) {
                buf[index] = body[index - HEADER_LENGTH];
                index++;
            }

            return buf;
        }
コード例 #13
0
ファイル: PackageManagerForm.cs プロジェクト: san90279/UK_OAS
 private void cbxPackageType_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.trvSolution.Nodes.Clear();
     if (cbxPackageType.SelectedIndex != 2)
     {
         this.trvSolution.Nodes.Add("Solution");
         foreach (DataRow row in this.solution.RealDataSet.Tables[0].Rows)
         {
             this.trvSolution.Nodes[0].Nodes.Add(row["ITEMTYPE"].ToString());
         }
         this.trvSolution.ExpandAll();
         if (cbxPackageType.SelectedIndex == 0)
         {
             PackageType = PackageType.Server;
             this.trvSolution.Nodes.Add("WorkFlow\\FL");//加上workflow文件夹
         }
         else if (cbxPackageType.SelectedIndex == 1)
         {
             PackageType = PackageType.Client;
         }
     }
     else if (cbxPackageType.SelectedIndex == 2)
     {
         PackageType = PackageType.WebClient;
         this.trvSolution.Nodes.Add("Folder");
         string path = EEPRegistry.WebClient;
         if (Directory.Exists(path))
         {
             string[] directories = Directory.GetDirectories(path, "*", SearchOption.TopDirectoryOnly);
             foreach (string str in directories)
             {
                  this.trvSolution.Nodes[0].Nodes.Add(Path.GetFileName(str));
             }
         }
     }
     this.trvSolution.ExpandAll();
     RefreshPackageDisplay(true, true);
 }
コード例 #14
0
ファイル: RateService.cs プロジェクト: appliedi/MerchantTribe
        private static MerchantTribe.Shipping.FedEx.FedExRateServices.PackagingType GetPackageType(PackageType packageType)
        {
            PackagingType result = PackagingType.YOUR_PACKAGING;

            switch (packageType)
            {
                case PackageType.FEDEX10KGBOX:
                    return PackagingType.FEDEX_10KG_BOX;
                case PackageType.FEDEX25KGBOX:
                    return PackagingType.FEDEX_25KG_BOX;
                case PackageType.FEDEXBOX:
                    return PackagingType.FEDEX_BOX;
                case PackageType.FEDEXENVELOPE:
                    return PackagingType.FEDEX_ENVELOPE;
                case PackageType.FEDEXPAK:
                    return PackagingType.FEDEX_PAK;
                case PackageType.FEDEXTUBE:
                    return PackagingType.FEDEX_TUBE;
                case PackageType.YOURPACKAGING:
                    return PackagingType.YOUR_PACKAGING;
            }

            return result;
        }
コード例 #15
0
 public Package(String filePath, String version, String publisher, String name, PackageType packageType, ProcessorArchitecture processorArchitecture)
 {
     _filePath              = filePath;
     _version               = version;
     _publisher             = publisher;
     _packageType           = packageType;
     _name                  = name;
     _processorArchitecture = processorArchitecture;
 }
コード例 #16
0
        private string XmlCreate()
        {
            InvoiceType res = new InvoiceType();

            res
            .With(io =>
            {
                #region Invoice
                io.UBLVersionID.Value    = "2.1";
                io.CustomizationID.Value = "TR1.2";
                io.ProfileID.Value       = "TEMELFATURA";
                io.InvoiceTypeCode.Value = "SATIS";
                io.ID.Value                   = "HKN0000000000001";
                io.UUID.Value                 = Guid.NewGuid().ToString();
                io.IssueDate.Value            = DateTime.Now;
                io.IssueTime.Value            = DateTime.Now;
                io.DocumentCurrencyCode.Value = "TRY";
                io.LineCountNumeric.Value     = 1;

                io.Note           = new List <NoteType>();
                NoteType oNewNote = new NoteType();
                oNewNote.Value    = "Test Dip Not";
                io.Note.Add(oNewNote);

                //xslt base64 formatında gömme
                io.AdditionalDocumentReference = new List <DocumentReferenceType>();

                DocumentReferenceType oNewAdd = new DocumentReferenceType();
                oNewAdd.ID.Value        = io.UUID.Value;
                oNewAdd.IssueDate.Value = DateTime.Now;
                oNewAdd.Attachment      = new AttachmentType();
                oNewAdd.Attachment
                .With(att =>
                {
                    att.EmbeddedDocumentBinaryObject                  = new EmbeddedDocumentBinaryObjectType();
                    att.EmbeddedDocumentBinaryObject.filename         = io.UUID.Value + ".xslt";
                    att.EmbeddedDocumentBinaryObject.characterSetCode = "UTF-8";
                    att.EmbeddedDocumentBinaryObject.encodingCode     = "Base64";
                    att.EmbeddedDocumentBinaryObject.mimeCode         = "application/xml";
                    att.EmbeddedDocumentBinaryObject.Value            = System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(System.Windows.Forms.Application.StartupPath + "/general.xslt"));
                });
                io.AdditionalDocumentReference.Add(oNewAdd);

                //irsaliye bilgilerini ekleme
                io.DespatchDocumentReference  = new List <DocumentReferenceType>();
                DocumentReferenceType onewSip = new DocumentReferenceType();
                onewSip.ID.Value        = "A859552";
                onewSip.IssueDate.Value = DateTime.Now;
                io.DespatchDocumentReference.Add(onewSip);

                //Sipariş bilgilerini ekleme
                io.OrderReference                 = new OrderReferenceType();
                io.OrderReference.ID.Value        = "32123";
                io.OrderReference.IssueDate.Value = DateTime.Now;
                #endregion

                #region Signature
                //io.Signature = new List<SignatureType>();
                //SignatureType oSig = new SignatureType();
                //oSig
                //    .With(sg =>
                //    {
                //        sg.ID = new IDType();
                //        sg.ID.schemeID = "VKN_TCKN";
                //        sg.ID.Value = "1288331521";

                //        sg.SignatoryParty = new PartyType();
                //        sg.SignatoryParty
                //            .With(sp =>
                //            {
                //                sp.PartyIdentification = new List<PartyIdentificationType>();

                //                PartyIdentificationType oPartyIdent = new PartyIdentificationType();
                //                oPartyIdent.ID = new IDType();
                //                oPartyIdent.ID.schemeID = "VKN";
                //                oPartyIdent.ID.Value = oSirket.RegisterNumber;
                //                sp.PartyIdentification.Add(oPartyIdent);

                //                sp.PostalAddress = new AddressType();
                //                sp.PostalAddress
                //                    .With(pa =>
                //                    {
                //                        pa.StreetName = new StreetNameType();
                //                        pa.StreetName.Value = oSirket.Address;

                //                        //pa.BuildingNumber = new BuildingNumberType();
                //                        //pa.BuildingNumber.Value = "21";

                //                        pa.CitySubdivisionName = new CitySubdivisionNameType();
                //                        pa.CitySubdivisionName.Value = oSirket.District;

                //                        pa.CityName = new CityNameType();
                //                        pa.CityName.Value = oSirket.City;

                //                        //pa.PostalZone = new PostalZoneType();
                //                        //pa.PostalZone.Value = "34100";

                //                        pa.Country = new CountryType();
                //                        pa.Country.Name.Value = oSirket.Country;
                //                    });
                //            });

                //        sg.DigitalSignatureAttachment = new AttachmentType();
                //        sg.DigitalSignatureAttachment.ExternalReference = new ExternalReferenceType();
                //        sg.DigitalSignatureAttachment.ExternalReference.URI.Value = "#Signature";
                //    });

                //io.Signature.Add(oSig);
                #endregion

                #region AccountingSupplierParty
                io.AccountingSupplierParty = new SupplierPartyType();
                io.AccountingSupplierParty
                .With(asp =>
                {
                    asp.Party = new PartyType();
                    asp.Party
                    .With(pp =>
                    {
                        pp.WebsiteURI          = new WebsiteURIType();
                        pp.WebsiteURI.Value    = "www.hakanuçar.com.tr";
                        pp.PartyIdentification = new List <PartyIdentificationType>();
                        pp.PartyIdentification.Add(
                            new PartyIdentificationType
                        {
                            ID = new IDType {
                                schemeID = "VKN", Value = "1234567801"
                            }
                        }
                            );
                        //Firma diğer bilgiler
                        pp.PartyIdentification.Add(
                            new PartyIdentificationType
                        {
                            ID = new IDType {
                                schemeID = "MERSISNO", Value = "4235234"
                            }
                        }
                            );

                        pp.PartyName            = new PartyNameType();
                        pp.PartyName.Name.Value = "Hakan UÇAR Bilgi İşlem";
                        pp.PostalAddress        = new AddressType();
                        pp.PostalAddress
                        .With(pa =>
                        {
                            pa.ID       = new IDType();
                            pa.ID.Value = "1234567801";

                            pa.StreetName       = new StreetNameType();
                            pa.StreetName.Value = "KOZYATAĞI";

                            //pa.BuildingNumber = new BuildingNumberType();
                            //pa.BuildingNumber.Value = "21";

                            pa.CitySubdivisionName       = new CitySubdivisionNameType();
                            pa.CitySubdivisionName.Value = "Beşiktaş";

                            pa.CityName       = new CityNameType();
                            pa.CityName.Value = "İstanbul";

                            //pa.PostalZone = new PostalZoneType();
                            //pa.PostalZone.Value = "341000";

                            pa.Country            = new CountryType();
                            pa.Country.Name.Value = "Türkiye";
                        });

                        pp.PartyTaxScheme                      = new PartyTaxSchemeType();
                        pp.PartyTaxScheme.TaxScheme            = new TaxSchemeType();
                        pp.PartyTaxScheme.TaxScheme.Name       = new NameType1();
                        pp.PartyTaxScheme.TaxScheme.Name.Value = "KOZYATAĞI";

                        pp.Contact = new ContactType();
                        pp.Contact
                        .With(co =>
                        {
                            co.Name       = new NameType1();
                            co.Name.Value = "Hakan UÇAR";

                            co.Telephone       = new TelephoneType();
                            co.Telephone.Value = "0592 558 5588";

                            co.Telefax       = new TelefaxType();
                            co.Telefax.Value = "0592 558 5588";

                            co.ElectronicMail       = new ElectronicMailType();
                            co.ElectronicMail.Value = "*****@*****.**";
                        });
                    });
                });
                #endregion

                #region AccountingCustomerParty
                io.AccountingCustomerParty = new CustomerPartyType();
                string Senaryo             = "0";
                switch (Senaryo)
                {
                //Temel Fatura
                case "0":
                    {
                        #region customerinf
                        io.AccountingCustomerParty
                        .With(cus =>
                        {
                            cus.Party = new PartyType();
                            cus.Party
                            .With(cusp =>
                            {
                                cusp.WebsiteURI       = new WebsiteURIType();
                                cusp.WebsiteURI.Value = "www.hakanuçar.com.tr";

                                cusp.PartyIdentification = new List <PartyIdentificationType>();

                                PartyIdentificationType pi = new PartyIdentificationType();
                                pi.ID          = new IDType();
                                pi.ID.schemeID = "VKN";
                                pi.ID.Value    = "1234567801";
                                cusp.PartyIdentification.Add(pi);

                                cusp.PartyName            = new PartyNameType();
                                cusp.PartyName.Name.Value = "Hakan UÇAR bilgi İşlem";

                                cusp.PostalAddress = new AddressType();
                                cusp.PostalAddress
                                .With(cupa =>
                                {
                                    cupa.ID       = new IDType();
                                    cupa.ID.Value = "1234567801";

                                    cupa.StreetName       = new StreetNameType();
                                    cupa.StreetName.Value = "Kadıköy";

                                    cupa.CityName       = new CityNameType();
                                    cupa.CityName.Value = "İstanbul";

                                    cupa.CitySubdivisionName       = new CitySubdivisionNameType();
                                    cupa.CitySubdivisionName.Value = "Kadıköy";

                                    cupa.Country            = new CountryType();
                                    cupa.Country.Name.Value = "Türkiye";

                                    cupa.PostalZone       = new PostalZoneType();
                                    cupa.PostalZone.Value = "34000";
                                });

                                cusp.Contact = new ContactType();
                                cusp.Contact
                                .With(cuc =>
                                {
                                    cuc.Name       = new NameType1();
                                    cuc.Name.Value = "Hakan UÇAR";

                                    cuc.Telephone       = new TelephoneType();
                                    cuc.Telephone.Value = "0555 55 55 55";

                                    cuc.Telefax       = new TelefaxType();
                                    cuc.Telefax.Value = "0555 55 55 55";

                                    cuc.ElectronicMail       = new ElectronicMailType();
                                    cuc.ElectronicMail.Value = "*****@*****.**";
                                });
                            });
                        });
                        #endregion
                    }
                    break;

                //Ticari Fatura
                case "1":
                    {
                        #region customerinf
                        io.AccountingCustomerParty
                        .With(cus =>
                        {
                            cus.Party = new PartyType();
                            cus.Party
                            .With(cusp =>
                            {
                                cusp.WebsiteURI       = new WebsiteURIType();
                                cusp.WebsiteURI.Value = "www.hakanuçar.com.tr";

                                cusp.PartyIdentification = new List <PartyIdentificationType>();

                                PartyIdentificationType pi = new PartyIdentificationType();
                                pi.ID          = new IDType();
                                pi.ID.schemeID = "VKN";
                                pi.ID.Value    = "1234567801";
                                cusp.PartyIdentification.Add(pi);

                                cusp.PartyName            = new PartyNameType();
                                cusp.PartyName.Name.Value = "Hakan UÇAR bilgi İşlem";

                                cusp.PostalAddress = new AddressType();
                                cusp.PostalAddress
                                .With(cupa =>
                                {
                                    cupa.ID       = new IDType();
                                    cupa.ID.Value = "1234567801";

                                    cupa.StreetName       = new StreetNameType();
                                    cupa.StreetName.Value = "Kadıköy";

                                    cupa.CityName       = new CityNameType();
                                    cupa.CityName.Value = "İstanbul";

                                    cupa.CitySubdivisionName       = new CitySubdivisionNameType();
                                    cupa.CitySubdivisionName.Value = "Kadıköy";

                                    cupa.Country            = new CountryType();
                                    cupa.Country.Name.Value = "Türkiye";

                                    cupa.PostalZone       = new PostalZoneType();
                                    cupa.PostalZone.Value = "34000";
                                });

                                cusp.Contact = new ContactType();
                                cusp.Contact
                                .With(cuc =>
                                {
                                    cuc.Name       = new NameType1();
                                    cuc.Name.Value = "Hakan UÇAR";

                                    cuc.Telephone       = new TelephoneType();
                                    cuc.Telephone.Value = "0555 55 55 55";

                                    cuc.Telefax       = new TelefaxType();
                                    cuc.Telefax.Value = "0555 55 55 55";

                                    cuc.ElectronicMail       = new ElectronicMailType();
                                    cuc.ElectronicMail.Value = "*****@*****.**";
                                });
                            });
                        });
                        #endregion
                    }
                    break;

                //İhracat
                case "2":
                    {
                        #region ExportCustomerInfo
                        io.AccountingCustomerParty
                        .With(cus =>
                        {
                            cus.Party = new PartyType();
                            cus.Party
                            .With(cusp =>
                            {
                                cusp.WebsiteURI       = new WebsiteURIType();
                                cusp.WebsiteURI.Value = "";

                                cusp.PartyIdentification = new List <PartyIdentificationType>();

                                PartyIdentificationType pi = new PartyIdentificationType();
                                pi.ID          = new IDType();
                                pi.ID.schemeID = "VKN";
                                pi.ID.Value    = "1460415308";
                                cusp.PartyIdentification.Add(pi);

                                cusp.PartyName            = new PartyNameType();
                                cusp.PartyName.Name.Value = "Gümrük ve Ticaret Bakanlığı Gümrükler Genel Müdürlüğü- Bilgi İşlem Dairesi Başkanlığı";

                                cusp.PostalAddress = new AddressType();
                                cusp.PostalAddress
                                .With(cupa =>
                                {
                                    //cupa.ID = new IDType();
                                    //cupa.ID.Value = grd.DataTable.GetValue("Vergi No", grdRowIndex).ToString();

                                    //cupa.StreetName = new StreetNameType();
                                    //cupa.StreetName.Value = grd.DataTable.GetValue("Adres", grdRowIndex).ToString();

                                    cupa.CityName       = new CityNameType();
                                    cupa.CityName.Value = "Ankara";

                                    //cupa.CitySubdivisionName = new CitySubdivisionNameType();
                                    //cupa.CitySubdivisionName.Value = grd.DataTable.GetValue("İlçe", grdRowIndex).ToString();

                                    cupa.Country            = new CountryType();
                                    cupa.Country.Name.Value = "Türkiye";
                                });


                                cusp.PartyTaxScheme                      = new PartyTaxSchemeType();
                                cusp.PartyTaxScheme.TaxScheme            = new TaxSchemeType();
                                cusp.PartyTaxScheme.TaxScheme.Name       = new NameType1();
                                cusp.PartyTaxScheme.TaxScheme.Name.Value = "Ulus";
                            });
                        });
                        #endregion
                    }
                    break;

                //Yolcu Beraber Fatura
                case "3":
                    {
                        #region TaxFreeInfo
                        //oInvoice.TaxFreeInfo = new TaxFreeInfo();
                        //oInvoice.TaxFreeInfo
                        //    .With(txfi =>
                        //    {
                        //        txfi.TouristInfo = new TouristInfo(); //Turistin bilgilerinin girileceği alandır.
                        //        txfi.TouristInfo
                        //            .With(ti =>
                        //            {
                        //                ti.Name = ""; //Bu alan turistin ad bilgisi girilir.
                        //                ti.SurName = ""; //Bu alan turistin soyad bilgisi girilir.
                        //                ti.PassportNo = ""; //Bu alan turistin pasaport numarası bilgisi girilir.
                        //                ti.PassportDate = DateTime.Now; //Bu alan turistin pasaport tarihi bilgisi girilir.
                        //                ti.CountryCode = ""; //Bu alan turistin ülke kodu bilgisi girilir.(örn:TR)
                        //                ti.FinancialAccountInfo = new FinancialAccountInfo(); //Bu alana turistin banka hesap bilgileri girilir.
                        //                ti.FinancialAccountInfo
                        //                    .With(fa =>
                        //                    {
                        //                        fa.BankName = ""; //Bu alan Banka Adı bilgisi girilir.
                        //                        fa.BranchName = ""; //Bu alan Banka Şube Adı bilgisi girilir.
                        //                        fa.CurrencyCode = ""; //Bu alan Para Birimi bilgisi girilir.
                        //                        fa.ID = ""; //Bu alan Banka Hesap Numarası bilgisi girilir.
                        //                        fa.PaymentNote = ""; //Bu alan Ödeme Notu bilgisi girilir.
                        //                    });
                        //                ti.AddressInfo = new AddressInfo(); //Bu alan turistin adres bilgileri girilir.
                        //                ti.AddressInfo
                        //                    .With(ai =>
                        //                    {
                        //                        ai.Address = "";
                        //                        ai.City = "";
                        //                        ai.Country = "";
                        //                        ai.District = "";
                        //                        ai.Fax = "";
                        //                        ai.Mail = "";
                        //                        ai.Phone = "";
                        //                        ai.PostalCode = "";
                        //                        ai.WebSite = "";
                        //                    });
                        //            });

                        //        txfi.TaxRepresentativeInfo = new TaxRepresentativeInfo(); //Aracı kurum bilgilerinin girileceği alandır.
                        //        txfi.TaxRepresentativeInfo
                        //            .With(tri =>
                        //            {
                        //                tri.RegisterNumber = ""; //Bu alana Aracı Kurumun Vergi Kimlik Numarası girilir.
                        //                tri.Alias = ""; //Bu alana Aracı Kurumun Etiket bilgisi girilir.
                        //                tri.Address = new AddressInfo();//Bu alan turistin adres bilgileri girilir
                        //                tri.Address
                        //                    .With(ai =>
                        //                    {
                        //                        ai.Address = "";
                        //                        ai.City = "";
                        //                        ai.Country = "";
                        //                        ai.District = "";
                        //                        ai.Fax = "";
                        //                        ai.Mail = "";
                        //                        ai.Phone = "";
                        //                        ai.PostalCode = "";
                        //                        ai.WebSite = "";
                        //                    });
                        //            });
                        //    });
                        #endregion
                    }
                    break;

                //EArşiv Fatura
                case "4":
                    {
                        #region customerinf
                        //oInvoice.CustomerInfo = new PartyInfo();
                        //oInvoice.CustomerInfo.Address = grd.DataTable.GetValue("Adres", grdRowIndex).ToString();
                        //oInvoice.CustomerInfo.City = grd.DataTable.GetValue("İl", grdRowIndex).ToString();//"İstanbul";
                        //oInvoice.CustomerInfo.Country = grd.DataTable.GetValue("Ülke", grdRowIndex).ToString();//"Türkiye";
                        //oInvoice.CustomerInfo.District = grd.DataTable.GetValue("İlçe", grdRowIndex).ToString();//"Ataşehir";
                        //oInvoice.CustomerInfo.Fax = grd.DataTable.GetValue("Fax", grdRowIndex).ToString();//"216 688 51 99";
                        //oInvoice.CustomerInfo.Mail = grd.DataTable.GetValue("Email", grdRowIndex).ToString();//"*****@*****.**";
                        //oInvoice.CustomerInfo.Name = grd.DataTable.GetValue("Muhatap Adı", grdRowIndex).ToString();//"NES Bilgi Teknolojileri";
                        //oInvoice.CustomerInfo.Phone = grd.DataTable.GetValue("Telefon", grdRowIndex).ToString();// "216 688 51 00";
                        //oInvoice.CustomerInfo.RegisterNumber = grd.DataTable.GetValue("Vergi No", grdRowIndex).ToString();// "1234567801";
                        //oInvoice.CustomerInfo.TaxOffice = grd.DataTable.GetValue("Vergi Dairesi", grdRowIndex).ToString();// "KOZYATAĞI";
                        //oInvoice.CustomerInfo.WebSite = grd.DataTable.GetValue("Web Sitesi", grdRowIndex).ToString();// "https://nesbilgi.com.tr/";
                        //oInvoice.CustomerInfo.ReceiverAlias = grd.DataTable.GetValue("Alıcı Posta Etiketi", grdRowIndex).ToString();// "urn:mail:[email protected]";/
                        #endregion
                    }
                    break;

                default:
                    break;
                }

                #endregion

                if (Senaryo == "2")
                {
                    #region BuyerCustomerParty
                    io.BuyerCustomerParty = new CustomerPartyType();
                    io.BuyerCustomerParty
                    .With(cus =>
                    {
                        cus.Party = new PartyType();
                        cus.Party
                        .With(cusp =>
                        {
                            cusp.WebsiteURI       = new WebsiteURIType();
                            cusp.WebsiteURI.Value = "www.hakanucar.com.tr";

                            cusp.PartyIdentification = new List <PartyIdentificationType>();

                            PartyIdentificationType pi = new PartyIdentificationType();
                            pi.ID          = new IDType();
                            pi.ID.schemeID = "VKN";
                            pi.ID.Value    = "1234567801";
                            cusp.PartyIdentification.Add(pi);

                            cusp.PartyName            = new PartyNameType();
                            cusp.PartyName.Name.Value = "Hakan UÇAR Bilişim";

                            cusp.PostalAddress = new AddressType();
                            cusp.PostalAddress
                            .With(cupa =>
                            {
                                cupa.ID       = new IDType();
                                cupa.ID.Value = "1234567801";

                                cupa.StreetName       = new StreetNameType();
                                cupa.StreetName.Value = "Meçhul bir yer";

                                cupa.CityName       = new CityNameType();
                                cupa.CityName.Value = "İstanbul";

                                cupa.CitySubdivisionName       = new CitySubdivisionNameType();
                                cupa.CitySubdivisionName.Value = "Beşiktaş";

                                cupa.Country            = new CountryType();
                                cupa.Country.Name.Value = "Türkiye";

                                cupa.PostalZone       = new PostalZoneType();
                                cupa.PostalZone.Value = "34000";
                            });

                            cusp.Contact = new ContactType();
                            cusp.Contact
                            .With(cuc =>
                            {
                                cuc.Name       = new NameType1();
                                cuc.Name.Value = "Hakan UÇAR";

                                cuc.Telephone       = new TelephoneType();
                                cuc.Telephone.Value = "555 55 55 55";

                                cuc.Telefax       = new TelefaxType();
                                cuc.Telefax.Value = "555 55 55 55";

                                cuc.ElectronicMail       = new ElectronicMailType();
                                cuc.ElectronicMail.Value = "*****@*****.**";
                            });
                        });
                    });
                    #endregion
                }

                #region PaymentTerms
                //Ödeme Koşulu

                io.PaymentTerms            = new PaymentTermsType();
                io.PaymentTerms.Note       = new NoteType();
                io.PaymentTerms.Note.Value = "60 gün vadeli";
                #endregion

                #region TaxTotal
                //Vergiler
                io.TaxTotal = new List <TaxTotalType>();
                io.TaxTotal
                .With(tt =>
                {
                    TaxTotalType ott         = new TaxTotalType();
                    ott.TaxAmount            = new TaxAmountType();
                    ott.TaxAmount.currencyID = "TRY";
                    ott.TaxAmount.Value      = 180;

                    ott.TaxSubtotal = new List <TaxSubtotalType>();

                    TaxSubtotalType oSubt          = new TaxSubtotalType();
                    oSubt.TaxableAmount            = new TaxableAmountType();
                    oSubt.TaxableAmount.currencyID = "TRY";
                    oSubt.TaxableAmount.Value      = 1000;

                    oSubt.TaxAmount            = new TaxAmountType();
                    oSubt.TaxAmount.currencyID = "TRY";
                    oSubt.TaxAmount.Value      = 180;

                    oSubt.TaxCategory                             = new TaxCategoryType();
                    oSubt.TaxCategory.TaxScheme                   = new TaxSchemeType();
                    oSubt.TaxCategory.TaxScheme.TaxTypeCode       = new TaxTypeCodeType();
                    oSubt.TaxCategory.TaxScheme.TaxTypeCode.Value = "0015";

                    ott.TaxSubtotal.Add(oSubt);

                    tt.Add(ott);
                });
                #endregion

                #region InvoiceLine
                io.InvoiceLine = new List <InvoiceLineType>();

                InvoiceLineType il = new InvoiceLineType();

                il
                .With(iol =>
                {
                    //Sıra No
                    iol.ID       = new IDType();
                    iol.ID.Value = "1";

                    //Kalem Tanımı
                    iol.Item            = new ItemType();
                    iol.Item.Name       = new NameType1();
                    iol.Item.Name.Value = "HP X534 Yazıcı";

                    iol.Item.SellersItemIdentification          = new ItemIdentificationType();
                    iol.Item.SellersItemIdentification.ID.Value = "KLM0012";

                    //Kalem Miktarı
                    iol.InvoicedQuantity          = new InvoicedQuantityType();
                    iol.InvoicedQuantity.unitCode = "C62";
                    iol.InvoicedQuantity.Value    = 1;

                    //Kalem Birim Fiyatı
                    iol.Price                        = new PriceType();
                    iol.Price.PriceAmount            = new PriceAmountType();
                    iol.Price.PriceAmount.currencyID = "TRY";
                    iol.Price.PriceAmount.Value      = 1000;

                    iol.Note          = new List <NoteType>();
                    NoteType oKlmNote = new NoteType();
                    oNewNote.Value    = "Test kalem notu";
                    iol.Note.Add(oKlmNote);

                    //iskonto
                    //iol.AllowanceCharge = new List<AllowanceChargeType>();
                    //iol.AllowanceCharge
                    //    .With(all =>
                    //    {
                    //        AllowanceChargeType allc = new AllowanceChargeType();
                    //        allc.ChargeIndicator = new ChargeIndicatorType();
                    //        allc.ChargeIndicator.Value = false;
                    //        allc.MultiplierFactorNumeric = new MultiplierFactorNumericType();
                    //        allc.MultiplierFactorNumeric.Value = 0.0M;
                    //        allc.Amount = new AmountType2();
                    //        allc.Amount.currencyID = "TRY";
                    //        allc.Amount.Value = 0M;
                    //        allc.BaseAmount = new BaseAmountType();
                    //        allc.BaseAmount.currencyID = "TRY";
                    //        allc.BaseAmount.Value = ((decimal)Services.ObjectToDouble(fech.Item("Quantity").Value)) *
                    //                                ((decimal)Services.ObjectToDouble(fech.Item("Price").Value));
                    //        all.Add(allc);
                    //    });

                    if (Senaryo == "2")
                    {
                        iol.Delivery           = new List <DeliveryType>();
                        DeliveryType oDelivery = new DeliveryType();

                        oDelivery
                        .With(d =>
                        {
                            DeliveryTermsType dtt = new DeliveryTermsType();
                            dtt.ID.schemeID       = "INCOTERMS";
                            dtt.ID.Value          = "Teslim şartı";
                            d.DeliveryTerms.Add(dtt);

                            d.DeliveryAddress
                            .With(ai =>
                            {
                                ai.StreetName       = new StreetNameType();
                                ai.StreetName.Value = "Meçhul bir adres";

                                ai.CitySubdivisionName       = new CitySubdivisionNameType();
                                ai.CitySubdivisionName.Value = "Beşiktaş";

                                ai.CityName       = new CityNameType();
                                ai.CityName.Value = "İstanbul";

                                ai.Country            = new CountryType();
                                ai.Country.Name.Value = "Türkiye";
                            });

                            d.Shipment
                            .With(shp =>
                            {
                                shp.ID.Value                   = "Gümrük tarkip numarası";
                                GoodsItemType oGItem           = new GoodsItemType();
                                oGItem.RequiredCustomsID.Value = "GTIP";
                                shp.GoodsItem.Add(oGItem);

                                ShipmentStageType oState       = new ShipmentStageType();
                                oState.TransportModeCode.Value = "Gönderim şekli";
                                shp.ShipmentStage.Add(oState);

                                TransportHandlingUnitType othlu = new TransportHandlingUnitType();
                                PackageType op             = new PackageType();
                                op.ID.Value                = "Kab numarası";
                                op.Quantity.Value          = 1;   //paket adedi
                                op.PackagingTypeCode.Value = "Kabın cinsi";
                                othlu.ActualPackage.Add(op);
                                shp.TransportHandlingUnit.Add(othlu);

                                //di.PackageBrandName = fech.Item("U_PackageBrandName").Value.ToString() == "" ? grd.DataTable.GetValue("Kabın Markası", grdRowIndex).ToString() : fech.Item("U_PackageBrandName").Value.ToString(); //Bu alana Mal/Hizmetin bulunduğu Kabın Marka isim bilgisi girilir.
                            });
                        });

                        iol.Delivery.Add(oDelivery);
                    }

                    //Vergi Toplam
                    iol.TaxTotal = new TaxTotalType();
                    iol.TaxTotal
                    .With(tx =>
                    {
                        tx.TaxAmount            = new TaxAmountType();
                        tx.TaxAmount.currencyID = "TRY";
                        tx.TaxAmount.Value      = 180;


                        //Vergiler
                        tx.TaxSubtotal = new List <TaxSubtotalType>();
                        tx.TaxSubtotal
                        .With(txs =>
                        {
                            TaxSubtotalType sbt          = new TaxSubtotalType();
                            sbt.TaxableAmount            = new TaxableAmountType();
                            sbt.TaxableAmount.currencyID = "TRY";
                            sbt.TaxableAmount.Value      = 1000;
                            sbt.TaxAmount            = new TaxAmountType();
                            sbt.TaxAmount.currencyID = "TRY";
                            sbt.TaxAmount.Value      = 180;
                            sbt.Percent       = new PercentType1();
                            sbt.Percent.Value = 18;

                            sbt.TaxCategory                             = new TaxCategoryType();
                            sbt.TaxCategory.TaxScheme                   = new TaxSchemeType();
                            sbt.TaxCategory.TaxScheme.Name              = new NameType1();
                            sbt.TaxCategory.TaxScheme.Name.Value        = "KDV";
                            sbt.TaxCategory.TaxScheme.TaxTypeCode       = new TaxTypeCodeType();
                            sbt.TaxCategory.TaxScheme.TaxTypeCode.Value = "0015";

                            txs.Add(sbt);
                        });
                    });

                    //Kalem Mal Hizmet Tutarı
                    iol.LineExtensionAmount            = new LineExtensionAmountType();
                    iol.LineExtensionAmount.currencyID = "TRY";
                    iol.LineExtensionAmount.Value      = 1000;
                });



                io.InvoiceLine.Add(il);

                #endregion

                #region LegalMonetaryTotal
                io.LegalMonetaryTotal = new MonetaryTotalType();

                //Mal Hizmet Toplam Tutar
                io.LegalMonetaryTotal.LineExtensionAmount            = new LineExtensionAmountType();
                io.LegalMonetaryTotal.LineExtensionAmount.currencyID = "TRY";
                io.LegalMonetaryTotal.LineExtensionAmount.Value      = 1000;

                //Vergiler Hariç Tutar
                io.LegalMonetaryTotal.TaxExclusiveAmount            = new TaxExclusiveAmountType();
                io.LegalMonetaryTotal.TaxExclusiveAmount.currencyID = "TRY";
                io.LegalMonetaryTotal.TaxExclusiveAmount.Value      = 1000;

                //Vergiler Dahil Tutar
                io.LegalMonetaryTotal.TaxInclusiveAmount            = new TaxInclusiveAmountType();
                io.LegalMonetaryTotal.TaxInclusiveAmount.currencyID = "TRY";
                io.LegalMonetaryTotal.TaxInclusiveAmount.Value      = 1180;


                //iskonto
                io.LegalMonetaryTotal.AllowanceTotalAmount            = new AllowanceTotalAmountType();
                io.LegalMonetaryTotal.AllowanceTotalAmount.currencyID = "TRY";
                io.LegalMonetaryTotal.AllowanceTotalAmount.Value      = 0M;

                //Ödenecek Tutar
                io.LegalMonetaryTotal.PayableAmount            = new PayableAmountType();
                io.LegalMonetaryTotal.PayableAmount.currencyID = "TRY";
                io.LegalMonetaryTotal.PayableAmount.Value      = 1180;

                #endregion
            });

            return(UblTrSerialize.UblSerialize(res));
        }
コード例 #17
0
 public abstract bool IsPackageExist(string componentId, PackageType packageType, Version version);
コード例 #18
0
ファイル: FE3.cs プロジェクト: cnbluefire/StoreLib
 public PackageInstance(string PackageMoniker, Uri PackageUri, PackageType packageType)
 {
     this.PackageMoniker = PackageMoniker;
     this.PackageUri     = PackageUri;
     this.PackageType    = packageType;
 }
コード例 #19
0
        public IReadOnlyCollection <IFile> Install(PackageReference package, PackageType type, DirectoryPath path)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            // Create the addin directory if it doesn't exist.
            path = GetPackagePath(path.MakeAbsolute(_environment), package);
            var root             = _fileSystem.GetDirectory(path);
            var createdDirectory = false;

            if (!root.Exists)
            {
                _log.Debug("Creating package directory {0}...", path);
                root.Create();
                createdDirectory = true;
            }

            // Package already exist?
            var packagePath = GetPackagePath(root, package.Package);

            if (packagePath != null)
            {
                // Fetch available content from disc.
                var content = _contentResolver.GetFiles(packagePath, package, type);
                if (content.Any())
                {
                    _log.Debug("Package {0} has already been installed.", package.Package);
                    return(content);
                }
            }

            // Install the package.
            if (!InstallPackage(package, path))
            {
                _log.Warning("An error occurred while installing package {0}.", package.Package);
                if (createdDirectory)
                {
                    _log.Debug("Deleting package directory {0}...", path);
                    root.Delete(true);
                    return(Array.Empty <IFile>());
                }
            }

            // Try locating the install folder again.
            packagePath = GetPackagePath(root, package.Package);

            // Get the files.
            var result = _contentResolver.GetFiles(packagePath, package, type);

            if (result.Count == 0)
            {
                if (type == PackageType.Addin)
                {
                    var framework = _environment.Runtime.BuiltFramework;
                    _log.Warning("Could not find any assemblies compatible with {0}.", framework.FullName);
                }
                else if (type == PackageType.Tool)
                {
                    const string format = "Could not find any relevant files for tool '{0}'. Perhaps you need an include parameter?";
                    _log.Warning(format, package.Package);
                }
            }

            return(result);
        }
コード例 #20
0
 public Task <bool> IsPackageExistAsync(string componentId, PackageType packageType, Version version, CancellationToken cancellationToken)
 {
     throw new NotImplementedException();
 }
コード例 #21
0
        public AppInstallerConfig Build(PackageType packageType = PackageType.Package)
        {
            var appIns = new AppInstallerConfig();

            appIns.UpdateSettings = new UpdateSettings();
            switch (this.CheckForUpdates)
            {
            case AppInstallerUpdateCheckingMethod.Never:
                appIns.UpdateSettings.OnLaunch = null;
                appIns.UpdateSettings.AutomaticBackgroundTask = null;
                break;

            case AppInstallerUpdateCheckingMethod.Launch:
                appIns.UpdateSettings.OnLaunch = new OnLaunchSettings();
                appIns.UpdateSettings.AutomaticBackgroundTask = null;
                break;

            case AppInstallerUpdateCheckingMethod.LaunchAndBackground:
                appIns.UpdateSettings.OnLaunch = new OnLaunchSettings();
                appIns.UpdateSettings.AutomaticBackgroundTask = new AutomaticBackgroundTaskSettings();
                break;

            case AppInstallerUpdateCheckingMethod.Background:
                appIns.UpdateSettings.OnLaunch = null;
                appIns.UpdateSettings.AutomaticBackgroundTask = new AutomaticBackgroundTaskSettings();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (this.AllowDowngrades)
            {
                appIns.UpdateSettings.ForceUpdateFromAnyVersion = true;
            }

            appIns.UpdateSettings.ForceUpdateFromAnyVersion = this.AllowDowngrades;

            if (appIns.UpdateSettings.OnLaunch != null)
            {
                appIns.UpdateSettings.OnLaunch.UpdateBlocksActivation = this.UpdateBlocksActivation;
                appIns.UpdateSettings.OnLaunch.ShowPrompt             = this.ShowPrompt;

                if (this.HoursBetweenUpdateChecks != 24)
                {
                    appIns.UpdateSettings.OnLaunch.HoursBetweenUpdateChecks = this.HoursBetweenUpdateChecks;
                }
            }

            if (this.MainPackageSource != null)
            {
                AppxIdentity identity;
                var          identityReader = new AppxIdentityReader();

                try
                {
                    identity = identityReader.GetIdentity(this.MainPackageSource.FullName).Result;
                }
                catch (AggregateException e)
                {
                    throw e.GetBaseException();
                }

                if (packageType == PackageType.Bundle)
                {
                    appIns.MainBundle = new AppInstallerBundleEntry
                    {
                        Name      = identity.Name,
                        Version   = identity.Version,
                        Publisher = identity.Publisher,
                        Uri       = this.MainPackageUri?.ToString()
                    };
                }
                else
                {
                    appIns.MainPackage = new AppInstallerPackageEntry
                    {
                        Name      = identity.Name,
                        Version   = identity.Version,
                        Publisher = identity.Publisher,
                        Uri       = this.MainPackageUri?.ToString()
                    };

                    if (identity.Architectures?.Any() != true)
                    {
                        appIns.MainPackage.Architecture = AppInstallerPackageArchitecture.neutral;
                    }
                    else
                    {
                        var arch = identity.Architectures.First().ToString("G");
                        if (Enum.TryParse(arch, true, out AppInstallerPackageArchitecture parsed))
                        {
                            appIns.MainPackage.Architecture = parsed;
                        }
                    }
                }
            }
            else
            {
                if (packageType == PackageType.Bundle)
                {
                    appIns.MainBundle = new AppInstallerBundleEntry
                    {
                        Name      = this.MainPackageName,
                        Version   = this.MainPackageVersion,
                        Publisher = MainPackagePublisher,
                        Uri       = this.MainPackageUri?.ToString()
                    };
                }
                else if (packageType == PackageType.Package)
                {
                    appIns.MainPackage = new AppInstallerPackageEntry
                    {
                        Name         = this.MainPackageName,
                        Version      = this.MainPackageVersion,
                        Publisher    = MainPackagePublisher,
                        Uri          = this.MainPackageUri?.ToString(),
                        Architecture = (AppInstallerPackageArchitecture)Enum.Parse(typeof(AppInstallerPackageArchitecture), this.MainPackageArchitecture.ToString("G"), true)
                    };
                }
            }

            if (!appIns.UpdateSettings.ForceUpdateFromAnyVersion && appIns.UpdateSettings.OnLaunch == null && appIns.UpdateSettings.AutomaticBackgroundTask == null)
            {
                appIns.UpdateSettings = null;
            }

            if (this.RedirectUri != null)
            {
                appIns.Uri = this.RedirectUri.ToString();
            }

            appIns.Version = this.Version ?? "1.0.0.0";

            return(appIns);
        }
コード例 #22
0
ファイル: ScriptBuilder.cs プロジェクト: Visualwit/KDZZ
        public static List <string> CreateUpdaterScript(PackageType packageType, string packageName, ModelBins modelBins)
        {
            Console.WriteLine("    - Building Updater-Script...");
            List <string> sb = new List <string>();

            try
            {
                sb.AddRange(titleLines("Flashing " + packageName + ".."));

                if (packageType == PackageType.Bootloader)
                {
                    // add sha1 checksum methods
                    sb.AddRange(extractBLtoTMP);
                    sb.Add(uiprint("Flashing Bootloader.."));
                    foreach (string s in modelBins.BL)
                    {
                        sb.AddRange(lineExtractFile(@"bootloader/" + s + ".img", modelBins.NOBAK.IndexOf(s) < 0 ? true : false));
                    }
                }
                else if (packageType == PackageType.Modem)
                {
                    sb.Add(uiprint("Flashing Modem.."));
                    foreach (string s in modelBins.MPR)
                    {
                        sb.AddRange(lineExtractFile(s + ".img", modelBins.NOBAK.IndexOf(s) < 0 ? true : false));
                    }
                }
                else if (packageType == PackageType.LAF)
                {
                    sb.Add(uiprint("Flashing LAF.."));
                    foreach (string s in modelBins.DLR)
                    {
                        if (s == "laf")
                        {
                            sb.AddRange(lineExtractFile(s + ".img", modelBins.NOBAK.IndexOf(s) < 0 ? true : false));
                        }
                    }
                }
                else if (packageType == PackageType.FullStock)
                {
                    sb.AddRange(extractBLtoTMP);
                    sb.Add(uiprint("Flashing Bootloader.."));
                    foreach (string s in modelBins.BL)
                    {
                        sb.AddRange(lineExtractFile(@"bootloader/" + s + ".img", modelBins.NOBAK.IndexOf(s) < 0 ? true : false));
                    }
                    sb.Add(uiprint("Flashing Modem.."));
                    foreach (string s in modelBins.MPR)
                    {
                        sb.AddRange(lineExtractFile(s + ".img", modelBins.NOBAK.IndexOf(s) < 0 ? true : false));
                    }
                    sb.Add(uiprint("Flasing Boot and System"));
                    sb.Add(uiprint("This may take a while..."));
                    foreach (string s in modelBins.PRI)
                    {
                        sb.AddRange(lineExtractFile(s + ".img", modelBins.NOBAK.IndexOf(s) < 0 ? true : false));
                    }
                }
                sb.AddRange(endLines(packageName));
                Console.WriteLine("    - Updater Script Created");
            }
            catch (Exception ex)
            {
                KDZZ.Program.ReturnError(ex.Message);
            }
            return(sb);
        }
コード例 #23
0
        /*================================================= tools */

        protected async Task SavePackage(string id, string version, string execTime, string releaseDate, PackageType packageType, ExecutionResult result)
        {
            var package = new Package
            {
                ComponentId      = id,
                ComponentVersion = Version.Parse(version),
                Description      = $"{id}-Description",
                ExecutionDate    = DateTime.Parse($"2017-03-30 {execTime}"),
                ReleaseDate      = DateTime.Parse(releaseDate),
                ExecutionError   = null,
                ExecutionResult  = result,
                PackageType      = packageType,
            };

            await PackageManager.Storage.SavePackageAsync(package, CancellationToken.None);

            RepositoryVersionInfo.Reset();
        }
コード例 #24
0
 public bool Is(PackageType type)
 {
     return((m_Type & type) != 0);
 }
コード例 #25
0
 public ResponseRequest(PackageType responseType, long milliseconds)
 {
     m_timer             = new OneShotTimer(milliseconds * 1000);
     ResponsePackageType = responseType;
     State = ResponseState.Pending;
 }
コード例 #26
0
 public void setPackageType(PackageType packageType)
 {
     throw new NotImplemented();
 }
コード例 #27
0
 protected PackageResponse(int trid, PackageType packageType)
     : base(trid, packageType)
 {
 }
コード例 #28
0
 public abstract bool IsPackageExist(string appId, PackageType packageType, PackageLevel packageLevel, Version version);
コード例 #29
0
ファイル: Bundle.PackageTests.cs プロジェクト: zooba/wix3
 /// <summary>
 /// Return the expected element name in burnManifest
 /// </summary>
 /// <param name="type">The type of the element</param>
 /// <param name="fileName">parameterInfo or burnManifest</param>
 /// <returns>Element name in the specified file.</returns>
 private static string GetPackageElementName(PackageType type)
 {
     switch (type)
     {
         case PackageType.MSI:
             return "MsiPackage";
         case PackageType.MSP:
             return "MspPackage";
         case PackageType.MSU:
             return "MsuPackage";
         case PackageType.EXE:
             return "ExePackage";
         default:
             throw new ArgumentException(string.Format("Undefined PacakgeType : {0}", type.ToString()));
     };
 }
コード例 #30
0
        /// <summary>
        /// Processes the Provides element.
        /// </summary>
        /// <param name="node">The XML node for the Provides element.</param>
        /// <param name="packageType">The type of the package being chained into a bundle, or "None" if building an MSI package.</param>
        /// <param name="keyPath">Explicit key path.</param>
        /// <param name="parentId">The identifier of the parent component or package.</param>
        /// <returns>The type of key path if set.</returns>
        private CompilerExtension.ComponentKeypathType ParseProvidesElement(XmlNode node, PackageType packageType, ref string keyPath, string parentId)
        {
            SourceLineNumberCollection sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);

            CompilerExtension.ComponentKeypathType keyPathType = CompilerExtension.ComponentKeypathType.None;
            string id          = null;
            string key         = null;
            string version     = null;
            string displayName = null;
            int    attributes  = 0;
            int    illegalChar = -1;

            foreach (XmlAttribute attrib in node.Attributes)
            {
                if (0 == attrib.NamespaceURI.Length || attrib.NamespaceURI == this.schema.TargetNamespace)
                {
                    switch (attrib.LocalName)
                    {
                    case "Id":
                        id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
                        break;

                    case "Key":
                        key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
                        break;

                    case "Version":
                        version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib, true);
                        break;

                    case "DisplayName":
                        displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
                        break;

                    default:
                        this.Core.UnexpectedAttribute(sourceLineNumbers, attrib);
                        break;
                    }
                }
                else
                {
                    this.Core.UnsupportedExtensionAttribute(sourceLineNumbers, attrib);
                }
            }

            // Make sure the key is valid. The key will default to the ProductCode for MSI packages
            // and the package code for MSP packages in the binder if not specified.
            if (!String.IsNullOrEmpty(key))
            {
                // Make sure the key does not contain any illegal characters or values.
                if (0 <= (illegalChar = key.IndexOfAny(DependencyCommon.InvalidCharacters)))
                {
                    StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
                    Array.ForEach <char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" "));

                    this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString()));
                }
                else if ("ALL" == key)
                {
                    this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, node.LocalName, "Key", key));
                }
            }
            else if (PackageType.ExePackage == packageType || PackageType.MsuPackage == packageType)
            {
                // Must specify the provider key when authored for a package.
                this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.LocalName, "Key"));
            }
            else if (PackageType.None == packageType)
            {
                // Make sure the ProductCode is authored and set the key.
                this.Core.CreateWixSimpleReferenceRow(sourceLineNumbers, "Property", "ProductCode");
                key = "!(bind.property.ProductCode)";
            }

            // The Version attribute should not be authored in or for an MSI package.
            if (!String.IsNullOrEmpty(version))
            {
                switch (packageType)
                {
                case PackageType.None:
                    this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers));
                    break;

                case PackageType.MsiPackage:
                    this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId));
                    break;
                }
            }
            else if (PackageType.MspPackage == packageType || PackageType.MsuPackage == packageType)
            {
                // Must specify the Version when authored for packages that do not contain a version.
                this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.LocalName, "Version"));
            }

            // Need the element ID for child element processing, so generate now if not authored.
            if (String.IsNullOrEmpty(id))
            {
                id = this.Core.GenerateIdentifier("dep", node.LocalName, parentId, key);
            }

            foreach (XmlNode child in node.ChildNodes)
            {
                if (XmlNodeType.Element == child.NodeType)
                {
                    if (child.NamespaceURI == this.schema.TargetNamespace)
                    {
                        switch (child.LocalName)
                        {
                        case "Requires":
                            this.ParseRequiresElement(child, id, PackageType.None == packageType);
                            break;

                        case "RequiresRef":
                            this.ParseRequiresRefElement(child, id, PackageType.None == packageType);
                            break;

                        default:
                            this.Core.UnexpectedElement(node, child);
                            break;
                        }
                    }
                    else
                    {
                        this.Core.UnsupportedExtensionElement(node, child);
                    }
                }
            }

            if (!this.Core.EncounteredError)
            {
                // Create the row in the provider table.
                Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider");
                row[0] = id;
                row[1] = parentId;
                row[2] = key;

                if (!String.IsNullOrEmpty(version))
                {
                    row[3] = version;
                }

                if (!String.IsNullOrEmpty(displayName))
                {
                    row[4] = displayName;
                }

                if (0 != attributes)
                {
                    row[5] = attributes;
                }

                if (PackageType.None == packageType)
                {
                    // Reference the Check custom action to check for dependencies on the current provider.
                    if (Platform.ARM == this.Core.CurrentPlatform)
                    {
                        // Ensure the ARM version of the CA is referenced.
                        this.Core.CreateWixSimpleReferenceRow(sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM");
                    }
                    else
                    {
                        // All other supported platforms use x86.
                        this.Core.CreateWixSimpleReferenceRow(sourceLineNumbers, "CustomAction", "WixDependencyCheck");
                    }

                    // Generate registry rows for the provider using binder properties.
                    string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key);

                    row    = this.Core.CreateRow(sourceLineNumbers, "Registry");
                    row[0] = this.Core.GenerateIdentifier("reg", id, "(Default)");
                    row[1] = -1;
                    row[2] = keyProvides;
                    row[3] = null;
                    row[4] = "[ProductCode]";
                    row[5] = parentId;

                    // Use the Version registry value as the key path if not already set.
                    string idVersion = this.Core.GenerateIdentifier("reg", id, "Version");
                    if (String.IsNullOrEmpty(keyPath))
                    {
                        keyPath     = idVersion;
                        keyPathType = CompilerExtension.ComponentKeypathType.Registry;
                    }

                    row    = this.Core.CreateRow(sourceLineNumbers, "Registry");
                    row[0] = idVersion;
                    row[1] = -1;
                    row[2] = keyProvides;
                    row[3] = "Version";
                    row[4] = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]";
                    row[5] = parentId;

                    row    = this.Core.CreateRow(sourceLineNumbers, "Registry");
                    row[0] = this.Core.GenerateIdentifier("reg", id, "DisplayName");
                    row[1] = -1;
                    row[2] = keyProvides;
                    row[3] = "DisplayName";
                    row[4] = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]";
                    row[5] = parentId;

                    if (0 != attributes)
                    {
                        row    = this.Core.CreateRow(sourceLineNumbers, "Registry");
                        row[0] = this.Core.GenerateIdentifier("reg", id, "Attributes");
                        row[1] = -1;
                        row[2] = keyProvides;
                        row[3] = "Attributes";
                        row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat));
                        row[5] = parentId;
                    }
                }
            }

            return(keyPathType);
        }
 public ChangePackageTypeForServiceProviderCommand(long serviceProviderId, PackageType packageType)
 {
     base.StoredProcedureName = AdminStoredProcedures.SpPutAdditionalInformation;
     this._serviceProviderId  = serviceProviderId;
     this._packageType        = packageType;
 }
コード例 #32
0
ファイル: MainWindow.xaml.cs プロジェクト: jacksonh/nuget
        private void LoadPackage(IPackage package, string packagePath, PackageType packageType)
        {
            if (package != null) {

                if (!RootLayout.LastChildFill) {
                    var packageViewer = new PackageViewer(UIServices, _packageViewModelFactory);
                    Grid.SetRow(packageViewer, 1);
                    RootLayout.Children.Add(packageViewer);
                    RootLayout.LastChildFill = true;

                    // set the Export of IPackageMetadataEditor here
                    EditorService = packageViewer.PackageMetadataEditor;
                }

                DataContext = _packageViewModelFactory.CreateViewModel(package, packagePath);
                if (!String.IsNullOrEmpty(packagePath)) {
                    _mruManager.NotifyFileAdded(package, packagePath, packageType);
                }
            }
        }
コード例 #33
0
        /// <summary>
        /// Return the list of <see cref="PackageToPrepare"/> in the ordered form
        /// for which we want to run all the tasks sequentially
        /// </summary>
        /// <returns>Ordered list of tasks to run for <see cref="PackageToPrepare"/></returns>
        private async Task <List <PackageToPrepare> > InitializePackagesAsync(PackageType packageType, ITestOutputHelper logger)
        {
            var                     id = GetPackageId(packageType);
            LicenseMetadata         licenseMetadata;
            PackageToPrepare        packageToPrepare;
            List <PackageToPrepare> packagesToPrepare = new List <PackageToPrepare>();

            switch (packageType)
            {
            case PackageType.SemVer2DueToSemVer2Dep:
                packageToPrepare = new PackageToPrepare(Package.Create(new PackageCreationContext
                {
                    Id = id,
                    NormalizedVersion = "1.0.0-beta",
                    FullVersion       = "1.0.0-beta",
                    DependencyGroups  = new[]
                    {
                        new PackageDependencyGroup(
                            TestData.TargetFramework,
                            new[]
                        {
                            new PackageDependency(
                                GetPackageId(PackageType.SemVer2Prerel),
                                VersionRange.Parse(SemVer2PrerelVersion))
                        })
                    },
                    Properties = new PackageProperties(packageType)
                }));
                break;

            case PackageType.SemVer2StableMetadataUnlisted:
                packageToPrepare = new PackageToPrepare(
                    Package.Create(packageType, id, "1.0.0", "1.0.0+metadata"),
                    unlist: true);
                break;

            case PackageType.SemVer2StableMetadata:
                packageToPrepare = new PackageToPrepare(Package.Create(packageType, id, "1.0.0", "1.0.0+metadata"));
                break;

            case PackageType.SemVer2PrerelUnlisted:
                packageToPrepare = new PackageToPrepare(
                    Package.Create(packageType, id, "1.0.0-alpha.1"),
                    unlist: true);
                break;

            case PackageType.SemVer2Prerel:
                packageToPrepare = new PackageToPrepare(Package.Create(packageType, id, SemVer2PrerelVersion));
                break;

            case PackageType.SemVer2PrerelRelisted:
                packageToPrepare = new PackageToPrepare(Package.Create(packageType, id, "1.0.0-alpha.1"),
                                                        unlist: true);
                break;

            case PackageType.SemVer1StableUnlisted:
                packageToPrepare = new PackageToPrepare(
                    Package.Create(packageType, id, "1.0.0"),
                    unlist: true);
                break;

            case PackageType.Signed:
                packageToPrepare = new PackageToPrepare(Package.SignedPackage());
                break;

            case PackageType.SymbolsPackage:
                return(await PrepareSymbolsPackageAsync(id, "1.0.0", logger));

            case PackageType.LicenseExpression:
                licenseMetadata  = new LicenseMetadata(LicenseType.Expression, "MIT", null, null, LicenseMetadata.EmptyVersion);
                packageToPrepare = new PackageToPrepare(Package.Create(new PackageCreationContext
                {
                    Id = id,
                    NormalizedVersion = "1.0.0",
                    FullVersion       = "1.0.0",
                    Properties        = new PackageProperties(packageType, licenseMetadata)
                }));
                break;

            case PackageType.LicenseFile:
                var licenseFilePath    = "license.txt";
                var licenseFileContent = "It's a license";
                licenseMetadata  = new LicenseMetadata(LicenseType.File, licenseFilePath, null, null, LicenseMetadata.EmptyVersion);
                packageToPrepare = new PackageToPrepare(Package.Create(new PackageCreationContext
                {
                    Id = id,
                    NormalizedVersion = "1.0.0",
                    FullVersion       = "1.0.0",
                    Properties        = new PackageProperties(packageType, licenseMetadata, licenseFileContent),
                    Files             = new List <PhysicalPackageFile> {
                        new PhysicalPackageFile(new MemoryStream(Encoding.UTF8.GetBytes(licenseFileContent)))
                        {
                            TargetPath = licenseFilePath
                        }
                    }
                }));
                break;

            case PackageType.LicenseUrl:
                var licenseUrl = new Uri("https://testLicenseUrl");
                packageToPrepare = new PackageToPrepare(Package.Create(new PackageCreationContext
                {
                    Id = id,
                    NormalizedVersion = "1.0.0",
                    FullVersion       = "1.0.0",
                    Properties        = new PackageProperties(packageType, licenseUrl: licenseUrl)
                }));
                break;

            case PackageType.EmbeddedIconJpeg:
                packageToPrepare = new PackageToPrepare(Package.Create(new PackageCreationContext
                {
                    Id = id,
                    NormalizedVersion = "1.0.0",
                    FullVersion       = "1.0.0",
                    Properties        = new PackageProperties(packageType)
                    {
                        EmbeddedIconFilename = "icon.jpg"
                    },
                }));
                break;

            case PackageType.EmbeddedIconPng:
                packageToPrepare = new PackageToPrepare(Package.Create(new PackageCreationContext
                {
                    Id = id,
                    NormalizedVersion = "1.0.0",
                    FullVersion       = "1.0.0",
                    Properties        = new PackageProperties(packageType)
                    {
                        EmbeddedIconFilename = "icon.png"
                    },
                }));
                break;

            case PackageType.Deprecated:
                packageToPrepare = new PackageToPrepare(
                    Package.Create(packageType, id, "1.0.0"),
                    PackageDeprecationContext.Default);
                break;

            case PackageType.DotnetTool:
                return(await PrepareDotnetToolPackageAsync(id, "1.0.0", logger));

            case PackageType.SemVer1Stable:
            case PackageType.FullValidation:
            default:
                packageToPrepare = new PackageToPrepare(Package.Create(packageType, id, "1.0.0"));
                break;
            }

            packagesToPrepare.Add(packageToPrepare);
            return(packagesToPrepare);
        }
コード例 #34
0
        /// <summary>
        /// Installs the specified resource.
        /// </summary>
        /// <param name="package">The package resource.</param>
        /// <param name="type">The package type.</param>
        /// <param name="path">The location where to install the resource.</param>
        /// <returns>The installed files.</returns>
        public IReadOnlyCollection <IFile> Install(PackageReference package, PackageType type, DirectoryPath path)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            // find npm
            _log.Debug("looking for npm.cmd");
            var npmTool = _toolLocator.Resolve("npm.cmd");

            if (npmTool == null)
            {
                _log.Debug("looking for npm");
                npmTool = _toolLocator.Resolve("npm");
            }

            if (npmTool == null)
            {
                throw new FileNotFoundException("npm could not be found.");
            }

            _log.Debug("Found npm at {0}", npmTool);

            // Install the package.
            _log.Debug("Installing package {0} with npm...", package.Package);
            var workingDir = _environment.WorkingDirectory;

            if (GetModuleInstallationLocation(package) == ModulesInstallationLocation.Tools)
            {
                var toolsFolder = _fileSystem.GetDirectory(
                    _config.GetToolPath(_environment.WorkingDirectory, _environment));

                if (!toolsFolder.Exists)
                {
                    toolsFolder.Create();
                }

                _log.Debug("Installing into cake-tools location: {0}", package.Package);
                workingDir = toolsFolder.Path;
            }

            var process = _processRunner.Start(
                npmTool.FullPath,
                new ProcessSettings
            {
                Arguments              = GetArguments(package, _config),
                WorkingDirectory       = workingDir,
                RedirectStandardOutput = true,
                Silent = _log.Verbosity < Verbosity.Diagnostic,
            });

            process.WaitForExit();

            var exitCode = process.GetExitCode();

            if (exitCode != 0)
            {
                _log.Warning("npm exited with {0}", exitCode);
                var output = string.Join(Environment.NewLine, process.GetStandardOutput());
                _log.Verbose(Verbosity.Diagnostic, "Output:\r\n{0}", output);
            }

            var result = _contentResolver.GetFiles(package, type, GetModuleInstallationLocation(package));

            if (result.Count != 0)
            {
                return(result);
            }

            _log.Warning("Could not determine installed package files! Installation may not be complete.");

            // TODO: maybe some warnings here
            return(result);
        }
コード例 #35
0
 public void ChangePackageType(long serviceProviderId, PackageType packageType)
 {
     new ChangePackageTypeForServiceProviderCommand(serviceProviderId, packageType).Execute();
 }
コード例 #36
0
        public bool AcquirePackage(ref MtcgClient client, PackageType type)
        {
            Package           package    = null;
            CardCollectionDto packageDto = null;
            int    price = 0;
            string statement;

            if (type == PackageType.Random)
            {
                packageDto = new CardCollectionDto()
                {
                    CardGuids          = AcquireRandomPackage(),
                    CardCollectionType = typeof(Package)
                };
                price = GetPackagePrice(PackageType.Random);
            }
            else
            {
                statement = "SELECT * FROM mtcg.\"Package\" p, mtcg.\"PackageType\" pT " +
                            "WHERE pt.\"Id\"=@packageTypeId AND p.\"PackageTypeId\"=pT.\"Id\" " +
                            "ORDER BY RANDOM() " +
                            "LIMIT 1;";

                using (NpgsqlCommand cmd = new NpgsqlCommand(statement, PostgreSQLSingleton.GetInstance.Connection))
                {
                    cmd.Parameters.Add("packageTypeId", NpgsqlDbType.Integer).Value = (int)type;
                    cmd.Prepare();
                    using (var reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (reader.HasRows)
                        {
                            reader.Read();
                            packageDto = new CardCollectionDto()
                            {
                                CardGuids          = JsonSerializer.Deserialize <List <Guid> >(reader["Cards"].ToString()),
                                CardCollectionType = typeof(Package)
                            };
                            price = (int)reader["Price"];
                        }
                    };
                }
            }

            package = packageDto?.ToObject() as Package;

            if (package == null)
            {
                return(false);
            }

            package.PackageType = type;

            //save old properties to fallback if necessary
            Stack <Package> oldUnopenedPackages = new Stack <Package>(new Stack <Package>(client.User.CurrentUnopenedPackages));

            client.User.RemoveCoins(price);
            client.User.AddPackage(package);

            statement = "UPDATE mtcg.\"User\" " +
                        "SET \"Coins\"=@coins, \"UnopenedPackages\"=@unopenedPackages " +
                        "WHERE \"Username\"=@username AND \"Password_Hash\"=@password";
            string[] credentials = client.User.Credentials.Split(':', 2);
            using (NpgsqlCommand cmd = new NpgsqlCommand(statement, PostgreSQLSingleton.GetInstance.Connection))
            {
                cmd.Parameters.Add("username", NpgsqlDbType.Varchar).Value         = credentials[0];
                cmd.Parameters.Add("password", NpgsqlDbType.Bytea).Value           = Encoding.UTF8.GetBytes(credentials[1]);
                cmd.Parameters.Add("coins", NpgsqlDbType.Integer).Value            = client.User.Coins;
                cmd.Parameters.Add("unopenedPackages", NpgsqlDbType.Varchar).Value = JsonSerializer.Serialize(client.User.CurrentUnopenedPackages);
                cmd.Prepare();
                if (cmd.ExecuteNonQuery() != 1)
                {
                    client.User.AddCoins(price);
                    client.User.CurrentUnopenedPackages = oldUnopenedPackages;
                    return(false);
                }
            }

            return(true);
        }
コード例 #37
0
        public KeyValuePair <StatusCode, object> AcquirePackage(ref MtcgClient client, PackageType type)
        {
            if (!(_userService is IPackageTransactionService && _userService is ILoggable))
            {
                return(new KeyValuePair <StatusCode, object>(StatusCode.InternalServerError, null));
            }

            if (client == null)
            {
                return(new KeyValuePair <StatusCode, object>(StatusCode.Unauthorized, null));
            }

            try
            {
                int packagePrice = ((IPackageTransactionService)_userService).GetPackagePrice(type);
                if (packagePrice == -1)
                {
                    return(new KeyValuePair <StatusCode, object>(StatusCode.InternalServerError, null));
                }
                if (!HasEnoughCoins(client.User.Coins, packagePrice))
                {
                    return(new KeyValuePair <StatusCode, object>(StatusCode.Conflict, "You don't have enough coins"));
                }

                ((IPackageTransactionService)_userService).AcquirePackage(ref client, type);
                string logDescription =
                    $"{client.User.Username} acquired a {Enum.GetName(typeof(PackageType), type)} package and paid {packagePrice}.";
                bool logged = ((ILoggable)_userService).Log(new Dictionary <string, object>(new []
                {
                    new KeyValuePair <string, object>("client", client),
                    new KeyValuePair <string, object>("description", logDescription)
                }));


                if (!logged)
                {
                    Console.WriteLine("Package transaction was not logged");
                }

                return(new KeyValuePair <StatusCode, object>(StatusCode.OK, logDescription));
            }
            catch (Exception e)
            {
                return(HandleException(e));
            }
        }
コード例 #38
0
 public void UpgradeAccountPackage(PackageType packageType, int accountId)
 {
コード例 #39
0
 public bool IsPackageExist(string componentId, PackageType packageType, Version version)
 {
     throw new NotImplementedException();
 }
コード例 #40
0
ファイル: InstallationManager.cs プロジェクト: raven-au/Emby
        /// <summary>
        /// Gets all available packages.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="withRegistration">if set to <c>true</c> [with registration].</param>
        /// <param name="packageType">Type of the package.</param>
        /// <param name="applicationVersion">The application version.</param>
        /// <returns>Task{List{PackageInfo}}.</returns>
        public async Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
            bool withRegistration = true,
            PackageType? packageType = null,
            Version applicationVersion = null)
        {
            var data = new Dictionary<string, string>
            {
                { "key", _securityManager.SupporterKey }, 
                { "mac", _applicationHost.SystemId }, 
                { "systemid", _applicationHost.SystemId }
            };

            if (withRegistration)
            {
                using (var json = await _httpClient.Post(MbAdmin.HttpsUrl + "service/package/retrieveall", data, cancellationToken).ConfigureAwait(false))
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList();

                    return FilterPackages(packages, packageType, applicationVersion);
                }
            }
            else
            {
                var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);

                return FilterPackages(packages.ToList(), packageType, applicationVersion);
            }
        }
コード例 #41
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="type">数据包类型</param>
 /// <param name="content">数据包内容</param>
 public CommunicatePackage(PackageType type, object content)
 {
     this.Type    = type;
     this.Content = content;
 }
コード例 #42
0
        private static decimal RateSinglePackage(FedExGlobalServiceSettings globalSettings,
            MerchantTribe.Web.Logging.ILogger logger,
            IShipment pak,
            ServiceType service,
            PackageType packaging,
            CarrierCode carCode)
        {
            decimal result = 0m;

            //Try
            RateRequest req = new RateRequest(globalSettings, logger);
            req.RequestHeader.AccountNumber = globalSettings.AccountNumber;
            req.RequestHeader.MeterNumber = globalSettings.MeterNumber;
            req.RequestHeader.CarrierCode = carCode;

            req.DeclaredValue = 0.1m;

            // Destination Address
            Country destinationCountry = Country.FindByBvin(pak.DestinationAddress.CountryData.Bvin);
            if (destinationCountry != null)
            {
                req.DestinationAddress.CountryCode = destinationCountry.IsoCode;
                if (destinationCountry.IsoCode == "US" | destinationCountry.IsoCode == "CA")
                {
                    Region destinationRegion
                        = destinationCountry
                            .Regions
                            .Where(y => y.Abbreviation == pak.DestinationAddress.RegionData.Abbreviation)
                            .SingleOrDefault();

                    req.DestinationAddress.StateOrProvinceCode = destinationRegion.Abbreviation;
                }
            }
            req.DestinationAddress.PostalCode = pak.DestinationAddress.PostalCode;

            // Origin Address
            Country originCountry = Country.FindByBvin(pak.SourceAddress.CountryData.Bvin);
            if (originCountry != null)
            {
                req.OriginAddress.CountryCode = originCountry.IsoCode;
                if (originCountry.IsoCode == "US" | originCountry.IsoCode == "CA")
                {
                    Region originRegion =
                        originCountry.Regions.Where(y => y.Abbreviation == pak.SourceAddress.RegionData.Abbreviation)
                        .SingleOrDefault();
                    req.OriginAddress.StateOrProvinceCode = originRegion.Abbreviation;
                }
            }
            req.OriginAddress.PostalCode = pak.SourceAddress.PostalCode;

            // Dimensions
            req.Dimensions.Length = pak.Items[0].BoxLength;
            req.Dimensions.Width = pak.Items[0].BoxWidth;
            req.Dimensions.Height = pak.Items[0].BoxHeight;
            //switch ()
            //{
            //    case MerchantTribe.Commerce.Shipping.LengthType.Centimeters:
            //        req.Dimensions.Units = DimensionType.CM;
            //        break;
                //case MerchantTribe.Commerce.Shipping.LengthType.Inches:
                    req.Dimensions.Units = DimensionType.IN;
            //        break;
            //}

            req.PackageCount = 1;
            req.Packaging = packaging;
            req.ReturnType = ReturnShipmentIndicatorType.NONRETURN;
            req.Service = service;
            req.SpecialServices.ResidentialDelivery = globalSettings.ForceResidentialRates;
            req.Weight = pak.Items[0].BoxWeight;
            //switch (WebAppSettings.ApplicationWeightUnits)
            //{
            //    case MerchantTribe.Commerce.Shipping.WeightType.Kilograms:
            //        req.WeightUnits = WeightType.KGS;
            //        break;
            //    case MerchantTribe.Commerce.Shipping.WeightType.Pounds:
                    req.WeightUnits = WeightType.LBS;
            //        break;
            //}

            RateResponse res = req.Send();

            if (res.Errors.Count > 0)
            {
                result = 0m;
            }
            else
            {
                if (globalSettings.UseListRates)
                {
                    if (res.EstimatedCharges.ListCharges.NetCharge > 0)
                    {
                        result = res.EstimatedCharges.ListCharges.NetCharge;
                    }
                    else
                    {
                        result = res.EstimatedCharges.DiscountedCharges.NetCharge;
                    }
                }
                else
                {
                    result = res.EstimatedCharges.DiscountedCharges.NetCharge;
                }
            }

            return result;
        }
コード例 #43
0
ファイル: RateService.cs プロジェクト: appliedi/MerchantTribe
        private static decimal RateSinglePackage(FedExGlobalServiceSettings globalSettings,
                                                 MerchantTribe.Web.Logging.ILogger logger,
                                                 IShipment pak, 
                                                 ServiceType service, 
                                                 PackageType packaging,
                                                 CarrierCodeType carCode)
        {
            decimal result = 0m;




            try
            {



                // Auth Header Data
                var req = new FedExRateServices.RateRequest();
                req.WebAuthenticationDetail = new WebAuthenticationDetail();
                req.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
                req.WebAuthenticationDetail.UserCredential.Key = globalSettings.UserKey;
                req.WebAuthenticationDetail.UserCredential.Password = globalSettings.UserPassword;
                req.ClientDetail = new ClientDetail();
                req.ClientDetail.AccountNumber = globalSettings.AccountNumber;
                req.ClientDetail.MeterNumber = globalSettings.MeterNumber;
                req.ClientDetail.IntegratorId = "BVSoftware";
                req.Version = new VersionId();

                // Basic Transaction Data
                req.TransactionDetail = new TransactionDetail();
                req.TransactionDetail.CustomerTransactionId = System.Guid.NewGuid().ToString();
                req.ReturnTransitAndCommit = false;
                req.CarrierCodes = new CarrierCodeType[1] { carCode };

                // Shipment Details
                req.RequestedShipment = new RequestedShipment();

                req.RequestedShipment.LabelSpecification = new LabelSpecification();
                req.RequestedShipment.LabelSpecification.ImageType = ShippingDocumentImageType.PDF;
                req.RequestedShipment.LabelSpecification.LabelFormatType = LabelFormatType.COMMON2D;
                req.RequestedShipment.LabelSpecification.CustomerSpecifiedDetail = new CustomerSpecifiedLabelDetail();

                req.RequestedShipment.DropoffType = GetDropOffType(globalSettings.DefaultDropOffType);
                req.RequestedShipment.PackagingType = GetPackageType(packaging);
                req.RequestedShipment.TotalWeight = new Weight();
                req.RequestedShipment.TotalWeight.Value = Math.Round(pak.Items.Sum(y => y.BoxWeight), 1);
                if (pak.Items[0].BoxWeightType == Shipping.WeightType.Kilograms)
                {
                    req.RequestedShipment.TotalWeight.Units = WeightUnits.KG;
                }
                else
                {
                    req.RequestedShipment.TotalWeight.Units = WeightUnits.LB;
                }

                // Uncomment these lines to get insured values passed in
                //
                //var totalValue = pak.Items.Sum(y => y.BoxValue);
                //req.RequestedShipment.TotalInsuredValue = new Money();
                //req.RequestedShipment.TotalInsuredValue.Amount = totalValue;
                //req.RequestedShipment.TotalInsuredValue.Currency = "USD";

                req.RequestedShipment.PackageCount = pak.Items.Count.ToString();

                req.RequestedShipment.RequestedPackageLineItems = new RequestedPackageLineItem[pak.Items.Count];
                for (int i = 0; i < pak.Items.Count; i++)
                {
                    req.RequestedShipment.RequestedPackageLineItems[i] = new RequestedPackageLineItem();
                    req.RequestedShipment.RequestedPackageLineItems[i].GroupNumber = "1";
                    req.RequestedShipment.RequestedPackageLineItems[i].GroupPackageCount = (i + 1).ToString();                    
                    req.RequestedShipment.RequestedPackageLineItems[i].Weight = new Weight();
                    req.RequestedShipment.RequestedPackageLineItems[i].Weight.Value = pak.Items[i].BoxWeight;
                    req.RequestedShipment.RequestedPackageLineItems[i].Weight.Units = pak.Items[i].BoxWeightType == Shipping.WeightType.Kilograms ? WeightUnits.KG : WeightUnits.LB;
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions = new Dimensions();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Height = pak.Items[i].BoxHeight.ToString();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Length = pak.Items[i].BoxLength.ToString();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Width = pak.Items[i].BoxWidth.ToString();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Units = pak.Items[i].BoxLengthType == LengthType.Centimeters ? LinearUnits.CM : LinearUnits.IN;
                }

                req.RequestedShipment.Recipient = new Party();
                req.RequestedShipment.Recipient.Address = new FedExRateServices.Address();
                req.RequestedShipment.Recipient.Address.City = pak.DestinationAddress.City;
                req.RequestedShipment.Recipient.Address.CountryCode = GetCountryCode(pak.DestinationAddress.CountryData);
                req.RequestedShipment.Recipient.Address.PostalCode = pak.DestinationAddress.PostalCode;                                

                if (pak.DestinationAddress.CountryData.Bvin == "bf7389a2-9b21-4d33-b276-23c9c18ea0c0" || // US or Canada
                    pak.DestinationAddress.CountryData.Bvin == "94052dcf-1ac8-4b65-813b-b17b12a0491f")
                {
                    req.RequestedShipment.Recipient.Address.StateOrProvinceCode = pak.DestinationAddress.RegionData.Abbreviation; // GetStateCode(pak.DestinationAddress.RegionData);
                }
                else
                {
                    req.RequestedShipment.Recipient.Address.StateOrProvinceCode = string.Empty;
                }
                req.RequestedShipment.Recipient.Address.StreetLines = new string[2] { pak.DestinationAddress.Street, pak.DestinationAddress.Street2 };

                if (service == ServiceType.GROUNDHOMEDELIVERY)
                {
                    req.RequestedShipment.Recipient.Address.Residential = true;
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = true;
                }
                else if (service == ServiceType.FEDEXGROUND)
                {
                    req.RequestedShipment.Recipient.Address.Residential = false;
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = true;
                }
                else
                {
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = false;
                }

                req.RequestedShipment.Shipper = new Party();
                req.RequestedShipment.Shipper.AccountNumber = globalSettings.AccountNumber;
                req.RequestedShipment.Shipper.Address = new FedExRateServices.Address();
                req.RequestedShipment.Shipper.Address.City = pak.SourceAddress.City;
                req.RequestedShipment.Shipper.Address.CountryCode = GetCountryCode(pak.SourceAddress.CountryData);
                req.RequestedShipment.Shipper.Address.PostalCode = pak.SourceAddress.PostalCode;
                req.RequestedShipment.Shipper.Address.Residential = false;
                if (pak.SourceAddress.CountryData.Bvin == "bf7389a2-9b21-4d33-b276-23c9c18ea0c0" || // US or Canada
                    pak.SourceAddress.CountryData.Bvin == "94052dcf-1ac8-4b65-813b-b17b12a0491f")
                {
                    req.RequestedShipment.Shipper.Address.StateOrProvinceCode = pak.SourceAddress.RegionData.Abbreviation;
                }
                else
                {
                    req.RequestedShipment.Shipper.Address.StateOrProvinceCode = string.Empty;
                }
                req.RequestedShipment.Shipper.Address.StreetLines = new string[2] { pak.SourceAddress.Street, pak.SourceAddress.Street2 };


                var svc = new FedExRateServices.RateService();
                RateReply res = svc.getRates(req);

                if (res.HighestSeverity == NotificationSeverityType.ERROR ||
                    res.HighestSeverity == NotificationSeverityType.FAILURE)
                {
                    if (globalSettings.DiagnosticsMode == true)
                    {
                        foreach (var err in res.Notifications)
                        {
                            logger.LogMessage("FEDEX", err.Message, Web.Logging.EventLogSeverity.Debug);
                        }
                    }
                    result = 0m;
                }
                else
                {
                    result = 0m;

                    var lookingForService = GetServiceType(service);
                    var matchingResponse = res.RateReplyDetails.Where(y => y.ServiceType == lookingForService).FirstOrDefault();
                    if (matchingResponse != null)
                    {
                        var matchedRate = matchingResponse.RatedShipmentDetails.Where(
                            y => y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_PACKAGE ||
                                y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_SHIPMENT).FirstOrDefault();
                        if (matchedRate != null)                        
                        {
                            result = matchedRate.ShipmentRateDetail.TotalNetCharge.Amount;
                        }
                    }                                                                
                }
            }
            catch (Exception ex)
            {
                result = 0m;
                logger.LogException(ex);
            }

            return result;
        }
コード例 #44
0
        private static decimal RateSinglePackage(FedExGlobalServiceSettings globalSettings, ILogger logger,
                                                 IShipment pak,
                                                 ServiceType service, PackageType packaging, CarrierCodeType carCode,
                                                 bool useNegotiatedRates)
        {
            var result = 0m;

            try
            {
                // Auth Header Data
                var req = new RateRequest
                {
                    WebAuthenticationDetail = new WebAuthenticationDetail
                    {
                        UserCredential = new WebAuthenticationCredential
                        {
                            Key      = globalSettings.UserKey,
                            Password = globalSettings.UserPassword
                        }
                    }
                };
                req.ClientDetail = new ClientDetail
                {
                    AccountNumber = globalSettings.AccountNumber,
                    MeterNumber   = globalSettings.MeterNumber,
                    IntegratorId  = "Hotcakes"
                };
                req.Version = new VersionId();

                // Basic Transaction Data
                req.TransactionDetail = new TransactionDetail
                {
                    CustomerTransactionId = Guid.NewGuid().ToString()
                };
                req.ReturnTransitAndCommit = false;
                req.CarrierCodes           = new CarrierCodeType[1] {
                    carCode
                };

                // Shipment Details
                req.RequestedShipment = new RequestedShipment
                {
                    LabelSpecification = new LabelSpecification
                    {
                        ImageType               = ShippingDocumentImageType.PDF,
                        LabelFormatType         = LabelFormatType.COMMON2D,
                        CustomerSpecifiedDetail = new CustomerSpecifiedLabelDetail()
                    },
                    RateRequestTypes = new[] { RateRequestType.LIST },
                    DropoffType      = GetDropOffType(globalSettings.DefaultDropOffType),
                    PackagingType    = GetPackageType(packaging),
                    TotalWeight      = new Weight
                    {
                        Value = Math.Round(pak.Items.Sum(y => y.BoxWeight), 1),
                        Units =
                            pak.Items[0].BoxWeightType == Shipping.WeightType.Kilograms
                                ? WeightUnits.KG
                                : WeightUnits.LB
                    },
                    PackageCount = pak.Items.Count.ToString(),
                    RequestedPackageLineItems = new RequestedPackageLineItem[pak.Items.Count]
                };

                /*
                 * Possible values for RateRequestType include: LIST and ACCOUNT.
                 * ACCOUNT will return negotiated rates, but LIST will return both regular and negotiated rates.
                 * http://www.fedex.com/us/developer/product/WebServices/MyWebHelp_March2010/Content/WS_Developer_Guide/Rate_Services.htm
                 */
                //req.RequestedShipment.RateRequestTypes = new[] { RateRequestType.ACCOUNT };

                // Uncomment these lines to get insured values passed in
                //
                //var totalValue = pak.Items.Sum(y => y.BoxValue);
                //req.RequestedShipment.TotalInsuredValue = new Money();
                //req.RequestedShipment.TotalInsuredValue.Amount = totalValue;
                //req.RequestedShipment.TotalInsuredValue.Currency = "USD";

                for (var i = 0; i < pak.Items.Count; i++)
                {
                    req.RequestedShipment.RequestedPackageLineItems[i] = new RequestedPackageLineItem
                    {
                        GroupNumber       = "1",
                        GroupPackageCount = (i + 1).ToString(),
                        Weight            = new Weight
                        {
                            Value = pak.Items[i].BoxWeight,
                            Units =
                                pak.Items[i].BoxWeightType == Shipping.WeightType.Kilograms
                                    ? WeightUnits.KG
                                    : WeightUnits.LB
                        }
                    };

                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions = new Dimensions
                    {
                        Height = pak.Items[i].BoxHeight.ToString(),
                        Length = pak.Items[i].BoxLength.ToString(),
                        Width  = pak.Items[i].BoxWidth.ToString(),
                        Units  = pak.Items[i].BoxLengthType == LengthType.Centimeters ? LinearUnits.CM : LinearUnits.IN
                    };
                }

                req.RequestedShipment.Recipient = new Party
                {
                    Address = new FedExRateServices.Address
                    {
                        City        = pak.DestinationAddress.City,
                        CountryCode = GetCountryCode(pak.DestinationAddress.CountryData),
                        PostalCode  = pak.DestinationAddress.PostalCode
                    }
                };


                if (pak.DestinationAddress.CountryData.IsoCode == "US" ||
                    pak.DestinationAddress.CountryData.IsoCode == "CA")
                {
                    req.RequestedShipment.Recipient.Address.StateOrProvinceCode = pak.DestinationAddress.RegionBvin;
                }
                else
                {
                    req.RequestedShipment.Recipient.Address.StateOrProvinceCode = string.Empty;
                }
                req.RequestedShipment.Recipient.Address.StreetLines = new string[2]
                {
                    pak.DestinationAddress.Street, pak.DestinationAddress.Street2
                };

                switch (service)
                {
                case ServiceType.GROUNDHOMEDELIVERY:
                    req.RequestedShipment.Recipient.Address.Residential          = true;
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = true;
                    break;

                case ServiceType.FEDEXGROUND:
                    req.RequestedShipment.Recipient.Address.Residential          = false;
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = true;
                    break;

                default:
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = false;
                    break;
                }

                req.RequestedShipment.Shipper = new Party
                {
                    AccountNumber = globalSettings.AccountNumber,
                    Address       = new FedExRateServices.Address
                    {
                        City        = pak.SourceAddress.City,
                        CountryCode = GetCountryCode(pak.SourceAddress.CountryData),
                        PostalCode  = pak.SourceAddress.PostalCode,
                        Residential = false
                    }
                };

                if (pak.SourceAddress.CountryData.IsoCode == "US" || // US or Canada
                    pak.SourceAddress.CountryData.IsoCode == "CA")
                {
                    req.RequestedShipment.Shipper.Address.StateOrProvinceCode = pak.SourceAddress.RegionBvin;
                }
                else
                {
                    req.RequestedShipment.Shipper.Address.StateOrProvinceCode = string.Empty;
                }
                req.RequestedShipment.Shipper.Address.StreetLines = new string[2]
                {
                    pak.SourceAddress.Street, pak.SourceAddress.Street2
                };

                var svc = new FedExRateServices.RateService
                {
                    Url =
                        globalSettings.UseDevelopmentServiceUrl
                            ? FedExConstants.DevRateServiceUrl
                            : FedExConstants.LiveRateServiceUrl
                };

                var res = svc.getRates(req);

                if (res.HighestSeverity == NotificationSeverityType.ERROR ||
                    res.HighestSeverity == NotificationSeverityType.FAILURE)
                {
                    if (globalSettings.DiagnosticsMode)
                    {
                        foreach (var err in res.Notifications)
                        {
                            logger.LogMessage("FEDEX", err.Message, EventLogSeverity.Debug);
                        }
                    }
                    result = 0m;
                }
                else
                {
                    result = 0m;

                    var lookingForService = GetServiceType(service);
                    var matchingResponse  = res.RateReplyDetails.FirstOrDefault(y => y.ServiceType == lookingForService);
                    if (matchingResponse != null)
                    {
                        if (useNegotiatedRates)
                        {
                            var matchedRate =
                                matchingResponse.RatedShipmentDetails.FirstOrDefault(
                                    y => y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_PACKAGE ||
                                    y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_SHIPMENT);

                            if (matchedRate != null)
                            {
                                result = matchedRate.ShipmentRateDetail.TotalNetCharge.Amount;

                                if (globalSettings.DiagnosticsMode)
                                {
                                    logger.LogMessage("FEDEX SHIPMENT",
                                                      "Negotiated rates were found and are currently being used.",
                                                      EventLogSeverity.Information);
                                }
                            }
                            else
                            {
                                matchedRate =
                                    matchingResponse.RatedShipmentDetails.FirstOrDefault(
                                        y => y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_LIST_PACKAGE ||
                                        y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_LIST_SHIPMENT);

                                result = matchedRate.ShipmentRateDetail.TotalNetCharge.Amount;

                                if (globalSettings.DiagnosticsMode)
                                {
                                    logger.LogMessage("FEDEX SHIPMENT",
                                                      "No negotiated rates were found. Public rates are being shown. You should update your account information, or uncheck the ‘Use Negotiated Rates’ checkbox.",
                                                      EventLogSeverity.Information);
                                }
                                else
                                {
                                    logger.LogMessage("FEDEX SHIPMENT", "No negotiated rates were found.",
                                                      EventLogSeverity.Information);
                                }
                            }
                        }
                        else
                        {
                            var matchedRate =
                                matchingResponse.RatedShipmentDetails.FirstOrDefault(
                                    y => y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_LIST_PACKAGE ||
                                    y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_LIST_SHIPMENT);

                            if (matchedRate != null)
                            {
                                result = matchedRate.ShipmentRateDetail.TotalNetCharge.Amount;

                                if (
                                    matchingResponse.RatedShipmentDetails.Any(
                                        y => y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_PACKAGE ||
                                        y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_SHIPMENT))
                                {
                                    if (globalSettings.DiagnosticsMode)
                                    {
                                        logger.LogMessage("FEDEX SHIPMENT",
                                                          "We also found negotiated rates for your account. You should consider checking the ‘Use Negotiated Rates’ checkbox.",
                                                          EventLogSeverity.Information);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = 0m;
                logger.LogException(ex);
            }

            return(result);
        }
コード例 #45
0
ファイル: Package.cs プロジェクト: hellokiddy/Mongo
 public Package(PackageType type, byte[] body)
 {
     this.type   = type;
     this.length = body.Length;
     this.body   = body;
 }
コード例 #46
0
 /// <summary>
 /// Gets all available packages.
 /// </summary>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <param name="packageType">Type of the package.</param>
 /// <param name="applicationVersion">The application version.</param>
 /// <returns>Task{List{PackageInfo}}.</returns>
 protected async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken,
     PackageType? packageType = null,
     Version applicationVersion = null)
 {
     var packages = (await _packageManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false)).ToList();
     return FilterPackages(packages, packageType, applicationVersion);
 }
コード例 #47
0
ファイル: Bundle.PackageTests.cs プロジェクト: zooba/wix3
        /// <summary>
        /// Verifies Package information in Burn-Manifest.xml and Burn-UxManifest.xml.
        /// </summary>
        /// <param name="embededResourcesDirectoryPath">Output folder where all the embeded resources are.</param>
        /// <param name="expectedPackageName">Package name; this is the attribute used to locate the package.</param>
        /// <param name="expectedPackageType">Package type MSI, MSP, MSU or EXE.</param>
        /// <param name="expectedId">Expected Package @Id value.</param>
        /// <param name="expectedInstallCondition">Expected Package @InstallCondition value.</param>
        /// <param name="expectedProductCode">Expected Package @ProductCode value.</param>
        /// <param name="expecteVital">Package is viatal or not.</param>
        /// <param name="expectedPermanent">Expected Package @Permanent value.</param>
        /// <param name="expectedCacheId">Expected Package @CacheId value.</param>
        /// <param name="expectedInstallCommmand">Expected @InstallCommand value.</param>
        /// <param name="expectedUninstallCommmand">Expected @UninstallCommand value.</param>
        /// <param name="expectedRepairCommand">Expected @RepairCommand value.</param>
        /// <param name="expectedDownloadURL">Expected Package @DownloadURL value.</param>
        /// <param name="acctualFilePath">Path to the acctual file for comparison.</param>
        private static void VerifyPackageInformation(string embededResourcesDirectoryPath, string expectedPackageName, PackageType expectedPackageType, string expectedId,
                                                     string expectedInstallCondition, string expectedProductCode, bool expecteVital, bool expectedPermanent, string expectedCacheId,
                                                     string expectedInstallCommmand, string expectedUninstallCommmand, string expectedRepairCommand, string expectedDownloadURL,
                                                     string acctualFilePath)
        {
            string expectedFileSize = new FileInfo(acctualFilePath).Length.ToString();
            string expectedHash = FileVerifier.ComputeFileSHA1Hash(acctualFilePath);
            string expectedProductSize = expectedFileSize;

            // verify the Burn_Manifest has the correct information
            string burnManifestXPath = string.Format(@"//burn:{0}[@Id='{1}']", GetPackageElementName(expectedPackageType), expectedId);
            XmlNodeList burnManifestNodes = BundleTests.QueryBurnManifest(embededResourcesDirectoryPath, burnManifestXPath);
            Assert.True(1 == burnManifestNodes.Count, String.Format("No MsiPackage with the Id: '{0}' was found in Burn_Manifest.xml.", expectedId));
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "InstallCondition", expectedInstallCondition);
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "Permanent", expectedPermanent ? "yes" : "no");
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "Vital", expecteVital ? "yes" : "no");

            if (expectedPackageType == PackageType.MSI)
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "ProductCode", expectedProductCode);
            }

            if (expectedPackageType == PackageType.EXE)
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "InstallArguments", expectedInstallCommmand);
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "UninstallArguments", expectedUninstallCommmand);
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "RepairArguments", expectedRepairCommand);
            }

            if (!String.IsNullOrEmpty(expectedCacheId))
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "CacheId", expectedCacheId);
            }

            // verify payload information
            PackageTests.VerifyPackagePayloadInformation(embededResourcesDirectoryPath, expectedPackageType, expectedPackageName, expectedId, expectedPackageName, expectedDownloadURL, acctualFilePath);

            // verify the Burn-UxManifest has the correct information
            string expectedProductName = null;
            string expectedDiscription = null;

            if (expectedPackageType == PackageType.EXE)
            {
                FileVersionInfo fileInfo = FileVersionInfo.GetVersionInfo(acctualFilePath);
                expectedProductName = string.IsNullOrEmpty(fileInfo.ProductName) ? null : fileInfo.ProductName;
                expectedDiscription = string.IsNullOrEmpty(fileInfo.FileDescription) ? null : fileInfo.FileDescription;
            }
            else if (expectedPackageType == PackageType.MSI)
            {
                string subject = Verifier.GetMsiSummaryInformationProperty(acctualFilePath, Verifier.MsiSummaryInformationProperty.Subject);
                expectedProductName = string.IsNullOrEmpty(subject) ? null : subject;
            }

            string burnUxManifestXPath = string.Format(@"//burnUx:WixPackageProperties[@Package='{0}']", expectedId);
            XmlNodeList burnUxManifestNodes = BundleTests.QueryBurnUxManifest(embededResourcesDirectoryPath, burnUxManifestXPath);
            Assert.True(1 == burnUxManifestNodes.Count, String.Format("No WixPackageProperties for Package: '{0}' was found in Burn-UxManifest.xml.", expectedId));
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "Vital", expecteVital ? "yes" : "no");
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "DownloadSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "PackageSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "InstalledSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "DisplayName", expectedProductName);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "Description", expectedDiscription);
        }
コード例 #48
0
        //Send system message, these message do not use messageProtocol
        internal void send(PackageType type, JsonObject msg)
        {
            //This method only used to send system package
            if(type == PackageType .PKG_DATA) return;

            byte[] body = Encoding.UTF8.GetBytes(msg.ToString());

            send (type, body);
        }
コード例 #49
0
ファイル: Packages.cs プロジェクト: leezer3/OpenBVE
		/// <summary>Creates a clone of the specified package</summary>
		/// <param name="packageToClone">The package to clone</param>
		/// <param name="dependancy">Whether this package is part of a dependancy list</param>
		public Package(Package packageToClone, bool dependancy)
		{
			Name = packageToClone.Name;
			Author = packageToClone.Author;
			GUID = packageToClone.GUID;
			Website = packageToClone.Website;
			PackageType = packageToClone.PackageType;
			Description = packageToClone.Description;
			Dependancies = packageToClone.Dependancies;
			Reccomendations = packageToClone.Reccomendations;
			Version = packageToClone.Version;
			/*
			 * If we are cloning a package, we can assume that the image will change, as these are only currently stored in archives TODO: Serialize to XML? Bad idea?
			 */

		}
コード例 #50
0
 internal void send(PackageType type)
 {
     if(this.state == ProtocolState.closed) return;
     transporter.send(PackageProtocol.encode (type));
 }
コード例 #51
0
ファイル: CarePackage.cs プロジェクト: twils1337/CSharp
    public static Rigidbody SpawnCarePackage(ref Rigidbody CarePkgPrefab, Transform transform, PackageType CPtype, bool fromManager)
    {
        Rigidbody newCarePkg = Instantiate(CarePkgPrefab, transform.position, transform.rotation) as Rigidbody;

        newCarePkg.GetComponent <CarePackage>().m_Type       = CPtype;
        newCarePkg.GetComponent <CarePackage>().m_WasSpawned = fromManager;
        return(newCarePkg);
    }
コード例 #52
0
ファイル: Package.cs プロジェクト: florisdh/LCPiratesOnline
 public TypedPackage(PackageType type, byte[] data, int offset = 0)
 {
     Type = type;
     Data = data;
     Offset = offset;
 }
コード例 #53
0
 private IPackage Send(string pc, PackageType pt, PackageContentType pct, string ps, string pr, string pcn = "")
 {
     IPackage package = new ipp_Package(ps, pc, pt, pct, pr, pcn, "1.0.0.0");
     var bytes = package.ToServerBytes();
     string s = Convert.ToBase64String(bytes);
     if (socket.State == WebSocketState.Open)
     {
         socket.Send(bytes, 0, bytes.Length);
         return package;
     }
     else { return null; }
 }
コード例 #54
0
        /// <summary>
        /// Processes the Provides element.
        /// </summary>
        /// <param name="node">The XML node for the Provides element.</param>
        /// <param name="packageType">The type of the package being chained into a bundle, or "None" if building an MSI package.</param>
        /// <param name="keyPath">Explicit key path.</param>
        /// <param name="parentId">The identifier of the parent component or package.</param>
        /// <returns>The type of key path if set.</returns>
        private CompilerExtension.ComponentKeypathType ParseProvidesElement(XmlNode node, PackageType packageType, ref string keyPath, string parentId)
        {
            SourceLineNumberCollection sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
            CompilerExtension.ComponentKeypathType keyPathType = CompilerExtension.ComponentKeypathType.None;
            string id = null;
            string key = null;
            string version = null;
            string displayName = null;
            int attributes = 0;
            int illegalChar = -1;

            foreach (XmlAttribute attrib in node.Attributes)
            {
                if (0 == attrib.NamespaceURI.Length || attrib.NamespaceURI == this.schema.TargetNamespace)
                {
                    switch (attrib.LocalName)
                    {
                        case "Id":
                            id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
                            break;
                        case "Key":
                            key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
                            break;
                        case "Version":
                            version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib, true);
                            break;
                        case "DisplayName":
                            displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
                            break;
                        default:
                            this.Core.UnexpectedAttribute(sourceLineNumbers, attrib);
                            break;
                    }
                }
                else
                {
                    this.Core.UnsupportedExtensionAttribute(sourceLineNumbers, attrib);
                }
            }

            // Make sure the key is valid. The key will default to the ProductCode for MSI packages
            // and the package code for MSP packages in the binder if not specified.
            if (!String.IsNullOrEmpty(key))
            {
                // Make sure the key does not contain any illegal characters or values.
                if (0 <= (illegalChar = key.IndexOfAny(DependencyCommon.InvalidCharacters)))
                {
                    StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
                    Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" "));

                    this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString()));
                }
                else if ("ALL" == key)
                {
                    this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, node.LocalName, "Key", key));
                }
            }
            else if (PackageType.ExePackage == packageType || PackageType.MsuPackage == packageType)
            {
                // Must specify the provider key when authored for a package.
                this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.LocalName, "Key"));
            }
            else if (PackageType.None == packageType)
            {
                // Make sure the ProductCode is authored and set the key.
                this.Core.CreateWixSimpleReferenceRow(sourceLineNumbers, "Property", "ProductCode");
                key = "!(bind.property.ProductCode)";
            }

            // The Version attribute should not be authored in or for an MSI package.
            if (!String.IsNullOrEmpty(version))
            {
                switch (packageType)
                {
                    case PackageType.None:
                        this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers));
                        break;
                    case PackageType.MsiPackage:
                        this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId));
                        break;
                }
            }
            else if (PackageType.MspPackage == packageType || PackageType.MsuPackage == packageType)
            {
                // Must specify the Version when authored for packages that do not contain a version.
                this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.LocalName, "Version"));
            }

            // Need the element ID for child element processing, so generate now if not authored.
            if (String.IsNullOrEmpty(id))
            {
                id = this.Core.GenerateIdentifier("dep", node.LocalName, parentId, key);
            }

            foreach (XmlNode child in node.ChildNodes)
            {
                if (XmlNodeType.Element == child.NodeType)
                {
                    if (child.NamespaceURI == this.schema.TargetNamespace)
                    {
                        switch (child.LocalName)
                        {
                            case "Requires":
                                this.ParseRequiresElement(child, id, PackageType.None == packageType);
                                break;
                            case "RequiresRef":
                                this.ParseRequiresRefElement(child, id, PackageType.None == packageType);
                                break;
                            default:
                                this.Core.UnexpectedElement(node, child);
                                break;
                        }
                    }
                    else
                    {
                        this.Core.UnsupportedExtensionElement(node, child);
                    }
                }
            }

            if (!this.Core.EncounteredError)
            {
                // Create the row in the provider table.
                Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider");
                row[0] = id;
                row[1] = parentId;
                row[2] = key;

                if (!String.IsNullOrEmpty(version))
                {
                    row[3] = version;
                }

                if (!String.IsNullOrEmpty(displayName))
                {
                    row[4] = displayName;
                }

                if (0 != attributes)
                {
                    row[5] = attributes;
                }

                if (PackageType.None == packageType)
                {
                    // Reference the Check custom action to check for dependencies on the current provider.
                    this.Core.CreateWixSimpleReferenceRow(sourceLineNumbers, "CustomAction", "WixDependencyCheck");

                    // Generate registry rows for the provider using binder properties.
                    string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key);

                    row = this.Core.CreateRow(sourceLineNumbers, "Registry");
                    row[0] = this.Core.GenerateIdentifier("reg", id, "(Default)");
                    row[1] = -1;
                    row[2] = keyProvides;
                    row[3] = null;
                    row[4] = "[ProductCode]";
                    row[5] = parentId;

                    // Use the Version registry value as the key path if not already set.
                    string idVersion = this.Core.GenerateIdentifier("reg", id, "Version");
                    if (String.IsNullOrEmpty(keyPath))
                    {
                        keyPath = idVersion;
                        keyPathType = CompilerExtension.ComponentKeypathType.Registry;
                    }

                    row = this.Core.CreateRow(sourceLineNumbers, "Registry");
                    row[0] = idVersion;
                    row[1] = -1;
                    row[2] = keyProvides;
                    row[3] = "Version";
                    row[4] = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]";
                    row[5] = parentId;

                    row = this.Core.CreateRow(sourceLineNumbers, "Registry");
                    row[0] = this.Core.GenerateIdentifier("reg", id, "DisplayName");
                    row[1] = -1;
                    row[2] = keyProvides;
                    row[3] = "DisplayName";
                    row[4] = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]";
                    row[5] = parentId;

                    if (0 != attributes)
                    {
                        row = this.Core.CreateRow(sourceLineNumbers, "Registry");
                        row[0] = this.Core.GenerateIdentifier("reg", id, "Attributes");
                        row[1] = -1;
                        row[2] = keyProvides;
                        row[3] = "Attributes";
                        row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat));
                        row[5] = parentId;
                    }
                }
            }

            return keyPathType;
        }
コード例 #55
0
        //Send message use the transporter
        internal void send(PackageType type, byte[] body)
        {
            if(this.state == ProtocolState.closed) return;

            byte[] pkg = PackageProtocol.encode (type, body);

            transporter.send(pkg);
        }
コード例 #56
0
        public ShipmentResponse CallUPSShipmentRequest(string serviceCode, int shipmentID, ref string szError)
        {
            //var dbShipment = ShipmentModule.GetShipmentByID(ShipmentDetailID);
            try
            {
                var shipmentDetails = ShipmentModule.GetShipmentShipmentDetails(shipmentID);

                var shpSvc          = new ShipService();
                var shipmentRequest = new ShipmentRequest();
                AddUpsSecurity(shpSvc);
                var      request       = new RequestType();
                string[] requestOption = { "nonvalidate" };
                request.RequestOption   = requestOption;
                shipmentRequest.Request = request;
                var shipment = new ShipmentType();
                shipment.Description = "Ship webservice";
                AddShipper(shipment);
                AddShipFromAddress(shipment);
                AddShipToAddress(shipment);
                AddBillShipperAccount(shipment);
                //AddPaymentInformation(shipment);

                var service = new ServiceType();
                service.Code     = serviceCode;
                shipment.Service = service;

                PackageType[] pkgArray;
                pkgArray = new PackageType[shipmentDetails.Count];
                var i = 0;
                foreach (var box in shipmentDetails)
                {
                    AddPackage(
                        box.BoxNo,
                        box.UnitWeight.Value,
                        (int)box.DeclaredValue,
                        box.DimensionH.Value,
                        box.DimensionD.Value,
                        box.DimensionL.Value,
                        PackagingTypeCode,
                        "USD",
                        pkgArray,
                        i);
                    i = i + 1;
                }
                shipment.Package = pkgArray;

                var labelSpec      = new LabelSpecificationType();
                var labelStockSize = new LabelStockSizeType();
                labelStockSize.Height    = "3";
                labelStockSize.Width     = "2";
                labelSpec.LabelStockSize = labelStockSize;
                var labelImageFormat = new LabelImageFormatType();
                labelImageFormat.Code              = "GIF"; //"SPL";
                labelSpec.LabelImageFormat         = labelImageFormat;
                shipmentRequest.LabelSpecification = labelSpec;
                shipmentRequest.Shipment           = shipment;

                var shipmentResponse = shpSvc.ProcessShipment(shipmentRequest);
                return(shipmentResponse);
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                string message = string.Empty;
                message = message + Environment.NewLine + "SoapException Message= " + ex.Message;
                message = message + Environment.NewLine + "SoapException Category:Code:Message= " + ex.Detail.LastChild.InnerText;
                message = message + Environment.NewLine + "SoapException XML String for all= " + ex.Detail.LastChild.OuterXml;
                message = message + Environment.NewLine + "SoapException StackTrace= " + ex.StackTrace;
                szError = string.Format("Error processing API Validate Address call (webservice error): {0} UPS API Error: {1}", ex.Message, ex.Detail.LastChild.InnerText);
                return(null);
            }
        }
コード例 #57
0
 public static byte[] encode(PackageType type)
 {
     return(new byte[] { Convert.ToByte(type), 0, 0, 0 });
 }
コード例 #58
0
 /// <summary>
 /// Passing in all fields on creation of an instance
 /// </summary>
 /// <param name="productcode"></param>
 /// <param name="productversion"></param>
 /// <param name="productname"></param>
 /// <param name="chainingpackage"></param>
 /// <param name="installDate"></param>
 /// <param name="installLocation"></param>
 /// <param name="url"></param>
 public Package(string productcode, string productversion, string productname, string chainingpackage, DateTime installDate, string installLocation, System.Uri url)
 {
     Initialize();
     Type = PackageType.MSI;
     ProductCode = productcode;
     ProductVersion = productversion;
     ProductName = productname;
     ChainingPackage = chainingpackage;
     InstallDate = installDate;
     InstallLocation = installLocation;
     Url = url;
 }
コード例 #59
0
        protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, PackageType? packageType, Version applicationVersion)
        {
            if (packageType.HasValue)
            {
                packages = packages.Where(p => p.type == packageType.Value).ToList();
            }

            // If an app version was supplied, filter the versions for each package to only include supported versions
            if (applicationVersion != null)
            {
                foreach (var package in packages)
                {
                    package.versions = package.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToList();
                }
            }

            // Remove packages with no versions
            packages = packages.Where(p => p.versions.Any()).ToList();

            return packages;
        }
コード例 #60
0
ファイル: NuGetContentResolver.cs プロジェクト: jnm2/cake
        public IReadOnlyCollection <IFile> GetFiles(DirectoryPath path, PackageReference package, PackageType type)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            if (type == PackageType.Addin)
            {
                return(GetAddinAssemblies(path));
            }
            if (type == PackageType.Tool)
            {
                return(GetToolFiles(path, package));
            }

            throw new InvalidOperationException("Unknown resource type.");
        }