Esempio n. 1
0
        private static PackInfo newPack()
        {
            PackInfo pack = new PackInfo();

            pack.spawns.Add(AnimalManager.packs[UnityEngine.Random.Range(0, AnimalManager.packs.Count)].spawns.First());
            return(pack);
        }
Esempio n. 2
0
        }         //装备所在的槽, PackEntry的Index 描述这个信息, 后续可能不需要这个数据,因为装备的槽唯一


        public EquipData(PackInfo pkinfo)
        {
            info     = pkinfo;
            entry    = info.PackEntry;
            itemData = Util.GetItemData(1, pkinfo.PackEntry.BaseId);
            KBEngine.Dbg.Assert(itemData == null, "EquipData::initError " + pkinfo.PackEntry.BaseId);
        }
Esempio n. 3
0
            public void Parse(Stream hs)
            {
                while (true)
                {
                    PropertyID propertyID = GetPropertyID(this, hs);
                    switch (propertyID)
                    {
                    case PropertyID.kPackInfo:
                        PackInfo = new PackInfo();
                        PackInfo.Parse(hs);
                        break;

                    case PropertyID.kUnPackInfo:
                        UnPackInfo = new UnPackInfo();
                        UnPackInfo.Parse(hs);
                        break;

                    case PropertyID.kSubStreamsInfo:
                        if (UnPackInfo == null)
                        {
                            Trace.TraceWarning("SubStreamsInfo block found, yet no UnPackInfo block has been parsed so far.");
                            UnPackInfo = new UnPackInfo();
                        }
                        SubStreamsInfo = new SubStreamsInfo(UnPackInfo);
                        SubStreamsInfo.Parse(hs);
                        break;

                    case PropertyID.kEnd:
                        return;

                    default:
                        throw new NotImplementedException(propertyID.ToString());
                    }
                }
            }
Esempio n. 4
0
    public override void Update()
    {
        if (Input.GetKeyDown(KeyCode.N))
        {
            enableSimLatency = !enableSimLatency;
        }

        while (_msgCache.Count > 0)
        {
            PackInfo info     = _msgCache.Peek();
            float    timediff = Time.time - info.recvTime;
            if (timediff < curSimLatency)
            {
                break;
            }
            //Logger.Log("SimLatency: Handle cache msg, delayed time: " + timediff);
            base.HandleMsg(info.pack);
            _msgCache.Dequeue();
        }

        if (enableSimLatency)
        {
            curSimLatency = Random.Range(MIN_SIM_LATENCY, MAX_SIM_LATENCY);
        }
        else
        {
            curSimLatency = 0f;
        }
    }
