Example #1
0
        FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums)
        {
            var wrappers = new FunctionCollection();

            foreach (var d in delegates.Values.SelectMany(v => v))
            {
                wrappers.AddRange(CreateNormalWrappers(d, enums));
            }

            if ((Settings.Compatibility & Settings.Legacy.KeepUntypedEnums) != 0)
            {
                // Generate an "All" overload for every function that takes strongly-typed enums
                var overloads = new List <Function>();
                foreach (var list in wrappers.Values)
                {
                    overloads.AddRange(list.Where(f => f.Parameters.Any(p => p.IsEnum)).Select(f =>
                    {
                        var fnew      = new Function(f);
                        fnew.Obsolete = "Use strongly-typed overload instead";
                        // Note that we can only overload parameters, not the return type
                        foreach (var p in fnew.Parameters)
                        {
                            if (p.IsEnum)
                            {
                                p.CurrentType = Settings.CompleteEnumName;
                            }
                        }

                        return(fnew);
                    }));
                }
                wrappers.AddRange(overloads);
            }
            return(wrappers);
        }
Example #2
0
        public FunctionCollection Process(DelegateCollection delegates, EnumCollection enums)
        {
            Console.WriteLine("Processing delegates.");
            var nav = new XPathDocument(Overrides).CreateNavigator();

            foreach (var d in delegates.Values)
            {
                var function_override = GetFuncOverride(nav, d);
                if (function_override != null)
                {
                    string obsolete = function_override.GetAttribute("obsolete", "");
                    if (!string.IsNullOrEmpty(obsolete))
                    {
                        d.Obsolete = obsolete;
                    }
                }

                TranslateReturnType(nav, d, enums);
                TranslateParameters(nav, d, enums);
            }

            Console.WriteLine("Generating wrappers.");
            var wrappers = CreateWrappers(delegates, enums);

            Console.WriteLine("Creating CLS compliant overloads.");
            wrappers = CreateCLSCompliantWrappers(wrappers, enums);
            Console.WriteLine("Removing non-CLS compliant duplicates.");

            return(MarkCLSCompliance(wrappers));
        }
Example #3
0
 public FollowOddsOption(EnumCollection.eFollowOddsOption option1, double num1)
 {
     this._objFollowOddsOption = EnumCollection.eFollowOddsOption.None;
     this._dblOddsValue = 0.0;
     this._objFollowOddsOption = option1;
     this._dblOddsValue = num1;
 }
Example #4
0
        public Generator(Settings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            Settings = settings.Clone();

            glTypemap = "GL2/gl.tm";
            csTypemap = Settings.LanguageTypeMapFile;

            enumSpec    = Path.Combine("GL2", "signatures.xml");
            enumSpecExt = String.Empty;
            glSpec      = Path.Combine("GL2", "signatures.xml");
            glSpecExt   = String.Empty;

            Settings.ImportsClass   = "Core";
            Settings.DelegatesClass = "Delegates";
            Settings.OutputClass    = "GL";

            Delegates = new DelegateCollection();
            Enums     = new EnumCollection();
            Wrappers  = new FunctionCollection();

            SpecReader = new XmlSpecReader(Settings);
        }
        public ActionResult Detail(Service service)
        {
            if (!ModelState.IsValid)
            {
                var model = new ServiceModel()
                {
                    Service      = service,
                    ServiceTypes = EnumCollection.GetServiceTypeEnum()
                };

                return(View(model));
            }
            var result = ServiceTypeService.Save(service);

            if (result.HasError)
            {
                ViewBag.Error = result.Message;
                var model = new ServiceModel()
                {
                    Service      = service,
                    ServiceTypes = EnumCollection.GetServiceTypeEnum()
                };
                return(View(model));
            }

            return(RedirectToAction("List"));
        }
Example #6
0
        void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
        {
            Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
            if (!Directory.Exists(Settings.OutputPath))
                Directory.CreateDirectory(Settings.OutputPath);

            // Hack: Fix 3dfx extension category so it doesn't start with a digit
            if (wrappers.ContainsKey("3dfx"))
            {
                var three_dee_fx = wrappers["3dfx"];
                wrappers.Remove("3dfx");
                wrappers.Add(DigitPrefix + "3dfx", three_dee_fx);
            }

            using (var sw = sw_h)
            {
                WriteLicense(sw);

                sw.WriteLine("package {0}.{1};", Settings.OutputNamespace, Settings.GLClass);
                sw.WriteLine();
                sw.WriteLine("import java.nio.*;");
                sw.WriteLine();

                WriteDefinitions(sw, enums, wrappers, Type.CSTypes);

                sw.Flush();
                sw.Close();
            }

            string output_header = Path.Combine(Settings.OutputPath, OutputFileHeader);
            Move(sw_h.File, output_header);
        }
Example #7
0
 public EnumCollection Process(EnumCollection enums)
 {
     var nav = new XPathDocument(Overrides).CreateNavigator();
     enums = ProcessNames(enums, nav);
     enums = ProcessConstants(enums, nav);
     return enums;
 }
