示例#1
2
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            float floatValue;
            float.TryParse((string)value,System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.InvariantCulture, out floatValue);

            return ConvertBack(floatValue, (string)parameter);
        }
示例#2
1
        public Func<string> First()
        {
            var sources = new[] { this.Male(), this.Female() };
            var factory = _random.Numbers.Integers(max: sources.Length);

            return () => sources[factory()]();
        }
示例#3
1
 public static void SomeFunction(GetMahNumber getit, NamespaceDlg getitnow, TemplatedDelegate<float> unused)
 {
     Console.WriteLine(getit(getitnow()));
     var a = new[] { getitnow };
     a[0]();
     StaticAction();
     Utilities.StaticAction();
     Blargh.Utilities.StaticAction();
 }
示例#4
1
 /// <summary>
 /// 随机生成生成简单密码
 /// </summary>
 /// <param name="length"></param>
 /// <returns></returns>
 public string CreateTemporaryPassword(int length)
 {
     Func<Random, char> randomNumber = rnd => (char)rnd.Next(48, 58);
     Func<Random, char> randomCharacter = rnd => (char)rnd.Next(97, 123);
     var funcArray = new[] { randomNumber, randomCharacter };
     var chars = new char[length];
     Random random = new Random();
     for (int i = 0; i < length; i++)
     {
         var index = random.Next(0, funcArray.Length);
         chars[i] = funcArray[index](random);
     }
     return new string(chars);
 }
    static void RunCode(string code)
    {
        int accumulator = 0;
        var opcodes = new Dictionary<char, Action>
        {
            {'H', () => Console.WriteLine("Hello, World!"))},
            {'Q', () => Console.WriteLine(code) },
            {'9', () => Console.WriteLine(Enumerable.Range(1,100).Reverse().Select(n => string.Format("{0} bottles of beer on the wall\n{0} bottles of beer\nTake one down, pass it around\n{1} bottles of beer on the wall\n", n, n-1)).Aggregate((a,b) => a + "\n" + b))},
            {'+', () => accumulator++ }
        }

        foreach(var c in code)
            opcodes[c]();
    }
示例#6
1
        public static void drawLine(Vector3 pos1, Vector3 pos2, int bold, System.Drawing.Color color)
        {
            var wts1 = Drawing.WorldToScreen(pos1);
            var wts2 = Drawing.WorldToScreen(pos2);

            Drawing.DrawLine(wts1[0], wts1[1], wts2[0], wts2[1], bold, color);
        }
示例#7
1
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            App.SelectedRoom = string.Empty;

            if (IsolatedStorageSettings.ApplicationSettings.Contains("NickName"))
            {
                TxtNickname.Text = IsolatedStorageSettings.ApplicationSettings["NickName"].ToString();
                TxtAge.Text = IsolatedStorageSettings.ApplicationSettings["Age"].ToString();
                TxtAvatarCode.Text = IsolatedStorageSettings.ApplicationSettings["AvatarCode"].ToString();

                _gender = IsolatedStorageSettings.ApplicationSettings["Gender"].ToString();
                var nickColor = IsolatedStorageSettings.ApplicationSettings["NickColor"] is Color ? (Color)IsolatedStorageSettings.ApplicationSettings["NickColor"] : new Color();

                _viewModel.NickColor = new SolidColorBrush(nickColor);

                if (_gender.Equals("m"))
                {
                    BtnMale.Background = (SolidColorBrush)Application.Current.Resources["ButtonBackground"];
                    BtnFemale.Background = (SolidColorBrush)Application.Current.Resources["TransparentBackground"];
                }
                else if (_gender.Equals("f"))
                {
                    BtnMale.Background = (SolidColorBrush) Application.Current.Resources["TransparentBackground"];
                    BtnFemale.Background = (SolidColorBrush) Application.Current.Resources["ButtonBackground"];
                }
                else
                {
                    BtnMale.Background = (SolidColorBrush)Application.Current.Resources["TransparentBackground"];
                    BtnFemale.Background = (SolidColorBrush)Application.Current.Resources["TransparentBackground"];
                }
            }
        }