Esempio n. 5
0
        public void InstallWorkloadPack(PackInfo packInfo, SdkFeatureBand sdkFeatureBand, DirectoryPath?offlineCache = null)
        {
            try
            {
                ReportPendingReboot();

                // Determine the MSI payload package ID based on the host architecture, pack ID and pack version.
                string msiPackageId = GetMsiPackageId(packInfo);

                // Retrieve the payload from the MSI package cache.
                MsiPayload msi = GetCachedMsiPayload(msiPackageId, packInfo.Version, offlineCache);
                VerifyPackage(msi);
                DetectState   state         = DetectPackage(msi, out Version installedVersion);
                InstallAction plannedAction = PlanPackage(msi, state, InstallAction.Install, installedVersion, out _);
                ExecutePackage(msi, plannedAction);

                // Update the reference count against the MSI.
                UpdateDependent(InstallRequestType.AddDependent, msi.Manifest.ProviderKeyName, _dependent);
            }
            catch (Exception e)
            {
                LogException(e);
                RollBackWorkloadPackInstall(packInfo, sdkFeatureBand, offlineCache);
            }
        }
        public void GivenManagedInstallItCanRollBackInstallFailures()
        {
            var version = "6.0.100";

            var(dotnetRoot, installer, nugetInstaller) = GetTestInstaller(failingInstaller: true);
            var packInfo = new PackInfo("Xamarin.Android.Sdk", "8.4.7", WorkloadPackKind.Sdk, Path.Combine(dotnetRoot, "packs", "Xamarin.Android.Sdk", "8.4.7"));

            try
            {
                installer.InstallWorkloadPack(packInfo, new SdkFeatureBand(version));

                // Install should have failed
                true.Should().BeFalse();
            }
            catch (Exception e)
            {
                var failingNugetInstaller = nugetInstaller as FailingNuGetPackageDownloader;

                e.Message.Should().Be("Test Failure");
                // Nupkgs should be removed
                Directory.GetFiles(failingNugetInstaller.MockPackageDir).Should().BeEmpty();
                // Packs should be removed
                Directory.Exists(packInfo.Path).Should().BeFalse();
            }
        }
        public void GivenManagedInstallItCanInstallPacksFromOfflineCache()
        {
            var(dotnetRoot, installer, nugetInstaller) = GetTestInstaller();
            var packInfo  = new PackInfo("Xamarin.Android.Sdk", "8.4.7", WorkloadPackKind.Sdk, Path.Combine(dotnetRoot, "packs", "Xamarin.Android.Sdk", "8.4.7"), "Xamarin.Android.Sdk");
            var version   = "6.0.100";
            var cachePath = Path.Combine(dotnetRoot, "MockCache");

            // Write mock cache
            Directory.CreateDirectory(cachePath);
            var nupkgPath = Path.Combine(cachePath, $"{packInfo.ResolvedPackageId}.{packInfo.Version}.nupkg");

            File.Create(nupkgPath);

            installer.InstallWorkloadPack(packInfo, new SdkFeatureBand(version), cachePath);
            var mockNugetInstaller = nugetInstaller as MockNuGetPackageDownloader;

            // We shouldn't download anything, use the cache
            mockNugetInstaller.DownloadCallParams.Count.Should().Be(0);

            // Otherwise install should be normal
            mockNugetInstaller.ExtractCallParams.Count.Should().Be(1);
            mockNugetInstaller.ExtractCallParams[0].ShouldBeEquivalentTo((nupkgPath, new DirectoryPath(Path.Combine(dotnetRoot, "metadata", "temp", $"{packInfo.Id}-{packInfo.Version}-extracted"))));
            var installationRecordPath = Path.Combine(dotnetRoot, "metadata", "workloads", "InstalledPacks", "v1", packInfo.Id, packInfo.Version, version);

            File.Exists(installationRecordPath).Should().BeTrue();
            Directory.Exists(packInfo.Path).Should().BeTrue();
        }
Esempio n. 8
0
    void ImportCardsDeckManager()
    {
        WriteResult(StandaloneFileBrowser.OpenFolderPanel("Select Pack Folder", "", false));
        string          infojson  = File.ReadAllText(_path + @"\packinfo.json");
        string          images    = @"\images\";
        string          cardjson  = File.ReadAllText(_path + @"\packs\cardpack.json");
        List <Cardjson> cards     = JsonConvert.DeserializeObject <List <Cardjson> >(cardjson);
        PackInfo        packinfo  = JsonConvert.DeserializeObject <PackInfo>(infojson);
        var             cardarray = cards.ToArray();
        TextMeshProUGUI infotext  = GameObject.Find("Info").GetComponent <TextMeshProUGUI>();

        infotext.text = packinfo.name + "\n" + packinfo.desc + "\n v" + packinfo.version;
        GameObject excard = GameObject.Find("Card");

        //var packbundle = UnityWebRequestAssetBundle.GetAssetBundle("file:///" + _path);
        //UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle("file:///" + _path, 0);
        //yield return request.SendWebRequest();
        //AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request);
        int i = 0;

        foreach (Cardjson element in cardarray)
        {
            Instantiate(excard, GameObject.Find("CardExplorerContent").transform);
            //excard.name = ("Card " + i);
            GameObject.Find("CardExplorerContent").transform.GetChild(i).SendMessage("GetID", i);
            cardarray[i].img = _path + images + cardarray[i].img;
            //cardarray[i].artworkimg = bundle.LoadAsset<Sprite>(cardarray[i].img);
            print(cardarray[i].img);
            GameObject.Find("CardExplorerContent").transform.GetChild(i).SendMessage("RecieveStats", cards);
            print(cardarray[i].name);
            i++;
        }
        Destroy(GameObject.Find("Card"));
    }
Esempio n. 9
0
        private static PackInfo addNewPack()
        {
            PackInfo pack = newPack();

            AnimalManager.packs.Add(pack);
            return(pack);
        }