Example #8
0
        private void Init()
        {
            try
            {
                ddlType.DataSource    = EnumCollection.UserTypeList();
                ddlType.DisplayMember = "Name";
                ddlType.ValueMember   = "ID";

                ddlStatus.DataSource    = EnumCollection.UserStatusList();
                ddlStatus.DisplayMember = "Name";
                ddlStatus.ValueMember   = "ID";

                ddlDepartment.DataSource    = _context.Departments.ToList();
                ddlDepartment.DisplayMember = "Name";
                ddlDepartment.ValueMember   = "ID";

                txtSearch.Text = "";

                this.LoadUserManagers();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Example #9
0
 // Merges the specified enum collections.
 internal static void Merge(EnumCollection enums, EnumCollection new_enums)
 {
     foreach (var e in new_enums)
     {
         Merge(enums, e.Value);
     }
 }
Example #10
0
        private EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav, string apiname)
        {
            EnumCollection processed_enums = new EnumCollection();

            foreach (var e in enums.Values)
            {
                // Note that we cannot modify a collection while iterating over it,
                // so we keep a list of modified enums and remove/readd the
                // modified items to refresh their keys.
                string name = e.Name;
                name   = ReplaceName(nav, apiname, name);
                name   = TranslateEnumName(name);
                e.Name = name;
                processed_enums.Add(e.Name, e);
            }

            // Mark enums differing only in case as not CLS-compliant.
            var list = enums.Values.ToList();

            while (list.Count > 0)
            {
                var e1 = list.Last();
                list.RemoveAt(list.Count - 1);

                var e2 = list.FirstOrDefault(l => String.Compare(e1.Name, l.Name, true) == 0);
                if (e2 != null)
                {
                    e1.CLSCompliant = false;
                    e2.CLSCompliant = false;
                }
            }

            return(processed_enums);
        }
Example #11
0
 public BetAmountStyleManagerUI(EnumCollection.eBetAmountStyle style1, bool flag1, int num1, string text1)
 {
     this._objBetAmountStyle = style1;
     this._isPercentOptionDisabled = flag1;
     this._intExtendedValue = num1;
     this._strSportBook = text1;
 }
Example #12
0
 public AgentToClientBet(MatchBetNew new1, MatchNew new2, EnumCollection.eBetAmountStyle style1, int num1, int num2, string text1, FollowOddsOption option1)
 {
     this._intMaxBettingAttempt = 5;
     this._objBetAmountStyle = EnumCollection.eBetAmountStyle.Fixed;
     this._intBetAmountValue = 0;
     this._objMatchBet = new MatchBetNew();
     this._objMatchClient = new MatchNew();
     this._intBettingAttempt = 0;
     this._intBetSuccessCount = 0;
     this._intTargetAmount = 0;
     this._intBettedAmount = 0;
     this._intLastBetSuccessAmount = 0;
     this._isRemoved = false;
     this._strMeaningfulStatus = "";
     this._strActionStatus = "";
     this._isWaitingReset = false;
     this._objFollowOddsOption = new FollowOddsOption();
     this._objMatchBet = new1;
     this._objMatchClient = new2;
     this._objBetAmountStyle = style1;
     this._intBetAmountValue = num1;
     this._intMaxBettingAttempt = num2;
     this._strActionStatus = text1;
     this._objFollowOddsOption = option1;
     this.UpdateTargetAmount();
 }
        private void BindSelect()
        {
            DataTable dt = EnumCollection.EnumToDataTable(typeof(EnumCollection.goods_group), "key", "val");

            this.ddlGroup.DataSource     = dt;
            this.ddlGroup.DataTextField  = "key";
            this.ddlGroup.DataValueField = "val";
            this.ddlGroup.DataBind();
            this.ddlGroup.Items.Insert(0, new ListItem("所属分组", "0"));

            dt = new BLL.common_category().GetListNew(" group_id = " + (int)EnumCollection.category_group.商城, "0");

            this.ddlCategory.Items.Add(new ListItem("所属分类", "0"));
            foreach (DataRow dr in dt.Rows)
            {
                string Id          = dr["id"].ToString();
                int    ClassLayer  = int.Parse(dr["category_level"].ToString());
                string Title       = dr["name"].ToString().Trim();
                string parent_name = dr["parent_name"].ToString().Trim();

                if (ClassLayer == 2)
                {
                    if (!string.IsNullOrEmpty(parent_name))
                    {
                        Title = parent_name + " ├ " + Title;
                        //Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                        this.ddlCategory.Items.Add(new ListItem(Title, Id));
                    }
                }
            }
        }
Example #14
0
        private void checkEnter(object sender, KeyEventArgs e)
        {
            TextBox b = sender as TextBox;
            String  c = b.Text;

            if (!checkEnter(b, e))
            {
                return;
            }
            // add value to the currently selected item
            object         o          = FindName("enumNamesHolder");
            ListBox        l          = o as ListBox;
            EnumCollection collection = l.SelectedItem as EnumCollection;

            if (renaming != null)
            {
                for (int i = 0; i < collection.Values.Count; i++)
                {
                    if (collection.Values[i] == renaming)
                    {
                        collection.Values[i] = c;
                        break;
                    }
                }
            }
            else
            {
                collection.Values.Add(c);
            }
        }
Example #15
0
 public void Bet(string text2, string text3, string text1, MatchBetNew new2, MatchNew new1, EnumCollection.eBetTarget target1)
 {
     try
     {
         string requestUriString = "";
         requestUriString = base._strRootURL + text1;
         this.WriteProgramLogger(requestUriString);
         HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUriString);
         request.Timeout = 0x4e20;
         request.Method = "POST";
         request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.16) Gecko/2009120208 Firefox/3.0.16";
         request.Headers.Add("Accept-Language", "en-us");
         request.Headers.Add("Accept-Encoding", "gzip, deflate");
         request.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
         request.ContentType = "application/x-www-form-urlencoded";
         request.KeepAlive = true;
         request.Referer = text2;
         request.ContentLength = text3.Length;
         request.AllowAutoRedirect = true;
         request.Headers["Cookie"] = base._objCookieList.ToString();
         WebRequestStateEx2 state = new WebRequestStateEx2("Bet", request, text3, EnumCollection.eBetType.HDP, target1, new1, null, null, new2);
         ThreadPool.RegisterWaitForSingleObject(request.BeginGetRequestStream(new AsyncCallback(this.ReadCallBackBet), state).AsyncWaitHandle, new WaitOrTimerCallback(this.TimeoutCallBackEx2), state, 0x4e20, true);
         base.allDone.WaitOne();
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         base._isBetting = false;
         base._objErrorLogger.write(base._strName + ": EXCEPTION IN Bet: " + exception.Message);
         this.WriteProgramLogger(base._strName + ": EXCEPTION IN Bet: " + exception.Message);
         this.RaiseEventBetComplete(base._strName, false, new1, new2);
         ProjectData.ClearProjectError();
     }
 }
        private void BindSelect()
        {
            DataTable dt = EnumCollection.EnumToDataTable(typeof(EnumCollection.resource_group), "key", "val");

            if (dt.Rows.Count > 0)
            {
                this.rbtnGroup.Items.Clear();
                foreach (DataRow item in dt.Rows)
                {
                    this.rbtnGroup.Items.Add(new ListItem(item["key"].ToString(), item["val"].ToString()));
                }
                this.rbtnGroup.SelectedIndex = 0;
            }

            dt = new BLL.user_info().GetList(" group_id = " + (int)EnumCollection.user_group.资源分享用户);
            this.ckbUser.DataSource     = dt;
            this.ckbUser.DataTextField  = "phone";
            this.ckbUser.DataValueField = "id";
            this.ckbUser.DataBind();
            this.ckbUser.SelectedIndex = 0;

            dt = new BLL.common_school().GetList(" 1=1 order by sort ");
            this.ddlSchool.DataSource     = dt;
            this.ddlSchool.DataTextField  = "name";
            this.ddlSchool.DataValueField = "id";
            this.ddlSchool.DataBind();
            this.ckbUser.SelectedIndex = 0;
        }
