Example #1
0
        public static SubfileBuilder GetBuilder(DatController datController, Patch.Patch patch)
        {
            try
            {
                SubfileBuilder builder;
                switch (patch.ContentType)
                {
                case PatchContentType.Text:
                    builder = new TextSubfileBuilder(datController, patch);
                    break;

                case PatchContentType.Image:
                case PatchContentType.Sound:
                case PatchContentType.Font:
                case PatchContentType.Texture:
                    builder = new BinarySubfileBuilder(datController, patch);
                    break;

                default:
                    throw new ArgumentException($"тип файлов {patch.ContentType} не обрабатывается программой.");
                }

                return(builder.InitResult == -1 ? null : builder);
            }
            catch (Exception e)
            {
                Logger.Write(e.Message);
                return(null);
            }
        }
Example #2
0
        protected void Init(DatController datController, Patch.Patch patch)
        {
            try
            {
                using (var con = new SQLiteConnection($"Data Source = {patch.Path}; Version = 3;"))
                {
                    con.Open();

                    Files = Database.GetFilesByClientDat(con, datController.Dat.ClientDat.Id);
                }

                IsOldClientDat = Files.Count > datController.Dat.SubfileInfo.Count;

                InitResult = 0;
            }
            catch (Exception ex)
            {
                Logger.Write(ex.Message);
                Files.Clear();
                InitResult = -1;
            }
        }
Example #3
0
 public DatPreloader(DatController datController, List <uint> patchFiles)
 {
     _patchFiles    = patchFiles;
     _datController = datController;
 }
Example #4
0
 public BinarySubfileBuilder(DatController datController, Patch.Patch patch)
 {
     Init(datController, patch);
 }