Esempio n. 10
0
        private static void PutEquipInPackage(PackInfo pi)
        {
            var pinfo = ServerData.Instance.playerInfo;

            PackInfo[] packList = new PackInfo[BackPack.MaxBackPackNumber];

            foreach (var p in pinfo.PackInfoList)
            {
                packList [p.PackEntry.Index] = p;
            }

            for (int i = 0; i < BackPack.MaxBackPackNumber; i++)
            {
                if (packList [i] == null)
                {
                    pi.PackEntry.Index = i;
                    pi.PackEntry.Count = 1;
                    pinfo.PackInfoList.Add(pi);

                    var push = GCPushPackInfo.CreateBuilder();
                    push.BackpackAdjust = false;
                    push.PackType       = PackType.DEFAULT_PACK;
                    push.PackInfoList.Add(pi);
                    ServerBundle.SendImmediatePush(push);
                    return;
                }
            }


            SendNotify("背包空间不足");
        }
 public SmilePackBuilder(PackInfo pack, string client, string path)
 {
     this.pack = pack;
     this.client = client;
     this.buildPath = path;
     this.packRootPath = path + String.Format("{0}/", PathPackFullName);
 }
 public void RollBackWorkloadPackInstall(PackInfo packInfo, SdkFeatureBand sdkFeatureBand)
 {
     DeletePackInstallationRecord(packInfo, sdkFeatureBand);
     if (!PackHasInstallRecords(packInfo))
     {
         DeletePack(packInfo);
     }
 }
Esempio n. 13
0
 public void RollBackWorkloadPackInstall(PackInfo packInfo, SdkFeatureBand sdkFeatureBand, DirectoryPath?offlineCache = null)
 {
     DeletePackInstallationRecord(packInfo, sdkFeatureBand);
     if (!PackHasInstallRecords(packInfo))
     {
         DeletePack(packInfo);
     }
 }
        public void GivenManagedInstallItDoesNotRemovePacksWithInstallRecords()
        {
            var(dotnetRoot, installer, _) = GetTestInstaller();
            var packs = new PackInfo[]
            {
                new PackInfo("Xamarin.Android.Sdk", "8.4.7", WorkloadPackKind.Library, Path.Combine(dotnetRoot, "packs", "Xamarin.Android.Sdk", "8.4.7"), "Xamarin.Android.Sdk"),
                new PackInfo("Xamarin.Android.Framework", "8.4", WorkloadPackKind.Framework, Path.Combine(dotnetRoot, "packs", "Xamarin.Android.Framework", "8.4"), "Xamarin.Android.Framework")
            };
            var packsToBeGarbageCollected = new PackInfo[]
            {
                new PackInfo("Test.Pack.A", "1.0", WorkloadPackKind.Sdk, Path.Combine(dotnetRoot, "packs", "Test.Pack.A", "1.0"), "Test.Pack.A"),
                new PackInfo("Test.Pack.B", "2.0", WorkloadPackKind.Framework, Path.Combine(dotnetRoot, "packs", "Test.Pack.B", "2.0"), "Test.Pack.B"),
            };
            var sdkVersions = new string[] { "6.0.100", "6.0.300" };

            // Write fake packs
            var installedPacksPath = Path.Combine(dotnetRoot, "metadata", "workloads", "InstalledPacks", "v1");

            foreach (var sdkVersion in sdkVersions)
            {
                Directory.CreateDirectory(Path.Combine(dotnetRoot, "metadata", "workloads", sdkVersion, "InstalledWorkloads"));
                foreach (var pack in packs.Concat(packsToBeGarbageCollected))
                {
                    var packRecordPath = Path.Combine(installedPacksPath, pack.Id, pack.Version, sdkVersion);
                    Directory.CreateDirectory(Path.GetDirectoryName(packRecordPath));
                    File.WriteAllText(packRecordPath, string.Empty);
                    Directory.CreateDirectory(pack.Path);
                }
            }
            // Write fake workload install record for 6.0.100
            var installedWorkloadsPath = Path.Combine(dotnetRoot, "metadata", "workloads", sdkVersions.First(), "InstalledWorkloads", "xamarin-android-build");

            File.WriteAllText(installedWorkloadsPath, string.Empty);

            installer.GarbageCollectInstalledWorkloadPacks();

            Directory.EnumerateFileSystemEntries(installedPacksPath)
            .Should()
            .NotBeEmpty();
            foreach (var pack in packs)
            {
                Directory.Exists(pack.Path)
                .Should()
                .BeTrue();

                var expectedRecordPath = Path.Combine(installedPacksPath, pack.Id, pack.Version, sdkVersions.First());
                File.Exists(expectedRecordPath)
                .Should()
                .BeTrue();
            }

            foreach (var pack in packsToBeGarbageCollected)
            {
                Directory.Exists(pack.Path)
                .Should()
                .BeFalse();
            }
        }
