public override void GetParams(IGAnswer answer, HttpSessionState session)
 {
     string sLogin = GetAttributeValue(IGREQUEST_USERLOGIN);
     string sServerIP = answer.GetParameterValue(IGAnswer.IGANSWER_SERVERIP);
     string sReqGuid = GetAttributeValue(IGREQUEST_GUID);
     foreach (string sImageName in m_lsInputImageName)
         m_lsOutputPath.Add(HC.PATH_OUTPUTVIRTUAL + sServerIP + "/" + HC.PATH_OUTPUTDOWNLOADS + sLogin + "/" + sReqGuid + "/" + sImageName.Replace(HC.PATH_USERIMAGES_BEETLEMORPH + "/", ""));
     session[IGSMREQUEST_PARAM_LISTPATH] = createParamFromList(m_lsOutputPath);
     session[IGAnswer.IGANSWER_RELOADPAGE] = true;
 }
 public override bool ProcessAnswer(IGAnswer answer)
 {
     SetParameter(IGAnswer.IGANSWER_SERVERIP, answer.GetParameterValue(IGAnswer.IGANSWER_SERVERIP));
     return true;
 }
 public override void GetParams(IGAnswer answer, HttpSessionState session)
 {
     if ((string)session[IGAnswer.IGANSWER_IMAGELIBRARY] == null)
         session[IGAnswer.IGANSWER_IMAGELIBRARY] = "";
     string sLogin = GetAttributeValue(IGREQUEST_USERLOGIN);
     string sServerIP = GetParameterValue(IGAnswer.IGANSWER_SERVERIP);
     SetParameter(IGSMREQUEST_PARAM_LISTSIZE, answer.GetParameterValue(IGSMREQUEST_PARAM_LISTSIZE));
     splitParamToList(m_lsImageSize, IGSMREQUEST_PARAM_LISTSIZE);
     for (int idxImageInputPath = 0; idxImageInputPath < m_lsInputPath.Count; idxImageInputPath++)
     {
         string sImageInputPath = m_lsInputPath[idxImageInputPath];
         if ((string)session[IGAnswer.IGANSWER_IMAGELIBRARY] != "")
             session[IGAnswer.IGANSWER_IMAGELIBRARY] += ",";
         string sImageName = sImageInputPath.Substring(sImageInputPath.IndexOf('$') + 1);
         string sImageNameJPEG = sImageName.Remove(sImageName.Length - Path.GetExtension(sImageName).Length) + "$" + GetAttributeValue(IGREQUEST_GUID) + ".JPG";
         session[IGAnswer.IGANSWER_IMAGELIBRARY] += HC.PATH_OUTPUTVIRTUAL + sServerIP + "/" + sLogin + HC.PATH_OUTPUTMINI + HC.PATH_PREFIXMINI + sImageNameJPEG;
         session[IGAnswer.IGANSWER_IMAGELIBRARY] += "," + m_lsImageSize[idxImageInputPath].Key.ToString(); // width
         session[IGAnswer.IGANSWER_IMAGELIBRARY] += "," + m_lsImageSize[idxImageInputPath].Value.ToString(); // height
     }
 }
Example #4
0
 public override bool ProcessAnswer(IGAnswer answer)
 {
     string sLogin = answer.GetAttributeValue(IGREQUEST_USERLOGIN);
     string sFrameId = answer.GetParameterValue(IGREQUEST_FRAMEID);
     string sImageOutputPath = answer.GetParameterValue(IGREQUEST_PATH);
     sImageOutputPath = sImageOutputPath.Substring(0, sImageOutputPath.LastIndexOf('\\') + 1) + HC.PATH_LASTSAVEDPICTURE;
     if (!File.Exists(sImageOutputPath))
         return false;
     string sImagePath = GetParameterValue(IGREQUEST_PATH);
     string sImagePathJPEG = sImagePath.Remove(sImagePath.Length - Path.GetExtension(sImagePath).Length) + "$" + GetAttributeValue(IGREQUEST_GUID) + ".JPG";
     string sAccountMiniImagePath = HC.PATH_USERACCOUNT + sLogin + HC.PATH_USERMINI + HC.PATH_PREFIXMINI + sImagePath;
     Image imgInput = Image.FromFile(sImageOutputPath);
     float fRate = HC.MINIPICTURE_MAXSIZE / (float)Math.Max(imgInput.Size.Width, imgInput.Size.Height);
     Image imgMini = new Bitmap(imgInput, new Size((int)((float)imgInput.Size.Width * fRate), (int)((float)imgInput.Size.Height * fRate)));
     imgMini.Save(sAccountMiniImagePath, ImageFormat.Jpeg);
     imgMini.Save(HC.PATH_OUTPUT + sLogin + HC.PATH_OUTPUTMINI + HC.PATH_PREFIXMINI + sImagePathJPEG, ImageFormat.Jpeg);
     answer.SetParameter(IGREQUEST_SIZE, imgMini.Width.ToString() + "," + imgMini.Height.ToString());
     return true;
 }
