Layer arrange

HI
How to arrange Layer[5] forward to Layer[2]

 using (PsdImage image = (PsdImage)Image.Load("layerTest1.psd"))
  {
       var layer = image.Layers[5];
                 
  }

Thank you

@Tim_Pan

I am afraid requested support is unavailable in API. However, I have added a ticket with ID PSDNET-832 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the support will be available.

@Tim_Pan

We have investigated the issue and suggest you to please try using the following sample code that can help you change the order of the layers in the image:

        Layer MoveLayer(int currentIndex, int newIndex, PsdImage image)
        {
            var layers = new List<Layer>(image.Layers); // gets layers from PsdImage to make changes

            var layer = layers[currentIndex]; // gets layer that needs to move
            layers.RemoveAt(currentIndex); // removes the layer from the current position
            layers.Insert(newIndex, layer); // insert layer to the target position

            image.Layers = layers.ToArray(); // updates the source layers in PsdImage

            return layer; // returns moved layer
        }

        using (PsdImage image = (PsdImage)Image.Load("layerTest1.psd"))
        {
            var layer = MoveLayer(5, 2, image);;
        }