Example #1
0
    // Use this for initialization
    void Start()
    {
        sprinkles        = GameObject.Find("Backdrop").GetComponent <Transform>();
        theCookie        = GameObject.Find("Cookie").GetComponent <Image>();
        theCookie.sprite = sprCookie;
        theText          = GameObject.Find("SEFDStuff Text").GetComponent <Image>();
        theText.sprite   = sprSEFDStuffTXT;
        Backdrop1        = GameObject.Find("Backdrop1").GetComponent <Image>();
        Backdrop2        = GameObject.Find("Backdrop2").GetComponent <Image>();
        Backdrop1.sprite = txrBackdrop;
        Backdrop2.sprite = Backdrop1.sprite;

        // Check the platform
        if (Application.isMobilePlatform)
        {
            resolution = version.portrait;
        }
        else
        {
            resolution = version.HD;
        }

        if (resolution == version.portrait)
        {
            Backdrop1.rectTransform.localScale   = Vector3.one * 2;
            Backdrop2.rectTransform.localScale   = Vector3.one * 2;
            theCookie.rectTransform.localScale   = Vector3.one * .95f;
            theText.rectTransform.localScale     = Vector3.one * .70f;
            theText.rectTransform.localPosition += Vector3.down * 256;
        }
    }
Example #2
0
        public static bool judgedepartment(string yonghu)
        {
            bool      flag    = false;
            version   version = new version();
            string    sql     = "select * from tb_update";
            DataTable dt      = SQLhelp.GetDataTable(sql, CommandType.Text);
            string    sql1    = "select * from tb_operator where 用户名 = '" + yonghu + "'";
            DataTable dt1     = SQLhelp.GetDataTable(sql1, CommandType.Text);
            string    务器版本号   = version.getversion("zttogffice");
            string    版本号     = dt.Rows[0]["版本号"].ToString();
            string    部门      = dt.Rows[0]["部门"].ToString();
            string    人员      = dt.Rows[0]["人员"].ToString();

            if (务器版本号.Equals(版本号))
            {
                if (部门.Contains(dt1.Rows[0]["部门"].ToString()))
                {
                    flag = true;
                }
                if (人员.Contains(yonghu))
                {
                    flag = true;
                }
            }
            if (部门.Equals("全员"))
            {
                flag = true;
            }
            return(flag);
        }
Example #3
0
 private bool isFirstNewer(version v1, version v2)
 {
     if (v2.Equals(v1))
     {
         return(false);
     }
     if (v2.major > v1.major)
     {
         return(false);
     }
     if (v2.minor > v1.minor)
     {
         return(false);
     }
     if (v2.patch > v1.patch)
     {
         return(false);
     }
     if (v2.alpha)
     {
         return(false);
     }
     if (v2.beta && !v1.alpha)
     {
         return(false);
     }
     return(true);
 }
Example #4
0
        protected override XResp Execute()
        {
            var r    = new version();
            var json = File.ReadAllText(Context.Server.MapPath("/app/ag_ver.x"));

            if (string.IsNullOrEmpty(json))
            {
                return(r);
            }

            var v = Serialize.FromJson <version>(json);

            if (v == null)
            {
                return(r);
            }

            if (v.no <= ver)
            {
                return(r);
            }

            v.hasnew = true;

            return(v);
        }
Example #5
0
        protected override XResp Execute()
        {
            var r    = new version();
            var json = File.ReadAllText(Context.Server.MapPath("/app/us_ver.x"));

            if (string.IsNullOrEmpty(json))
            {
                return(r);
            }

            var v = Serialize.FromJson <version>(json);

            if (v == null)
            {
                return(r);
            }

            if (v.no <= ver)
            {
                return(r);
            }
            if (!string.IsNullOrEmpty(v.ranges) && (us == null || us.range == 0 || !v.ranges.Split(',').Contains(us.range + "")))
            {
                return(r);
            }

            v.hasnew = true;

            return(v);
        }
        // GET: table_
        public ActionResult Index(int id)
        {
            if (Session["id"] == null)
            {
                return(RedirectToAction("Login", "Users"));
            }

            ViewData["id"] = id;


            List <table_> result = new List <table_>();


            version v = db.version.Find(id);

            string queryString = "select *  from " + v.version1 + "  ;";

            using (var connection = new SqlConnection("data source=DESKTOP-KV8OTIG;initial catalog=GestionImmobilier;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"))
            {
                var command = new SqlCommand(queryString, connection);

                connection.Open();


                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    table_ t = new table_();


                    t.id = reader.GetInt32(6);

                    t.Cible = reader.GetString(0);

                    if (!reader.IsDBNull(1))
                    {
                        t.HOMME___âge = reader.GetDouble(1) as Double?;
                    }
                    if (!reader.IsDBNull(2))
                    {
                        t.FEMME___âge = reader.GetDouble(2);
                    }

                    t.Espérance = reader.GetDouble(3);

                    t.tx_rente = reader.GetDouble(4);

                    t.dt_us_ = reader.GetDouble(5);



                    result.Add(t);
                }
            }



            return(View(result));
        }
