Exemplo n.º 1
0
        private void method_3(string string_1, string string_2, IList ilist_0)
        {
            int       j;
            Exception exception;

            try
            {
                OleDbConnection oleDbConnection =
                    new OleDbConnection(string.Concat("Provider=Microsoft.Jet.OLEDB.4.0;Data source= ", string_2));
                string           str = string.Concat("SELECT * FROM [", string_1, "]");
                OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(str, oleDbConnection);
                DataSet          dataSet          = new DataSet();
                oleDbDataAdapter.Fill(dataSet);
                oleDbConnection.Close();
                for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                {
                    try
                    {
                        IStyleGalleryItem myStyleGalleryItem = new MyStyleGalleryItem();
                        ((MyStyleGalleryItem)myStyleGalleryItem).ItemID = (int)dataSet.Tables[0].Rows[i]["ID"];
                        myStyleGalleryItem.Name     = (string)dataSet.Tables[0].Rows[i]["Name"];
                        myStyleGalleryItem.Category = (string)dataSet.Tables[0].Rows[i]["Category"];
                        IMemoryBlobStream memoryBlobStreamClass = new MemoryBlobStream();
                        object            item   = dataSet.Tables[0].Rows[i]["Object"];
                        Array             arrays = (Array)item;
                        int    length            = arrays.Length - 16;
                        byte[] value             = new byte[16];
                        for (j = 0; j < 16; j++)
                        {
                            value[j] = (byte)arrays.GetValue(j);
                        }
                        IPersistStream persistStream = (IPersistStream)this.method_0(new Guid(value));
                        byte[]         numArray      = new byte[length];
                        for (j = 0; j < length; j++)
                        {
                            numArray[j] = (byte)arrays.GetValue(j + 16);
                        }
                        ((IMemoryBlobStreamVariant)memoryBlobStreamClass).ImportFromVariant(numArray);
                        persistStream.Load(memoryBlobStreamClass);
                        myStyleGalleryItem.Item = persistStream;
                        ilist_0.Add(myStyleGalleryItem);
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        // CErrorLog.writeErrorLog(this, exception, "");
                    }
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                //CErrorLog.writeErrorLog(this, exception, "");
                MessageBox.Show(exception.Message);
            }
        }
Exemplo n.º 2
0
        private void method_4(string string_1, string string_2, string string_3, IList ilist_0)
        {
            int j;

            try
            {
                OleDbConnection oleDbConnection =
                    new OleDbConnection(string.Concat("Provider=Microsoft.Jet.OLEDB.4.0;Data source= ", string_2));
                string[]       string1          = new string[] { "SELECT * FROM [", string_1, "] Where Category = '", string_3, "'" };
                IDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(string.Concat(string1), oleDbConnection);
                DataSet        dataSet          = new DataSet();
                oleDbDataAdapter.Fill(dataSet);
                oleDbConnection.Close();
                for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                {
                    IStyleGalleryItem myStyleGalleryItem = new MyStyleGalleryItem();
                    ((MyStyleGalleryItem)myStyleGalleryItem).ItemID = (int)dataSet.Tables[0].Rows[i]["ID"];
                    myStyleGalleryItem.Name     = (string)dataSet.Tables[0].Rows[i]["Name"];
                    myStyleGalleryItem.Category = (string)dataSet.Tables[0].Rows[i]["Category"];
                    IMemoryBlobStream memoryBlobStreamClass = new MemoryBlobStream();
                    object            item   = dataSet.Tables[0].Rows[i]["Object"];
                    Array             arrays = (Array)item;
                    int    length            = arrays.Length - 16;
                    byte[] value             = new byte[16];
                    for (j = 0; j < 16; j++)
                    {
                        value[j] = (byte)arrays.GetValue(j);
                    }
                    IPersistStream persistStream = (IPersistStream)this.method_0(new Guid(value));
                    byte[]         numArray      = new byte[length];
                    for (j = 0; j < length; j++)
                    {
                        numArray[j] = (byte)arrays.GetValue(j + 16);
                    }
                    ((IMemoryBlobStreamVariant)memoryBlobStreamClass).ImportFromVariant(numArray);
                    persistStream.Load(memoryBlobStreamClass);
                    myStyleGalleryItem.Item = persistStream;
                    ilist_0.Add(myStyleGalleryItem);
                }
            }
            catch
            {
            }
        }