Пример #1
1
        public string TaskCreate(ulong SequenceId, Packs Package, CONST.LaunchMode LaunchMode, TaskFileDescription[] InputFiles, TaskFileDescription[] OutputFiles, string[] ParamKeys, string[] ParamValues)
        {
            lock (_taskServiceLock)
            {
                Task task = new Task(SequenceId, Package, LaunchMode, InputFiles, OutputFiles);

                if (ParamKeys != null && ParamKeys.Length > 0)
                {
                    if (ParamKeys.Length != ParamValues.Length)
                        throw new Exception("Param keys and values lengths must be equal!");

                    int length = ParamKeys.Length;
                    for (int i = 0; i < length; i++)
                        task.Params[ParamKeys[i]] = ParamValues[i];
                }

                Log.Debug(String.Format(
                    "Цепочка {0}: создана задача {1}", SequenceId, task.TaskId
                ));
                task.Save();

                return task.TaskId;
            }
        }
Пример #2
0
        private AssetManagerInfo _Read(StringStreamReader reader)
        {
            Version = reader.ReadString();

            Date = DateTime.Parse(reader.ReadString());

            var count = reader.ReadNumber();

            for (var i = 0; i < count; ++i)
            {
                var key   = reader.ReadIndexString("/");
                var value = new AssetPackInfo()._Read(reader);
                Packs.Add(key, value);
            }

            count = reader.ReadNumber();
            for (var i = 0; i < count; ++i)
            {
                var key   = reader.ReadIndexString("/");
                var value = new AssetInfo()._Read(reader);
                Assets.Add(key, value);
            }

            return(this);
        }
Пример #3
0
        private void loadBinaryFromPaths(object sender, object arg)
        {
            BackgroundWorker     backgroundWorker = (BackgroundWorker)sender;
            IEnumerable <string> paths            = (IEnumerable <string>)arg;

            for (Int32 i = 0; i < paths.Count(); ++i)
            {
                String path = paths.ElementAt(i);
                Pack   pack = null;

                if (packLookupCache.TryGetValue(path.GetHashCode(), out pack) == false)
                {
                    pack = Pack.LoadBinary(path);

                    if (pack != null)
                    {
                        packLookupCache.Add(path.GetHashCode(), pack);
                        Packs.Add(pack);

                        foreach (Asset asset in pack.Assets)
                        {
                            if (false == AssetsByType.ContainsKey(asset.Type))
                            {
                                AssetsByType.Add(asset.Type, new List <Asset>());
                            }

                            AssetsByType[asset.Type].Add(asset);
                        }
                    }
                }

                Single percent = (Single)(i + 1) / (Single)paths.Count();
                backgroundWorker.ReportProgress((Int32)(percent * 100.0f), System.IO.Path.GetFileName(path));
            }
        }
 public void SavePacks(Packs packs)
 {
     if (packs.PacksID == 0)
     {
         context.Packss.Add(packs);
     }
     else
     {
         Packs dbEntry = context.Packss.Find(packs.PacksID);
         if (dbEntry != null)
         {
             dbEntry.Name                    = packs.Name;
             dbEntry.OwnerDescription        = packs.OwnerDescription;
             dbEntry.wymiarX                 = packs.wymiarX;
             dbEntry.wymiarY                 = packs.wymiarY;
             dbEntry.wymiarZ                 = packs.wymiarZ;
             dbEntry.Waga                    = packs.Waga;
             dbEntry.dataprzyjeciadomagazynu = packs.dataprzyjeciadomagazynu;
             dbEntry.datawyslaniazmagazynu   = packs.datawyslaniazmagazynu;
             dbEntry.dataodebrania           = packs.dataodebrania;
             dbEntry.WarehousesID            = packs.WarehousesID;
             dbEntry.personID                = packs.personID;
             //  dbEntry.CarriageID = packs.CarriageID;
         }
     }
     context.SaveChanges();
 }