Example #7
0
        public JsonResult InsererVersion(version customer)
        {
            version v = db.version.OrderByDescending(m => m.id).FirstOrDefault();

            db.version.Add(customer);
            db.SaveChanges();


            if (v != null)
            {
                string queryString = "select * into  " + customer.version1 + " from " + v.version1 + " ;";

                using (var connection = new SqlConnection("data source=DESKTOP-KV8OTIG;initial catalog=GestionImmobilier;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"))
                {
                    var command = new SqlCommand(queryString, connection);

                    connection.Open();
                    command.ExecuteNonQuery();


                    string q = " alter table " + customer.version1 + "  drop  COLUMN id ;";
                    var    d = new SqlCommand(q, connection);

                    d.ExecuteNonQuery();

                    string qs = " ALTER table " + customer.version1 + "  ADD  id INT NOT NULL IDENTITY(1, 1) PRIMARY KEY;";

                    var c = new SqlCommand(qs, connection);
                    c.ExecuteNonQuery();
                }
            }
            else if (v == null)
            {
                string queryString = "select * into  " + customer.version1 + " from table$ ;";

                using (var connection = new SqlConnection("data source=DESKTOP-KV8OTIG;initial catalog=GestionImmobilier;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"))
                {
                    var command = new SqlCommand(queryString, connection);

                    connection.Open();
                    command.ExecuteNonQuery();


                    string q = " alter table " + customer.version1 + "  drop  COLUMN id ;";
                    var    d = new SqlCommand(q, connection);

                    d.ExecuteNonQuery();

                    string qs = " ALTER table " + customer.version1 + "  ADD  id INT NOT NULL IDENTITY(1, 1) PRIMARY KEY;";

                    var c = new SqlCommand(qs, connection);
                    c.ExecuteNonQuery();
                }
            }



            return(Json(customer));
        }
Example #8
0
        public ActionResult DeleteConfirmed(int id)
        {
            version version = db.version.Find(id);

            db.version.Remove(version);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #9
0
 public ActionResult Edit([Bind(Include = "id,version1")] version version)
 {
     if (ModelState.IsValid)
     {
         db.Entry(version).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(version));
 }
Example #10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            String versionlocal = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            label3.Text = versionlocal;
            version version = new version();
            getData getData = new getData();

            getData.getiprouter();
            //if (version.judgeversion(versionlocal) == true)
            //{
            //    this.Close();
            //    downloadexe downloadexe = new downloadexe();
            //    downloadexe.Show();
            //}
            //else
            //{
            System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcessesByName("ztoffice"); //获取指定的进程名
            if (myProcesses.Length > 1)                                                                           //如果可以获取到知道的进程名则说明已经启动
            {
                MessageBox.Show("程序已启动!");
                Application.Exit();              //关闭系统
            }

            this.txtZerenren1.Text = Properties.Settings.Default.name;
            bool flag = Properties.Settings.Default.isrem;

            if (flag)
            {
                string sql_pass = "******" + txtZerenren1.Text.Trim() + "'";
                String password = Convert.ToString(SQLhelp.ExecuteScalar(sql_pass, CommandType.Text));
                this.checkbox1.Checked = true;
                this.txtPwd.Text       = password;
            }

            string    sql  = "select 用户名 from tb_operator";
            DataTable aaaa = SQLhelp.GetDataTable(sql, CommandType.Text);


            List <string> spaceminute = new List <string>();

            for (int i = 0; i < aaaa.Rows.Count; i++)
            {
                string n = aaaa.Rows[i]["用户名"].ToString();
                spaceminute.Add(n);
            }


            foreach (string s in spaceminute)
            {
                //comboBox1.Items.Add(s);
            }
            //}
        }
Example #11
0
        public ActionResult Create([Bind(Include = "id,version1")] version version)
        {
            if (ModelState.IsValid)
            {
                db.version.Add(version);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(version));
        }
Example #12
0
        private void downloadexe_Load(object sender, EventArgs e)
        {
            WebClient client = new WebClient();

            client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
            client.DownloadFileCompleted   += new AsyncCompletedEventHandler(DownloadFileCompleted);
            version version    = new version();
            String  versionnum = version.getversion();

            pathfilesave = System.Environment.CurrentDirectory + "\\zttoffice" + versionnum + ".exe";
            client.DownloadFileAsync(new Uri("http://10.15.1.252:8080/ZttErp/zttCodeversionController/getZttCodeversion?fileName=zttoffice"), pathfilesave);
        }
Example #13
0
        // GET: versions/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            version version = db.version.Find(id);

            if (version == null)
            {
                return(HttpNotFound());
            }
            return(View(version));
        }
Example #14
0
        private void downloadexe_Load(object sender, EventArgs e)
        {
            WebClient client = new WebClient();

            client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
            client.DownloadFileCompleted   += new AsyncCompletedEventHandler(DownloadFileCompleted);
            version version    = new version();
            String  versionnum = version.getversion("zttofficeyasou");

            pathfilesave = System.Environment.CurrentDirectory + "\\update.zip";
            String url = "http://" + MyGlobal.ip + ":8080/ZttErp/zttCodeversionController/getZttCodeversion?fileName=zttofficeyasou";

            client.DownloadFileAsync(new Uri(url), pathfilesave);
        }