Example #17
0
        public FunctionCollection Process(DelegateCollection delegates, EnumCollection enums)
        {
            Console.WriteLine("Processing delegates.");
            var nav = new XPathDocument(Overrides).CreateNavigator();
            foreach (var d in delegates.Values)
            {
                var function_override = GetFuncOverride(nav, d);
		if (function_override != null) {
                    string obsolete = function_override.GetAttribute ("obsolete", "");
                    if (!string.IsNullOrEmpty (obsolete))
                        d.Obsolete = obsolete;
                }

                TranslateReturnType(nav, d, enums);
                TranslateParameters(nav, d, enums);
            }

            Console.WriteLine("Generating wrappers.");
            var wrappers = CreateWrappers(delegates, enums);
            Console.WriteLine("Creating CLS compliant overloads.");
            wrappers = CreateCLSCompliantWrappers(wrappers, enums);
            Console.WriteLine("Removing non-CLS compliant duplicates.");

            return MarkCLSCompliance(wrappers);
        }
 private void Bind()
 {
     this.ddlCategory.DataSource     = EnumCollection.EnumToDataTable(typeof(EnumCollection.service_items_category), "name", "id");
     this.ddlCategory.DataTextField  = "name";
     this.ddlCategory.DataValueField = "id";
     this.ddlCategory.DataBind();
 }
Example #19
0
        static EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav)
        {
            foreach (var e in enums.Values)
            {
                var processed_constants = new Dictionary <string, Constant>(e.ConstantCollection.Count);
                foreach (Constant c in e.ConstantCollection.Values)
                {
                    c.Name  = TranslateConstantName(c.Name, false);
                    c.Value = TranslateConstantValue(c.Value);
                    if (!processed_constants.ContainsKey(c.Name))
                    {
                        processed_constants.Add(c.Name, c);
                    }
                }
                e.ConstantCollection = processed_constants;

                var enum_override = nav.SelectSingleNode(String.Format(Path, e.Name));
                foreach (Constant c in e.ConstantCollection.Values)
                {
                    ReplaceConstant(enum_override, c);
                    ResolveBareAlias(c, enums);
                }
            }

            foreach (var e in enums.Values)
            {
                ResolveAliases(e, enums);
            }

            return(enums);
        }
 public static void EnumCollection(EnumCollection enumCollectionRequest)
 {
     if (null != enumCollectionRequest)
     {
         paymentSimpleType(enumCollectionRequest.paymentSimpleType);
     }
 }