Пример #5
0
        public void InstallUpdates()
        {
            var toInstall = Packs
                            .Where(x => x.Version > OldVersion)
                            .OrderBy(x => x.Version);

            foreach (var itm in toInstall)
            {
                Log.AppendFormat("Installing pack {0}...{1}", itm.Version, Environment.NewLine);
                itm.Load();

                var args = new BeforePackInstallEventArgs()
                {
                    Pack = itm
                };
                OnBeforeInstallPack(args);

                if (!args.Cancel)
                {
                    itm.Install();
                    Log.Append(itm.Log);
                    OnAfterInstallPack(itm);
                }
                ;

                Log.AppendFormat("Pack {0} has been installed{1}{1}", itm.Version, Environment.NewLine);
            }
            ;
        }
Пример #6
0
    // packFileName is the file name relative to the steamingAssets folder
    public void PrecomptePacks(string packFileName)
    {
        string path       = Application.streamingAssetsPath + "/" + packFileName;
        string jsonString = File.ReadAllText(path);
        Packs  allData    = JsonUtility.FromJson <Packs>(jsonString);

        string dirName  = "";
        string fileName = "";

        DirFileName(packFileName, ref dirName, ref fileName);

        // First we identify and remove all the noisy packs
        Packs newAllData = new Packs();

        for (int i = 0; i < allData.data.Count; i++)
        {
            bool noisyPack = IdentifyRemoveNoisyPack(packFileName, i);
            if (!noisyPack)
            {
                newAllData.data.Add(allData.data.ElementAt(i));
            }
            else
            {
                Debug.Log("packFileName, i: " + packFileName + ", " + i + " is noisy and removed from data");
            }
        }
        File.WriteAllText(path, JsonUtility.ToJson(newAllData));

        for (int i = 0; i < newAllData.data.Count; i++)
        {
            PrecomptePack(packFileName, i,
                          dirName + "_precompute_unity/" + fileName + "_" + i,
                          dirName + "_precompute_python/" + fileName + "_" + i);
        }
    }
        private PAP.GenericResponse ReadPapXml()
        {
            try
            {
                var response        = new PAP.GenericResponse();
                var xmlDoc          = XDocument.Load(@"Files\ReceivePAP.xml");
                var packxmldata     = new Packs();
                var packlistxmldata = new PackLists();
                var settings        = new XmlReaderSettings {
                    IgnoreWhitespace = true
                };
                var buffer    = Encoding.ASCII.GetBytes(xmlDoc.ToString());
                var xmlStream = new MemoryStream(buffer);
                using (var xmlReader = XmlReader.Create(xmlStream, settings))
                {
                    var packXmlSerializer     = new XmlSerializer(packxmldata.GetType());
                    var packlistXmlSerializer = new XmlSerializer(packlistxmldata.GetType());
                    packxmldata                  = (Packs)packXmlSerializer.Deserialize(xmlReader);
                    packlistxmldata              = (PackLists)packlistXmlSerializer.Deserialize(xmlReader);
                    response.FailureInformation  = CreatePacksFromXml(packxmldata.PackCollection).FailureInformation;
                    response.FailureInformation += CreatePackListsFromXml(packlistxmldata.PackListCollection);
                }

                return(response);
            }
            catch (Exception ex)
            {
                LoggingMediator.Log("ReadPapXml");
                LoggingMediator.Log(ex);
                throw;
            }
        }