Example #15
0
        public async Task offersAsync([Remainder] string text)
        {
            IUserMessage responce = await ReplyAsync("Getting store...");

            //Get username and password
            string[] arguments = text.Split(' ');
            string   data      = Program.ShopRequest(arguments[0], arguments[1]);

            if (data == "nullerror")
            {
                await responce.DeleteAsync();
                await ReplyAsync("Invalid credentials");
            }
            else
            {
                store storeobj = JsonConvert.DeserializeObject <store>(data);
                //Get version to get ID list
                string  json    = GetRequest("https://valorant-api.com/v1/version");
                version version = JsonConvert.DeserializeObject <version>(json);
                //Get ID list
                string        skinJson = Authentication.getSkins(version.data.branch + "-shipping-" + version.data.buildVersion + "-" + version.data.version.Substring(version.data.version.Length - 6));
                IDList        idClass  = JsonConvert.DeserializeObject <IDList>(skinJson);
                List <string> gunnames = new List <string>();
                //For each skin code, go through the ID list and find the object.
                foreach (string id in storeobj.SkinsPanelLayout.SingleItemOffers)
                {
                    foreach (SkinLevel skin in idClass.SkinLevels)
                    {
                        if (skin.ID.Contains(id, StringComparison.OrdinalIgnoreCase))
                        {
                            gunnames.Add(skin.Name);
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                String[] str      = gunnames.ToArray();
                TimeSpan t        = TimeSpan.FromSeconds(storeobj.SkinsPanelLayout.SingleItemOffersRemainingDurationInSeconds);
                string   timeLeft = string.Format("{0:D2} hours, {1:D2} minutes, and {2:D2} seconds",
                                                  t.Hours,
                                                  t.Minutes,
                                                  t.Seconds);
                await responce.DeleteAsync();
                await ReplyAsync("Your shop contains the " + str[0] + ", " + str[1] + ", " + str[2] + ", and the " + str[3] + ". There are " + timeLeft + " left until the shop changes.");
            }
        }
Example #16
0
        //Open the TAP adapter and set the connection to enabled :)
        static Microsoft.Win32.SafeHandles.SafeFileHandle TAPOpen(string device_guid)
        {
            string device_path;

            UInt32 version_len = 0;

            //_snprintf (device_path, sizeof(device_path), "%s%s%s",
            //          USERMODEDEVICEDIR,
            //          device_guid,
            //          TAPSUFFIX);
            device_path = USERMODEDEVICEDIR + device_guid + TAPSUFFIX;

            Microsoft.Win32.SafeHandles.SafeFileHandle handle = CreateFile(
                device_path,
                GENERIC_READ | GENERIC_WRITE,
                0,
                IntPtr.Zero,
                OPEN_EXISTING,
                FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED,
                IntPtr.Zero);

            if (handle.IsInvalid)
            {
                Console.Error.WriteLine("Error @ CF " + Marshal.GetLastWin32Error());
                //return INVALID_HANDLE_VALUE;
                return(new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(-1), true));
            }
            version ver = new version();

            IntPtr nullptr = IntPtr.Zero;
            bool   bret    = DeviceIoControl(handle, TAP_IOCTL_GET_VERSION,
                                             ref ver, (UInt32)Marshal.SizeOf(ver),
                                             ref ver, (UInt32)Marshal.SizeOf(ver), ref version_len, nullptr);

            if (bret == false)
            {
                Console.Error.WriteLine("Error @ DIOC " + Marshal.GetLastWin32Error());
                handle.Close();
                return(new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(-1), true));
            }

            if (!TAPSetStatus(handle, true))
            {
                Console.Error.WriteLine("Error @ TAPSETSTAT " + Marshal.GetLastWin32Error());
                return(new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(-1), true));
            }

            return(handle);
        }
Example #17
0
        /// <summary>
        /// 获取逆序分页数据
        /// </summary>
        /// <param name="index"></param>
        /// <param name="pageSize"></param>
        /// <param name="currentPage"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public valueType[] GetPageDesc(int index, int pageSize, int currentPage, out int count)
        {
            version <list <valueType> > list = default(version <list <valueType> >);

            do
            {
                array[index].Get(ref list);
                count = list.Value.count();
                valueType[] values = list.Value.toSubArray().GetPageDesc(pageSize, currentPage);
                if (array[index].Version == list.Version)
                {
                    return(values);
                }
            }while (true);
        }
Example #18
0
        public JsonResult submitVersion(version value)
        {
            version temp = value;

            temp.createTime = DateTime.Now;
            temp.state      = 0;
            db.versions.Add(temp);
            db.SaveChanges();
            var data = new
            {
                name = 1,
            };

            return(Json(data));
        }
        public ActionResult UpdateCustomer(table_ customer, int id)
        {
            version v = db.version.Find(id);

            string queryString = "update  " + v.version1 + " set HOMME___âge=" + customer.HOMME___âge + " , FEMME___âge =" + customer.FEMME___âge + " where id = " + customer.id + ";";

            using (var connection = new SqlConnection("data source=DESKTOP-KV8OTIG;initial catalog=GestionImmobilier;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"))
            {
                var command = new SqlCommand(queryString, connection);

                connection.Open();
                command.ExecuteNonQuery();
            }



            return(new EmptyResult());
        }
        public JsonResult Inserer(table_ customer, int id)
        {
            version v = db.version.Find(id);

            string esp   = customer.Espérance.ToString().Replace(",", ".");
            string us    = customer.dt_us_.ToString().Replace(",", ".");
            string rente = customer.tx_rente.ToString().Replace(",", ".");

            string queryString = "insert into  " + v.version1 + " (Cible,HOMME___âge,FEMME___âge,Espérance,tx_rente,dt_us_)VALUES('" + customer.Cible + "'," + customer.HOMME___âge + "," + customer.FEMME___âge + "," + esp + "," + rente + "," + us + ") ;";

            using (var connection = new SqlConnection("data source=DESKTOP-KV8OTIG;initial catalog=GestionImmobilier;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"))
            {
                var command = new SqlCommand(queryString, connection);

                connection.Open();
                command.ExecuteNonQuery();
            }


            return(Json(customer));
        }