示例#8
1
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            base.OnBackKeyPress(e);

            var isHidden = false;

            try
            {
                if (_avatarControl != null)
                isHidden = _avatarControl.IsHidden;
            }
            catch (Exception)
            {
                Application.Current.Terminate();
            }

            if (isHidden)
            {
                e.Cancel = true;

                PopupManager.Instance.Hide();
            }
            else 
                Application.Current.Terminate();
        }
        public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
        {

            if (actionContext.ModelState.IsValid) return;

            var errors = actionContext.ModelState
                .Where(e => e.Value.Errors.Count > 0)
                .Select(e => new Error
                {
                    Name = e.Key,
                    Message = e.Value.Errors.First().ErrorMessage ?? e.Value.Errors.First().Exception.Message
                }).ToArray();

            var strErrors = new StringBuilder();
            foreach (var error in errors)
            {
                var errorM = String.IsNullOrEmpty(error.Message) ? "Invalid Value" : error.Message;
                strErrors.Append(string.Format("[{0}]:{{{1}}}/", error.Name, errorM));
            }
            actionContext.Response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.BadRequest,
                ReasonPhrase = strErrors.ToString(),
                Content = new StringContent(strErrors.ToString())
            };
        }
示例#10
1
 public SqlStatement BuildDeleteCommand(NonQueryLinqCommandData commandData)
 {
     var sqlWhere = string.Empty;
       if(commandData.IsSingleTableCommand) {
     var whereList = commandData.BaseSelect.Where;
     if(whereList.Count > 0) {
       var tables = new[] { commandData.TargetTable };
       sqlWhere = "\r\n  " + BuildWhere(tables, whereList);
     }
       } else {
     //multiple tables version
     // base query must return set of PK values
     var targetEnt = commandData.TargetTable.TableInfo.Entity;
     Util.Check(targetEnt.PrimaryKey.ExpandedKeyMembers.Count == 1,
       "DELETE LINQ query with multiple tables cannot be used for table with composite primiry key. Entity: {0}", targetEnt.EntityType);
     var pk = targetEnt.PrimaryKey.ExpandedKeyMembers[0].Member;
     var outExpr = commandData.BaseSelect.Reader.Body;
     Util.Check(outExpr.Type == pk.DataType,
       "DELETE Query with multiple tables must return a value compatible with primary key of the table." +
       " Query returns: {0}; Primary key type: {1}, entity: {2}", outExpr.Type, pk.DataType, targetEnt.EntityType);
     var subQueryStmt = BuildSelect(commandData.BaseSelect);
     var subQuery = subQueryStmt.ToString();
     var pkCol = commandData.TargetTable.TableInfo.GetColumnByMemberName(pk.MemberName);
     Util.Check(pkCol != null, "Internal error in Linq engine: failed to find PK column for PK member {0}, entity {1}",
          pk.MemberName, targetEnt.EntityType);
     var strPkCol = _sqlProvider.GetColumn(pkCol.ColumnName);
     sqlWhere = string.Format("   WHERE {0} IN (\r\n{1})",  strPkCol, subQuery);
       }
       var tblInfo = commandData.TargetTable.TableInfo;
       var sql =string.Format("DELETE FROM {0} {1};", tblInfo.FullName, sqlWhere);
       return new SqlStatement(sql);
 }
示例#11
1
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     var manager = new TuinManager();
     foreach (Leverancier lev in levOb)
     {
         if (lev.Changed == true)
             GewijzigdeLeveranciers.Add(lev);
         lev.Changed = false;
     }
     if (OudeLeveranciers.Count() != 0 || NieuweLeveranciers.Count() != 0 || GewijzigdeLeveranciers.Count() != 0)
     {
         if (MessageBox.Show("Wilt u alles wegschrijven naar de database ?", "Opslaan", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             if (OudeLeveranciers.Count() != 0)
                 manager.SchrijfVerwijderingen(OudeLeveranciers);
             else if (NieuweLeveranciers.Count() != 0)
                 manager.SchrijfToevoegingen(NieuweLeveranciers);
             else if (GewijzigdeLeveranciers.Count() != 0)
                 manager.SchrijfWijzigingen(GewijzigdeLeveranciers);
         }
     }
     OudeLeveranciers.Clear();
     NieuweLeveranciers.Clear();
     GewijzigdeLeveranciers.Clear();
 }