Пример #8
0
        private void loadFromFileNames(object sender, object arg)
        {
            BackgroundWorker     backgroundWorker = (BackgroundWorker)sender;
            IEnumerable <string> fileNames        = (IEnumerable <string>)arg;

            for (int i = 0; i < fileNames.Count(); ++i)
            {
                string fileName = fileNames.ElementAt(i);
                Pack   pack     = null;

                if (!Packs.TryGetValue(fileName.GetHashCode(), out pack))
                {
                    pack = Pack.Load(fileName);

                    if (pack != null)
                    {
                        Packs.Add(fileName.GetHashCode(), pack);

                        foreach (Asset asset in pack.Assets.Values)
                        {
                            if (!AssetsByType.ContainsKey(asset.Type))
                            {
                                AssetsByType.Add(asset.Type, new List <Asset>());
                            }

                            AssetsByType[asset.Type].Add(asset);
                        }
                    }
                }

                float percent = (Single)(i + 1) / (Single)fileNames.Count();
                backgroundWorker.ReportProgress((int)(percent * 100.0f), System.IO.Path.GetFileName(fileName));
            }
        }
Пример #9
0
        public string TaskCreate(ulong SequenceId, Packs Package, CONST.LaunchMode LaunchMode, TaskFileDescription[] InputFiles, TaskFileDescription[] OutputFiles, string[] ParamKeys, string[] ParamValues)
        {
            lock (_taskServiceLock)
            {
                Task task = new Task(SequenceId, Package, LaunchMode, InputFiles, OutputFiles);

                if (ParamKeys != null && ParamKeys.Length > 0)
                {
                    if (ParamKeys.Length != ParamValues.Length)
                    {
                        throw new Exception("Param keys and values lengths must be equal!");
                    }

                    int length = ParamKeys.Length;
                    for (int i = 0; i < length; i++)
                    {
                        task.Params[ParamKeys[i]] = ParamValues[i];
                    }
                }

                Log.Debug(String.Format(
                              "Цепочка {0}: создана задача {1}", SequenceId, task.TaskId
                              ));
                task.Save();

                return(task.TaskId);
            }
        }
Пример #10
0
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Set.ToStream(output);
     Packs.ToStream(output);
     Documents.ToStream(output);
 }
Пример #11
0
        private void StartClicked(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            if (Player.All.Any(p => p.Groups.Any(x => x.Count > 0)))
            {
                if (MessageBoxResult.Yes ==
                    TopMostMessageBox.Show(
                        "Some players have cards currently loaded.\n\nReset the game before starting limited game?",
                        "Warning", MessageBoxButton.YesNo))
                {
                    Program.Client.Rpc.ResetReq();
                }
            }
            if (addCards.Visibility == Visibility.Visible)
            {
                if (addCards.SelectedIndex == 1)
                {
                    Program.Client.Rpc.AddPacksReq(Packs.Select(p => p.Id).ToArray(), false);
                }
                else if (addCards.SelectedIndex == 0)
                {
                    Program.Client.Rpc.AddPacksReq(Packs.Select(p => p.Id).ToArray(), true);
                }
            }
            else
            {
                Program.Client.Rpc.StartLimitedReq(Packs.Select(p => p.Id).ToArray());
            }
            Close();
            // Solves an issue where Dialog isn't the active window anymore if the confirmation dialog above was shown
            //fix MAINWINDOW bug
            WindowManager.PlayWindow.Activate();
        }
Пример #12
0
        public void LoadBedrockPacks(IProgressReceiver progressReceiver, DirectoryInfo directoryInfo)
        {
            progressReceiver?.UpdateProgress(0, "Loading bedrock .MCPack files...");

            var files = directoryInfo.EnumerateFiles("*.mcpack").ToArray();

            for (var index = 0; index < files.Length; index++)
            {
                var file = files[index];
                progressReceiver?.UpdateProgress(index * (files.Length / 100), "Loading bedrock .MCPack files...", file.Name);

                try
                {
                    using (var archive = new ZipArchive(file.Open(FileMode.Open, FileAccess.Read), ZipArchiveMode.Read))
                    {
                        MCPack pack = new MCPack(archive);
                        Packs.Add(pack);
                    }
                }
                catch (Exception ex)
                {
                    Log.Warn(ex, $"Failed to load bedrock .MCPack file: {file.Name}: {ex}");
                }
            }
        }