Example #21
0
        private version stringToVersion(string version)
        {
            version v = new version(0, 0, 0, true, false, false);

            try
            {
                string[] vArr = version.Split('.');
                if (vArr.Count() == 3)
                {
                    v.alpha  = vArr[2].Contains("-alpha");
                    v.beta   = vArr[2].Contains("-beta") && !v.alpha;
                    v.stable = !v.alpha && !v.beta;
                    v.major  = int.Parse(vArr[0].Replace("v", ""));
                    v.minor  = int.Parse(vArr[1]);
                    v.patch  = int.Parse(vArr[2].Replace("-alpha", "").Replace("-beta", ""));
                }
            }
            catch (Exception ex) {}

            return(v);
        }
Example #22
0
        static void Main()
        {
            String  versionlocal = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            version version      = new version();

            getData.getiprouter();
            if (getData.ifping("10.15.1.252"))
            {
                DevExpress.UserSkins.BonusSkins.Register();
                SkinManager.EnableFormSkins();
                UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue");  // 设置皮肤样式

                //DevExpress.XtraEditors.WindowsFormsSettings.SetDPIAware();
                //DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new Font("宋体", 12);
                //DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont=new Font("宋体", 12);
                Application.Run(new FrLogin());
            }
            else if (getData.ifping("47.97.210.239"))
            {
                DevExpress.UserSkins.BonusSkins.Register();
                SkinManager.EnableFormSkins();
                UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue");  // 设置皮肤样式
                //DevExpress.XtraEditors.WindowsFormsSettings.SetDPIAware();
                //DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new Font("宋体", 12);
                //DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont = new Font("宋体", 12);
                Application.Run(new FrLogin());
            }
            else
            {
                DevExpress.UserSkins.BonusSkins.Register();
                SkinManager.EnableFormSkins();
                UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue");  // 设置皮肤样式
                //DevExpress.XtraEditors.WindowsFormsSettings.SetDPIAware();
                //DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new Font("宋体", 12);
                //DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont = new Font("宋体", 12);
                Application.Run(new FrLogin());
            }
        }
Example #23
0
 await UrlLib.GetAllModIntroAsync(version, path);
Example #24
0
 public static string Route(accessGroup accessGroup, version version, modName modName)
 {
     return($"https://{Domain}/{accessGroup}/{GetVersion(version)}/{GetModName(modName)}");
 }
Example #25
0
 public static string GetVersion(version version)
 {
     return(version.ToString().Replace("_", "."));
 }
Example #26
0
 static extern bool DeviceIoControl(Microsoft.Win32.SafeHandles.SafeFileHandle hDevice, UInt32 dwIoControlCode, ref version lpInBuffer, UInt32 nInBufferSize, ref version lpOutBuffer, UInt32 nOutBufferSize, ref UInt32 lpBytesReturned, IntPtr lpOverlapped);
