コード例 #1
0
ファイル: AddReference.xaml.cs プロジェクト: morecraf/Siaqodb
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.DirectorySeparatorChar + "config"))
            {
                assemblies.Clear();
                namespaces.Clear();
                Sqo.SiaqodbConfigurator.EncryptedDatabase = false;
                Sqo.Siaqodb siaqodb = new Sqo.Siaqodb(AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.DirectorySeparatorChar + "config");
                try
                {
                    siaqodb.DropType <ReferenceItem>();
                    siaqodb.DropType <NamespaceItem>();
                    foreach (object o in listBox1.Items)
                    {
                        ReferenceItem refItem = o as ReferenceItem;
                        if (refItem == null)
                        {
                            refItem = new ReferenceItem(o.ToString());
                        }
                        assemblies.Add(refItem);
                        siaqodb.StoreObject(refItem);

                        if (File.Exists(refItem.Item))
                        {
                            try
                            {
                                File.Copy(refItem.Item, AppDomain.CurrentDomain.BaseDirectory + "\\" + System.IO.Path.GetFileName(refItem.Item), true);
                            }
                            catch
                            {
                            }
                        }
                    }
                    foreach (string s in textBox1.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        NamespaceItem nobj = new NamespaceItem(s);
                        namespaces.Add(nobj);
                        siaqodb.StoreObject(nobj);
                    }
                }
                finally
                {
                    siaqodb.Close();
                    EncryptionSettings.SetEncryptionSettings();//set back settings
                }
            }

            this.DialogResult = true;
        }
コード例 #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (Directory.Exists(Application.StartupPath))
            {
                assemblies.Clear();
                namespaces.Clear();
                Sqo.Siaqodb siaqodb = new Sqo.Siaqodb(Application.StartupPath);
                try
                {
                    siaqodb.DropType <ReferenceItem>();
                    siaqodb.DropType <NamespaceItem>();
                    foreach (object o in listBox1.Items)
                    {
                        ReferenceItem refItem = o as ReferenceItem;
                        if (refItem == null)
                        {
                            refItem = new ReferenceItem(o.ToString());
                        }
                        assemblies.Add(refItem);
                        siaqodb.StoreObject(refItem);

                        if (File.Exists(refItem.Item))
                        {
                            try
                            {
                                File.Copy(refItem.Item, Application.StartupPath + Path.DirectorySeparatorChar + Path.GetFileName(refItem.Item), true);
                            }
                            catch
                            {
                            }
                        }
                    }
                    foreach (string s in textBox1.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        NamespaceItem nobj = new NamespaceItem(s);
                        namespaces.Add(nobj);
                        siaqodb.StoreObject(nobj);
                    }
                }
                finally
                {
                    siaqodb.Close();
                }
            }

            this.DialogResult = DialogResult.OK;
        }