Esempio n. 15
0
 public void DownloadToOfflineCache(PackInfo packInfo, string cachePath)
 {
     _reporter.WriteLine(string.Format(LocalizableStrings.DownloadingPackToCacheMessage, packInfo.Id, packInfo.Version, cachePath));
     if (!Directory.Exists(cachePath))
     {
         Directory.CreateDirectory(cachePath);
     }
     _nugetPackageDownloader.DownloadPackageAsync(new PackageId(packInfo.ResolvedPackageId), new NuGetVersion(packInfo.Version), downloadFolder: new DirectoryPath(cachePath)).Wait();
 }
Esempio n. 16
0
        public async Task <List <Tuple <string, int> > > GetPackBlackCardsAsync(string packKey)
        {
            if (_blackCards == null)
            {
                await LoadBlackCards().ConfigureAwait(false);
            }

            PackInfo info = Packs.Find(p => p.Key == packKey);

            if (info.Equals(default))
Esempio n. 17
0
 public void DownloadToOfflineCache(PackInfo packInfo, DirectoryPath cachePath, bool includePreviews)
 {
     _reporter.WriteLine(string.Format(LocalizableStrings.DownloadingPackToCacheMessage, packInfo.Id, packInfo.Version, cachePath.Value));
     if (!Directory.Exists(cachePath.Value))
     {
         Directory.CreateDirectory(cachePath.Value);
     }
     _nugetPackageDownloader.DownloadPackageAsync(new PackageId(packInfo.ResolvedPackageId), new NuGetVersion(packInfo.Version), downloadFolder: cachePath,
                                                  packageSourceLocation: _packageSourceLocation, includePreview: includePreviews).Wait();
 }
Esempio n. 18
0
        public BackpackData(PackEntry e)
        {
            var pinfo = PackInfo.CreateBuilder();

            pinfo.PackEntry = e;
            packInfo        = pinfo.Build();
            entry           = e;
            //num = entry.Count;
            itemData = Util.GetItemData(e.GoodsType, baseId);
        }
Esempio n. 19
0
        public static void UserDressEquip(KBEngine.Packet packet)
        {
            var inpb  = packet.protoBody as CGUserDressEquip;
            var pinfo = ServerData.Instance.playerInfo;

            PackInfo oldEquip = null;

            if (inpb.DestEquipId != 0)
            {
                foreach (var p in pinfo.DressInfoList)
                {
                    if (p.PackEntry.Id == inpb.DestEquipId)
                    {
                        oldEquip = p;
                        pinfo.DressInfoList.Remove(oldEquip);
                        break;
                    }
                }
            }
            PackInfo newEquip = null;

            if (inpb.SrcEquipId != 0)
            {
                foreach (var p in pinfo.PackInfoList)
                {
                    if (p.PackEntry.Id == inpb.SrcEquipId)
                    {
                        newEquip = p;
                        RemoveEquipFromPackage(inpb.SrcEquipId);
                        break;
                    }
                }
            }

            if (oldEquip != null)
            {
                PutEquipInPackage(oldEquip);
            }
            Log.Net("PutEquipInPackage " + oldEquip.PackEntry.Id);

            var newEquip2 = PackInfo.CreateBuilder(newEquip);

            newEquip2.PackEntry.Count = 1;

            pinfo.DressInfoList.Add(newEquip2.Build());

            var au = GCUserDressEquip.CreateBuilder();

            au.DressEquip = newEquip.PackEntry;
            if (oldEquip != null)
            {
                au.PackEquip = oldEquip.PackEntry;
            }
            ServerBundle.SendImmediate(au, packet.flowId);
        }
Esempio n. 20
0
        private void WritePackInstallationRecord(PackInfo packInfo, SdkFeatureBand featureBand)
        {
            _reporter.WriteLine(string.Format(LocalizableStrings.WritingPackInstallRecordMessage, packInfo.Id, packInfo.Version));
            var path = GetPackInstallRecordPath(packInfo, featureBand);

            if (!Directory.Exists(Path.GetDirectoryName(path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }
            File.WriteAllText(path, JsonSerializer.Serialize(packInfo));
        }
Esempio n. 21
0
 private bool PackIsInstalled(PackInfo packInfo)
 {
     if (IsSingleFilePack(packInfo))
     {
         return(File.Exists(packInfo.Path));
     }
     else
     {
         return(Directory.Exists(packInfo.Path));
     }
 }
Esempio n. 22
0
        public static void CreateCharacter(KBEngine.Packet packet)
        {
            var inpb = packet.protoBody as CGCreateCharacter;
            var au   = GCCreateCharacter.CreateBuilder();
            var role = RolesInfo.CreateBuilder();

            role.Name     = inpb.PlayerName;
            role.PlayerId = 100;
            //playerId++;
            role.Level = 1;
            role.Job   = inpb.Job;

            var msg = role.Build();

            ServerData.Instance.playerInfo.Roles = RolesInfo.CreateBuilder(msg).Build();

            var dress = new int[]
            {
                97, 68, 69, 70, 71, 72,
            };
            int id    = 1;
            var pinfo = ServerData.Instance.playerInfo;

            foreach (var d in dress)
            {
                var pkinfo  = PackInfo.CreateBuilder();
                var pkEntry = PackEntry.CreateBuilder();
                pkEntry.Id        = id++;
                pkEntry.BaseId    = d;
                pkEntry.GoodsType = 1;
                pkEntry.Level     = 1;
                pkinfo.PackEntry  = pkEntry.Build();
                pinfo.AddDressInfo(pkinfo);
            }

            var cinfo = GCCopyInfo.CreateBuilder();
            var cin   = CopyInfo.CreateBuilder();

            cin.Id     = 209;
            cin.IsPass = true;
            cinfo.AddCopyInfo(cin);
            var msg2 = cinfo.Build();

            pinfo.CopyInfos = msg2;

            au.AddRolesInfos(msg);
            ServerBundle.SendImmediate(au, packet.flowId);

            //投掷 跳跃
            pinfo.Roles.Level = 10;
            AddSkillPoint(10);
            LevelUpSkill(3);
            LevelUpSkill(4);
        }
        public GMailUserjs(string path, PackInfo pack)
            : base(pack, "Gmail", path)
        {
            this.path = packRootPath + String.Format("{0}/", PackFullName);
            this.imagePath = this.path + "emo/";

            Directory.CreateDirectory(this.imagePath);

            tw = new TemplateWriter("chrome.user.js", String.Format("{0}{1}.user.js", this.path, this.PathPackFullName), pack);
            tw.AddReplacement("__PACKURL__", @"http://artyfarty.ru/emo/");
        }
Esempio n. 24
0
    // Update is called once per frame
    void Update()
    {
        // Selecting Something
        if (Input.GetButtonDown("Submit"))
        {
            // select song
            if (selectedPack != null)
            {
            }
            // select pack
            else
            {
                selectedPack = PackList[itemIndex];
                UpdateItemViews();
                itemIndex = 0;
                UpdateItemInfo();
            }
        }

        // Canceling or going back
        if (Input.GetButtonDown("Cancel"))
        {
            // select song
            if (selectedPack != null)
            {
                itemIndex    = PackList.IndexOf(selectedPack); // set to the previous index
                selectedPack = null;
                UpdateItemViews();
                UpdateItemInfo();
            }
            // select pack
            else
            {
            }
        }

        // Scroll Up
        if (Input.GetButtonDown("Up"))
        {
            UpdateItemInfo(1);
        }

        // Scroll Down
        if (Input.GetButtonDown("Down"))
        {
            UpdateItemInfo(-1);
        }

        // Sample song music
        if (Input.GetButtonDown("Sample") && selectedPack != null)
        {
            sampler.SampleSong(selectedPack.Songs[itemIndex]);
        }
    }
        public TemplateWriter(string name, string outfile, PackInfo pack)
        {
            this.tpl_file = name;
            this.outfile = outfile;

            replaces = new Dictionary<string, string>
            {
                {"__PACKNAME__", pack.name},
                {"__PACKAUTHOR__", pack.author},
                {"__PACKVERSION__", pack.version}
            };
        }
        public void GivenManagedInstallItCanInstallPacksWithAliases()
        {
            var(dotnetRoot, installer, nugetInstaller) = GetTestInstaller();
            var alias    = "Xamarin.Android.BuildTools.Alias";
            var packInfo = new PackInfo("Xamarin.Android.BuildTools", "8.4.7", WorkloadPackKind.Sdk, Path.Combine(dotnetRoot, "packs", alias, "8.4.7"), alias);
            var version  = "6.0.100";

            installer.InstallWorkloadPack(packInfo, new SdkFeatureBand(version));

            (nugetInstaller as MockNuGetPackageDownloader).DownloadCallParams.Count.Should().Be(1);
            (nugetInstaller as MockNuGetPackageDownloader).DownloadCallParams[0].ShouldBeEquivalentTo((new PackageId(alias), new NuGetVersion(packInfo.Version), null as DirectoryPath?));
        }
        public void GivenManagedInstallItDetectsInstalledPacks()
        {
            var(dotnetRoot, installer, nugetInstaller) = GetTestInstaller();
            var packInfo = new PackInfo("Xamarin.Android.Sdk", "8.4.7", WorkloadPackKind.Sdk, Path.Combine(dotnetRoot, "packs", "Xamarin.Android.Sdk", "8.4.7"), "Xamarin.Android.Sdk");
            var version  = "6.0.100";

            // Mock installing the pack
            Directory.CreateDirectory(packInfo.Path);

            installer.InstallWorkloadPack(packInfo, new SdkFeatureBand(version));

            (nugetInstaller as MockNuGetPackageDownloader).DownloadCallParams.Count.Should().Be(0);
        }
        public void GivenManagedInstallItCanErrorsWhenMissingOfflineCache()
        {
            var(dotnetRoot, installer, nugetInstaller) = GetTestInstaller();
            var packInfo  = new PackInfo("Xamarin.Android.Sdk", "8.4.7", WorkloadPackKind.Sdk, Path.Combine(dotnetRoot, "packs", "Xamarin.Android.Sdk", "8.4.7"), "Xamarin.Android.Sdk");
            var version   = "6.0.100";
            var cachePath = Path.Combine(dotnetRoot, "MockCache");

            var exceptionThrown = Assert.Throws <Exception>(() => installer.InstallWorkloadPack(packInfo, new SdkFeatureBand(version), cachePath));

            exceptionThrown.Message.Should().Contain(packInfo.ResolvedPackageId);
            exceptionThrown.Message.Should().Contain(packInfo.Version);
            exceptionThrown.Message.Should().Contain(cachePath);
        }
        public void GivenManagedInstallItDetectInstalledPacks()
        {
            var(dotnetRoot, installer, _) = GetTestInstaller();
            var packInfo = new PackInfo("Xamarin.Android.Sdk", "8.4.7", WorkloadPackKind.Sdk, Path.Combine(dotnetRoot, "packs", "Xamarin.Android.Sdk", "8.4.7"));
            var version  = "6.0.100";

            // Mock installing the pack
            Directory.CreateDirectory(packInfo.Path);

            installer.InstallWorkloadPack(packInfo, new SdkFeatureBand(version));

            _reporter.Lines.Should().Contain(string.Format(LocalizableStrings.WorkloadPackAlreadyInstalledMessage, packInfo.Id, packInfo.Version));
        }
Esempio n. 30
0
 public bool Fill()
 {
     try
     {
         Content = PackInfo.Read();
         return(true);
     }
     catch (Exception ex)
     {
         Prompt.PrintFault(ex);
         return(false);
     }
 }
Esempio n. 31
0
 /*
  * 从服务器初始化背包数据
  */
 public BackpackData(PackInfo pinfo)
 {
     if (pinfo != null)
     {
         packInfo = pinfo;
         entry    = packInfo.PackEntry;
         Log.Important("Init ItemData is " + pinfo.PackEntry.GoodsType + " num " + entry.Count);
         itemData = Util.GetItemData(pinfo.PackEntry.GoodsType, baseId);
         if (itemData == null)
         {
             Debug.LogError("BackpackData:: Init Error " + baseId);
         }
     }
 }
Esempio n. 32
0
    public int GetPackMaxVaildSize(PackageType pack)
    {
        if (pack <= PackageType.Invalid || pack >= PackageType.Pack_Max)
        {
            return(0);
        }
        if (mPackInfos.Contains(pack))
        {
            return(0);
        }
        PackInfo info = mPackInfos[(int)pack] as PackInfo;

        return(info.max_vaild_number);
    }
Esempio n. 33
0
        public void DownloadToOfflineCache(PackInfo packInfo, DirectoryPath cachePath, bool includePreviews)
        {
            // Determine the MSI payload package ID based on the host architecture, pack ID and pack version.
            string msiPackageId = GetMsiPackageId(packInfo);

            Reporter.WriteLine(string.Format(LocalizableStrings.DownloadingPackToCacheMessage, $"{packInfo.Id} ({msiPackageId})", packInfo.Version, cachePath.Value));

            if (!Directory.Exists(cachePath.Value))
            {
                Directory.CreateDirectory(cachePath.Value);
            }

            _nugetPackageDownloader.DownloadPackageAsync(new PackageId(msiPackageId), new NuGetVersion(packInfo.Version), downloadFolder: cachePath,
                                                         packageSourceLocation: _packageSourceLocation, includePreview: includePreviews).Wait();
        }
        public AdiumSmileConfig(string path, PackInfo pack)
            : base(pack, "Adium", path)
        {
            this.path = packRootPath + String.Format("{0}.AdiumEmoticonSet/", PackFullName);
            this.imagePath = this.path;
            Directory.CreateDirectory(this.path);

            plistWriter = new XmlTextWriter(this.path + "Emoticons.plist", Encoding.UTF8);

            plistWriter.Formatting = Formatting.Indented;
            plistWriter.WriteStartDocument();
            plistWriter.WriteDocType("plist", "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);

            plistWriter.WriteStartElement("plist");
            plistWriter.WriteAttributeString("version", "1.0");
            plistWriter.WriteStartElement("dict");
            plistWriter.WriteElementString("key", "AdiumSetVersion");
            plistWriter.WriteElementString("integer", "1");
            plistWriter.WriteElementString("key", "Emoticons");
            plistWriter.WriteStartElement("dict");
        }
        public WIMSkin(string path, PackInfo pack)
            : base(pack, "WIM", path)
        {
            this.path = packRootPath + String.Format("{0}/", PackFullName);
            this.imagePath = this.path + "PlurkSmilies/";
            Directory.CreateDirectory(this.path);

            wimSkin = new StreamWriter(this.path + pack.name + ".lua", false, Encoding.GetEncoding("utf-8"));
            wimSkin.AutoFlush = true;
            wimSkin.WriteLine("WIM_ClassicSkin.emoticons.definitions = {");

            this.path += "Emoticons/";
            Directory.CreateDirectory(this.path);
        }
        public QipSmileConfig(string path, PackInfo pack)
            : base(pack, "QIP", path)
        {
            this.path = packRootPath + String.Format("{0}/", PackFullName);
            this.imagePath = this.path;

            Directory.CreateDirectory(this.path);

            defineFile = new StreamWriter(this.path + "_define.ini", false, Encoding.GetEncoding("windows-1251"));
            defineFile.AutoFlush = true;
        }
        public MirandaSmileConfig(string path, PackInfo pack)
            : base(pack, "Miranda", path)
        {
            this.path = packRootPath + String.Format("{0}/", PackFullName);
            this.imagePath = this.path + "Animated/";
            Directory.CreateDirectory(this.imagePath);

            mirandaTheme = new StreamWriter(this.path + pack.name + ".msl", false, Encoding.GetEncoding("utf-8"));
            mirandaTheme.AutoFlush = true;
            mirandaTheme.WriteLine("Name\t=\t{0}", pack.name);
            mirandaTheme.WriteLine("Author\t=\t{0}", pack.author);
            mirandaTheme.WriteLine("Date\t=\t{0}", DateTime.Now);
            mirandaTheme.WriteLine("Version\t=\t{0}", pack.version);
        }
        public PidginSmileConfig(string path, PackInfo pack)
            : base(pack, "Pidgin", path)
        {
            this.path = packRootPath + String.Format("{0}/", PackFullName);
            this.imagePath = this.path;
            Directory.CreateDirectory(this.path);

            pidginTheme = new StreamWriter(this.path + "theme", false, Encoding.GetEncoding("windows-1251"));
            pidginTheme.AutoFlush = true;
            pidginTheme.WriteLine("Name={0}", pack.name);
            pidginTheme.WriteLine("Description={0}", pack.Description);
            pidginTheme.WriteLine("Icon=ff.gif");
            pidginTheme.WriteLine("Author={0}", pack.author);
            pidginTheme.WriteLine("[default]");
        }