This commit is contained in:
parent
b955f6e331
commit
23c5e6534d
@ -230,9 +230,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
using (ROImageInfoList myROImages = ROImageInfoList.GetByRODbID(rdi.RODbID))
|
||||
{
|
||||
Dictionary<string, int> myROImagesList = BuildROImagesList(myROImages);
|
||||
List<int> myROImageIDs = new List<int>();
|
||||
List<string> myROsAdded = new List<string>();
|
||||
Dictionary<string, int> myExistingROImages = BuildROImagesList(myROImages);
|
||||
List<int> myChangedROImages = new List<int>();
|
||||
List<string> myAddedROImages = new List<string>();
|
||||
rofst = ROFst.MakeROFst(rodb, ab, null, di.LastWriteTimeUtc, rdi.UserID);
|
||||
// Hook this into the current docversion by replacing the rofstid field in the doc version
|
||||
// association object:
|
||||
@ -247,12 +247,12 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
using (ROFstInfo rfi = ROFstInfo.Get(rofst.ROFstID))
|
||||
{
|
||||
rfi.MigrateRoFstGraphics(rdi, rofst.ROFSTLookup.myHdr.myDbs[i].children, rodb, rofst, myROImagesList, myROImageIDs,myROsAdded);// TODO: Need to add MyImages
|
||||
rfi.MigrateRoFstGraphics(rdi, rofst.ROFSTLookup.myHdr.myDbs[i].children, rodb, rofst, myExistingROImages, myChangedROImages,myAddedROImages);// TODO: Need to add MyImages
|
||||
}
|
||||
}
|
||||
}
|
||||
if(myROImageIDs.Count > 0)
|
||||
using(FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID,buildImageIDString(myROImageIDs)));
|
||||
if(myChangedROImages.Count > 0)
|
||||
using(FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID,buildImageIDString(myChangedROImages)));
|
||||
return rofst;
|
||||
}
|
||||
}
|
||||
@ -298,9 +298,9 @@ namespace VEPROMS.CSLA.Library
|
||||
// Now load any images in... type 8 - integrated graphics ro type
|
||||
using (ROImageInfoList myROImages = ROImageInfoList.GetByRODbIDNoData(rdi.RODbID))
|
||||
{
|
||||
Dictionary<string, int> myROImagesList = BuildROImagesList(myROImages);
|
||||
List<int> myROImageIDs = new List<int>();
|
||||
List<string> myROsAdded = new List<string>();
|
||||
Dictionary<string, int> myExistingROImages = BuildROImagesList(myROImages);
|
||||
List<int> myChangedROImages = new List<int>();
|
||||
List<string> myAddedROImages = new List<string>();
|
||||
using (ROFstInfo rfi = ROFstInfo.Get(rofst.ROFstID))
|
||||
{
|
||||
for (int i = 0; i < rofst.ROFSTLookup.myHdr.myDbs.Length; i++)
|
||||
@ -308,12 +308,12 @@ namespace VEPROMS.CSLA.Library
|
||||
// walk through the rofst 'database' searching for all nodes that are integrated graphics, type 8:
|
||||
if (rofst.ROFSTLookup.myHdr.myDbs[i].children != null)
|
||||
{
|
||||
rfi.MigrateRoFstGraphics(rdi, rofst.ROFSTLookup.myHdr.myDbs[i].children, rodb, rofst, myROImagesList, myROImageIDs,myROsAdded);
|
||||
rfi.MigrateRoFstGraphics(rdi, rofst.ROFSTLookup.myHdr.myDbs[i].children, rodb, rofst, myExistingROImages, myChangedROImages,myAddedROImages);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (myROImageIDs.Count > 0)
|
||||
using(FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID,buildImageIDString(myROImageIDs)));
|
||||
if (myChangedROImages.Count > 0)
|
||||
using(FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID,buildImageIDString(myChangedROImages)));
|
||||
}
|
||||
// Now update the usages: compare old to new rofsts and update usages accordingly, i.e. modified
|
||||
// values, deleted ros, etc.
|
||||
@ -497,15 +497,15 @@ namespace VEPROMS.CSLA.Library
|
||||
retval = string.Format("{0}_{1}", roName, iSuffix + 1);
|
||||
return retval;
|
||||
}
|
||||
private void MigrateRoFstGraphics(RODbInfo rdi, ROFSTLookup.rochild[] rochild, RODb rodb, ROFst rofst, Dictionary<string, int> myROImagesList, List<int> myROImageIDs, List<string> myROsAdded)
|
||||
private void MigrateRoFstGraphics(RODbInfo rdi, ROFSTLookup.rochild[] rochild, RODb rodb, ROFst rofst, Dictionary<string, int> myExistingROImages, List<int> myChangedROImages, List<string> myAddedROImages)
|
||||
{
|
||||
for (int i = 0; i < rochild.Length; i++)
|
||||
{
|
||||
if (rochild[i].type == 8) this.AddGraphic(rdi, rochild[i].value, rodb, rofst, myROImagesList, myROImageIDs, myROsAdded);
|
||||
if (rochild[i].children != null) this.MigrateRoFstGraphics(rdi, rochild[i].children, rodb, rofst, myROImagesList, myROImageIDs, myROsAdded);
|
||||
if (rochild[i].type == 8) this.AddGraphic(rdi, rochild[i].value, rodb, rofst, myExistingROImages, myChangedROImages, myAddedROImages);
|
||||
if (rochild[i].children != null) this.MigrateRoFstGraphics(rdi, rochild[i].children, rodb, rofst, myExistingROImages, myChangedROImages, myAddedROImages);
|
||||
}
|
||||
}
|
||||
private void AddGraphic(RODbInfo rdi, string p, RODb rodb, ROFst rofst, Dictionary<string, int> myROImagesList, List<int> myROImageIDs, List<string> myROsAdded)
|
||||
private void AddGraphic(RODbInfo rdi, string p, RODb rodb, ROFst rofst, Dictionary<string, int> myExistingROImages, List<int> myChangedROImages, List<string> myAddedROImages)
|
||||
{
|
||||
if (p == null) return;
|
||||
string imgname = p.Substring(0, p.IndexOf('\n'));
|
||||
@ -525,15 +525,15 @@ namespace VEPROMS.CSLA.Library
|
||||
FileInfo fi = new FileInfo(imgfile);
|
||||
// if the roimage record exists, don't create a new one...
|
||||
string key = ROImageKey(imgname, fi.LastWriteTimeUtc);
|
||||
if (myROImagesList.ContainsKey(key))
|
||||
if (myExistingROImages.ContainsKey(key))
|
||||
{
|
||||
int imageID = myROImagesList[key];
|
||||
if(!myROImageIDs.Contains(imageID))
|
||||
myROImageIDs.Add(imageID);
|
||||
int imageID = myExistingROImages[key];
|
||||
if(!myChangedROImages.Contains(imageID))
|
||||
myChangedROImages.Add(imageID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!myROsAdded.Contains(key))
|
||||
if (!myAddedROImages.Contains(key))
|
||||
{
|
||||
FileStream fsIn = new FileStream(imgfile, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
BinaryReader r = new BinaryReader(fsIn);
|
||||
@ -544,7 +544,7 @@ namespace VEPROMS.CSLA.Library
|
||||
Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID);
|
||||
if (figure != null) return;
|
||||
figure = Figure.MakeFigure(rofst, roImg, null);
|
||||
myROsAdded.Add(key);
|
||||
myAddedROImages.Add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user