示例#12
1
        public IEnumerable<SelectListItem> GetSelectListItems(System.Web.Routing.RequestContext requestContext, string filter = null)
        {
            var siteName = requestContext.GetRequestValue("siteName");

            var site = new Site(siteName).AsActual();

            IEnumerable<Page> pageList = new List<Page>();

            var rootPages = Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.All(site, null);

            pageList = rootPages.ToList();

            foreach (var r in rootPages)
            {
                this.GenerateList(site, r, ref pageList);
            }

            if (filter == null)
            {
                return null;
            }

            var result = pageList.Where(o => o.VirtualPath.StartsWith(filter, StringComparison.OrdinalIgnoreCase)).Select(o => new SelectListItem { Text = o.VirtualPath, Value = o.VirtualPath });

            return result;
        }
 /// <summary> This implements only the most basic checking for an email address's validity -- that it contains
 /// an '@' contains no characters disallowed by RFC 2822. This is an overly lenient definition of
 /// validity. We want to generally be lenient here since this class is only intended to encapsulate what's
 /// in a barcode, not "judge" it.
 /// </summary>
 internal static bool isBasicallyValidEmailAddress(System.String email)
 {
     if (email == null)
     {
         return false;
     }
     bool atFound = false;
     for (int i = 0; i < email.Length; i++)
     {
         char c = email[i];
         if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9') && !isAtextSymbol(c))
         {
             return false;
         }
         if (c == '@')
         {
             if (atFound)
             {
                 return false;
             }
             atFound = true;
         }
     }
     return atFound;
 }
示例#14
1
        public static void WriteException(System.Exception e)
        {
            ArrayList messages = new ArrayList();
            while (e != null)
            {
                messages.Add(e);
                e = e.InnerException;
            }
            Console.WriteLine(" ");
            Console.WriteLine("------- System.Exception ----------------------------- ");
            messages.Reverse();

            foreach (System.Exception ex in messages)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(" ");
            Console.WriteLine("----- Details -----");
            foreach (System.Exception ex in messages)
            {
                Console.WriteLine("Message..........: " + ex.Message);
                Console.WriteLine("Stact trace......: " + ex.StackTrace);
                Console.WriteLine("TargetSite.......: " + ex.TargetSite.Name);
                Console.WriteLine("Source...........: " + ex.Source);
                Console.WriteLine(" ");
            }
        }
 public object[] ConvertBack(object value,
                             Type[] targetTypes,
                             object parameter,
                             System.Globalization.CultureInfo culture)
 {
     throw new NotSupportedException();
 }
        /// <summary>
        /// Helper method for building the error response for the user
        /// </summary>
        /// <param name="errorCode"></param>
        /// <returns></returns>
        internal static HttpResponseMessage BuildResponse(ApiErrorCode errorCode)
        {
            HttpStatusCode statusCode = HttpStatusCode.InternalServerError;
            string message = null;

            switch (errorCode)
            {
                case ApiErrorCode.ExpiredToken:
                    message = ApiErrorMessages.ExpiredToken;
                    statusCode = HttpStatusCode.Unauthorized;
                    break;

                case ApiErrorCode.InvalidToken:
                    message = ApiErrorMessages.InvalidToken;
                    statusCode = HttpStatusCode.Unauthorized;
                    break;
                case ApiErrorCode.UserDoesNotExist:
                    message = ApiErrorMessages.UserNotFound;
                    statusCode = HttpStatusCode.NotModified;
                    break;
                case ApiErrorCode.PasswordIsRequired:
                    message = ApiErrorMessages.PasswordIsRequired;
                    statusCode = HttpStatusCode.BadRequest;
                    break;
            }

            var responseBody = new
            {
                errorCode = errorCode,
                errorMessage = message
            };

            return BuildResponseMessage(statusCode, responseBody);
        }
示例#17
1
 public override void TouchUp(System.Drawing.PointF global, System.Drawing.PointF relative)
 {
     var videoControl = Source.FindParent<HotelVideoControl>() as HotelVideoControl;
     if (videoControl == null) return;
     videoControl.UnTouchSlider();
     base.TouchUp(global, relative);
 }