Example #21
0
 public SBOBet(string text1, ISynchronizeInvoke invoke1, string text2, string text3, string text4, bool flag1, bool flag2, bool flag3, bool flag4, bool flag5, bool flag6, bool flag7, bool flag8, EnumCollection.eSpiderMethod method1, int num2, int num3, int num4, int num1)
 {
     this._strLoginName = "";
     this._strSynidNextRunning = "-1";
     this._strSynidNextToday = "-1";
     this._strSynidNextEarly = "-1";
     this._strSynidNextRunningTmp = "-1";
     this._strSynidNextTodayTmp = "-1";
     this._strSynidNextEarlyTmp = "-1";
     this._objMatchOutRightList = new List<MatchOutRight>();
     this._objMatchOddEvenList = new List<MatchOddEven>();
     this._objMatchTotalGoalList = new List<MatchTotalGoal>();
     this._isToSaveBetList = false;
     try
     {
         this.DoNew(text1, "SBOBet", num1, invoke1, text2, text3, text4);
         this.Init(flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8, method1, num2, num3, num4);
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         base._objErrorLogger.write(base._strName + ": EXCEPTION IN New: " + exception.Message);
         this.WriteProgramLogger(base._strName + ": EXCEPTION IN New: " + exception.Message);
         ProjectData.ClearProjectError();
     }
 }
Example #22
0
        EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav, string apiname)
        {
            foreach (var e in enums.Values)
            {
                var processed_constants = new SortedDictionary <string, Constant>();
                foreach (Constant c in e.ConstantCollection.Values)
                {
                    c.Name      = TranslateConstantName(c.Name, false);
                    c.Value     = TranslateConstantValue(c.Value);
                    c.Reference = TranslateEnumName(c.Reference);
                    if (!processed_constants.ContainsKey(c.Name))
                    {
                        processed_constants.Add(c.Name, c);
                    }
                }
                e.ConstantCollection = processed_constants;

                var enum_override = nav.SelectSingleNode(GetOverridesPath(apiname, e.Name));
                foreach (Constant c in e.ConstantCollection.Values)
                {
                    ReplaceConstant(enum_override, c);
                    ResolveBareAlias(c, enums);
                }
            }

            foreach (var e in enums.Values)
            {
                ResolveAliases(e, enums);
            }

            return(enums);
        }
Example #23
0
        public Generator(Settings settings, string dirName)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");
            if (dirName == null)
                dirName = "GL2";

            Settings = settings.Clone();

            glTypemap = "GL2/gl.tm";
            csTypemap = Settings.LanguageTypeMapFile;

            enumSpec = Path.Combine(dirName, "signatures.xml");
            enumSpecExt = String.Empty;
            glSpec = Path.Combine(dirName, "signatures.xml");
            glSpecExt = String.Empty;
            Settings.OverridesFile = Path.Combine(dirName, "overrides.xml");

            Settings.ImportsClass = "Core";
            Settings.DelegatesClass = "Delegates";
            Settings.OutputClass = "GL";

            Delegates = new DelegateCollection();
            Enums = new EnumCollection();
            Wrappers = new FunctionCollection();

            SpecReader = new XmlSpecReader(Settings);
        }
Example #24
0
 public void Bet(string text1, MatchBetNew new2, MatchNew new1, EnumCollection.eBetTarget target1)
 {
     try
     {
         string requestUriString = "";
         base._isBetting = true;
         base._datBetStart = DateTime.Now;
         requestUriString = base._strRootURL + text1;
         CommonFunction.Log(requestUriString);
         HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUriString);
         request.Timeout = 0x4e20;
         request.Method = "GET";
         request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.16) Gecko/2009120208 Firefox/3.0.16";
         request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
         request.Headers.Add("Accept-Language", "en-gb,en;q=0.5");
         request.Headers.Add("Accept-Encoding", "gzip, deflate");
         request.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
         request.Headers["Cookie"] = base._objCookieList.ToString();
         request.Referer = base._strRootURL + "/english/index.php?p=betting_entry";
         request.ContentType = "application/x-www-form-urlencoded";
         request.ContentLength = 0L;
         WebRequestStateEx2 state = new WebRequestStateEx2("Bet", request, "", EnumCollection.eBetType.HDP, target1, new1, null, null, new2);
         ThreadPool.RegisterWaitForSingleObject(request.BeginGetResponse(new AsyncCallback(this.RequestCompleteBet), state).AsyncWaitHandle, new WaitOrTimerCallback(this.TimeoutCallBackEx2), state, 0x2710, true);
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         base._isBetting = false;
         base._objErrorLogger.write(base._strName + ": EXCEPTION IN Bet: " + exception.Message);
         this.WriteProgramLogger(base._strName + ": EXCEPTION IN Bet: " + exception.Message);
         this.RaiseEventBetComplete(base._strName, false, new1, new2);
         ProjectData.ClearProjectError();
     }
 }
Example #25
0
 public void WriteEnums(BindStreamWriter sw, EnumCollection enums)
 {
     foreach (Enum @enum in enums.Values)
     {
         sw.WriteLine("public enum {0}", @enum.Name);
         sw.WriteLine("{");
         sw.Indent();
         int count = @enum.ConstantCollection.Values.Count;
         if (count == 0)
         {
             // Java enums must have at least one value.
             sw.WriteLine("None;");
         }
         else
         {
             foreach (var c in @enum.ConstantCollection.Values)
             {
                 sw.WriteLine(String.Format("{0}({1}{2}){3}",
                                            c.Name,
                                            !String.IsNullOrEmpty(c.Reference) ? (c.Reference + Settings.NamespaceSeparator) : "",
                                            !String.IsNullOrEmpty(c.Reference) ? c.Value : c.Value.ToLower(),
                                            --count == 0 ? ";" : ","));
             }
             sw.WriteLine();
             sw.WriteLine("{0} mValue;", @enum.Type);
             sw.WriteLine("{0}({1} value) {{ mValue = value; }}", @enum.Name, @enum.Type);
         }
         sw.Unindent();
         sw.WriteLine("}");
         sw.WriteLine();
     }
 }