Example #5
0
 public override void GetParams(IGAnswer answer, HttpSessionState session)
 {
     if ((string)session[IGAnswer.IGANSWER_IMAGELIBRARY] == null)
         session[IGAnswer.IGANSWER_IMAGELIBRARY] = "";
     string sLogin = answer.GetAttributeValue(IGREQUEST_USERLOGIN);
     string sServerIP = answer.GetParameterValue(IGAnswer.IGANSWER_SERVERIP);
     string sImagePath = GetParameterValue(IGREQUEST_PATH);
     string sImagePathExt = Path.GetExtension(sImagePath);
     string sImagePathPrefix = sImagePath.Remove(sImagePath.Length - Path.GetExtension(sImagePath).Length) + "$";
     sImagePath = sImagePathPrefix + GetAttributeValue(IGREQUEST_GUID) + sImagePathExt;
     string sMiniOutputImagePath = HC.PATH_OUTPUTVIRTUAL + sServerIP + "/" + sLogin + HC.PATH_OUTPUTMINI + HC.PATH_PREFIXMINI + sImagePath;
     string sImageLibrary = (string)(string)session[IGAnswer.IGANSWER_IMAGELIBRARY];
     sImageLibrary = sImageLibrary.ToUpper();
     SetParameter(IGREQUEST_SIZE, answer.GetParameterValue(IGREQUEST_SIZE));
     List<string> lsListSize = new List<string>();
     splitParamToList(lsListSize, IGREQUEST_SIZE);
     m_pairSize = new KeyValuePair<string, string>(lsListSize[1], lsListSize[2]);
     if (sImageLibrary.Contains(sImagePathPrefix.ToUpper()))
     {
         int nIdxImPath = sImageLibrary.IndexOf(sImagePathPrefix.ToUpper());
         int nIdxNextDot = sImageLibrary.IndexOf(',', nIdxImPath);
         if (nIdxNextDot < nIdxImPath)
             nIdxNextDot = sImageLibrary.Length;
         string sOldImagePath = HC.PATH_OUTPUTVIRTUAL + sServerIP + "/" + sLogin + HC.PATH_OUTPUTMINI + HC.PATH_PREFIXMINI + sImageLibrary.Substring(nIdxImPath, nIdxNextDot - nIdxImPath);
         sOldImagePath = sOldImagePath.ToUpper();
         SetParameter(IGAnswer.IGANSWER_IMAGELIBRARY, sImageLibrary);
         List<string> lsOutputPath = new List<string>();
         splitParamToList(lsOutputPath, IGAnswer.IGANSWER_IMAGELIBRARY);
         lsOutputPath[lsOutputPath.IndexOf(sOldImagePath)] = sMiniOutputImagePath;
         lsOutputPath.RemoveAt(0);
         session[IGAnswer.IGANSWER_IMAGELIBRARY] = createParamFromList(lsOutputPath);
     }
     else
     {
         if ((string)session[IGAnswer.IGANSWER_IMAGELIBRARY] != "")
             session[IGAnswer.IGANSWER_IMAGELIBRARY] += ",";
         session[IGAnswer.IGANSWER_IMAGELIBRARY] += sMiniOutputImagePath;
         session[IGAnswer.IGANSWER_IMAGELIBRARY] += "," + lsListSize[1]; // width
         session[IGAnswer.IGANSWER_IMAGELIBRARY] += "," + lsListSize[2]; // height
     }
     SetParameter(IGREQUEST_USERLOGIN, sLogin);
     SetParameter(IGAnswer.IGANSWER_SERVERIP, sServerIP);
     SetParameter(IGREQUEST_PATH, sMiniOutputImagePath);
 }