示例#18
1
        public ExportData(System.Data.DataTable dt, string location)
        {
            //instantiate excel objects (application, workbook, worksheets)
            excel.Application XlObj = new excel.Application();
            XlObj.Visible = false;
            excel._Workbook WbObj = (excel.Workbook)(XlObj.Workbooks.Add(""));
            excel._Worksheet WsObj = (excel.Worksheet)WbObj.ActiveSheet;

            //run through datatable and assign cells to values of datatable

                int row = 1; int col = 1;
                foreach (DataColumn column in dt.Columns)
                {
                    //adding columns
                    WsObj.Cells[row, col] = column.ColumnName;
                    col++;
                }
                //reset column and row variables
                col = 1;
                row++;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //adding data
                    foreach (var cell in dt.Rows[i].ItemArray)
                    {
                        WsObj.Cells[row, col] = cell;
                        col++;
                    }
                    col = 1;
                    row++;
                }
                WbObj.SaveAs(location);
        }
示例#19
1
 public void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     var mouseState = Mouse.GetState();
     var keyboardState = Keyboard.GetState();
     var currentMouseCoordinate = new Vector2(e.X, e.Y);
     if (keyboardState.IsKeyDown(Key.ShiftLeft) && (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft])))
     {
         var d = 5;
         var previousMouseWorldCoordinate = Maths.Project(ViewMatrix, Viewport.ProjectionMatrix, previousMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var mouseWorldCoordinate = Maths.Project(ViewMatrix, ProjectionMatrix, currentMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var delta = mouseWorldCoordinate - previousMouseWorldCoordinate;
         delta *= d;
         panTrack.Update(delta.X, delta.Y);
     }
     else if (keyboardState.IsKeyDown(Key.AltLeft) && (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft])))
     {
         var previousMouseWorldCoordinate = Maths.Project(ViewMatrix, Viewport.ProjectionMatrix, previousMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var mouseWorldCoordinate = Maths.Project(ViewMatrix, ProjectionMatrix, currentMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var delta = mouseWorldCoordinate - previousMouseWorldCoordinate;
         delta *= 10;
         zoomTrack.Update(delta.Y);
     }
     else if (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft]))
     {
         var delta = currentMouseCoordinate - previousMouseCoordinate;
         //delta *= 10;
         orbitTrack.Update(delta.X, delta.Y);
     }
     if (this.MouseMove != null) this.MouseMove(this, new MouseEventArgs(this, new Vector2(e.X, e.Y), default(Vector3), e.Button));
     previousMouseCoordinate = currentMouseCoordinate;
 }