Example #26
0
 public PerMatchLimitManagerUI(int num1, EnumCollection.ePerMatchLimitType type1, decimal decimal1, decimal decimal2)
 {
     this._intPermatchLimitMethod = num1;
     this._objPerMatchLimitType = type1;
     this._dclAmountLimit = decimal1;
     this._intCountLimit = Convert.ToInt32(decimal2);
 }
Example #27
0
 public void WriteEnums(BindStreamWriter sw, EnumCollection enums)
 {
     foreach (Enum @enum in enums.Values)
     {
         sw.WriteLine("struct {0} : Enumeration<{0}>", @enum.Name);
         sw.WriteLine("{");
         sw.Indent();
         sw.WriteLine("inline {0}(int value) : Enumeration<{0}>(value) {{ }}", @enum.Name);
         sw.WriteLine("enum");
         sw.WriteLine("{");
         sw.Indent();
         foreach (var c in @enum.ConstantCollection.Values)
         {
             sw.WriteLine(String.Format("{0} = {1}{2},",
                                        c.Name,
                                        !String.IsNullOrEmpty(c.Reference) ? (c.Reference + Settings.NamespaceSeparator) : "",
                                        !String.IsNullOrEmpty(c.Reference) ? c.Value : c.Value.ToLower()));
         }
         sw.Unindent();
         sw.WriteLine("};");
         sw.Unindent();
         sw.WriteLine("};");
         sw.WriteLine();
     }
 }
Example #28
0
        void WriteDefinitions(BindStreamWriter sw,
                              EnumCollection enums, FunctionCollection wrappers,
                              IDictionary <string, string> CSTypes)
        {
            sw.WriteLine("public class {0}", Settings.GLClass);
            sw.WriteLine("{");
            sw.Indent();

            foreach (string extension in wrappers.Keys)
            {
                if (extension != "Core")
                {
                    sw.WriteLine("public static class {0}", extension);
                    sw.WriteLine("{");
                    sw.Indent();
                }

                // Write wrappers
                foreach (var f in wrappers[extension])
                {
                    WriteWrapper(f, sw);
                }

                if (extension != "Core")
                {
                    sw.Unindent();
                    sw.WriteLine("}");
                }
            }

            WriteEnums(sw, enums);

            sw.Unindent();
            sw.WriteLine("}");
        }
 private void BindSelect()
 {
     this.ddlType.DataSource     = EnumCollection.EnumToDataTable(typeof(EnumCollection.dict_type), "key", "val");
     this.ddlType.DataTextField  = "key";
     this.ddlType.DataValueField = "val";
     this.ddlType.DataBind();
 }
Example #30
0
        public EnumCollection Process(EnumCollection enums, string apiname)
        {
            var nav = new XPathDocument(Overrides).CreateNavigator();

            enums = ProcessNames(enums, nav, apiname);
            enums = ProcessConstants(enums, nav, apiname);
            return(enums);
        }
 private void FrmUI_OKClicked(AccountInformationList list1, EnumCollection.eOddsType type1)
 {
     OKClickedEventHandler oKClickedEvent = this.OKClickedEvent;
     if (oKClickedEvent != null)
     {
         oKClickedEvent(list1, type1);
     }
 }
Example #32
0
 private void FrmUI_OKClicked(string text1, string text2, EnumCollection.eMemberPosition position1)
 {
     OKClickedEventHandler oKClickedEvent = this.OKClickedEvent;
     if (oKClickedEvent != null)
     {
         oKClickedEvent(text1, text2, position1);
     }
 }
 private void FrmUI_OKClicked(decimal decimal1, EnumCollection.eProgramAction action1)
 {
     OKClickedEventHandler oKClickedEvent = this.OKClickedEvent;
     if (oKClickedEvent != null)
     {
         oKClickedEvent(decimal1, action1);
     }
 }
Example #34
0
 private void FrmUI_OKClicked(int num1, EnumCollection.ePerMatchLimitType type1, decimal decimal1, int num2)
 {
     OKClickedEventHandler oKClickedEvent = this.OKClickedEvent;
     if (oKClickedEvent != null)
     {
         oKClickedEvent(num1, type1, decimal1, num2);
     }
 }
Example #35
0
 private void OKClicked_Done(EnumCollection.eBetAmountStyle style1, int num1)
 {
     OKClickedEventHandler oKClickedEvent = this.OKClickedEvent;
     if (oKClickedEvent != null)
     {
         oKClickedEvent(style1, num1);
     }
 }
Example #36
0
 public EnumComboBoxColumnSetting(Type type)
 {
     EnumType      = type;
     collectiion   = new EnumCollection(type);
     ItemsSource   = collectiion;
     ValueMember   = "Value";
     DisplayMember = "Description";
 }
