@@ -790,9 +790,10 @@ public bool SaveAs(string fn, bool writeFreshly = false, SerializationFormat pre
790
790
//delete old type, because its not according to spec or something
791
791
//then replace with the current type
792
792
package . DeleteRelationship ( x . Rel . Id ) ;
793
- package . CreateRelationship (
794
- originPart . Uri , TargetMode . Internal ,
795
- relTypesOrigin . FirstOrDefault ( ) ) ;
793
+ package . DeletePart ( absoluteURI ) ;
794
+ //package.CreateRelationship(
795
+ // originPart.Uri, TargetMode.Internal,
796
+ // relTypesOrigin.FirstOrDefault());
796
797
originPart = null ;
797
798
break ;
798
799
}
@@ -835,20 +836,21 @@ public bool SaveAs(string fn, bool writeFreshly = false, SerializationFormat pre
835
836
if ( package . PartExists ( absoluteURI ) )
836
837
{
837
838
specPart = package . GetPart ( absoluteURI ) ;
838
- }
839
839
840
- // check if it a deprecated URI
841
- if ( x . Deprecated )
842
- {
843
- //delete old type, because its not according to spec or something
844
- //then replace with the current type
845
- package . DeleteRelationship ( x . Rel . Id ) ;
846
- package . CreateRelationship (
847
- specPart . Uri , TargetMode . Internal ,
848
- relTypesSpec . FirstOrDefault ( ) ) ;
849
- specPart = null ;
850
- specRel = null ;
851
- break ;
840
+ // check if it a deprecated URI
841
+ if ( x . Deprecated )
842
+ {
843
+ //delete old type, because its not according to spec or something
844
+ //then replace with the current type
845
+ package . DeleteRelationship ( x . Rel . Id ) ;
846
+ package . DeletePart ( absoluteURI ) ;
847
+ //package.CreateRelationship(
848
+ // specPart.Uri, TargetMode.Internal,
849
+ // relTypesSpec.FirstOrDefault());
850
+ specPart = null ;
851
+ specRel = null ;
852
+ break ;
853
+ }
852
854
}
853
855
}
854
856
@@ -888,6 +890,13 @@ public bool SaveAs(string fn, bool writeFreshly = false, SerializationFormat pre
888
890
else
889
891
aas_spec_fn += ".xml" ;
890
892
aas_spec_fn = aas_spec_fn . Replace ( "#" , "" + frn ) ;
893
+
894
+ // new: make sure the part is not existing anymore
895
+ var aas_spec_uri = new Uri ( aas_spec_fn , UriKind . RelativeOrAbsolute ) ;
896
+ if ( package . PartExists ( aas_spec_uri ) )
897
+ package . DeletePart ( aas_spec_uri ) ;
898
+
899
+ // now create
891
900
specPart = package . CreatePart (
892
901
new Uri ( aas_spec_fn , UriKind . RelativeOrAbsolute ) ,
893
902
System . Net . Mime . MediaTypeNames . Text . Xml , CompressionOption . Maximum ) ;
@@ -950,7 +959,7 @@ public bool SaveAs(string fn, bool writeFreshly = false, SerializationFormat pre
950
959
specPart . DeleteRelationship ( x . Rel . Id ) ;
951
960
specPart . CreateRelationship (
952
961
filePart . Uri , TargetMode . Internal ,
953
- "http://admin-shell.io/aasx/relationships/aas-suppl" ) ;
962
+ relTypesSuppl . FirstOrDefault ( ) ) ;
954
963
}
955
964
}
956
965
}
0 commit comments