示例#20
1
 protected void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         myLoginID=Session["LoginID"].ToString();
     }
     catch
     {
     }
     if (myLoginID=="")
     {
         Response.Redirect("../Login.aspx");
     }
     intSubjectID=Convert.ToInt32(Request["SubjectID"]);
     strSubjectName=Convert.ToString(Request["SubjectName"]);
     labSubject.Text=Convert.ToString(Request["SubjectName"]);
     if (!IsPostBack)
     {
         //if (ObjFun.GetValues("select UserType from UserInfo where LoginID='"+myLoginID+"' and UserType=1 and (RoleMenu=1 or (RoleMenu=2 and Exists(select OptionID from UserPower where UserID=UserInfo.UserID and PowerID=3 and OptionID=3)))","UserType")!="1")
         //{
         //    Response.Write("<script>alert('�Բ�����û�д˲���Ȩ�ޣ�')</script>");
         //    Response.End();
         //}
         //else
         //{
             if (intSubjectID!=0)
             {
                 CountTestType(intSubjectID);//����������ͳ��
                 CountTestLore(intSubjectID);//������֪ʶ��ͳ��
                 CountTestDiff(intSubjectID);//�������Ѷ�ͳ��
             }
         //}
     }
 }
        public object Convert(object[] values,
                              Type targetType,
                              object parameter,
                              System.Globalization.CultureInfo culture)
        {
            if (values == null ||
                values.Length != 2)
            {
                return Visibility.Collapsed;
            }

            if (values[0] is IEnumerable<string>)
            {
                var a = (IEnumerable<string>)values[0];
                var b = values[1];

                if (a.Contains(b) == true)
                {
                    return Visibility.Collapsed;
                }
            }
            else if (values[0] is ItemCollection)
            {
                var a = (ItemCollection)values[0];
                var b = values[1];

                if (a.Contains(b) == true)
                {
                    return Visibility.Collapsed;
                }
            }

            return Visibility.Visible;
        }
        private void ArrayBinding_Load(object sender, System.EventArgs e)
        {
            // Access database
            System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;

            // The XML document
            string fileNameString = mainForm.applicationPath + "\\data\\data.xml";
            string fileNameSchema = mainForm.applicationPath + "\\data\\data.xsd";

            // Initializes a new instance of the DataSet class
            DataSet custDS = new DataSet();

            // Reads an XML schema into the DataSet.
            custDS.ReadXmlSchema( fileNameSchema );

            // Reads XML schema and data into the DataSet.
            custDS.ReadXml( fileNameString );

            // Initializes a new instance of the DataView class
            DataView firstView = new DataView(custDS.Tables[0]);

            Chart1.Series.Clear();
            // Since the DataView implements and IEnumerable, pass the reader directly into
            // the DataBindTable method with the name of the column used for the X value.
            Chart1.DataBindTable(firstView, "Name");

            // Set series appearance
            Chart1.Series[0].ChartType = SeriesChartType.Bar;
            Chart1.Series[0].Font = new Font("Trebuchet MS", 8);
            Chart1.Series[0].Color = System.Drawing.Color.FromArgb(220, 224,64,10);
            Chart1.Series[0].BorderWidth = 0;
        }
    public override GroupConfiguration SelectGroupConfiguration( int groupLevel, CollectionViewGroup collectionViewGroup, System.ComponentModel.GroupDescription groupDescription )
    {
      if( m_groupConfigurationSelectorItems.Count == 0 )
        return base.SelectGroupConfiguration( groupLevel, collectionViewGroup, groupDescription );

      string fieldName = string.Empty;

      DataGridGroupDescription dataGridGroupDescription = groupDescription as DataGridGroupDescription;
      if( dataGridGroupDescription != null )
      {
        fieldName = dataGridGroupDescription.PropertyName;
      }
      else
      {
        PropertyGroupDescription propertyGroupDescription = groupDescription as PropertyGroupDescription;
        if( propertyGroupDescription != null )
        {
          fieldName = propertyGroupDescription.PropertyName;
        }
      }

      if( String.IsNullOrEmpty( fieldName ) == true )
        return base.SelectGroupConfiguration( groupLevel, collectionViewGroup, groupDescription );

      FieldNameGroupConfigurationSelectorItem groupConfig = m_groupConfigurationSelectorItems.GetGroupConfigurationSelectorItem( fieldName );
      if( groupConfig != null )
      {
        return groupConfig.GroupConfiguration;
      }

      return base.SelectGroupConfiguration( groupLevel, collectionViewGroup, groupDescription );
    }
示例#24
0
        protected void sbmt_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                int createMacroVal = 0;
                if (createMacro.Checked)
                    createMacroVal = 1;

                string xsltName = UmbracoSettings.UseLegacyXmlSchema ? xsltTemplate.SelectedValue :
                    Path.Combine("schema2", xsltTemplate.SelectedValue);

                string returnUrl = dialogHandler_temp.Create(
                    helper.Request("nodeType"),
                    createMacroVal,
                    xsltName + "|||" + rename.Text);

                BasePage.Current.ClientTools
                    .ChangeContentFrameUrl(returnUrl)
                    .ChildNodeCreated()
                    .CloseModalWindow();




            }

        }
        public void GetQuotes()
        {
            // create list of stocks
            var stocks = new[] { new Stock { Symbol = "MSFT" }, new Stock { Symbol = "YHOO" } };
            var expectedQuotes = new[] { new StockQuote { Symbol = "MSFT" }, new StockQuote { Symbol = "YHOO" } };

            // set up fake logger
            var logger = A.Fake<ILog>();

            // set up first fake data provider
            var marketDataProvider1 = A.Fake<IYahooMarketDataProvider>();
            A.CallTo(() => marketDataProvider1.GetQuotes(A<IEnumerable<Stock>>.Ignored))
             .Throws<Exception>();

            // set up second fake data provider
            var marketDataProvider2 = A.Fake<IYahooMarketDataProvider>();
            A.CallTo(() => marketDataProvider2.GetQuotes(A<IEnumerable<Stock>>.Ignored))
             .Returns(expectedQuotes);

            // create Yahoo market data provider
            var yahooMarketDataProvider = new YahooMarketDataProvider(logger, new[] { marketDataProvider1, marketDataProvider2 });

            // get quotes from provider
            IEnumerable<StockQuote> actualQuotes = yahooMarketDataProvider.GetQuotes(stocks);

            // check that a call was made to get the stock quote select
            A.CallTo(() => marketDataProvider1.GetQuotes(stocks)).MustHaveHappened();
            A.CallTo(() => marketDataProvider2.GetQuotes(stocks)).MustHaveHappened();

            A.CallTo(() => logger.Warn(A<string>.Ignored, A<Exception>.Ignored)).MustHaveHappened();

            // check that quotes returned are the same as the quotes returned by the result translator
            actualQuotes.Should().OnlyContain(q => expectedQuotes.Contains(q));
        }