Пример #13
0
        public static SmileyPack AddPack(string name)
        {
            var pack = new SmileyPack(name, false);

            Directory.CreateDirectory(GetPath(pack));
            Packs.Add(pack);
            return(pack);
        }
Пример #14
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Set.ToBytes(),
                Packs.ToBytes(),
                Documents.ToBytes()));
 }
Пример #15
0
        public static void SetCurrentPack(string packName)
        {
            CurrentPack = Packs.FirstOrDefault(p => p.Name == packName);

            if (CurrentPack == null)
            {
                CurrentPack = Packs.First();
            }
        }
Пример #16
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Packs packs = await db.Packs.FindAsync(id);

            db.Packs.Remove(packs);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #17
0
        /// <summary>
        ///     Update to the current version.
        /// </summary>
        /// <param name="detectDataChanges">Boolean indicating whether the update should also look for changes in data.</param>
        /// <param name="progress">Optional object to which update progress is reported.</param>
        /// <returns>Returns the <see cref="UpdateReport" /> containing all changes.</returns>
        /// <exception cref="InvalidOperationException">Definition is up-to-date.</exception>
        public UpdateReport Update(bool detectDataChanges, IProgress <UpdateProgress> progress = null)
        {
            if (DefinitionVersion == GameVersion)
            {
                throw new InvalidOperationException();
            }

            var previousVersion = DefinitionVersion;

            var exdPackId          = new PackIdentifier("exd", PackIdentifier.DefaultExpansion, 0);
            var exdPack            = Packs.GetPack(exdPackId);
            var exdOldKeepInMemory = exdPack.KeepInMemory;

            exdPack.KeepInMemory = true;

            string       tempPath = null;
            UpdateReport report;

            try {
                using (var zip = new ZipFile(StateFile.FullName, ZipEncoding)) {
                    tempPath = ExtractPacks(zip, previousVersion);
                    var previousPack = new PackCollection(Path.Combine(tempPath, previousVersion));
                    previousPack.GetPack(exdPackId).KeepInMemory = true;
                    var previousDefinition = ReadDefinition(zip);

                    var updater = new RelationUpdater(previousPack, previousDefinition, Packs, GameVersion, progress);

                    var changes = updater.Update(detectDataChanges);
                    report = new UpdateReport(previousVersion, GameVersion, changes);

                    var definition = updater.Updated;

                    StorePacks(zip);
                    StoreDefinition(zip, definition, DefinitionFile);
                    StoreDefinition(zip, definition, string.Format("{0}/{1}", definition.Version, DefinitionFile));
                    StoreReport(zip, report);
                    zip.Save();

                    GameData.Definition = definition;
                    GameData.Definition.Compile();
                }
            } finally {
                if (exdPack != null)
                {
                    exdPack.KeepInMemory = exdOldKeepInMemory;
                }
                if (tempPath != null)
                {
                    try {
                        Directory.Delete(tempPath, true);
                    } catch {
                        Console.Error.WriteLine("Failed to delete temporary directory {0}.", tempPath);
                    }
                }
            }
            return(report);
        }
Пример #18
0
 // Use this for initialization
 void Start()
 {
     gameObject.tag = "Boosterpack";
     pieces         = new List <GameObject>();
     //canvas = GameObject.Find("Canvas").GetComponent<CanvasManager>();
     manager     = GameObject.Find("_Manager").GetComponent <CameraScript>();
     packButtons = GameObject.FindGameObjectsWithTag("Packselection");
     packs       = GameObject.Find("Packs").GetComponent <Packs>();
 }
Пример #19
0
        public ViewResult Edit(int?PacksID)
        {
            Packs packss = repository.Packss.FirstOrDefault(p => p.PacksID == PacksID);

            Populate(packss.WarehousesID);
            Populate1(packss.personID);

            return(View(packss));
        }
