Example #1
0
        private void button_ypf_unpack_Click(object sender, EventArgs e)
        {
            var files = new List <string>();

            if (Directory.Exists(textBox_ypf_unpack_input.Text))
            {
                files.AddRange(Directory.GetFiles(textBox_ypf_unpack_input.Text, "*.ypf"));
            }
            else
            {
                files.Add(textBox_ypf_unpack_input.Text);
            }
            groupBox1.Enabled = false;
            Func <byte[], uint> hashName = null, hashData = null;

            if (checkBox_ypf_verify.Checked)
            {
                if (radioButton_ypf_crc32.Checked)
                {
                    hashName = CheckSum.CRC32;
                    hashData = CheckSum.Adler32;
                }
                else
                {
                    hashData = hashName = CheckSum.MurmurHash2;
                }
            }
            var output = textBox_ypf_unpack_output.Text;

            ThreadPool.QueueUserWorkItem(s =>
            {
                int success = 0;
                foreach (var file in files)
                {
                    try
                    {
                        Log("[YPF Unpack] Unpacking " + Path.GetFileName(file) + " ...");
                        using (var reader = new BinaryReader(File.OpenRead(file)))
                        {
                            var ypf = YPF.ReadFile(reader, hashName, hashData);
                            Log("[YPF Unpack] Found " + ypf.Entries.Count + " entries.");
                            foreach (var entry in ypf.Entries)
                            {
                                Log("[YPF Unpack] Unpacking " + entry.Name + "(" + entry.Size + ") ...");
                                var path = Path.Combine(output, Path.GetFileNameWithoutExtension(file), entry.Name);
                                Directory.CreateDirectory(Path.GetDirectoryName(path));
                                File.WriteAllBytes(path, entry.Data);
                            }
                        }
                        success++;
                    }
                    catch (Exception ex) { Oops(ex); }
                }
                Log("[YPF Unpack] Complete, unpacked " + success + "/" + files.Count + " files.");
                Invoke(new Action(() => groupBox1.Enabled = true));
            });
        }
Example #2
0
 private void button_ypf_pack_Click(object sender, EventArgs e)
 {
     try
     {
         var ypf      = new YPF();
         var baseName = Path.GetFullPath(textBox_ypf_pack_input.Text).TrimEnd('\\') + "\\";
         HashSet <string> non_compress = new HashSet <string>(textBox_ypf_pack_no_compress.Text.ToLower().Split('/').Where(s => s.Trim() != "")),
                          non_packing  = new HashSet <string>(textBox_ypf_pack_no_packing.Text.ToLower().Split('/').Where(s => s.Trim() != ""));
         foreach (var file in Directory.GetFiles(textBox_ypf_pack_input.Text, "*", SearchOption.AllDirectories).OrderBy(f => f))
         {
             if (non_packing.Contains(Path.GetExtension(file).ToLower()))
             {
                 continue;
             }
             ypf.Entries.Add(new YPFEntry(file.Replace(baseName, ""), File.ReadAllBytes(file))
             {
                 Compressed = !non_compress.Contains(Path.GetExtension(file).ToLower())
             });
         }
         Log("[YPF Pack] Created " + ypf.Entries.Count + " entries.");
         var target = textBox_ypf_pack_output.Text;
         if (Directory.Exists(target))
         {
             target = Path.Combine(target, Path.GetFileName(textBox_ypf_pack_input.Text) + ".ypf");
         }
         using (var writer = new BinaryWriter(File.Open(target, FileMode.Create)))
         {
             Func <byte[], uint> hashName = CheckSum.MurmurHash2, hashData = CheckSum.MurmurHash2;
             if (radioButton_ypf_crc32.Checked)
             {
                 hashName = CheckSum.CRC32;
                 hashData = CheckSum.Adler32;
             }
             ypf.Write(writer, int.Parse(textBox_ypf_engine.Text), hashName, hashData);
             Log("[YPF Pack] Write success, size: " + writer.BaseStream.Position + ", target: " + target);
         }
     }
     catch (Exception ex) { Oops(ex); }
 }
Example #3
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public void RbsReplayInternal(YPF.Comercial.RRCC.SUP.Motivo entity)
 {
     
     YPF.Comercial.RRCC.SUP.intrnl.OperationReplay _replay = new YPF.Comercial.RRCC.SUP.intrnl.OperationReplay();
     _replay.RemoteId =(".");
     _replay.Component =("CRMMobileDesa.Motivo_rs");
     _replay.EntityKey =(entity.KeyToString());
     _replay.Operation =(entity.LastOperation);
     bool _includeBig = !("delete").Equals(_replay.Operation);
     com.sybase.afx.json.JsonObject _parameters = new com.sybase.afx.json.JsonObject();
     _parameters.Put("entity", YPF.Comercial.RRCC.SUP.Motivo.__toJSON(entity, _includeBig));
     //_replay.Parameters =(_parameters.ToString());
     //lock(typeof(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB))
     //{
         Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
         Sybase.Persistence.LocalTransaction _tran = null;
         try
         {
             _tran = _conn.BeginTransaction();
         
             com.sybase.afx.json.JsonObject _json = new com.sybase.afx.json.JsonObject();
             _replay.Attributes =(_json.ToString());
             _replay.Save();
             _replay.SaveParameter(_parameters);
             _tran.Commit();
         }
         catch (Sybase.Persistence.PersistenceException pe)
         {   
             _tran.Rollback();     
             throw pe;
         }
         catch (System.ApplicationException e)
         {
             _tran.Rollback();
             throw e;
         }
     //}
 }