Example #27
0
        public @class ProcessEntity(Entity entity)
        {
            Log.DebugFormat("Processing entity {0}", entity.Name);
            var newClass = new @class {
                name = entity.Name
            };
            IList <ITable> mappedTables = entity.MappedTables().ToList();
            // One Entity to one or more tables
            ITable table = GetPrimaryTable(entity);

            if (table != null && !string.IsNullOrEmpty(table.Name))
            {
                newClass.table = table.Name.BackTick();
            }

            if (table != null && !string.IsNullOrEmpty(table.Schema))
            {
                newClass.schema = table.Schema.BackTick();
            }

            var entityDefaultLazy = entity.GetEntityLazy();

            if (entity.GetEntityLazy() == Interfaces.NHibernateEnums.EntityLazyTypes.inherit_default)
            {
                newClass.lazy = ArchAngel.Interfaces.SharedData.CurrentProject.GetProjectDefaultLazy();
            }
            else
            {
                newClass.lazy = entityDefaultLazy == Interfaces.NHibernateEnums.EntityLazyTypes.@true;
            }

            newClass.lazySpecified = !newClass.lazy;

            newClass.batchsize          = entity.GetEntityBatchSize();
            newClass.batchsizeSpecified = entity.GetEntityBatchSize() != 1;

            if (entity.GetEntityDynamicInsert())
            {
                newClass.dynamicinsert = true;
            }

            if (entity.GetEntityDynamicUpdate())
            {
                newClass.dynamicupdate = true;
            }

            newClass.@abstract = entity.IsAbstract;

            if (entity.IsAbstract)
            {
                newClass.abstractSpecified = true;
            }

            newClass.mutable            = entity.GetEntityMutable();
            newClass.optimisticlock     = (optimisticLockMode)Enum.Parse(typeof(optimisticLockMode), entity.GetEntityOptimisticLock().ToString(), true);
            newClass.selectbeforeupdate = entity.GetEntitySelectBeforeUpdate();

            if (entity.Cache.Usage != Cache.UsageTypes.None)
            {
                newClass.cache = new cache()
                {
                    include = (cacheInclude)Enum.Parse(typeof(cacheInclude), entity.Cache.Include.ToString().Replace("_", ""), true),
                    region  = entity.Cache.Region
                };
                switch (entity.Cache.Usage)
                {
                case Cache.UsageTypes.NonStrict_Read_Write:
                    newClass.cache.usage = cacheUsage.nonstrictreadwrite;
                    break;

                case Cache.UsageTypes.Read_Only:
                    newClass.cache.usage = cacheUsage.@readonly;
                    break;

                case Cache.UsageTypes.Read_Write:
                    newClass.cache.usage = cacheUsage.readwrite;
                    break;

                case Cache.UsageTypes.Transactional:
                    newClass.cache.usage = cacheUsage.transactional;
                    break;

                default:
                    throw new NotImplementedException("This cache type not implemented yet: " + entity.Cache.Usage.ToString());
                }
            }

            if (entity.GetEntityBatchSize() != 1)
            {
                newClass.batchsize = entity.GetEntityBatchSize();
            }

            if (!string.IsNullOrWhiteSpace(entity.GetEntityProxy()))
            {
                newClass.proxy = entity.GetEntityProxy();
            }

            if (!string.IsNullOrWhiteSpace(entity.GetEntityPersister()))
            {
                newClass.persister = entity.GetEntityPersister();
            }

            string sqlWhere = entity.GetEntitySqlWhereClause();

            if (!string.IsNullOrEmpty(sqlWhere))
            {
                newClass.where = sqlWhere;
            }

            // bool isSingleColumnPK = false;

            if (entity.IsAbstract)
            {
                // This is an abstract class in Table Per Concrete Class inheritance. The child entities
                // should have properties of the same name.
                Entity firstChild = entity.Children.FirstOrDefault();

                while (firstChild != null && firstChild.IsAbstract)
                {
                    firstChild = firstChild.Children.FirstOrDefault();
                }

                if (firstChild != null)
                {
                    ITable childTable = GetPrimaryTable(firstChild);
                    ProcessEntityKey(firstChild, newClass, childTable);
                    // isSingleColumnPK = childTable.ColumnsInPrimaryKey.Count() == 1;

                    foreach (var property in entity.Properties.OrderBy(p => p.Name))
                    {
                        if (firstChild.PropertiesHiddenByAbstractParent.Single(p => p.Name == property.Name).IsKeyProperty)
                        {
                            continue;
                        }

                        var      mappedColumn = firstChild.PropertiesHiddenByAbstractParent.Single(p => p.Name == property.Name).MappedColumn();
                        property prop         = new property {
                            name = property.Name, column = mappedColumn.Name.BackTick()
                        };
                        //AddExtraInfoToProperty(prop, property);
                        newClass.AddProperty(prop);
                    }
                }
                foreach (Entity child in entity.Children)
                {
                    Entity theChild = child;

                    while (theChild != null && theChild.IsAbstract)
                    {
                        theChild = theChild.Children.FirstOrDefault();
                    }

                    ITable mappedTable = theChild.MappedTables().First();

                    unionsubclass union = new unionsubclass()
                    {
                        name  = theChild.Name,
                        table = mappedTable.Name.BackTick()
                    };
                    newClass.AddItem1(union);

                    List <property> unionProperties = new List <property>();

                    foreach (Property prop in theChild.ConcreteProperties)
                    {
                        if (prop.IsKeyProperty)
                        {
                            continue;
                        }

                        unionProperties.Add(
                            new property()
                        {
                            name   = prop.Name,
                            column = prop.MappedColumn().Name.BackTick()
                        });
                        //AddExtraInfoToProperty(prop, property);
                    }
                    union.Items = unionProperties.ToArray();
                }
            }
            else
            {
                ProcessEntityKey(entity, newClass, table);
                // isSingleColumnPK = table.ColumnsInPrimaryKey.Count() == 1;
            }
            var propertiesAlreadyHandled = new List <Property>();

            foreach (ITable joinedTable in mappedTables.OrderBy(t => t.Name))
            {
                if (joinedTable == table)
                {
                    continue;
                }

                join joinNode = new join();
                joinNode.table  = joinedTable.Name.BackTick();
                joinNode.schema = joinedTable.Schema.BackTick();
                int numPrimaryKeyColumns = joinedTable.ColumnsInPrimaryKey.Count();

                if (numPrimaryKeyColumns > 0)
                {
                    key keyNode = GetKeyNode(joinedTable);
                    joinNode.key = keyNode;
                }

                foreach (var property in entity.Properties.OrderBy(p => p.Name))
                {
                    var mappedColumn = property.MappedColumn();

                    if (mappedColumn == null || mappedColumn.Parent != joinedTable)
                    {
                        continue;
                    }

                    property prop = new property {
                        name = property.Name, column = mappedColumn.Name.BackTick()
                    };
                    AddExtraInfoToProperty(prop, property);
                    joinNode.AddProperty(prop);
                    propertiesAlreadyHandled.Add(property);
                }
                newClass.AddItem1(joinNode);
            }
            var versionProperty = entity.Properties.FirstOrDefault(p => p.GetPropertyIsVersion());

            if (versionProperty != null)
            {
                version versionNode = new version();
                versionNode.column1 = versionProperty.MappedColumn().Name.BackTick();
                versionNode.name    = versionProperty.Name;
                versionNode.type    = versionProperty.NHibernateType;
                // AddExtraInfoToProperty(prop, property);
                newClass.SetVersion(versionNode);
                propertiesAlreadyHandled.Add(versionProperty);
            }

            //foreach (var prop in ProcessProperties(entity.Properties.Except(propertiesAlreadyHandled).Except(entity.ForeignKeyPropertiesToExclude), isSingleColumnPK).OrderBy(p => p.name))
            foreach (var prop in ProcessProperties(entity.Properties.Except(propertiesAlreadyHandled).Except(entity.ForeignKeyPropertiesToExclude)).OrderBy(p => p.name))
            {
                newClass.AddProperty(prop);
            }

            // Process components, skip component used as Key.
            foreach (var component in ProcessComponent(entity.Components.Except(new[] { entity.Key.Component })).OrderBy(c => c.name))
            {
                newClass.AddComponent(component);
            }

            ProcessInheritance(entity, newClass);

            var referenceMapper = new ReferenceMapper();

            referenceMapper.ProcessReferences(entity, item => newClass.AddItem(item));
            return(newClass);
        }
		static extern Status sane_init (out version, AuthorizeCallback func);
        internal AIMLTagHandler GetTagHandlerU(User user, SubQuery query, Request request, Result result, XmlNode node, bool liText)
        {
            AIMLTagHandler tagHandlerU   = getBespokeTags(user, query, request, result, node);
            string         nodeNameLower = StaticAIMLUtils.ToLower(node.LocalName);
            AltBot         targetBot     = query.TargetBot;

            if (Equals(null, tagHandlerU))
            {
                switch (nodeNameLower)
                {
                case "template":
                case "answer":     //CML
                    tagHandlerU = new template(targetBot, user, query, request, result, node);
                    break;

                case "aiml":
                case "cml":     //CML
                    tagHandlerU = new aiml(targetBot, user, query, request, result, node);
                    break;

                case "aimlexec":
                case "eval":
                    tagHandlerU = new aimlexec(targetBot, user, query, request, result, node);
                    break;

                case "vars":
                case "root":
                case "predicates":     //CML
                    tagHandlerU = new root(targetBot, user, query, request, result, node, (() => query.TargetSettings));
                    break;

                case "properties":
                case "bots":
                    tagHandlerU = new root(targetBot, user, query, request, result, node,
                                           (() => request.TargetBot.GlobalSettings));
                    break;

                case "substitutions":
                    tagHandlerU = new root(targetBot, user, query, request, result, node,
                                           (() => request.TargetBot.InputSubstitutions));
                    break;

                case "topic":
                case "conversation":     //CML
                    tagHandlerU = new topic(targetBot, user, query, request, result, node);
                    break;

                case "category":
                case "conv":     //CML
                    tagHandlerU = new category(targetBot, user, query, request, result, node);
                    break;

                case "and":
                    tagHandlerU = new and(targetBot, user, query, request, result, node);
                    break;

                case "or":
                    tagHandlerU = new or(targetBot, user, query, request, result, node);
                    break;

                case "optional":
                    tagHandlerU = new optional(targetBot, user, query, request, result, node);
                    break;

                case "isa":
                    tagHandlerU = new isa(targetBot, user, query, request, result, node);
                    break;

                case "bot":
                    tagHandlerU = new bot(targetBot, user, query, request, result, node);
                    break;

                case "condition":
                case "options":     //cml
                    tagHandlerU = new condition_aima(targetBot, user, query, request, result, node);
                    break;

                case "li":
                    if (liText)
                    {
                        tagHandlerU = new liif(targetBot, user, query, request, result, node);
                    }
                    break;

                case "if":
                    tagHandlerU = new liif(targetBot, user, query, request, result, node);
                    break;

                case "personf":
                    tagHandlerU = new format(targetBot, user, query, request, result, node,
                                             new Func <string, string>(HttpUtility.UrlEncode),
                                             null);
                    break;

                case "date":
                    tagHandlerU = new date(targetBot, user, query, request, result, node);
                    break;

                case "formal":
                    tagHandlerU = new formal(targetBot, user, query, request, result, node);
                    break;

                case "gender":
                    tagHandlerU = new gender(targetBot, user, query, request, result, node);
                    break;

                case "get":
                    tagHandlerU = new get(targetBot, user, query, request, result, node);
                    break;

                case "gossip":
                    tagHandlerU = new gossip(targetBot, user, query, request, result, node);
                    break;

                case "get_ip":
                case "id":
                    tagHandlerU = new id(targetBot, user, query, request, result, node);
                    break;

                case "inputreq":
                    tagHandlerU = new inputreq(targetBot, user, query, request, result, node);
                    break;

                case "request":
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 1);
                    break;

                case "input":
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 1);
                    break;

                case "justthat":     // <input index="2"/>
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 2);
                    break;

                case "beforethat":     // <input index="3"/>
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 3);
                    break;