Пример #20
0
        /// <summary>
        /// Add a pack to main list
        /// </summary>
        /// <param name="task"></param>
        public static void AddPack(LanguagePack pack)
        {
            if (Packs == null)
            {
                Packs = new Dictionary <string, LanguagePack>();
            }

            Packs.Add(pack.Language, pack);
        }
Пример #21
0
        private void RemoveClicked(object sender, EventArgs e)
        {
            var btn = sender as Button;

            if (btn != null)
            {
                Packs.Remove((SelectedPack)btn.DataContext);
            }
        }
        public RedirectToRouteResult AddtoCart(int?PacksID, string returnUrl)
        {
            Packs pack = repository.Packss.FirstOrDefault(p => p.PacksID == PacksID);

            if (pack != null)
            {
                GetCart().AddPackstoCarriage(pack, 1);
            }
            return(RedirectToAction("Index", new { returnUrl }));
        }
Пример #23
0
        public void Delete(ShaderPack pack)
        {
            if (_enabledPack == pack)
            {
                _enabledPack = null;
            }

            Packs.Remove(pack);
            _shaderPackService.DeleteFromDisk(pack);
        }
        public RedirectToRouteResult RemoveFromCart(int?PacksID, string returnUrl)
        {
            Packs pack = repository.Packss.FirstOrDefault(p => p.PacksID == PacksID);

            if (pack != null)
            {
                GetCart().RemoveLine(pack);
            }
            return(RedirectToAction("Index", new { returnUrl }));
        }
Пример #25
0
        private Lgb.LgbFile TryGetLgb(string name)
        {
            var path = BasePath + name;

            if (Packs.TryGetFile(path, out var file))
            {
                return(new Lgb.LgbFile(file));
            }
            return(null);
        }
Пример #26
0
        public override void ToStream(Stream output)
        {
            output.Write(TLUtils.SignatureToBytes(Signature));
            HashValue.ToStream(output);
            Sets.ToStream(output);

            Packs.ToStream(output);
            Documents.ToStream(output);
            MessagesStickerSets.ToStream(output);
        }
Пример #27
0
        public ActionResult Delete(int PacksID)
        {
            Packs delpacks = repository.DeletePacks(PacksID);

            if (delpacks != null)
            {
                TempData["message"] = string.Format("Usunięto {0}", delpacks.Name);
            }
            return(RedirectToAction("Index"));
        }
Пример #28
0
        public async Task <ActionResult> Edit([Bind(Include = "id,name,price")] Packs packs)
        {
            if (ModelState.IsValid)
            {
                db.Entry(packs).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(packs));
        }
Пример #29
0
        /// <summary>
        /// Load pack from bytes
        /// </summary>
        /// <param name="s">Bytes to load</param>
        public static void LoadFromBytes(byte[] s)
        {
            if (Packs == null)
            {
                Packs = new Dictionary <string, LanguagePack>();
            }

            LanguagePack lp = LanguagePack.Load(s);

            Packs.Add(lp.Language, lp);
        }
        public Packs DeletePacks(int PacksID)
        {
            Packs dbEntry = context.Packss.Find(PacksID);

            if (dbEntry != null)
            {
                context.Packss.Remove(dbEntry);
                context.SaveChanges();
            }
            return(dbEntry);
        }
