Пример #1
0
 /// <summary>
 /// 从给定的数据文件路径构造对象
 /// </summary>
 /// <param name="path"></param>
 public ItemData(Anoicess.Anoicess.Anoicess objDB)
 {
     if (objDB != null)
     {
         this.objDB = objDB;
         ConnectDB();
     }
     else
     {
         Dispose();
     }
 }
Пример #2
0
        private void CreateDB()
        {
            objDB = Manage.mMAIN.CreateChildDB(data.ID, true);
            objDB.Insert("ID", data.ID);
            objDB.Insert("Name", data.Name);
            objDB.Insert("Icon", data.Icon.Length.ToString());
            objDB.Insert("Path", data.Path);
            objDB.Insert("Arguments", data.Arguments);
            objDB.Insert("Runas", data.RunAs.ToString());
            objDB.Insert("Autorun", data.AutoRun.ToString());
            objDB.Insert("Levels", data.Levels.ToString());
            objDB.Insert("WorkingDirectory", data.WorkingDirectory);
            objDB.Insert("TagName", data.tagName);
            if (data.HotKey == null)
            {
                data.HotKey = new HotKeyItem(this, System.Windows.Forms.Keys.None, 0, 0, HotKeyItem.HotKeyParentType.Item);
            }

            if (data.HotKey.KeyValue != System.Windows.Forms.Keys.None)
            {
                objDB.Insert("HotKey", data.HotKey.KeyValue.ToString() + "," + data.HotKey.ModifiersValue.ToString() + "," + data.HotKey.ID.ToString());
            }
            else
            {
                objDB.Insert("HotKey", ",,");
            }

            objDB.Insert("EnableHotKey", data.EnableHotKey.ToString());

            if (!Directory.Exists(Manage.IconPath))
            {
                Directory.CreateDirectory(Manage.IconPath);
            }

            try
            {
                using (BinaryWriter bw = new BinaryWriter(new FileStream(Manage.IconPath + data.ID + ".ib", FileMode.Create)))
                {
                    bw.Write(data.Icon);
                    bw.Flush();
                    bw.Close();
                }
            }
            catch
            {
            }
        }