Example #37
0
        void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
        {
            Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
            if (!Directory.Exists(Settings.OutputPath))
                Directory.CreateDirectory(Settings.OutputPath);

            // Hack: Fix 3dfx extension category so it doesn't start with a digit
            if (wrappers.ContainsKey("3dfx"))
            {
                var three_dee_fx = wrappers["3dfx"];
                wrappers.Remove("3dfx");
                wrappers.Add(DigitPrefix + "3dfx", three_dee_fx);
            }

            Settings.DefaultOutputNamespace = "OpenTK";

            // Enums
            using (var sw = sw_h_enums)
            {
                WriteEnums(sw, enums);
                sw.Flush();
                sw.Close();
            }

            // Core definitions
            using (var sw = sw_h)
            {
                WriteDefinitions(sw, enums, wrappers, Type.CSTypes, false);
                sw.Flush();
                sw.Close();
            }

            // Compatibility definitions
            using (var sw = sw_h_compat)
            {
                WriteDefinitions(sw, enums, wrappers, Type.CSTypes, true);
                sw.Flush();
                sw.Close();
            }

            // Core & compatibility declarations
            using (var sw = sw_cpp)
            {
                WriteDeclarations(sw, wrappers, Type.CSTypes);
                sw.Flush();
                sw.Close();
            }

            string output_header = Path.Combine(Settings.OutputPath, OutputFileHeader);
            string output_cpp = Path.Combine(Settings.OutputPath, OutputFileCpp);
            string output_header_compat = Path.Combine(Settings.OutputPath, OutputFileHeaderCompat);
            string output_header_enums = Path.Combine(Settings.OutputPath, OutputFileHeaderEnums);

            Move(sw_h.File, output_header);
            Move(sw_cpp.File, output_cpp);
            Move(sw_h_compat.File, output_header_compat);
            Move(sw_h_enums.File, output_header_enums);
        }
Example #38
0
        public FunctionCollection Process(EnumProcessor enum_processor, DelegateCollection delegates, EnumCollection enums,
            string apiname, string apiversion)
        {
            Console.WriteLine("Processing delegates.");
            var nav = new XPathDocument(Overrides).CreateNavigator();
            foreach (var version in apiversion.Split('|'))
            {
                // Translate each delegate:
                // 1st using the <replace> elements in overrides.xml
                // 2nd using the hardcoded rules in FuncProcessor (e.g. char* -> string)
                foreach (var signatures in delegates.Values)
                {
                    foreach (var d in signatures)
                    {
                        TranslateExtension(d);
                        TranslateReturnType(enum_processor, nav, d, enums, apiname, version);
                        TranslateParameters(enum_processor, nav, d, enums, apiname, version);
                        TranslateAttributes(nav, d, enums, apiname, version);
                    }
                }

                // Create overloads for backwards compatibility,
                // by resolving <overload> elements
                var overload_list = new List<Delegate>();
                foreach (var d in delegates.Values.Select(v => v.First()))
                {
                    var overload_element = GetFuncOverload(nav, d, apiname, apiversion);
                    if (overload_element != null)
                    {
                        var overload = new Delegate(d);
                        ApplyParameterReplacement(overload, overload_element);
                        ApplyReturnTypeReplacement(overload, overload_element);
                        overload_list.Add(overload);
                    }
                }
                foreach (var overload in overload_list)
                {
                    delegates.Add(overload);
                }
            }

            Console.WriteLine("Generating convenience overloads.");
            delegates.AddRange(CreateConvenienceOverloads(delegates));

            Console.WriteLine("Generating wrappers.");
            var wrappers = CreateWrappers(delegates, enums);

            Console.WriteLine("Generating CLS compliant overloads.");
            wrappers = CreateCLSCompliantWrappers(wrappers, enums);

            Console.WriteLine("Removing non-CLS compliant duplicates.");
            wrappers = MarkCLSCompliance(wrappers);

            Console.WriteLine("Removing overloaded delegates.");
            RemoveOverloadedDelegates(delegates, wrappers);

            return wrappers;
        }
Example #39
0
        public void WriteEnums(BindStreamWriter sw, EnumCollection enums)
        {
            //sw.WriteLine("#pragma warning disable 3019");   // CLSCompliant attribute
            sw.WriteLine("#pragma warning disable 1591");   // Missing doc comments
            sw.WriteLine();

            if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
            {
                Trace.WriteLine(String.Format("Writing enums to:\t{0}.{1}.{2}", Settings.OutputNamespace, Settings.OutputClass, Settings.NestedEnumsClass));
            }
            else
            {
                Trace.WriteLine(String.Format("Writing enums to:\t{0}", Settings.EnumsOutput));
            }

            if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) == Settings.Legacy.None)
            {
                if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None &&
                    !String.IsNullOrEmpty(Settings.NestedEnumsClass))
                {
                    sw.WriteLine("public class Enums");
                    sw.WriteLine("{");
                    sw.Indent();
                }

                foreach (Enum @enum in enums.Values)
                {
                    sw.Write(@enum);
                    sw.WriteLine();
                }

                if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None &&
                    !String.IsNullOrEmpty(Settings.NestedEnumsClass))
                {
                    sw.Unindent();
                    sw.WriteLine("}");
                }
            }
            else
            {
                // Tao legacy mode: dump all enums as constants in GLClass.
                foreach (Constant c in enums[Settings.CompleteEnumName].ConstantCollection.Values)
                {
                    // Print constants avoiding circular definitions
                    if (c.Name != c.Value)
                    {
                        sw.WriteLine(String.Format(
                                         "public const int {0} = {2}((int){1});",
                                         c.Name.StartsWith(Settings.ConstantPrefix) ? c.Name : Settings.ConstantPrefix + c.Name,
                                         Char.IsDigit(c.Value[0]) ? c.Value : c.Value.StartsWith(Settings.ConstantPrefix) ? c.Value : Settings.ConstantPrefix + c.Value,
                                         c.Unchecked ? "unchecked" : ""));
                    }
                    else
                    {
                    }
                }
            }
        }
 public frmMinimumCreditLimitManagerUI(decimal decimal1, EnumCollection.eProgramAction action1, List<int> list1)
 {
     this._decMininmumCreditLimit = 500M;
     this._objActionTaken = EnumCollection.eProgramAction.SwitchNextAccount;
     this._objAvailableActionList = new List<int>();
     this._decMininmumCreditLimit = decimal1;
     this._objActionTaken = action1;
     this._objAvailableActionList = list1;
 }