示例#26
0
		public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
		{
			if (String.IsNullOrEmpty(name))
				name = Name;

			base.Initialize(name, config);
		}
示例#27
0
		/// <summary>
		///     Changes the language of the <c>Form</c> object provided and all
		///     its MDI children (in the case of MDI UI) to the currently
		///     selected language.
		/// </summary>
		/// <param name="form">
		///     <c>Form</c> object to apply changes to.
		/// </param>
		/// <param name="cultureInfo">
		///     <c>CultureInfo</c> to which language has to be changed.
		/// </param>
		public void ChangeLanguage(System.Windows.Forms.Form form, System.Globalization.CultureInfo cultureInfo) {
			m_cultureInfo = cultureInfo;
			ChangeFormLanguage(form);
			foreach (System.Windows.Forms.Form childForm in form.MdiChildren) {
				ChangeFormLanguage(childForm);
			}
		}
 public void TestSerializeAnonymousClass()
 {
     object a = new { X = 1 };
     var json = a.ToJson();
     var expected = "{ 'X' : 1 }".Replace("'", "\"");
     Assert.AreEqual(expected, json);
 }
示例#29
0
    // Import Message Asset
    private static void ImportParameterAsset(string path, System.Type type)
    {
        try{
            if( File.Exists(path) == false ){
                return;
            }

            string s = File.ReadAllText(path);

            string asset_path = GetAssetPath(path);
            DataClassBase data = AssetDatabase.LoadAssetAtPath(asset_path, type) as DataClassBase;
            if( data == null ){
                data = ScriptableObject.CreateInstance(type) as DataClassBase;
                if( data == null ){
                    return;
                }
                data.Load(s, path);
                AssetDatabase.CreateAsset(data, asset_path);
            }
            else{
                data.Reload(s, path);
            }

            EditorUtility.SetDirty(data);
            AssetDatabase.SaveAssets();
        }
        catch(System.Exception err){
            Debug.Log(err.Message);
            EditorUtility.DisplayDialog("Import Error", "Error File : " + path, "OK");
        }
    }
示例#30
0
文件: Player.cs 项目: ekicyou/pasta
		public Player(string name, System.DateTime birthDate, NeoDatis.Odb.Test.VO.Sport.Sport
			 favoriteSport)
		{
			this.name = name;
			this.birthDate = birthDate;
			this.favoriteSport = favoriteSport;
		}
示例#31
0
 public override void OnRead()
 {
     System.Complete();
 }
示例#32
0
 public override void OnComplete()
 {
     System.AddObjective(new CashBankCheckObjective());
 }
示例#33
0
 public override void OnComplete()
 {
     System.AddObjective(new FindMaabusCorpseObjective());
 }
示例#34
0
		 /// <summary>
		 /// It is <em>only</em> useful for comparing values returned from the same clock, as the wall clock time of this method is arbitrary.
		 /// </summary>
		 /// <returns> current nano time of the system. </returns>
		 public virtual long Nanos()
		 {
			  return System.nanoTime();
		 }