Example #4
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public void SetOriginalState(YPF.Comercial.RRCC.SUP.TablaRelevamiento orig)
 {
     __originalStateValid = true;
     __originalState = orig;
 }
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.ClientPersonalization _object, bool _includeBigAttribute)
 {
     if(_includeBigAttribute)
     {
         return YPF.Comercial.RRCC.SUP.ClientPersonalization.ToJSON(_object);
     }
     else
     {
     	return YPF.Comercial.RRCC.SUP.ClientPersonalization.ToJSONWithoutBigAttribute(_object);
     }
 }
 /// <summary>
 /// copy the MBO attributes to current MBO
 /// </summary>
 public void CopyAll(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario entity)
 {
     this._isNew = entity._isNew;
     this.__idInteraccion = entity.__idInteraccion;
     this.__formulario_CodigoSAP = entity.__formulario_CodigoSAP;
     this.__pregunta_CodigoSAP = entity.__pregunta_CodigoSAP;
     this.__respuesta_CodigoSAP = entity.__respuesta_CodigoSAP;
     this.__observaciones = entity.__observaciones;
     this.__puntaje = entity.__puntaje;
     this.__interaccion = entity.__interaccion;
     this.__interaccionValid = entity.__interaccionValid;
     this.__pending = entity.__pending;
     this.__pendingChange = entity.__pendingChange;
     this.__replayPending = entity.__replayPending;
     this.__replayFailure = entity.__replayFailure;
     this.__interaccionFK = entity.__interaccionFK;
     this.__surrogateKey = entity.SurrogateKey;
     this.__replayCounter = entity.__replayCounter;
     this.__disableSubmit = entity.__disableSubmit;
 }
 private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario __theObject)
 {
     System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "idInteraccion", __theObject.IdInteraccion);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "formulario_CodigoSAP", __theObject.Formulario_CodigoSAP);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "pregunta_CodigoSAP", __theObject.Pregunta_CodigoSAP);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "respuesta_CodigoSAP", __theObject.Respuesta_CodigoSAP);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "observaciones", __theObject.Observaciones);
     com.sybase.afx.db.CommandUtil.SetDecimal(_conn.GetConnectionProfile(), ps, "puntaje", __theObject.Puntaje);
     com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), ps, "pending", __theObject.Pending);
     com.sybase.afx.db.CommandUtil.SetChar(_conn.GetConnectionProfile(), ps, "pendingChange", __theObject.PendingChange);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "replayPending", __theObject.ReplayPending);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "replayFailure", __theObject.ReplayFailure);
     com.sybase.afx.db.CommandUtil.SetNullableLong(_conn.GetConnectionProfile(), ps, "interaccionFK", __theObject.InteraccionFK);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "surrogateKey", __theObject.SurrogateKey);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "replayCounter", __theObject.ReplayCounter);
     com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), ps, "disableSubmit", __theObject.DisableSubmit);
     ps.ExecuteNonQuery();
     ps.Dispose();;
 }
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario _object)
 {
     return YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario.ToJSON(_object);
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.intrnl.RelevamientoProveedor_rs _object)
 {
     return YPF.Comercial.RRCC.SUP.intrnl.RelevamientoProveedor_rs.ToJSON(_object, false, true, true);
 }
Example #10
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs _object)
 {
     return YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs.ToJSON(_object, false, true, true);
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.ClientPersonalization _object, bool __buildGraph, bool _includeBigAttribute)
 {
     return ToJSON(_object, __buildGraph, _includeBigAttribute, true);    
 }
Example #12
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs _object, bool _includeBigAttribute)
 {
     if(_includeBigAttribute)
     {
         return YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs.ToJSON(_object);
     }
     else
     {
     	return YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs.ToJSONWithoutBigAttribute(_object);
     }
 }
Example #13
0
 internal static com.sybase.afx.json.JsonObject ToJSONWithoutUserAttributes(YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs _object)
 {
     return YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs.ToJSON(_object, false, false, false);
 }