#if !(__MonoCS__)
                case "javascript":
                    tagHandlerU = new javascript(targetBot, user, query, request, result, node);
                    break;
#endif
                case "learn":
                case "load":
                case "noload":     // the commented version of <load>
                    tagHandlerU = new learn(targetBot, user, query, request, result, node);
                    break;

                case "lowercase":
                    tagHandlerU = new lowercase(targetBot, user, query, request, result, node);
                    break;

                case "person":
                    tagHandlerU = new substitute(targetBot, user, query, request, result, node);
                    break;

                case "person2":
                    tagHandlerU = new substitute(targetBot, user, query, request, result, node);
                    break;

                case "random":
                    tagHandlerU = new random(targetBot, user, query, request, result, node);
                    break;

                case "sentence":
                    tagHandlerU = new sentence(targetBot, user, query, request, result, node);
                    break;

                case "set":
                    tagHandlerU = new set(targetBot, user, query, request, result, node);
                    break;

                case "size":
                case "getsize":
                    tagHandlerU = new size(targetBot, user, query, request, result, node);
                    break;

                case "sr":
                    tagHandlerU = new sr(targetBot, user, query, request, result, node);
                    break;

                case "srai_odd":
                    tagHandlerU = new srai_odd(targetBot, user, query, request, result, node);
                    break;

                case "star":
                    tagHandlerU = new star(targetBot, user, query, request, result, node);
                    break;

                case "system":
                    tagHandlerU = new system(targetBot, user, query, request, result, node);
                    break;

                case "that":     //default <that index="1,1"/>
                    tagHandlerU = new that(targetBot, user, query, request, result, node, 1);
                    break;

                case "justbeforethat":     //treated as <that index="2,1"/>
                    tagHandlerU = new that(targetBot, user, query, request, result, node, 2);
                    break;

                case "response":     //treated as <that index="1,1"/>
                    tagHandlerU = new that(targetBot, user, query, request, result, node, 2);
                    break;

                case "thatstar":
                    tagHandlerU = new thatstar(targetBot, user, query, request, result, node);
                    break;

                case "think":
                    tagHandlerU = new think(targetBot, user, query, request, result, node);
                    break;

                case "topicstar":
                    tagHandlerU = new topicstar(targetBot, user, query, request, result, node);
                    break;

                case "uppercase":
                    tagHandlerU = new uppercase(targetBot, user, query, request, result, node);
                    break;

                case "version":
                case "getversion":
                    tagHandlerU = new version(targetBot, user, query, request, result, node);
                    break;

                case "cycsystem":
                    tagHandlerU = new cycsystem(targetBot, user, query, request, result, node);
                    break;

                case "cycretract":
                    tagHandlerU = new cycretract(targetBot, user, query, request, result, node);
                    break;

                case "cycassert":
                    tagHandlerU = new cycassert(targetBot, user, query, request, result, node);
                    break;

                case "cycterm":
                    tagHandlerU = new cycterm(targetBot, user, query, request, result, node);
                    break;

                case "cycquery":
                    tagHandlerU = new cycquery(targetBot, user, query, request, result, node);
                    break;

                case "cyccondition":
                    tagHandlerU = new cyccondition(targetBot, user, query, request, result, node);
                    break;

                case "cycphrase":
                    tagHandlerU = new cycphrase(targetBot, user, query, request, result, node);
                    break;

                case "cycparaphrase":
                    tagHandlerU = new cycphrase(targetBot, user, query, request, result, node);
                    break;

                case "guard":
                    tagHandlerU = new guard(targetBot, user, query, request, result, node);
                    break;

                case "guardstar":
                    tagHandlerU = new guardstar(targetBot, user, query, request, result, node);
                    break;

                case "cycrandom":
                    tagHandlerU = new cycrandom(targetBot, user, query, request, result, node);
                    break;

                case "tscore":
                    tagHandlerU = new tscore(targetBot, user, query, request, result, node);
                    break;

                case "space":
                    tagHandlerU = new space(targetBot, user, query, request, result, node);
                    break;

                case "markov":
                    tagHandlerU = new markov(targetBot, user, query, request, result, node);
                    break;

                case "soundcode":
                    tagHandlerU = new soundcode(targetBot, user, query, request, result, node);
                    break;

                // MSM
                case "msm":
                    tagHandlerU = new msm(targetBot, user, query, request, result, node);
                    break;

                case "processmsm":
                    tagHandlerU = new process_msm(targetBot, user, query, request, result, node);
                    break;

                case "setstate":
                    tagHandlerU = new setstate(targetBot, user, query, request, result, node);
                    break;

                case "state":
                    tagHandlerU = new state(targetBot, user, query, request, result, node);
                    break;

                case "transition":
                    tagHandlerU = new transition(targetBot, user, query, request, result, node);
                    break;

                case "setevidence":
                    tagHandlerU = new setevidence(targetBot, user, query, request, result, node);
                    break;

                case "evidenceassoc":
                    tagHandlerU = new evidence_assoc(targetBot, user, query, request, result, node);
                    break;

                case "evidencepattern":
                    tagHandlerU = new evidence_pattern(targetBot, user, query, request, result, node);
                    break;

                case "evidencestate":
                    tagHandlerU = new evidencestate(targetBot, user, query, request, result, node);
                    break;

                case "dependentmachine":
                    tagHandlerU = new dependentmachine(targetBot, user, query, request, result, node);
                    break;

                case "responsetopic":
                    tagHandlerU = new response_topic(targetBot, user, query, request, result, node);
                    break;

                case "push":
                    tagHandlerU = new push(targetBot, user, query, request, result, node);
                    break;

                case "pop":
                    tagHandlerU = new pop(targetBot, user, query, request, result, node);
                    break;

                case "peekstack":
                    tagHandlerU = new peekstack(targetBot, user, query, request, result, node);
                    break;

                case "lex":
                    tagHandlerU = new lex(targetBot, user, query, request, result, node);
                    break;

                case "lexset":
                    tagHandlerU = new lexset(targetBot, user, query, request, result, node);
                    break;

                case "lexis":
                    tagHandlerU = new lexis(targetBot, user, query, request, result, node);
                    break;

                case "dbpush":
                    tagHandlerU = new dbpush(targetBot, user, query, request, result, node);
                    break;

                case "dbquery":
                    tagHandlerU = new dbquery(targetBot, user, query, request, result, node);
                    break;

                case "dbupdate":
                    tagHandlerU = new dbupdate(targetBot, user, query, request, result, node);
                    break;

                case "dbdelete":
                    tagHandlerU = new dbdelete(targetBot, user, query, request, result, node);
                    break;

                case "dbload":
                    tagHandlerU = new dbload(targetBot, user, query, request, result, node);
                    break;


                case "regex":
                    tagHandlerU = new regex(targetBot, user, query, request, result, node);
                    break;

                case "bind":     // <bind>#$isa</bind>
                    tagHandlerU = new bind(targetBot, user, query, request, result, node);
                    break;

                case "#text":
                    if (!liText)
                    {
                        return(null);
                    }
                    return(new verbatum(node.Value, targetBot, user, query, request, result, node));

                case "#comment":
                    return(new verbatum(node.OuterXml, targetBot, user, query, request, result, node));

                case "br":
                    return(new verbatum("\n", targetBot, user, query, request, result, node));

                case "pre":
                    return(new verbatum(StaticXMLUtils.InnerXmlText(node), targetBot, user, query, request, result, node));

                case "p":
                    return(new verbatum("\n\n", targetBot, user, query, request, result, node));

                case "meta":
                    return(new verbatum(node.OuterXml, targetBot, user, query, request, result, node));

                default:
                    break;
                }
            }
            if (tagHandlerU != null)
            {
                return(tagHandlerU);
            }
            if (StaticAIMLUtils.IsHtmlTag(node.Name))
            {
                return(new recursiveVerbatum(node, targetBot, user, query, request, result, node, true));
            }
            if (tagHandlerU == null)
            {
                // "bot", "favorite", "fav"
                foreach (KeyValuePair <string, string> prefix in new[]
                {
                    new KeyValuePair <string, string>("get_", "get"),
                    new KeyValuePair <string, string>("set_", "set"),
                    new KeyValuePair <string, string>("bot_", "bot"),
                    new KeyValuePair <string, string>("favorite_", "bot"),
                    new KeyValuePair <string, string>("favorite", "bot"),
                    new KeyValuePair <string, string>("fav_", "bot"),
                    new KeyValuePair <string, string>("fav", "bot"),

                    new KeyValuePair <string, string>("get", "get"),
                    new KeyValuePair <string, string>("set", "set"),
                    new KeyValuePair <string, string>("bot", "bot"),
                })
                {
                    if (nodeNameLower.StartsWith(prefix.Key) && node.Name.Length > prefix.Key.Length)
                    {
                        string               name    = node.Name.Substring(prefix.Key.Length);
                        XmlNode              pn      = node.ParentNode;
                        LineInfoElementImpl  newnode = StaticXMLUtils.CopyNode(prefix.Value, node, false);
                        XmlAttributeLineInfo atr     = (XmlAttributeLineInfo)newnode.OwnerDocument.CreateAttribute("name");
                        atr.ReadOnly = false;
                        atr.Value    = name;
                        newnode.Attributes.Append(atr);
                        if (node.Name.ToLower() != newnode.Name.ToLower())
                        {
                            writeToLog("AIMLLOADER: converted " + node.OuterXml + " -> " + newnode.OuterXml);
                            return(targetBot.GetTagHandler(newnode, query, request, result, user, liText));
                        }
                        writeToLog("AIMLLOADER: ! convert " + node.OuterXml + " -> " + newnode.OuterXml);
                    }
                }
            }
            if (tagHandlerU != null)
            {
                return(tagHandlerU);
            }
            if (nodeNameLower == "name")
            {
                return(new bot(targetBot, user, query, request, result, node));
            }

            tagHandlerU = new lazyClosure(targetBot, user, query, request, result, node);
            writeToLog("AIMLLOADER:  lazyClosure: " + node.OuterXml);
            return(tagHandlerU);
        }
 if (DllGetVersion(ref version) == 0) SOYSAUCE CHIPS IS A F****T
Example #31
0
 static extern Status sane_init(out version, AuthorizeCallback func);
Example #32
0
 var(version, objs) = DeserializeBinaryArray <T>(data);