示例#35
0
        public void Start()
        {
            foreach (Type parent in new Type[] { typeof(IInterDomainMessageHandler), typeof(IInterDomainMessagePostRequestInterceptor), typeof(IInterDomainMessagePreRequestInterceptor) })
            {
                foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
                {
                    try
                    {
                        if (ass.GetName().Name != "mscorlib" && !ass.GetName().Name.StartsWith("System.") && ass.GetName().Name != "System" && !ass.GetName().Name.StartsWith("Microsoft"))
                        {
                            foreach (Type t in ass.GetTypes())
                            {
                                if (!t.IsInterface)
                                {
                                    if (new List <Type>(t.GetInterfaces()).Contains(parent) && t.FullName != this.GetType().FullName&& !t.IsAbstract)
                                    {
                                        object   obj    = t.GetConstructor(Type.EmptyTypes).Invoke(new object[0]);
                                        sRoute[] routes = _GenerateRoutes(obj);
                                        switch (parent.Name)
                                        {
                                        case "IInterDomainMessageHandler":
                                            lock (_handlers)
                                            {
                                                foreach (sRoute srt in routes)
                                                {
                                                    List <IInterDomainMessageHandler> handlers = new List <IInterDomainMessageHandler>();
                                                    if (_handlers.ContainsKey(srt))
                                                    {
                                                        handlers = _handlers[srt];
                                                        _handlers.Remove(srt);
                                                    }
                                                    handlers.Add((IInterDomainMessageHandler)obj);
                                                    _handlers.Add(srt, handlers);
                                                }
                                            }
                                            break;

                                        case "IInterDomainMessagePostRequestInterceptor":
                                            lock (_postRequestors)
                                            {
                                                foreach (sRoute srt in routes)
                                                {
                                                    List <IInterDomainMessagePostRequestInterceptor> postInterceptors = new List <IInterDomainMessagePostRequestInterceptor>();
                                                    if (_postRequestors.ContainsKey(srt))
                                                    {
                                                        postInterceptors = _postRequestors[srt];
                                                        _postRequestors.Remove(srt);
                                                    }
                                                    postInterceptors.Add((IInterDomainMessagePostRequestInterceptor)obj);
                                                    _postRequestors.Add(srt, postInterceptors);
                                                }
                                            }
                                            break;

                                        case "IInterDomainMessagePreRequestInterceptor":
                                            lock (_preRequestors)
                                            {
                                                foreach (sRoute srt in routes)
                                                {
                                                    List <IInterDomainMessagePreRequestInterceptor> preInterceptors = new List <IInterDomainMessagePreRequestInterceptor>();
                                                    if (_preRequestors.ContainsKey(srt))
                                                    {
                                                        preInterceptors = _preRequestors[srt];
                                                        _preRequestors.Remove(srt);
                                                    }
                                                    preInterceptors.Add((IInterDomainMessagePreRequestInterceptor)obj);
                                                    _preRequestors.Add(srt, preInterceptors);
                                                }
                                            }
                                            break;
                                        }
                                        System._RegsiterMessageHandlerRoute(routes);
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        if (e.Message != "The invoked member is not supported in a dynamic assembly." &&
                            e.Message != "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.")
                        {
                            throw e;
                        }
                    }
                }
            }
        }
示例#36
0
 public override void OnRead()
 {
     System.AddObjective(new SneakPastGuardiansObjective());
 }
示例#37
0
 public override void OnComplete()
 {
     System.AddConversation(new ApprenticeCorpseConversation());
 }
示例#38
0
 public override void OnRead()
 {
     System.AddObjective(new SearchForSwordObjective());
 }
示例#39
0
 public override void OnRead()
 {
     System.AddObjective(new HallwayWalkObjective());
 }
示例#40
0
 public override void OnRead()
 {
     System.AddObjective(new ReturnSwordObjective());
 }
示例#41
0
 public override void OnComplete()
 {
     System.AddConversation(new HorusRewardConversation());
 }
示例#42
0
 public override void OnRead()
 {
     System.AddObjective(new UseTeleporterObjective());
 }
示例#43
0
文件: Switch.cs 项目: yltee1/Ryujinx
 public void LoadNsp(string nspFile)
 {
     System.LoadNsp(nspFile);
 }
示例#44
0
文件: Switch.cs 项目: yltee1/Ryujinx
 public void LoadXci(string xciFile)
 {
     System.LoadXci(xciFile);
 }
示例#45
0
 public override void OnComplete()
 {
     System.AddConversation(new EndConversation());
 }
示例#46
0
 public override void OnRead()
 {
     System.AddObjective(new EnterCaveObjective());
 }
示例#47
0
文件: Switch.cs 项目: yltee1/Ryujinx
 public void LoadNca(string ncaFile)
 {
     System.LoadNca(ncaFile);
 }
示例#48
0
 private static void HitPlayer(string playerName, int damage)
 {
     System.ActorSelection($"/user/PlayerCoordinator/{playerName}")
     .Tell(new HitPlayer(damage));
 }
示例#49
0
文件: Switch.cs 项目: yltee1/Ryujinx
 public void LoadCart(string exeFsDir, string romFsFile = null)
 {
     System.LoadCart(exeFsDir, romFsFile);
 }
示例#50
0
 private static void DisplayPlayer(string playerName)
 {
     System.ActorSelection($"/user/PlayerCoordinator/{playerName}")
     .Tell(new DisplayStatus());
 }
示例#51
0
        public void EndBattle()
        {
            OnGoing = false;
            EndTimer();

            if (Region is GuardedRegion)
            {
                ((GuardedRegion)Region).Disabled = false;

                foreach (PlayerMobile pm in Region.GetEnumeratedMobiles().OfType <PlayerMobile>())
                {
                    pm.RecheckTownProtection();
                }
            }

            foreach (VvVAltar altar in Altars)
            {
                if (!altar.Deleted)
                {
                    altar.Delete();
                }
            }

            foreach (VvVTrap trap in Traps)
            {
                if (!trap.Deleted)
                {
                    trap.Delete();
                }
            }

            foreach (CannonTurret turret in Turrets)
            {
                if (!turret.Deleted)
                {
                    turret.Delete();
                }
            }

            if (VicePriest != null)
            {
                VicePriest.Delete();
                VicePriest = null;
            }

            if (VirtuePriest != null)
            {
                VirtuePriest.Delete();
                VirtuePriest = null;
            }

            if (Sigil != null)
            {
                Sigil.Delete();
                Sigil = null;
            }

            TallyStats();
            SendBattleStatsGump();

            System.SendVvVMessage(1154722); // A VvV battle has just concluded. The next battle will begin in less than five minutes!

            if (BattleAggression != null)
            {
                BattleAggression.Clear();
            }

            ColUtility.Free(Altars);
            ColUtility.Free(Teams);
            KillCooldown.Clear();
            ColUtility.Free(Messages);
            ColUtility.Free(Traps);
            ColUtility.Free(Warned);
            ColUtility.Free(Turrets);

            if (Region is GuardedRegion)
            {
                ((GuardedRegion)Region).Disabled = false;
            }

            NextSigilSpawn      = DateTime.MinValue;
            LastOccupationCheck = DateTime.MinValue;
            NextAnnouncement    = DateTime.MinValue;
            StartTime           = DateTime.MinValue;
            NextAltarActivate   = DateTime.MinValue;
            ManaSpikeEndEffects = DateTime.MinValue;
            NextManaSpike       = DateTime.MinValue;

            CooldownEnds = DateTime.UtcNow + TimeSpan.FromMinutes(Cooldown);

            Timer.DelayCall(TimeSpan.FromMinutes(Cooldown), () =>
            {
                System.CheckBattleStatus();
            });
        }
示例#52
0
 private static void ErrorPlayer(string playerName)
 {
     System.ActorSelection($"/user/PlayerCoordinator/{playerName}")
     .Tell(new SimulateError());
 }
示例#53
0
		public void Validate()
		{

			if (this.SetSamplerState(0, SamplerStateCompareTo(this.SetSamplerState(0, SamplerStateGetMinInclusive()) < 0)
				throw new System.SetSamplerState(0, SamplerStateException("Out of range");
		}
示例#54
0
 public override void OnComplete()
 {
     System.AddObjective(new UseCallingScrollObjective());
 }
示例#55
0
 public override void OnComplete()
 {
     System.AddConversation(new MardothVaultConversation());
 }
示例#56
0
 public override void OnRead()
 {
     System.AddObjective(new GiveEminoSwordObjective());
 }
示例#57
0
文件: Switch.cs 项目: yltee1/Ryujinx
 public void LoadProgram(string fileName)
 {
     System.LoadProgram(fileName);
 }
示例#58
0
 public override void OnRead()
 {
     System.AddObjective(new FindZoelObjective());
 }
示例#59
0
 public override void OnComplete()
 {
     System.AddObjective(new FindMardothAboutKronusObjective());
 }
示例#60
0
 public override void OnRead()
 {
     System.AddObjective(new SlayHenchmenObjective());
 }