Пример #31
0
    // Use this for initialization
    void Start()
    {
        mute = false;
        deckHolder.SetActive(false);
        if (GameObject.Find("Deck") == null)
        {
            deckHolder.SetActive(true);
        }
        deck = GameObject.Find("Deck").GetComponent <DeckScript>();

        boosterStartPosition = packholder.transform.position;

        current_volume       = 0.25f;
        AudioListener.volume = current_volume;
        cards_up             = 0;
        gameObject.tag       = "Manager";
        doneholder.GetComponent <DoneButton>().disableDone();

        Vector3[] positions = new Vector3[cards.Length];
        for (int i = 0; i < cards.Length; i++)
        {
            positions[i] = cards[i].GetComponent <MainCard>().transform.position;
        }
        foreach (GameObject card in cards)
        {
            card.GetComponent <MainCard>().initializePositions(positions);
        }
        disableAllCards();

        newCardFlag         = false;
        AudioListener.pause = false;

        booster           = GameObject.FindGameObjectWithTag("Boosterpack");
        startPositionPack = booster.transform.position;

        packText = GameObject.Find("CurrentPack");

        inScaling   = false;
        currentPack = 0;
        initBoosters();
        disableAllBoosters();
        enableBooster();
        packText.GetComponent <Text>().text = "Current Pack: " + boosterpacks[currentPack].name;
        packButtons     = GameObject.FindGameObjectsWithTag("Packselection");
        inBoosterMove   = false;
        cardsSelected   = 0;
        inSelectionMove = false;
        notInZone       = true;

        packs = GameObject.Find("Packs").GetComponent <Packs>();

        bank = GameObject.Find("BankAmount").GetComponent <Text>();
        SetBankText(deck.bankAmount);
    }
Пример #32
0
 public static AssetLoadInfo[] GetPack(Packs pack)
 {
     return PACKS[(int)pack];
 }
Пример #33
0
    // Use this for initialization
    void Start()
    {
        mute = false;
        deckHolder.SetActive(false);
        if (GameObject.Find("Deck") == null)
        {
            deckHolder.SetActive(true);
        }
        deck = GameObject.Find("Deck").GetComponent<DeckScript>();

        boosterStartPosition = packholder.transform.position;

        current_volume = 0.25f;
        AudioListener.volume = current_volume;
        cards_up = 0;
        gameObject.tag = "Manager";
        doneholder.GetComponent<DoneButton>().disableDone();

        Vector3[] positions = new Vector3[cards.Length];
        for (int i = 0; i < cards.Length; i++)
        {
            positions[i] = cards[i].GetComponent<MainCard>().transform.position;
        }
        foreach (GameObject card in cards)
        {
            card.GetComponent<MainCard>().initializePositions(positions);
        }
        disableAllCards();

        newCardFlag = false;
        AudioListener.pause = false;

        booster = GameObject.FindGameObjectWithTag("Boosterpack");
        startPositionPack = booster.transform.position;

        packText = GameObject.Find("CurrentPack");

        inScaling = false;
        currentPack = 0;
        initBoosters();
        disableAllBoosters();
        enableBooster();
        packText.GetComponent<Text>().text = "Current Pack: " + boosterpacks[currentPack].name;
        packButtons = GameObject.FindGameObjectsWithTag("Packselection");
        inBoosterMove = false;
        cardsSelected = 0;
        inSelectionMove = false;
        notInZone = true;

        packs = GameObject.Find("Packs").GetComponent<Packs>();

        bank = GameObject.Find("BankAmount").GetComponent<Text>();
        SetBankText(deck.bankAmount);
    }
Пример #34
0
 public double EstimateTime(Packs Package, CONST.LaunchMode LaunchMode, TaskFileDescription[] InputFiles, TaskFileDescription[] OutputFiles, string[] ParamKeys, string[] ParamValues)
 {
     string taskId = TaskCreate(0, Package, LaunchMode, InputFiles, OutputFiles, ParamKeys, ParamValues);
     return TaskEstimateTime(taskId);
 }
Пример #35
0
 // Use this for initialization
 void Start()
 {
     gameObject.tag = "Boosterpack";
     pieces = new List<GameObject>();
     //canvas = GameObject.Find("Canvas").GetComponent<CanvasManager>();
     manager = GameObject.Find("_Manager").GetComponent<CameraScript>();
     packButtons = GameObject.FindGameObjectsWithTag("Packselection");
     packs = GameObject.Find("Packs").GetComponent<Packs>();
 }