Example #6
0
 public override void GetParams(IGAnswer answer, HttpSessionState session)
 {
     SetParameter(IGAnswer.IGANSWER_RESTOREDFRAMEIDS, (string)session[IGAnswer.IGANSWER_RESTOREDFRAMEIDS]);
     SetParameter(IGAnswer.IGANSWER_FRAMENAMES, (string)session[IGAnswer.IGANSWER_FRAMENAMES]);
     SetParameter(IGAnswer.IGANSWER_REQGUIDS, (string)session[IGAnswer.IGANSWER_REQGUIDS]);
     SetParameter(IGAnswer.IGANSWER_ALLNBLAYERS, (string)session[IGAnswer.IGANSWER_ALLNBLAYERS]);
     SetParameter(IGAnswer.IGANSWER_ALLLAYERVISIBILITY, (string)session[IGAnswer.IGANSWER_ALLLAYERVISIBILITY]);
     SetParameter(IGAnswer.IGANSWER_ALLSTEPIDS, (string)session[IGAnswer.IGANSWER_ALLSTEPIDS]);
     SetParameter(IGAnswer.IGANSWER_FRAMEPROPERTIES, (string)session[IGAnswer.IGANSWER_FRAMEPROPERTIES]);
     List<string> lsFrameIds = new List<string>();
     splitParamToList(lsFrameIds, IGAnswer.IGANSWER_RESTOREDFRAMEIDS);
     List<string> lsFrameNames = new List<string>();
     splitParamToList(lsFrameNames, IGAnswer.IGANSWER_FRAMENAMES);
     List<string> lsFrameGuids = new List<string>();
     splitParamToList(lsFrameGuids, IGAnswer.IGANSWER_REQGUIDS);
     List<string> lsNbLayers = new List<string>();
     splitParamToList(lsNbLayers, IGAnswer.IGANSWER_ALLNBLAYERS);
     List<string> lsLayerVisibility = new List<string>();
     splitParamToList(lsLayerVisibility, IGAnswer.IGANSWER_ALLLAYERVISIBILITY);
     List<string> lsStepIds = new List<string>();
     splitParamToList(lsStepIds, IGAnswer.IGANSWER_ALLSTEPIDS);
     List<string> lsFrameProperties = new List<string>();
     splitParamToList(lsFrameProperties, IGAnswer.IGANSWER_FRAMEPROPERTIES);
     string frameId = answer.GetParameterValue(IGREQUEST_FRAMEID);
     if (frameId == "-1")
     {
         session[IGAnswer.IGANSWER_RESTOREDFRAMEIDS] = "";
         session[IGAnswer.IGANSWER_FRAMENAMES] = "";
         session[IGAnswer.IGANSWER_REQGUIDS] = "";
         session[IGAnswer.IGANSWER_ALLNBLAYERS] = "";
         session[IGAnswer.IGANSWER_ALLLAYERVISIBILITY] = "";
         session[IGAnswer.IGANSWER_ALLSTEPIDS] = "";
         session[IGAnswer.IGANSWER_FRAMEPROPERTIES] = "";
         session[IGAnswer.IGANSWER_SELECTEDFRAMEID] = "";
         session[IGAnswer.IGANSWER_SELECTEDREQGUID] = "";
     }
     else
     {
         int nIdxFrame = lsFrameIds.IndexOf(frameId);
         lsFrameIds.RemoveAt(nIdxFrame);
         lsFrameIds.RemoveAt(0);
         lsFrameNames.RemoveAt(nIdxFrame);
         lsFrameNames.RemoveAt(0);
         lsFrameGuids.RemoveAt(nIdxFrame);
         lsFrameGuids.RemoveAt(0);
         lsNbLayers.RemoveAt(nIdxFrame);
         lsNbLayers.RemoveAt(0);
         lsLayerVisibility.RemoveAt(nIdxFrame);
         lsLayerVisibility.RemoveAt(0);
         lsStepIds.RemoveAt(nIdxFrame);
         lsStepIds.RemoveAt(0);
         lsFrameProperties.RemoveAt(nIdxFrame);
         lsFrameProperties.RemoveAt(0);
         session[IGAnswer.IGANSWER_RESTOREDFRAMEIDS] = createParamFromList(lsFrameIds);
         session[IGAnswer.IGANSWER_FRAMENAMES] = createParamFromList(lsFrameNames);
         session[IGAnswer.IGANSWER_REQGUIDS] = createParamFromList(lsFrameGuids);
         session[IGAnswer.IGANSWER_ALLNBLAYERS] = createParamFromList(lsNbLayers);
         session[IGAnswer.IGANSWER_ALLLAYERVISIBILITY] = createParamFromList(lsLayerVisibility);
         session[IGAnswer.IGANSWER_ALLSTEPIDS] = createParamFromList(lsStepIds);
         session[IGAnswer.IGANSWER_FRAMEPROPERTIES] = createParamFromList(lsFrameProperties);
         if (lsFrameIds.Count > 0)
         {
             session[IGAnswer.IGANSWER_SELECTEDFRAMEID] = lsFrameIds[lsFrameIds.Count - 1];
             session[IGAnswer.IGANSWER_SELECTEDREQGUID] = lsFrameGuids[lsFrameGuids.Count - 1];
         }
         else
         {
             session[IGAnswer.IGANSWER_SELECTEDFRAMEID] = "";
             session[IGAnswer.IGANSWER_SELECTEDREQGUID] = "";
         }
     }
     answer.SetParameter(IGAnswer.IGANSWER_RESTOREDFRAMEIDS, (string)session[IGAnswer.IGANSWER_RESTOREDFRAMEIDS]);
     answer.SetParameter(IGAnswer.IGANSWER_FRAMENAMES, (string)session[IGAnswer.IGANSWER_FRAMENAMES]);
     answer.SetParameter(IGAnswer.IGANSWER_REQGUIDS, (string)session[IGAnswer.IGANSWER_REQGUIDS]);
     answer.SetParameter(IGAnswer.IGANSWER_ALLNBLAYERS, (string)session[IGAnswer.IGANSWER_ALLNBLAYERS]);
     answer.SetParameter(IGAnswer.IGANSWER_ALLLAYERVISIBILITY, (string)session[IGAnswer.IGANSWER_ALLLAYERVISIBILITY]);
     answer.SetParameter(IGAnswer.IGANSWER_ALLSTEPIDS, (string)session[IGAnswer.IGANSWER_ALLSTEPIDS]);
     answer.SetParameter(IGAnswer.IGANSWER_FRAMEPROPERTIES, (string)session[IGAnswer.IGANSWER_FRAMEPROPERTIES]);
     SetParameter(IGAnswer.IGANSWER_ALLNBLAYERS, (string)session[IGAnswer.IGANSWER_ALLNBLAYERS]);
     SetParameter(IGAnswer.IGANSWER_ALLLAYERVISIBILITY, (string)session[IGAnswer.IGANSWER_ALLLAYERVISIBILITY]);
     SetParameter(IGAnswer.IGANSWER_ALLSTEPIDS, (string)session[IGAnswer.IGANSWER_ALLSTEPIDS]);
 }
 public static bool Remove(IGAnswer answer)
 {
     if (answer.GetId() == (int)IGAnswer.IGANSWER_ID.IGANSWER_WORKSPACE_DISCONNECTED)
     {
         // server does not wait for a disconnection answer
         return true;
     }
     else
     {
         bool bRes = true;
         XmlNode xmlNodeRequestGuid = answer.GetAttribute(IGAnswer.IGANSWER_REQGUID);
         if (xmlNodeRequestGuid == null)
             bRes = false;
         IGRequestProcessing reqProc = GetRequest(xmlNodeRequestGuid.Value);
         if (reqProc == null)
             bRes = false;
         IGServerManager serverMgr = IGServerManager.Instance;
         if (!bRes)
         {
             serverMgr.AppendError("- IGRequestProcessing failed to match this answer with a request: \"" + answer.ToString() + "\"");
             return false;
         }
         if (answer.IsError() || answer.IsSMError())
         {
             serverMgr.AppendError("- IGRequestProcessing Error " + answer.ToString());
             if (answer.IsSMError())
                 ((IGServerManagerRemote)serverMgr).DisconnectUser(answer.GetParameterValue(IGRequest.IGREQUEST_USERLOGIN), true);
         }
         else if (!answer.Silent)
             serverMgr.AppendInfo("IGRequestProcessing Answer " + answer.ToString());
         IGRequest finishedReq = reqProc.GetRequest();
         if (finishedReq != null)
             finishedReq.FireEventDone(answer.GetXml());
         return remove(xmlNodeRequestGuid.Value);
     }
 }