Beispiel #1
0
        public static DeltaAsset QueueImage(string classname, string pathname, ImageModifications mods, DeltaExportPatch patch)
        {
            //SHA1 this file for version control
            byte[] hashBytes = new SHA1Managed().ComputeHash(File.ReadAllBytes(pathname));
            string hash      = string.Concat(hashBytes.Select(b => b.ToString("x2")));

            //Get the game pathname
            ArkAsset asset          = ArkAsset.GetAssetFromFolderPath(pathname, patch.installation);
            string   namespacedName = asset.fullName;

            //Check for matching file pathnames and versions
            var matches       = patch.persist.external_assets.Where(x => x.sha1 == hash && x.name == namespacedName).ToArray();
            var queuedMatches = patch.queued_images.Where(x => x.name == namespacedName).ToArray();

            //Create or get
            string hiId;
            string loId;

            if (matches.Length >= 1)
            {
                //We'll use this existing image
                hiId = matches[0].id_hires;
                loId = matches[0].id_lores;
            }
            else if (queuedMatches.Length >= 1)
            {
                //We'll use the existing queued image
                hiId = queuedMatches[0].hiId;
                loId = queuedMatches[0].loId;
            }
            else
            {
                //We'll generate this

                //Generate IDs for the high res image and thumbnail
                hiId = GenerateUniqueImageID(patch);
                loId = GenerateUniqueImageID(patch);

                //Now, create an object and add it to a queue
                patch.queued_images.Add(new QueuedImage
                {
                    classname = classname,
                    pathname  = pathname,
                    hiId      = hiId,
                    loId      = loId,
                    mods      = mods,
                    sha1      = hash,
                    name      = namespacedName
                });
            }

            //Now, create an ArkImage
            DeltaAsset r = new DeltaAsset
            {
                image_thumb_url = GetAssetsUrl() + loId + FORMAT_TYPE,
                image_url       = GetAssetsUrl() + hiId + FORMAT_TYPE
            };

            return(r);
        }
Beispiel #2
0
        public static ArkImage QueueImage(string classname, string pathname, ImageModifications mods)
        {
            //Generate IDs for the high res image and thumbnail
            string hiId = GenerateUniqueImageID();
            string loId = GenerateUniqueImageID();

            //Now, create an ArkImage
            ArkImage r = new ArkImage
            {
                image_thumb_url = GetAssetsUrl() + loId + FORMAT_TYPE,
                image_url       = GetAssetsUrl() + hiId + FORMAT_TYPE
            };

            //Now, create an object and add it to a queue
            queue.Add(new QueuedImage
            {
                classname = classname,
                pathname  = pathname,
                hiId      = hiId,
                loId      = loId,
                mods      = mods
            });

            return(r);
        }
Beispiel #3
0
 //Applies the Quality function
 private void btnQuality_Click(object sender, RoutedEventArgs e)
 {
     if (Load())
     {
         _processedImage = ImageModifications.Quality(5);
         DisplayProcessedWindow();
     }
     else
     {
         NotLoadedMessage();
     }
 }
Beispiel #4
0
 //Applies the Sepia filter
 private void btnSepia_Click(object sender, RoutedEventArgs e)
 {
     if (Load())
     {
         _processedImage = ImageModifications.Filter(MatrixFilters.Sepia);
         DisplayProcessedWindow();
     }
     else
     {
         NotLoadedMessage();
     }
 }
Beispiel #5
0
        //Resets the current image back to its original state
        private void btnReset_Click(object sender, RoutedEventArgs e)
        {
            if (Load())
            {
                _processedImage = new BitmapImage(new Uri(_imgPath));
                DisplayProcessedWindow();

                ImageModifications.Initialize(_imgPath);
            }
            else
            {
                NotLoadedMessage();
            }
        }
Beispiel #6
0
        private void btnLoad_Click(object sender, RoutedEventArgs e)
        {
            //Opens a File System Dialog
            OpenFileDialog op = new OpenFileDialog();

            op.Title = "Select a picture";
            //Filters the seen results by the appropriate extensions
            op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                        "Portable Network Graphic (*.png)|*.png";

            //Loads the chosen image and displays it in a separate window
            //Prepares the newly loaded image for the upcoming modifications
            if (op.ShowDialog() == true)
            {
                _imgPath = op.FileName;

                DisplayOriginalWindow();

                ImageModifications.Initialize(_imgPath);
            }
        }
Beispiel #7
0
 public static DeltaAsset QueueImage(ClassnamePathnamePair name, ImageModifications mods, DeltaExportPatch patch)
 {
     return(QueueImage(name.classname, name.pathname, mods, patch));
 }
Beispiel #8
0
 public static ArkImage QueueImage(ClassnamePathnamePair name, ImageModifications mods)
 {
     return(QueueImage(name.classname, name.pathname, mods));
 }