Example #41
0
 internal void WriteWrapper2(Function f, EnumCollection enums)
 {
     if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0)
     {
         _hostCSWriter.WriteDocumentation(_sw2, f);
     }
     WriteMethod2(_sw2, f, enums);
     _sw2.WriteLine();
 }
Example #42
0
 void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums)
 {
     if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0)
     {
         WriteDocumentation(sw, f);
     }
     WriteMethod(sw, f, enums);
     sw.WriteLine();
 }
Example #43
0
 private void Bind()
 {
     this.ddlCategory.DataSource     = EnumCollection.EnumToDataTable(typeof(EnumCollection.mooc_item), "name", "id");
     this.ddlCategory.DataTextField  = "name";
     this.ddlCategory.DataValueField = "id";
     this.ddlCategory.DataBind();
     this.ddlCategory.Items.Insert(0, new ListItem("全部分类", "0")
     {
     });
 }
        private void BindSelect()
        {
            DataTable dt = EnumCollection.EnumToDataTable(typeof(EnumCollection.order_status), "key", "val");

            this.ddlStatus.DataSource     = dt;
            this.ddlStatus.DataTextField  = "key";
            this.ddlStatus.DataValueField = "val";
            this.ddlStatus.DataBind();
            this.ddlStatus.Items.Insert(0, new ListItem("全部订单", "0"));
        }
Example #45
0
        static FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums)
        {
            var wrappers = new FunctionCollection();

            foreach (var d in delegates.Values)
            {
                wrappers.AddRange(CreateNormalWrappers(d, enums));
            }
            return(wrappers);
        }
Example #46
0
        static IEnumerable <Function> CreateNormalWrappers(Delegate d, EnumCollection enums)
        {
            Function f = new Function(d);

            WrapReturnType(f);
            foreach (var wrapper in WrapParameters(f, enums))
            {
                yield return(wrapper);
            }
        }
Example #47
0
        private void BindSelect()
        {
            DataTable dt = EnumCollection.EnumToDataTable(typeof(EnumCollection.YesOrNot), "title", "id");

            this.rbtnStatus.DataSource     = dt;
            this.rbtnStatus.DataValueField = "id";
            this.rbtnStatus.DataTextField  = "title";
            this.rbtnStatus.DataBind();
            this.rbtnStatus.SelectedIndex = 0;
        }
Example #48
0
        private void BindSelect()
        {
            DataTable dt = EnumCollection.EnumToDataTable(typeof(EnumCollection.questions_type), "key", "val");

            this.ddlType.DataSource     = dt;
            this.ddlType.DataTextField  = "key";
            this.ddlType.DataValueField = "val";
            this.ddlType.DataBind();
            this.ddlType.Items.Insert(0, new ListItem("=试题类型=", "0"));
        }
        public ActionResult Detail(int id)
        {
            var result = ServiceTypeService.GetByID(id);
            var model  = new ServiceModel()
            {
                Service      = result.Data ?? new Service(),
                ServiceTypes = EnumCollection.GetServiceTypeEnum()
            };

            return(View(model));
        }
 internal frmPerMatchLimitManagerUI(int num1, EnumCollection.ePerMatchLimitType type1, decimal decimal1, decimal decimal2)
 {
     this._intLimitMethod = 1;
     this._objPerMatchLimitType = EnumCollection.ePerMatchLimitType.ByAmount;
     this._dclAmountLimit = new decimal();
     this._intCountLimit = 0;
     this._intLimitMethod = num1;
     this._objPerMatchLimitType = type1;
     this._dclAmountLimit = decimal1;
     this._intCountLimit = Convert.ToInt32(decimal2);
 }
Example #51
0
 public AccountInformation(string text1, string text2, string text3, EnumCollection.eMemberStatus status1, EnumCollection.eMemberPosition position1)
 {
     this._objRole = EnumCollection.eMemberPosition.Member;
     this._strLoginURL = "";
     this._strAccountID = "";
     this._strAccountPassword = "";
     this._objAccountStatus = EnumCollection.eMemberStatus.Open;
     this._strLoginURL = text1;
     this._strAccountID = text2;
     this._strAccountPassword = text3;
     this._objAccountStatus = status1;
     this._objRole = position1;
 }
Example #52
0
 public AccountLoginManagerUI(string text1, string text2, EnumCollection.eMemberPosition position1, string text3)
 {
     this._strSportBook = "";
     this._strAccountLogin = "";
     this._strAccountPassword = "";
     this._isRoleEnabled = false;
     this._objAccountRole = EnumCollection.eMemberPosition.Member;
     this._strAccountLogin = text1.Trim();
     this._strAccountPassword = text2.Trim();
     this._isRoleEnabled = true;
     this._objAccountRole = position1;
     this._strSportBook = text3;
 }