Example #14
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs _object)
 {
     return YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs.ToJSON(_object);
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.intrnl.RelevamientoProveedor_rs _object, bool __buildGraph, bool _includeBigAttribute, bool _includeUserAttributes)
 {
     if ((_object == null))
     {
         return null;
     }
     else
     {
         return _object._toJSON(__buildGraph,_includeBigAttribute,_includeUserAttributes);
     }
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.intrnl.RelevamientoProveedor_rs _object, bool __buildGraph)
 {    
     return ToJSON(_object, __buildGraph, true, true);    
 }
 internal static com.sybase.afx.json.JsonObject ToJSONWithoutUserAttributes(YPF.Comercial.RRCC.SUP.ClientPersonalization _object)
 {
     return YPF.Comercial.RRCC.SUP.ClientPersonalization.ToJSON(_object, false, false, false);
 }
Example #18
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.intrnl.Motivo_rs _object, bool __buildGraph, bool _includeBigAttribute)
 {
     return ToJSON(_object, __buildGraph, _includeBigAttribute, true);    
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.ClientPersonalization _object)
 {
     return YPF.Comercial.RRCC.SUP.ClientPersonalization.ToJSON(_object, false, true, true);
 }
 internal static com.sybase.afx.json.JsonObject ToJSONWithoutUserAttributes(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario _object)
 {
     return YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario.ToJSON(_object, false, false, false);
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.ClientPersonalization _object, bool __buildGraph, bool _includeBigAttribute, bool _includeUserAttributes)
 {
     if ((_object == null))
     {
         return null;
     }
     else
     {
         return _object._toJSON(__buildGraph,_includeBigAttribute,_includeUserAttributes);
     }
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario _object, bool __buildGraph, bool _includeBigAttribute)
 {
     return ToJSON(_object, __buildGraph, _includeBigAttribute, true);    
 }
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario _object, bool _includeBigAttribute)
 {
     if(_includeBigAttribute)
     {
         return YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario.ToJSON(_object);
     }
     else
     {
     	return YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario.ToJSONWithoutBigAttribute(_object);
     }
 }
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.intrnl.RelevamientoProveedor_rs _object)
 {
     return YPF.Comercial.RRCC.SUP.intrnl.RelevamientoProveedor_rs.ToJSON(_object);
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario _object)
 {
     return YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario.ToJSON(_object, false, true, true);
 }
 /// <summary>
 /// copy the MBO attributes to current MBO
 /// </summary>
 public void CopyAll(YPF.Comercial.RRCC.SUP.ClientPersonalization entity)
 {
     this._isNew = entity._isNew;
     this.__key_name = entity.__key_name;
     this.__user = entity.__user;
     this.__value = entity.__value;
     this.__user_defined = entity.__user_defined;
     this.__description = entity.__description;
     this.__id = entity.Id;
 }
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario _object, bool __buildGraph, bool _includeBigAttribute, bool _includeUserAttributes)
 {
     if ((_object == null))
     {
         return null;
     }
     else
     {
         return _object._toJSON(__buildGraph,_includeBigAttribute,_includeUserAttributes);
     }
 }
 /// <summary>
 /// Set current MBO attributes by specified MBO.
 /// </summary>
 public static YPF.Comercial.RRCC.SUP.ClientPersonalization Merge(YPF.Comercial.RRCC.SUP.ClientPersonalization entity)
 {
     YPF.Comercial.RRCC.SUP.ClientPersonalization ent = Find(entity._pk());
     if (ent == null)
     {
         ent = new YPF.Comercial.RRCC.SUP.ClientPersonalization();
     }
     ent.CopyAll(entity);
     ent.Save();
     return ent;
 }
 /// <summary>
 /// Set current MBO attributes by specified MBO.
 /// </summary>
 public static YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario Merge(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario entity)
 {
     YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario ent = Find(entity._pk());
     if (ent == null)
     {
         ent = new YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario();
     }
     ent.CopyAll(entity);
     ent.Save();
     return ent;
 }
 private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.ClientPersonalization __theObject)
 {
     System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "key_name", __theObject.Key_name);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "user", __theObject.User);
     com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "value", __theObject.Value);
     com.sybase.afx.db.CommandUtil.SetBoolean(_conn.GetConnectionProfile(), ps, "user_defined", __theObject.User_defined);
     com.sybase.afx.db.CommandUtil.SetNullableString(_conn.GetConnectionProfile(), ps, "description", __theObject.Description);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "id", __theObject.Id);
     ps.ExecuteNonQuery();
     ps.Dispose();;
 }
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public void SetOriginalState(YPF.Comercial.RRCC.SUP.RespuestaInteraccionFormulario orig)
 {
     __originalStateValid = true;
     __originalState = orig;
 }
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.ClientPersonalization _object)
 {
     return YPF.Comercial.RRCC.SUP.ClientPersonalization.ToJSON(_object);
 }