Example #53
0
        public WebsiteBetStyle(string text1, EnumCollection.eBetAmountStyle style1)
        {
            this._strWebsite = "";
            this._objBetStyle = EnumCollection.eBetAmountStyle.Fixed;
            this._intBetValue = 0;
            this._strWebsite = text1;
            this._objBetStyle = style1;

            if (style1 == EnumCollection.eBetAmountStyle.MaxBet)
            {
                _intBetValue = 1;
            }
        }
 public frmAccountListLoginManagerUI(AccountInformationList list1, bool flag1, bool flag2, bool flag3, EnumCollection.eOddsType type1, string text1)
 {
     this._strSportBook = "";
     this._objAccountInfoList = new AccountInformationList();
     this._isToShowLoginURL = false;
     this._isToShowRole = false;
     this._isOddsTypeEnabled = false;
     this._objOddsType = EnumCollection.eOddsType.Malay;
     this._objAccountInfoList = list1;
     this._isToShowLoginURL = flag1;
     this._isToShowRole = flag2;
     this._isOddsTypeEnabled = flag3;
     this._objOddsType = type1;
     this._strSportBook = text1;
 }
Example #55
0
 public IBCBet(string text1, ISynchronizeInvoke invoke1, string text2, string text3, string text4, bool flag1, bool flag2, bool flag3, bool flag4, bool flag5, bool flag6, bool flag7, bool flag8, EnumCollection.eSpiderMethod method1, int num1)
 {
     try
     {
         this.DoNew(text1, "IBCBet", num1, invoke1, text2, text3, text4);
         this.Init(flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8, method1, 10, 30, 300);
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         base._objErrorLogger.write(base._strName + ": EXCEPTION IN New: " + exception.Message);
         this.WriteProgramLogger(base._strName + ": EXCEPTION IN New: " + exception.Message);
         ProjectData.ClearProjectError();
     }
 }
Example #56
0
 static EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav)
 {
     EnumCollection processed_enums = new EnumCollection();
     foreach (var e in enums.Values)
     {
         // Note that we cannot modify a collection while iterating over it,
         // so we keep a list of modified enums and remove/readd the
         // modified items to refresh their keys.
         string name = e.Name;
         name = ReplaceName(nav, name);
         name = TranslateEnumName(name);
         e.Name = name;
         processed_enums.Add(e.Name, e);
     }
     return processed_enums;
 }
Example #57
0
        public WebsiteBetStyle(string text1, EnumCollection.eBetAmountStyle style1, int num1)
        {
            this._strWebsite = "";
            this._objBetStyle = EnumCollection.eBetAmountStyle.Fixed;
            this._intBetValue = 0;
            this._strWebsite = text1;
            this._objBetStyle = style1;

            // modify Aorta 2010.12.13
            if (style1 == EnumCollection.eBetAmountStyle.MaxBet)
            {
                num1 = 1;
            }

            this._intBetValue = num1;
            // end Aorta
        }
Example #58
0
 public CorrectScore(EnumCollection.eScoreRange range1, int num1, EnumCollection.eScoreRange range2, int num2, string text1, string text2)
 {
     this._objWinScoreRange = EnumCollection.eScoreRange.Fixed;
     this._intWinScore = 0;
     this._objLoseScoreRange = EnumCollection.eScoreRange.Fixed;
     this._intLoseScore = 0;
     this._dblHomeWinOdds = 0.0;
     this._dblAwayWinOdds = 0.0;
     this._strHomeWinBetLink = "";
     this._strAwayWinBetLink = "";
     this._objWinScoreRange = range1;
     this._intWinScore = num1;
     this._objLoseScoreRange = range2;
     this._intLoseScore = num2;
     this.set_HomeWinOddsString(text1);
     this.set_AwayWinOddsString(text2);
 }
Example #59
0
 public BW3388(string text1, ISynchronizeInvoke invoke1, string text2, string text3, string text4, bool flag1, bool flag2, bool flag3, bool flag4, bool flag5, bool flag6, bool flag7, bool flag8, EnumCollection.eOddsType type1, EnumCollection.eSpiderMethod method1, int num2, int num3, int num4, int num1)
 {
     this._strOddsText = "MALAY";
     try
     {
         this.DoNew(text1, "BW3388", num1, invoke1, text2, text3, text4);
         this.Init(flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8, type1, method1, num2, num3, num4);
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         base._objErrorLogger.write(base._strName + ": EXCEPTION IN New: " + exception.Message);
         this.WriteProgramLogger(base._strName + ": EXCEPTION IN New: " + exception.Message);
         ProjectData.ClearProjectError();
     }
 }
Example #60
0
 public void InitializeList(int num1, int num3, EnumCollection.eBetChoose choose1, double num5, double num6, int num4)
 {
     int num = 0;
     this._objRuleList.Clear();
     int num2 = num3;
     for (num = num1; num <= num2; num++)
     {
         LiveBettingRule item = new LiveBettingRule();
         item.set_BetAmount(num4);
         item.set_BetChoose(choose1);
         item.set_MinuteFrom(num);
         item.set_MinuteTo(num);
         item.set_OddDifferentFrom(num5);
         item.set_OddDifferentTo(num6);
         this._objRuleList.Add(item);
     }
 }