Inheritance: IList
Esempio n. 1
1
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            try
            {
                _application = Core.Default.CreateObjectFromComProxy(null, Application);

                /*
                * _application is stored as COMObject the common base type for all reference types in NetOffice
                * because this addin is loaded in different office application.
                * 
                * with the CreateObjectFromComProxy method the _application instance is created as corresponding wrapper based on the com proxy type
                */

                if (_application is Excel.Application)
                   _hostApplicationName = "Excel";
                else if (_application is Word.Application)
                   _hostApplicationName = "Word";
                else if (_application is Outlook.Application)
                   _hostApplicationName = "Outlook";
                else if (_application is PowerPoint.Application)
                   _hostApplicationName = "PowerPoint";
                else if (_application is Access.Application)
                   _hostApplicationName = "Access";
            }
            catch (Exception exception)
            {
                if(_hostApplicationName != null)
                    OfficeRegistry.LogErrorMessage(_hostApplicationName, _progId, "Error occured in OnConnection. ", exception);
            }
        }
 public ArraySubsetEnumerator(Array array, int count) {
     Debug.Assert(count == 0 || array != null, "if array is null, count should be 0");
     Debug.Assert(array == null || count <= array.Length, "Trying to enumerate more than the array contains");
     this.array = array;
     this.total = count;
     current = -1;
 }
Esempio n. 3
0
        public static void Sort(string[] keys, Array items)
        {
            Debug.Assert(keys != null);
            Debug.Assert(items != null);

            Array.Sort(keys, items, InvariantComparer);
        }
Esempio n. 4
0
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            Connect.CurrentAddin = (EnvDTE.AddIn)AddInInst;
            Connect.CurrentApplication = (EnvDTE80.DTE2)Connect.CurrentAddin.DTE;

            SetObjectExplorerEventProvider();            
        }
Esempio n. 5
0
 static void Method1(ref byte param1)
 {
     for (; m_bFlag; param1 = param1)
     {
         Array[] a = new Array[2];
     }
 }
Esempio n. 6
0
 protected override DevicePtrEx GetDevicePtr(Array array, ref int n)
 {
     EmuDevicePtrEx ptrEx = new EmuDevicePtrEx(0, array, array.Length);
     if (n == 0)
         n = ptrEx.TotalSize;
     return ptrEx;
 }
Esempio n. 7
0
        /// <summary>
        /// Implements the OnConnection method of the IDTExtensibility2 interface.
        /// Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="connectMode">The connect mode.</param>
        /// <param name="addInInst">The add in inst.</param>
        /// <param name="custom">The custom.</param>
        /// <seealso class="IDTExtensibility2"/>
        public void OnConnection(object application, ext_ConnectMode connectMode,
            object addInInst, ref Array custom)
        {
            if (_gitPlugin == null)
            {
                var cultureInfo = new CultureInfo("en-US");
                Thread.CurrentThread.CurrentCulture = cultureInfo;

                _gitPlugin =
                    new Plugin((DTE2)application, (AddIn)addInInst, "GitExtensions", "GitPlugin.Connect");
            }

            switch (connectMode)
            {
                case ext_ConnectMode.ext_cm_UISetup:
                    // Install CommandBar permanently (only runs once per AddIn)
                    GitPluginUISetup();
                    break;

                case ext_ConnectMode.ext_cm_Startup:
                    // The add-in was marked to load on startup
                    // Do nothing at this point because the IDE may not be fully initialized
                    // Visual Studio will call OnStartupComplete when fully initialized
                    GitPluginUIUpdate();
                    break;

                case ext_ConnectMode.ext_cm_AfterStartup:
                    // The add-in was loaded by hand after startup using the Add-In Manager
                    // Initialize it in the same way that when is loaded on startup
                    GitPluginInit();
                    break;
            }
        }
        static MyGuiEditorVoxelHandHelpers()
        {
            MyMwcLog.WriteLine("MyGuiEditorVoxelHandHelpers()");

            MyEditorVoxelHandShapeHelperTypesEnumValues = Enum.GetValues(typeof(MyVoxelHandShapeType));
            MyEditorVoxelHandModeHelperTypesEnumValues = Enum.GetValues(typeof(MyMwcVoxelHandModeTypeEnum));
        }
        int DecodeFrameImpl(IMpegFrame frame, Array dest, int destOffset)
        {
            Decoder.LayerDecoderBase curDecoder = null;
            switch (frame.Layer)
            {
                case MpegLayer.LayerI:
                    if (_layerIDecoder == null)
                    {
                        _layerIDecoder = new Decoder.LayerIDecoder();
                    }
                    curDecoder = _layerIDecoder;
                    break;
                case MpegLayer.LayerII:
                    if (_layerIIDecoder == null)
                    {
                        _layerIIDecoder = new Decoder.LayerIIDecoder();
                    }
                    curDecoder = _layerIIDecoder;
                    break;
                case MpegLayer.LayerIII:
                    if (_layerIIIDecoder == null)
                    {
                        _layerIIIDecoder = new Decoder.LayerIIIDecoder();
                    }
                    curDecoder = _layerIIIDecoder;
                    break;
            }

            if (curDecoder != null)
            {
                curDecoder.SetEQ(_eqFactors);
                curDecoder.StereoMode = StereoMode;

                var cnt = curDecoder.DecodeFrame(frame, _ch0, _ch1);

                if (frame.ChannelMode == MpegChannelMode.Mono)
                {
                    Buffer.BlockCopy(_ch0, 0, dest, destOffset * sizeof(float), cnt * sizeof(float));
                }
                else
                {
                    // This is kinda annoying...  if we're doing a downmix, we should technically only output a single channel
                    //  The problem is, our caller is probably expecting stereo output.  Grrrr....

                    // We use Buffer.BlockCopy here because we don't know dest's type, but do know it's big enough to do the copy
                    for (int i = 0; i < cnt; i++)
                    {
                        Buffer.BlockCopy(_ch0, i * sizeof(float), dest, destOffset * sizeof(float), sizeof(float));
                        ++destOffset;
                        Buffer.BlockCopy(_ch1, i * sizeof(float), dest, destOffset * sizeof(float), sizeof(float));
                        ++destOffset;
                    }
                    cnt *= 2;
                }

                return cnt;
            }

            return 0;
        }
Esempio n. 10
0
 public static void ThrowIfIsNullOrEmpty(Array array)
 {
     if (array == null || array.Length == 0)
     {
         throw new ArgumentNullException();
     }
 }
Esempio n. 11
0
		/// <summary>
		/// Implements the OnDisconnection method of the IDTExtensibility2 interface. 
		/// Occurs when he Add-in is loaded into Visual Studio.
		/// </summary>
		/// <param name="application">A reference to an instance of the IDE, DTE.</param>
		/// <param name="connectMode">
		///   An <see cref="ext_ConnectMode"/> enumeration value that indicates 
		///   the way the add-in was loaded into Visual Studio.
		/// </param>
		/// <param name="instance">An <see cref="AddIn"/> reference to the add-in's own instance.</param>
		/// <param name="custom">An empty array that you can use to pass host-specific data for use in the add-in.</param>
		public void OnConnection(object application, ext_ConnectMode connectMode, object instance, ref Array custom)
		{
			App = (DTE2) application;
			Instance = (AddIn) instance;
			Events = App.Events as Events2;
			Logger = new OutputWindowLogger(App);

			Logger.Log("Loading...");

			Compose(); // Do not attempt to use [Import]s before this line!

			if(Chirp == null)
			{
				Logger.Log("Unable to load.");
				return;
			}

			BindEvents();

			PrintLoadedEngines();

			Logger.Log("Ready");

			if(App.Solution.IsOpen)
			{
				SolutionOpened();

				foreach (var project in App.Solution.Projects.Cast<Project>())
				{
					ProjectAdded(project);
				}
			}
		}
Esempio n. 12
0
	// Copy a block of bytes from one primitive array to another.
	public static void BlockCopy(Array src, int srcOffset,
								 Array dst, int dstOffset,
								 int count)
			{
				int srcLen = ValidatePrimitive(src, "src");
				int dstLen = ValidatePrimitive(dst, "dst");
				if(srcOffset < 0)
				{
					throw new ArgumentOutOfRangeException
						("srcOffset", _("ArgRange_Array"));
				}
				if(count < 0)
				{
					throw new ArgumentOutOfRangeException
						("count", _("ArgRange_Array"));
				}
				if((srcLen - srcOffset) < count)
				{
					throw new ArgumentException
						("count", _("ArgRange_Array"));
				}
				if(dstOffset < 0 )
				{
					throw new ArgumentOutOfRangeException
						("dstOffset", _("ArgRange_Array"));
				}
				if((dstLen - dstOffset) < count)
				{
					throw new ArgumentException
						("count", _("ArgRange_Array"));
				}
				Copy(src, srcOffset, dst, dstOffset, count);
			}
Esempio n. 13
0
        public GridHackForm()
        {
            InitializeComponent();
            this.Visible = false; // Form is hidden at launch

            // Setup columns
            windowGrid.AutoGenerateColumns = false;

            for (int i = 0; i < gridSize; i++)
            {
                windowGrid.Columns.Add(new DataGridViewTextBoxColumn());
            }

            // Setup rows
            Array[] rows = new Array[gridSize];
            windowGrid.DataSource = rows;

            // The DataGrid control is docked in Form, so calculate the form size so everything fits
            // The last part isn't right (only works with the current gridWidth / gridHeight
            this.ClientSize = new Size(gridSize * gridWidth, gridSize * gridHeight - (gridSize * 2 - 1));

            // Register a global hotkey, the 8 is a bitmask, with the value of WIN_KEY
            if (!RegisterHotKey(this.Handle, 1, 8, (int)Keys.Oemtilde))
            {
                MessageBox.Show("Hotkey not registered, GridHack running already?");
                Application.Exit();
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Dump the contents of an array into a string builder
        /// </summary>
        static void RenderArray(Array array, StringBuilder buffer)
        {
            if (array == null)
                buffer.Append(SystemInfo.NullText);
            else
            {
                if (array.Rank != 1)
                    buffer.Append(array.ToString());
                else
                {
                    buffer.Append("{");
                    var len = array.Length;

                    if (len > 0)
                    {
                        RenderObject(array.GetValue(0), buffer);
                        for (var i = 1; i < len; i++)
                        {
                            buffer.Append(", ");
                            RenderObject(array.GetValue(i), buffer);
                        }
                    }
                    buffer.Append("}");
                }
            }
        }
Esempio n. 15
0
        public void Indexer_OutOfRange_ThrowsException()
        {
            var name = Guid.NewGuid().ToString();
            using (var sma = new Array<int>(name, 10))
            {
                bool exceptionThrown = false;
                try
                {
                    sma[-1] = 0;
                }
                catch (ArgumentOutOfRangeException)
                {
                    exceptionThrown = true;
                }

                Assert.IsTrue(exceptionThrown, "Index of -1 should result in ArgumentOutOfRangeException");

                try
                {
                    exceptionThrown = false;
                    sma[sma.Length] = 0;
                }
                catch (ArgumentOutOfRangeException)
                {
                    exceptionThrown = true;
                }

                Assert.IsTrue(exceptionThrown, "Index of Length should result in ArgumentOutOfRangeException");
            }
        }
Esempio n. 16
0
        public static void Main() {
            Foo f = new Foo(0, 1);
            Bar b = new Bar(0, 1, new Foo(0, 1));
            Test t = new Test();
            Date d = new Date("3/9/1976");
            int[] items = new Array();
            int[] items2 = new int[] { 1, 2 };
            int[] items3 = { 4, 5 };
            int[] items4 = new int[5];
            ArrayList list = new ArrayList();
            ArrayList list2 = new ArrayList(5);
            ArrayList list3 = new ArrayList("abc", "def", "ghi");
            ArrayList list4 = new ArrayList(1, 2, 3);
            Date[] dates = new Date[] {
                             new Date("1/1/2006"),
                             new Date("1/1/2005") };

            Point p = new Point(0, 0);

            CustomDictionary cd = new CustomDictionary();
            CustomDictionary cd2 = new CustomDictionary("abc", 123, "def", true);

            object o1 = Script.CreateInstance(typeof(Test));

            Type type1 = typeof(Foo);
            object o2 = Script.CreateInstance(type1, 1, 2);
            object o3 = Script.CreateInstance(typeof(Bar), 1, 2, (Foo)o2);

            Function f1 = new Function("alert('hello');");
            Function f2 = new Function("alert(s);", "s");
            Function f3 = new Function("alert(greeting + ' ' + name + '!');", "greeting", "name");
        }
Esempio n. 17
0
        public static Double[] ObjectToDouble(Array values)
        {

            int length = values.Length;
            Double[] result = new Double[length];
            int i = 0;

            foreach (object value in values)
            {
                try
                {
                    result[i++] = Convert.ToDouble(value);
                    // Console.WriteLine("Converted the {0} value {1} to {2}.",
                    //                value.GetType().Name, value, result);
                }
                catch (FormatException)
                {
                    // Console.WriteLine("The {0} value {1} is not recognized as a valid Double value.",
                    //                value.GetType().Name, value);
                }
                catch (InvalidCastException)
                {
                    // Console.WriteLine("Conversion of the {0} value {1} to a Double is not supported.",
                    //                value.GetType().Name, value);
                }
            }
            return result;
        }
Esempio n. 18
0
		/// <summary>
		/// Sort an array using the specified comparer
		/// </summary>
		/// <param name="array">array to be sorted</param>
		/// <param name="compare">comparer to use for sorting</param>
		public static void Sort(ref Array array, System.Collections.IComparer compare)
		{
			using (MergeSort mergeSort = new MergeSort())
			{
				mergeSort.InternalSort(ref array, 0, array.Length - 1, compare);
			}
		}
Esempio n. 19
0
		public void CopyTo(Array array, int index)
		{
			ArrayList arrayList = new ArrayList();
			foreach (BrokerAccountField brokerAccountField in this)
				arrayList.Add((object)brokerAccountField);
			arrayList.CopyTo(array, index);
		}
Esempio n. 20
0
 public void parseInputArray(int serverNO, int histogramResolution, Array array,
     out int pointNO)
 {
     int cellNO = (int)Math.Pow(histogramResolution, array.Rank);
     Console.WriteLine("Enter values for array (splitted by character ' '):");
     Console.WriteLine("Example: (space dimension : 3, histogram resolution : 2)");
     Console.WriteLine("Level 0:");
     Console.WriteLine("1 1");
     Console.WriteLine("2 3");
     Console.WriteLine("Level 1:");
     Console.WriteLine("2 3");
     Console.WriteLine("4 1");
     Console.WriteLine("The correct input for this example: 1 1 2 3 2 3 4 1");
     // The array elements for this example will be
     //  array[0, 0, 0]==1
     //  array[0, 0, 1]==1
     //  array[0, 1, 0]==2
     //  array[0, 1, 1]==3
     //  array[1, 0, 0]==2
     //  array[1, 0, 1]==3
     //  array[1, 1, 0]==4
     //  array[1, 1, 1]==1
     // So the highest dimension-related index is the lowest index of the array.
     string line = Console.ReadLine();
     innerParseInputArray(histogramResolution, array, cellNO, line, out pointNO);
 }
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            _applicationObject = (DTE2)application;
            _addInInstance = (AddIn)addInInst;

            if (connectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                object[] contextGUIDS = new object[] { };
                Commands2 commands = (Commands2)_applicationObject.Commands;
                CommandBars cBars = (CommandBars)_applicationObject.CommandBars;
                try
                {
                    Command commandProjectSettings = commands.AddNamedCommand2(_addInInstance, "DavecProjectSchemaSettings", "Davec Project Settings", "Manages Database Project Settings", false, 1, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
                    Command commandAddSchemaUpdate = commands.AddNamedCommand2(_addInInstance, "DavecProjectUpdate", "Davec Update", "Updates Database Schema", false, 2, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

                    CommandBar vsBarProject = cBars["Project"];
                    CommandBar vsBarFolder = cBars["Folder"];

                    commandProjectSettings.AddControl(vsBarProject, 1);
                    commandAddSchemaUpdate.AddControl(vsBarFolder, 1);

                }
                catch (System.ArgumentException)
                {
                    //ignore
                }

                var _solutionEvents = _applicationObject.Events.SolutionEvents;
                _solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);

                var _documentEvents = _applicationObject.Events.DocumentEvents;
                _documentEvents.DocumentSaved += new _dispDocumentEvents_DocumentSavedEventHandler(_documentEvents_DocumentSaved);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Modifies the specified array by applying the specified function to each element.
        /// </summary>
        /// <param name="a"></param>
        /// <param name="func">object delegate(object o){}</param>
        /// <returns></returns>
        public static void ForEach(Array a, ForEachFunction func)
        {
            long[] ix = new long[a.Rank];
            //Init index
            for (int i = 0; i < ix.Length; i++) ix[i] = a.GetLowerBound(i);

            //Loop through all items
            for (long i = 0; i < a.LongLength; i++)
            {
                a.SetValue(func(a.GetValue(ix)), ix);

                //Increment ix, the index
                for (int j = 0; j < ix.Length; j++)
                {
                    if (ix[j] < a.GetUpperBound(j))
                    {
                        ix[j]++;
                        break; //We're done incrementing.
                    }
                    else
                    {
                        //Ok, reset this one and increment the next.
                        ix[j] = a.GetLowerBound(j);
                        //If this is the last dimension, assert
                        //that we are at the last element
                        if (j == ix.Length - 1)
                        {
                            if (i < a.LongLength - 1) throw new Exception();
                        }
                        continue;
                    }
                }
            }
            return;
        }
Esempio n. 23
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            Globals.DTE = (DTE2)application;
            Globals.Addin = (AddIn)addInInst;

            solutionEvents = Globals.DTE.Events.SolutionEvents;
            solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
            solutionEvents.BeforeClosing += new _dispSolutionEvents_BeforeClosingEventHandler(SolutionEvents_BeforeClosing);

            commandManager = new CommandManager(Globals.DTE, Globals.Addin);
            commandBarBuilder = new CommandBarBuilder(Globals.DTE, Globals.Addin);

            switch (connectMode)
            {
                case ext_ConnectMode.ext_cm_UISetup:
                    // Initialize the UI of the add-in
                    break;

                case ext_ConnectMode.ext_cm_Startup:
                    // The add-in was marked to load on startup
                    // Do nothing at this point because the IDE may not be fully initialized
                    // Visual Studio will call OnStartupComplete when fully initialized
                    break;

                case ext_ConnectMode.ext_cm_AfterStartup:
                    // The add-in was loaded by hand after startup using the Add-In Manager
                    // Initialize it in the same way that when is loaded on startup
                    Initialize();
                    break;
            }
        }
Esempio n. 24
0
        public static void CreateAll(SPWeb web, Array aKlienci, int okresId, bool createKK)
        {
            foreach (SPListItem item in aKlienci)
            {
                Debug.WriteLine("klientId=" + item.ID.ToString());

                SPFieldLookupValueCollection kody;

                switch (item.ContentType.Name)
                {
                    case "Osoba fizyczna":
                    case "Firma":
                        kody = new SPFieldLookupValueCollection(item["selSerwisyWspolnicy"].ToString());
                        break;
                    default:
                        kody = new SPFieldLookupValueCollection(item["selSewisy"].ToString());
                        break;
                }

                foreach (SPFieldLookupValue kod in kody)
                {
                    switch (kod.LookupValue)
                    {
                        case @"RBR":
                            if (createKK) BLL.tabKartyKontrolne.Create_KartaKontrolna(web, item.ID, okresId);

                            Create_BR_Form(web, item.ID, okresId);
                            break;
                        default:
                            break;
                    }
                }
            }
        }
 private static void Copy(Array array, int dimension, Array jagged, params int[] indices)
 {
     if (dimension > 1)
         CopyNextDimension(array, dimension, jagged, indices);
     else
         CopyLastDimension(array, jagged, indices);
 }
        internal void Init(InternalPrimitiveTypeE code, Array array)
        {
            this.code = code;
            switch (code)
            {
                case InternalPrimitiveTypeE.Boolean:
                    this.booleanA = (bool[]) array;
                    return;

                case InternalPrimitiveTypeE.Byte:
                case InternalPrimitiveTypeE.Currency:
                case InternalPrimitiveTypeE.Decimal:
                case InternalPrimitiveTypeE.TimeSpan:
                case InternalPrimitiveTypeE.DateTime:
                    break;

                case InternalPrimitiveTypeE.Char:
                    this.charA = (char[]) array;
                    return;

                case InternalPrimitiveTypeE.Double:
                    this.doubleA = (double[]) array;
                    return;

                case InternalPrimitiveTypeE.Int16:
                    this.int16A = (short[]) array;
                    return;

                case InternalPrimitiveTypeE.Int32:
                    this.int32A = (int[]) array;
                    return;

                case InternalPrimitiveTypeE.Int64:
                    this.int64A = (long[]) array;
                    return;

                case InternalPrimitiveTypeE.SByte:
                    this.sbyteA = (sbyte[]) array;
                    return;

                case InternalPrimitiveTypeE.Single:
                    this.singleA = (float[]) array;
                    return;

                case InternalPrimitiveTypeE.UInt16:
                    this.uint16A = (ushort[]) array;
                    return;

                case InternalPrimitiveTypeE.UInt32:
                    this.uint32A = (uint[]) array;
                    return;

                case InternalPrimitiveTypeE.UInt64:
                    this.uint64A = (ulong[]) array;
                    break;

                default:
                    return;
            }
        }
Esempio n. 27
0
        public void OpenFiles(Array a)
        {
            string sError = "";

            // process all files in array
            for (int i = 0; i < a.Length; i++)
            {
                string sFile = a.GetValue(i).ToString();

                FileInfo info = new FileInfo(sFile);

                if (!info.Exists)
                {
                    sError += "\nIncorrect file name: " + sFile;
                }
                else if (info.Name.ToLower().IndexOf(".srt") > -1)
                {
                    tbSubtitle.Text = info.Name;
                    ShowGuess(sFile);
                }
                else if (info.Name.ToLower().IndexOf(".mkv") > -1)
                {
                    tbMovie.Text = info.Name;
                    moviePath = info.FullName;
                }
            }

            if (sError.Length > 0)
                MessageBox.Show(this, sError, "Open File Error");
        }
Esempio n. 28
0
        // Load data
        public void LoadData( Array array )
        {
            //
            this.array = array;

            // set column and row headers
            FixedRows = 1;
            FixedColumns = 1;

            // Redim the grid
            Redim( array.GetLength( 0 ) + FixedRows, array.GetLength( 1 ) + FixedColumns );

            // Col Header Cell Template
            columnHeader = new CellColumnHeaderTemplate( );
            columnHeader.BindToGrid( this );

            // Row Header Cell Template
            rowHeader = new CellRowHeaderTemplate( );
            rowHeader.BindToGrid( this );

            // Header Cell Template (0,0 cell)
            cellHeader = new CellHeaderTemplate( );
            cellHeader.BindToGrid( this );

            // Data Cell Template
            dataCell = new CellArrayTemplate( array ); ;
            dataCell.BindToGrid( this );

            RefreshCellsStyle( );
        }
Esempio n. 29
0
        public object ConnectData(int topicId, ref Array strings, ref bool newValues)
        {
            var isin = strings.GetValue(0) as string;

            LoggingWindow.WriteLine("Connecting: {0} {1}", topicId, isin);

            lock (topics)
            {
                // create a listener for this topic
                var listener = new SpotListener(isin);
                listener.OnUpdate += (sender, args) =>
                {
                    try
                    {
                        if (callback != null)
                        {
                            callback.UpdateNotify();
                        }
                    }
                    catch (COMException comex)
                    {
                        LoggingWindow.WriteLine("Unable to notify Excel: {0}", comex.ToString());
                    }
                };
                listener.Start();

                topics.Add(topicId, listener);
            }

            return "WAIT";
        }
Esempio n. 30
0
        public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
        {
            //if (disconnectMode == ext_DisconnectMode.ext_dm_HostShutdown
            //    || disconnectMode == ext_DisconnectMode.ext_dm_UserClosed)
            //{
            //    _gitPlugin.DeleteCommands();
            //    _gitPlugin.DeleteCommandBar(GitToolBarName);
            //    //Place the command on the tools menu.
            //    //Find the MenuBar command bar, which is the top-level command bar holding all the main menu items:
            //    var menuBarCommandBar = ((CommandBars)_applicationObject.CommandBars)["MenuBar"];

            //    CommandBarControl toolsControl;
            //    try
            //    {
            //        toolsControl = menuBarCommandBar.Controls["Git"];
            //        if (toolsControl != null)
            //        {
            //            toolsControl.Delete();
            //        }
            //    }
            //    catch
            //    {
            //    }
            //}
        }
Esempio n. 31
0
    static int SetValue(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(object), typeof(long)))
            {
                System.Array obj  = (System.Array)ToLua.ToObject(L, 1);
                object       arg0 = ToLua.ToVarObject(L, 2);
                long         arg1 = (long)LuaDLL.lua_tonumber(L, 3);
                obj.SetValue(arg0, arg1);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(object), typeof(int), typeof(int)))
            {
                System.Array obj  = (System.Array)ToLua.ToObject(L, 1);
                object       arg0 = ToLua.ToVarObject(L, 2);
                int          arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 4);
                obj.SetValue(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(object), typeof(long), typeof(long)))
            {
                System.Array obj  = (System.Array)ToLua.ToObject(L, 1);
                object       arg0 = ToLua.ToVarObject(L, 2);
                long         arg1 = (long)LuaDLL.lua_tonumber(L, 3);
                long         arg2 = (long)LuaDLL.lua_tonumber(L, 4);
                obj.SetValue(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 5 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(object), typeof(int), typeof(int), typeof(int)))
            {
                System.Array obj  = (System.Array)ToLua.ToObject(L, 1);
                object       arg0 = ToLua.ToVarObject(L, 2);
                int          arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 4);
                int          arg3 = (int)LuaDLL.lua_tonumber(L, 5);
                obj.SetValue(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (count == 5 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(object), typeof(long), typeof(long), typeof(long)))
            {
                System.Array obj  = (System.Array)ToLua.ToObject(L, 1);
                object       arg0 = ToLua.ToVarObject(L, 2);
                long         arg1 = (long)LuaDLL.lua_tonumber(L, 3);
                long         arg2 = (long)LuaDLL.lua_tonumber(L, 4);
                long         arg3 = (long)LuaDLL.lua_tonumber(L, 5);
                obj.SetValue(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(object)) && TypeChecker.CheckParamsType(L, typeof(long), 3, count - 2))
            {
                System.Array obj  = (System.Array)ToLua.ToObject(L, 1);
                object       arg0 = ToLua.ToVarObject(L, 2);
                long[]       arg1 = ToLua.ToParamsNumber <long>(L, 3, count - 2);
                obj.SetValue(arg0, arg1);
                return(0);
            }
            else if (TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(object)) && TypeChecker.CheckParamsType(L, typeof(int), 3, count - 2))
            {
                System.Array obj  = (System.Array)ToLua.ToObject(L, 1);
                object       arg0 = ToLua.ToVarObject(L, 2);
                int[]        arg1 = ToLua.ToParamsNumber <int>(L, 3, count - 2);
                obj.SetValue(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.SetValue"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 32
0
 void System.Collections.ICollection.CopyTo(System.Array array, int index)
 {
     CopyToCore(array, index);
 }
 public void CopyTo(int index, System.Array array, int arrayIndex, int count)
 public void CopyTo(System.Array array, int arrayIndex)
 public void CopyTo(System.Array array)
Esempio n. 36
0
 public void Trace(ulong id, System.Array tms, System.Array vals)
 {
     control?.Trace(id, tms, vals);
 }
Esempio n. 37
0
        public static object GetValue(string strValue, InternalType tp)
        {
            char[]       splitor      = new char[] { ';' };
            string[]     temp_array   = null;
            System.Array array_result = null;

            switch (tp)
            {
            case InternalType.t_Boolean:
                return(Convert.ToBoolean(strValue));

            case InternalType.t_Byte:
                return(Convert.ToByte(strValue));

            case InternalType.t_SByte:
                return(Convert.ToSByte(strValue));

            case InternalType.t_Short:
                return(Convert.ToInt16(strValue));

            case InternalType.t_UShort:
                return(Convert.ToUInt16(strValue));

            case InternalType.t_Char:
                return(Convert.ToChar(strValue));

            case InternalType.t_Enum:
                return(Convert.ToInt32(strValue));

            case InternalType.t_Int:
                return(Convert.ToInt32(strValue));

            case InternalType.t_UInt:
                return(Convert.ToUInt32(strValue));

            case InternalType.t_Long:
                return(Convert.ToInt64(strValue));

            case InternalType.t_ULong:
                return(Convert.ToUInt64(strValue));

            case InternalType.t_Float:
                return(Convert.ToSingle(strValue));

            case InternalType.t_Double:
                return(Convert.ToDouble(strValue));

            case InternalType.t_String:
                return(strValue);

            case InternalType.t_Date:
                return(Convert.ToDateTime(strValue));

/* unsupported right now
 *                      InternalType.t_Object,
 *                      InternalType.t_Value,
 */
            case InternalType.t_ArrayOfBoolean:
            case InternalType.t_ArrayOfByte:
            case InternalType.t_ArrayOfSByte:
            case InternalType.t_ArrayOfShort:
            case InternalType.t_ArrayOfUShort:
            case InternalType.t_ArrayOfEnum:
            case InternalType.t_ArrayOfInt:
            case InternalType.t_ArrayOfUInt:
            case InternalType.t_ArrayOfLong:
            case InternalType.t_ArrayOfULong:
            case InternalType.t_ArrayOfFloat:
            case InternalType.t_ArrayOfDouble:
            case InternalType.t_ArrayOfDate:
                temp_array   = strValue.Split(splitor);
                array_result = System.Array.CreateInstance(GetSystemTypeSimple(tp), temp_array.Length);
                for (int i = 0; i < temp_array.Length; i++)
                {
                    array_result.SetValue(GetValue(temp_array[i], InternalType.t_Boolean), i);
                }
                return(array_result);

            case InternalType.t_ArrayOfString:                     //array of string is a little bit different
                return(null);

            case InternalType.t_ArrayOfChar:                     //array of char is a little bit different
                return(null);



/*
 *                      InternalType.t_ArrayOfObject,
 *                      InternalType.t_ArrayOfValue,
 */
            case InternalType.t_Unsupported:
                throw new OOD.Exception.NotImplemented(
                          null, "This data type is not supported yet.");
            }

            return(null);
        }
Esempio n. 38
0
    void Start()
    {
        isInGoldenGoal = false;
        // stop timer, but play the game
        Game.Instance.TimerActive = false;
        CancelInvoke("PrepareEnemie");
        Game.Instance.SetGameActive(true);
        // distance from the screen
        float dFromScreen = 4f;

        points01 = new PointsManager();
        points02 = new PointsManager();
        canShoot = false;
        float doorPos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x;

        currentPlayer = PlayerEnumUtils.GetCurrentPlayer();
        offlineMatch  = Game.Instance.OnlinePlay == false && Game.Instance.BluetoothPlay == false && Game.Instance.LocalMultiPlayer == false;

        if (SavedVariables.FirstPlay)
        {
            SavedVariables.FirstPlay = false;
            tutorial.SetActive(true);
        }

        // disable some components
        MenuPause.SetActive(false);
        MenuGameEnded.SetActive(false);
        if (Game.Instance.TournamentMode)
        {
            GameEndedRowOffline.SetActive(false);
            GameEndedRowOnline.SetActive(false);
            GameEndedTournament.SetActive(true);
            RedoButton.enabled = false;
            RedoButton.SetState(UIButton.State.Disabled, true);
        }
        else if (Game.Instance.OnlinePlay || Game.Instance.BluetoothPlay)
        {
            GameEndedRowOffline.SetActive(false);
            GameEndedRowOnline.SetActive(true);
            GameEndedTournament.SetActive(false);
        }
        else if (Game.Instance.LocalPlay || Game.Instance.LocalMultiPlayer)
        {
            GameEndedRowOffline.SetActive(true);
            GameEndedRowOnline.SetActive(false);
            GameEndedTournament.SetActive(false);
        }
        Points01.enabled = false;
        Points02.enabled = false;

        if (Game.Instance.BluetoothPlay || Game.Instance.OnlinePlay)
        {
            PauseButton.SetActive(false);
        }
        else
        {
            EndMatchButton.SetActive(false);
        }

        // get the letters distance
        for (byte i = 0; i < letters.Length; i++)          // count the distance from the letter on the left
        {
            if (i == 0)
            {
                lettersDistances[i] = 0;
            }
            else
            {
                lettersDistances[i] = letters[i].transform.position.x - letters[i - 1].transform.position.x;
            }
        }

        // SET WALLS POSITION
        {
            //Move each wall to its edge location:
            topDeath.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2 * 2, 1);
            topDeath.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y + 0.5f + dFromScreen);

            bottomDeath.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2 * 2, 1);
            bottomDeath.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).y - 0.5f - dFromScreen);

            leftDeath.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2 * 2);;
            leftDeath.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x - 0.5f - dFromScreen, 0);

            rightDeath.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2 * 2);
            rightDeath.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x + 0.5f + dFromScreen, 0);

            //Move each wind to its edge location:
            topWall.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2, 1);
            topWall.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y + 0.5f);

            bottomWall.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2, 1);
            bottomWall.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).y - 0.5f);

            leftWall.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2);;
            leftWall.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x - 0.5f, 0);

            rightWall.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2);
            rightWall.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x + 0.5f, 0);
        }
        // SETUP BALL AND DOORS
        {
            // move down the referee
            Whistle(true);

            // doors

            doorLeft.transform.position  = new Vector3(-doorPos, 0, 0);
            doorRight.transform.position = new Vector3(+doorPos, 0, 0);
        }

        GameObject player01   = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject;
        GameObject player02   = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject;
        GameObject goalKeeper = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject;

        while (Game.Instance.Nation01 == Nationals.NONE)
        {
            System.Array A = System.Enum.GetValues(typeof(Nationals));
            Nationals    V = (Nationals)A.GetValue(UnityEngine.Random.Range(0, A.Length));
            Game.Instance.Nation01 = V;
        }
        while (Game.Instance.Nation02 == Nationals.NONE || Game.Instance.Nation02 == Game.Instance.Nation01)
        {
            System.Array A = System.Enum.GetValues(typeof(Nationals));
            Nationals    V = (Nationals)A.GetValue(UnityEngine.Random.Range(0, A.Length));
            Game.Instance.Nation02 = V;
        }
        Flag01.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation01);
        Flag02.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation02);

        PlayerName01.text = NationalSuits.getNationNameShort(Game.Instance.Nation01);
        PlayerName02.text = NationalSuits.getNationNameShort(Game.Instance.Nation02);
        NationalSuit nationalSuit01 = NationalSuits.getSuitForNation(Game.Instance.Nation01);
        NationalSuit nationalSuit02 = NationalSuits.getSuitForNation(Game.Instance.Nation02);
        //LifeBarContent01.color = nationalSuit01.NationalColors.Jersey;
        //LifeBarContent02.color = nationalSuit02.NationalColors.Jersey;


        // SETUP PLAYERS
        {
            // set suit colors
            PlayerConfigurer.ConfigurePlayer(player01, nationalSuit01);
            PlayerConfigurer.ConfigurePlayer(player02, nationalSuit02);
            PlayerConfigurer.ConfigurePlayer(goalKeeper, NationalSuits.getGoalKeeperSuit());
            // create many copies

            PlayerShooter.Instance.SetupPlayers(player01, player02, goalKeeper);

            Destroy(player01);
            Destroy(player02);
            Destroy(goalKeeper);
        }
    }
Esempio n. 39
0
 void System.Collections.ICollection.CopyTo(System.Array array, int index)
 {
     T[] tmp = new T[array.Length];
     CopyTo(tmp, index);
     Array.Copy(tmp, 0, array, index, array.Length);
 }
Esempio n. 40
0
 private void CopyToCore(System.Array array, int index)
 {
     _list.CopyTo(array, index);
 }
Esempio n. 41
0
 private void Trace(ulong elem_id, System.Array tms, System.Array vals)
 {
     //Debug.WriteLine("##################" + tms.Length.ToString());
     //Debug.WriteLine("[*** CPTraceHandler::Trace ***]; thread id: " + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString());
     localProcTracer?.Trace(elem_id, tms, vals);
 }
Esempio n. 42
0
        protected override void OnBindingsCollectionChanged(string propName)
        {
            // This method actually forms an DataBindingExpression of the design time and associates it to the Property of the Control.
            IHtmlControlDesignerBehavior myHtmlControlDesignBehavior = Behavior;
            DataBindingCollection        myDataBindingCollection;
            DataBinding myDataBinding1, myDataBinding2;
            String      myStringReplace1, myDataBindingExpression1, removedBinding, removedBindingAfterReplace, myDataBindingExpression2, myStringReplace2;

            string[]    removedBindings1, removedBindings2;
            Int32       temp;
            IEnumerator myEnumerator;

            if (myHtmlControlDesignBehavior == null)
            {
                return;
            }
// <Snippet8>
            DataBindingCollection myDataBindingCollection1 = new DataBindingCollection();

            myDataBindingCollection1 = myDataBindingCollection = DataBindings;
// </Snippet8>

            if (propName != null)
            {
                myDataBinding1   = myDataBindingCollection[propName];
                myStringReplace1 = propName.Replace(".", "-");
                if (myDataBinding1 == null)
                {
                    myHtmlControlDesignBehavior.RemoveAttribute(myStringReplace1, true);
                    return;
                }
                // DataBinding is not null.
                myDataBindingExpression1 = String.Concat("<%#", myDataBinding1.Expression, "%>");
                myHtmlControlDesignBehavior.SetAttribute(myStringReplace1, myDataBindingExpression1, true);
                int index = myStringReplace1.IndexOf("-");
            }
            else
            {
// <Snippet9>
                removedBindings2 = removedBindings1 = DataBindings.RemovedBindings;
// </Snippet9>
                temp = 0;
                while (removedBindings2.Length > temp)
                {
                    removedBinding             = removedBindings2[temp];
                    removedBindingAfterReplace = removedBinding.Replace('.', '-');
                    myHtmlControlDesignBehavior.RemoveAttribute(removedBindingAfterReplace, true);
                    temp = temp + 1;
                }
// <Snippet10>
                myDataBindingCollection = DataBindings;
                myEnumerator            = myDataBindingCollection.GetEnumerator();
                while (myEnumerator.MoveNext())
                {
// <Snippet11>
// <Snippet12>
                    myDataBinding2 = (DataBinding)myEnumerator.Current;
                    String dataBindingOutput1, dataBindingOutput2, dataBindingOutput3;
                    dataBindingOutput1 = String.Concat("The property name is ", myDataBinding2.PropertyName);
                    dataBindingOutput2 = String.Concat("The property type is ", myDataBinding2.PropertyType.ToString(), "-", dataBindingOutput1);
                    dataBindingOutput3 = String.Concat("The expression is ", myDataBinding2.Expression, "-", dataBindingOutput2);
                    WriteToFile(dataBindingOutput3);
// </Snippet12>
// </Snippet11>
                    myDataBindingExpression2 = String.Concat("<%#", myDataBinding2.Expression, "%>");
                    myStringReplace2         = myDataBinding2.PropertyName.Replace(".", "-");
                    myHtmlControlDesignBehavior.SetAttribute(myStringReplace2, myDataBindingExpression2, true);
                    int index = myStringReplace2.IndexOf('-');
                }// while loop ends
// </Snippet10>
// <Snippet13>
// <Snippet14>
// <Snippet15>
                string dataBindingOutput4, dataBindingOutput5, dataBindingOutput6, dataBindingOutput7, dataBindingOutput8;
                dataBindingOutput4 = String.Concat("The Count of the collection is ", myDataBindingCollection1.Count);
                dataBindingOutput5 = String.Concat("The IsSynchronised property of the collection is ", myDataBindingCollection1.IsSynchronized, "-", dataBindingOutput4);
                dataBindingOutput6 = String.Concat("The IsReadOnly property of the collection is ", myDataBindingCollection1.IsReadOnly, "-", dataBindingOutput5);
                WriteToFile(dataBindingOutput6);
// </Snippet15>
// </Snippet14>
// </Snippet13>

// <Snippet16>
                System.Array dataBindingCollectionArray = Array.CreateInstance(typeof(object), myDataBindingCollection1.Count);
                myDataBindingCollection1.CopyTo(dataBindingCollectionArray, 0);
                dataBindingOutput7 = String.Concat("The count of DataBindingArray is  ", dataBindingCollectionArray.Length);
                WriteToFile(dataBindingOutput7);
// </Snippet16>
                IEnumerator myEnumerator1 = myDataBindingCollection1.GetEnumerator();
                if (myEnumerator1.MoveNext())
                {
// <Snippet17>

                    myDataBinding1     = (DataBinding)myEnumerator1.Current;
                    dataBindingOutput8 = String.Concat("The HashCode is", myDataBinding1.GetHashCode().ToString());
                    WriteToFile(dataBindingOutput8);
// <Snippet18>
                    myDataBindingCollection1.Remove(myDataBinding1);
                    dataBindingOutput8 = String.Concat("The Count of the collection after DataBinding is removed is  ", myDataBindingCollection1.Count);
                    WriteToFile(dataBindingOutput8);
// </Snippet18>
// </Snippet17>
                }
                else
                {
                    myDataBinding1 = (DataBinding)myEnumerator1.Current;
// <Snippet19>
                    myDataBindingCollection1.Remove("Text", true);
                    dataBindingOutput8 = String.Concat("The Count of the collection after DataBinding is removed is  ", myDataBindingCollection1.Count);
                    WriteToFile(dataBindingOutput8);
// </Snippet19>
// <Snippet20>
                    myDataBindingCollection1.Clear();
                    dataBindingOutput8 = String.Concat("The Count of the collection after clear method is called  ", myDataBindingCollection1.Count);
                    WriteToFile(dataBindingOutput8);
// </Snippet20>
                }
            } // else ends here.
        }
Esempio n. 43
0
 //ICollection
 public virtual void CopyTo(System.Array array, int fIndex)
 {
 }
        private void MainForm_Load(object sender, EventArgs e)
        {
            cbSendAudioFile.ItemCheck += new ItemCheckEventHandler(cbSendAudioFile_ItemCheck);
            cbForwardAudio.ItemCheck  += new ItemCheckEventHandler(cbForwardAudio_ItemCheck);

            tbSendWavPath.Enter    += new EventHandler(tbSendWavPath_Enter);
            tbSendWavPath.Leave    += new EventHandler(tbSendWavPath_Leave);
            tbSendWavPath.Text      = "Select *.wav file";
            tbSendWavPath.ForeColor = Color.Gray;

            tbSaveMessagesPath.Enter    += new EventHandler(tbSaveMessagesPath_Enter);
            tbSaveMessagesPath.Leave    += new EventHandler(tbSaveMessagesPath_Leave);
            tbSaveMessagesPath.Text      = "Select folder to save wav files";
            tbSaveMessagesPath.ForeColor = Color.Gray;

            try
            {
                // Try to create Loudtalks Mesh control instance
                // We demonstrate how to create control dynamically here
                // This way we can easily handle situation when Loudtalks Mesh ActiveX control is not registered in system
                // Alternative is to add the control to form in design mode
                axMesh = new AxPttLib.AxPtt();
                axMesh.BeginInit();
                //axMesh.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom |
                //	System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
                axMesh.TabIndex = textPassword.TabIndex + 1;
                axMesh.TabStop  = false;
                //Controls.Add(axMesh);
                axMesh.Dock = DockStyle.Fill;
                split.Panel1.Controls.Add(axMesh);
                axMesh.EndInit();
                axMesh.Dock = DockStyle.None;
                Invalidate(true);
                axMesh.Dock    = DockStyle.Fill;
                axMesh.Visible = false;
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                axMesh = null;
            }
            catch (Exception)
            {
                axMesh = null;
            }
            bExitOnSignout = false;
            if (axMesh != null)
            {
                // Wire Loudtalks Mesh control events
                axMesh.SignInStarted              += new EventHandler(axMesh_SignInStarted);
                axMesh.SignInSucceeded            += new EventHandler(axMesh_SignInSucceeded);
                axMesh.SignInFailed               += new AxPttLib.IPttEvents_SignInFailedEventHandler(axMesh_SignInFailed);
                axMesh.SignInRequested            += new EventHandler(axMesh_SignInRequested);
                axMesh.SignOutStarted             += new EventHandler(axMesh_SignOutStarted);
                axMesh.SignOutComplete            += new EventHandler(axMesh_SignOutComplete);
                axMesh.GetCanSignIn               += new AxPttLib.IPttEvents_GetCanSignInEventHandler(axMesh_GetCanSignIn);
                axMesh.MessageInBegin             += new AxPttLib.IPttEvents_MessageInBeginEventHandler(axMesh_MessageInBegin);
                axMesh.MessageInEnd               += new AxPttLib.IPttEvents_MessageInEndEventHandler(axMesh_MessageInEnd);
                axMesh.MessageOutBegin            += new AxPttLib.IPttEvents_MessageOutBeginEventHandler(axMesh_MessageOutBegin);
                axMesh.MessageOutEnd              += new AxPttLib.IPttEvents_MessageOutEndEventHandler(axMesh_MessageOutEnd);
                axMesh.MessageOutError            += new AxPttLib.IPttEvents_MessageOutErrorEventHandler(axMesh_MessageOutError);
                axMesh.AudioMessageInStart        += new AxPttLib.IPttEvents_AudioMessageInStartEventHandler(axMesh_AudioMessageInStart);
                axMesh.AudioMessageInStop         += new AxPttLib.IPttEvents_AudioMessageInStopEventHandler(axMesh_AudioMessageInStop);
                axMesh.PlayerAudioMessageStart    += new AxPttLib.IPttEvents_PlayerAudioMessageStartEventHandler(axMesh_PlayerAudioMessageStart);
                axMesh.PlayerAudioMessageStop     += new AxPttLib.IPttEvents_PlayerAudioMessageStopEventHandler(axMesh_PlayerAudioMessageStop);
                axMesh.PlayerAudioMessageProgress += new AxPttLib.IPttEvents_PlayerAudioMessageProgressEventHandler(axMesh_PlayerAudioMessageProgress);
                axMesh.ContactListChanged         += new EventHandler(axMesh_ContactListChanged);
                // Configure Loudtalks Mesh network parameters
                axMesh.Network.NetworkName = "default";
                axMesh.Network.LoginServer = "default.loudtalks.net";
                axMesh.Network.WebServer   = "http://default.zellowork.com";
                PttLib.INetwork2 ntw2 = axMesh.Network as PttLib.INetwork2;
                if (ntw2 != null)
                {
                    ntw2.EnableTls("tls.zellowork.com");
                }
                // Customize using embedded oem.config
                System.Array OemConfig = Resource.oem_config;
                axMesh.Customization.set_OemConfigData(ref OemConfig);
                // Install tray icon
                axMesh.Settings.ShowTrayIcon = true;
                // Update UI
                UpdateCompactState();
                UpdateMenuState();
                UpdateControlsState();
                tmUpdateOnlineContacts.Interval = 5000;
                tmUpdateOnlineContacts.Tick    += new EventHandler(tmUpdateOnlineContacts_Tick);
            }
            else
            {
                // Loudtalks Mesh control is unavailable
                // Hide all controls
                foreach (ToolStripMenuItem Item in menu.Items)
                {
                    foreach (ToolStripItem SubItem in Item.DropDownItems)
                    {
                        SubItem.Enabled = false;
                    }
                }
                foreach (Control Ctrl in Controls)
                {
                    Ctrl.Visible = false;
                }
                menu.Show();
                // Disable menu commands
                exitToolStripMenuItem.Enabled    = true;
                helpWebToolStripMenuItem.Enabled = true;
                // Show error description
                labelError.Top     = menu.Location.Y + menu.Size.Height + 10;
                labelError.Visible = true;
            }
        }
Esempio n. 45
0
 public void CopyTo(System.Array array, int arrayIndex)
 {
     CopyTo(0, array, arrayIndex, this.Count);
 }
Esempio n. 46
0
        /// <summary>
        /// Sets a field to an application encoded null value (used in BLL layer).
        /// </summary>
        /// <param name="objPropertyInfo">Object of  class PropertyInfo.</param>
        /// <returns>object</returns>
        public static object SetNull(PropertyInfo objPropertyInfo)
        {
            object functionReturnValue = null;

            switch (objPropertyInfo.PropertyType.ToString())
            {
            case "System.Int16":
                functionReturnValue = NullShort;
                break;

            case "System.Int32":
            case "System.Int64":
                functionReturnValue = NullInteger;
                break;

            case "System.Single":
                functionReturnValue = NullSingle;
                break;

            case "System.Double":
                functionReturnValue = NullDouble;
                break;

            case "System.Decimal":
                functionReturnValue = NullDecimal;
                break;

            case "System.DateTime":
                functionReturnValue = NullDate;
                break;

            case "System.String":
            case "System.Char":
                functionReturnValue = NullString;
                break;

            case "System.Boolean":
                functionReturnValue = NullBoolean;
                break;

            case "System.Guid":
                functionReturnValue = NullGuid;
                break;

            default:
                // Enumerations default to the first entry
                Type pType = objPropertyInfo.PropertyType;
                if (pType.BaseType.Equals(typeof(System.Enum)))
                {
                    System.Array objEnumValues = System.Enum.GetValues(pType);
                    Array.Sort(objEnumValues);
                    functionReturnValue = System.Enum.ToObject(pType, objEnumValues.GetValue(0));
                }
                else
                {
                    // complex object
                    functionReturnValue = null;
                }

                break;
            }
            return(functionReturnValue);
        }
Esempio n. 47
0
 public static void Clear(System.Array array, int index, int length)
 {
     throw new NotImplementedException();
 }
Esempio n. 48
0
 public void CopyTo(System.Array array)
 {
     CopyTo(0, array, 0, this.Count);
 }
Esempio n. 49
0
 /// <summary>
 /// Copies the entire ConnectToModuleCollection to a compatible one-dimensional Array, starting at the specified index of the target array.
 /// </summary>
 /// <param name="array">The one-dimensional Array that is the destination of the elements copied from this ConnectToModuleCollection. The Array must have zero-based indexing.</param>
 /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
 public void CopyTo(System.Array array, int arrayIndex)
 {
     this.collection.Keys.CopyTo(array, arrayIndex);
 }
Esempio n. 50
0
 public static void Copy(System.Array sourceArray, int sourceIndex, System.Array destinationArray, int destinationIndex, int length)
 {
     //TODO: params checks
     java.lang.System.arraycopy(sourceArray, sourceIndex, destinationArray, destinationIndex, length);
 }
Esempio n. 51
0
        public static unsafe void InitArray(System.Array srcArray,
                                            System.Array dstArray)
        {
#if !REFERENCE_COUNTING_GC && !DEFERRED_REFERENCE_COUNTING_GC
            Barrier.ArrayCopy(srcArray, 0, dstArray, 0, srcArray.Length);
#else
            fixed(int *srcFieldPtr = &srcArray.field1)
            {
                void *src = srcArray.GetFirstElementAddress(srcFieldPtr);

                fixed(int *dstFieldPtr = &dstArray.field1)
                {
                    void *dst  = dstArray.GetFirstElementAddress(dstFieldPtr);
                    int   size = (srcArray.vtable.arrayElementSize *
                                  srcArray.Length);

#if REFERENCE_COUNTING_GC
                    if (dstArray.vtable.arrayOf ==
                        StructuralType.Reference ||
                        dstArray.vtable.arrayOf ==
                        StructuralType.Struct)
                    {
                        int dstLength =
                            size / dstArray.vtable.arrayElementSize;
                        GCs.ReferenceCountingCollector.
                        IncrementReferentRefCounts(Magic.addressOf(srcArray),
                                                   srcArray.vtable,
                                                   0,
                                                   srcArray.Length);
                        GCs.ReferenceCountingCollector.
                        DecrementReferentRefCounts(Magic.addressOf(dstArray),
                                                   dstArray.vtable,
                                                   0,
                                                   dstLength);
                    }
#elif DEFERRED_REFERENCE_COUNTING_GC
                    if (dstArray.vtable.arrayOf ==
                        StructuralType.Reference ||
                        dstArray.vtable.arrayOf ==
                        StructuralType.Struct)
                    {
                        int dstLength =
                            size / dstArray.vtable.arrayElementSize;
                        GCs.DeferredReferenceCountingCollector.
                        IncrementReferentRefCounts(Magic.addressOf(srcArray),
                                                   srcArray.vtable,
                                                   0,
                                                   srcArray.Length);
                        GCs.DeferredReferenceCountingCollector.
                        DecrementReferentRefCounts(Magic.addressOf(dstArray),
                                                   dstArray.vtable,
                                                   0,
                                                   dstLength);
                    }
#endif // REFERENCE_COUNTING_GC
                    System.IO.__UnmanagedMemoryStream.memcpyimpl
                        ((byte *)src, (byte *)dst, size);
                }
            }
#endif // REFERENCE_COUNTING_GC
        }
Esempio n. 52
0
    /// <summary>
    /// path,快速设置值。
    /// </summary>
    /// <param name="instance">对象</param>
    /// <param name="path">操作路径。字典key:"aa";数组索引:[0];组合使用:"data.items[0].name"。</param>
    /// <param name="value">要设置的值</param>
    /// <returns>返回是否操作成功。</returns>
    public static bool Path(object instance, string path, object value)
    {
        if (instance == null)
        {
            return(false);
        }
        if (string.IsNullOrEmpty(path))
        {
            return(false);
        }
        try {
            string[]           paths         = path.Split('.');
            object             parent        = null;
            object             lastTarget    = instance;
            string             lastKey       = null;
            bool               lastAllowNull = false;
            PathSetValueAction setMethod     = null;

            for (int i = 0; i < paths.Length; i++)
            {
                lastAllowNull = false;
                string p = paths[i];
                if (string.IsNullOrEmpty(p))
                {
                    return(false);
                }
                int    p10 = p.IndexOf('[');
                string p11 = null;
                if (p10 > -1)
                {
                    p11 = p.Substring(p10 + 1, p.Length - 2 - p10);
                    p   = p.Substring(0, p10);
                }
                //JsonObject j;
                if (!string.IsNullOrEmpty(p))
                {
                    if (System.Text.RegularExpressions.Regex.IsMatch(p, "^[0-9a-zA-Z]+$"))
                    {
                        System.Collections.Generic.IList <object> list = lastTarget as System.Collections.Generic.IList <object>;
                        if (list != null)
                        {
                            parent = lastTarget;
                            try {
                                if (string.Equals("add", p, System.StringComparison.OrdinalIgnoreCase) ||
                                    string.Equals("push", p, System.StringComparison.OrdinalIgnoreCase))
                                {
                                    lastTarget = null;
                                }
                                else
                                {
                                    lastTarget = list[TypeExtensions.Convert <int>(p, 0)];
                                }
                            } catch { lastTarget = null; }
                            lastKey       = p;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => {
                                //((System.Collections.Generic.IList<object>)p1)[TypeExtensions.Convert<int>(p3, 0)] = p4;
                                System.Collections.Generic.IList <object> p10_list = (System.Collections.Generic.IList <object>)p1;
                                if (string.Equals("add", p3, System.StringComparison.OrdinalIgnoreCase) ||
                                    string.Equals("push", p3, System.StringComparison.OrdinalIgnoreCase))
                                {
                                    p10_list.Add(p4);
                                    return;
                                }
                                int p11_list = TypeExtensions.Convert <int>(p3, 0);
                                if ((p10_list.Count - 1) < p11_list)
                                {
                                    p10_list.Add(p4);
                                    return;
                                }
                                p10_list[p11_list] = p4;
                            };
                            goto lb_Index;
                        }
                    }
                    {
                        System.Collections.Generic.IDictionary <string, object> dic = lastTarget as System.Collections.Generic.IDictionary <string, object>;
                        if (dic != null)
                        {
                            parent = lastTarget;
                            if (!dic.TryGetValue(p, out lastTarget))
                            {
                                lastTarget = null;
                            }
                            //lastTarget = dic[p];
                            lastKey       = p;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => {
                                //((System.Collections.Generic.IDictionary<string, object>)p1)[(string)p3] = p4;
                                System.Collections.Generic.IDictionary <string, object> p10_list = (System.Collections.Generic.IDictionary <string, object>)p1;
                                object p11_v;
                                if (p10_list.TryGetValue(p3, out p11_v))
                                {
                                    p10_list[p3] = p4;
                                }
                                else
                                {
                                    p10_list.Add(p3, p4);
                                }
                            };
                            goto lb_Index;
                        }
                    }
                    {
                        System.Collections.IDictionary dic = lastTarget as System.Collections.IDictionary;
                        if (dic != null)
                        {
                            parent = lastTarget;
                            try {
                                lastTarget = dic[p];
                            } catch { lastTarget = null; }
                            lastKey       = p;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => {
                                System.Collections.IDictionary p10_list = (System.Collections.IDictionary)p1;
                                if (p10_list.Contains(p3))
                                {
                                    p10_list[p3] = p4;
                                }
                                else
                                {
                                    p10_list.Add(p3, p4);
                                }
                                //((System.Collections.IDictionary)p1)[(string)p3] = p4;
                            };
                            goto lb_Index;
                        }
                    }
                    {
                        if (string.Equals(p, "length", System.StringComparison.OrdinalIgnoreCase))
                        {
                            setMethod = null;
                            lastKey   = null;
                            try {
                                parent     = lastTarget;
                                lastTarget = TypeExtensions.Get(lastTarget, p);
                            } catch {
                                parent     = lastTarget;
                                lastTarget = TypeExtensions.Get(lastTarget, p == "length" ? "Length" : "length");
                            }
                        }
                        else
                        {
                            lastTarget    = TypeExtensions.Get(lastTarget, p);
                            lastKey       = p;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => TypeExtensions.Set(p1, (string)p3, p4);
                        }
                        goto lb_Index;
                    }
                }
lb_Index:
                if (lastTarget == null && !lastAllowNull)
                {
                    return(false);
                }
                if (string.IsNullOrEmpty(p11))
                {
                    continue;
                }
                if (p11.StartsWith("\""))
                {
                    p11 = p11.Substring(1, p11.Length - 2);
                    {
                        System.Collections.Generic.IDictionary <string, object> dic = lastTarget as System.Collections.Generic.IDictionary <string, object>;
                        if (dic != null)
                        {
                            parent = lastTarget;
                            if (!dic.TryGetValue(p11, out lastTarget))
                            {
                                lastTarget = null;
                            }
                            //lastTarget = dic[p11];
                            lastKey       = p11;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => {
                                //((System.Collections.Generic.IDictionary<string, object>)p1)[(string)p3] = p4;
                                System.Collections.Generic.IDictionary <string, object> p10_list = (System.Collections.Generic.IDictionary <string, object>)p1;
                                object p11_v;
                                if (p10_list.TryGetValue(p3, out p11_v))
                                {
                                    p10_list[p3] = p4;
                                }
                                else
                                {
                                    p10_list.Add(p3, p4);
                                }
                            };
                            continue;
                        }
                    }
                    {
                        System.Collections.IDictionary dic = lastTarget as System.Collections.IDictionary;
                        if (dic != null)
                        {
                            parent = lastTarget;
                            try {
                                lastTarget = dic[p11];
                            } catch { lastTarget = null; }
                            lastKey       = p11;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => {
                                System.Collections.IDictionary p10_list = (System.Collections.IDictionary)p1;
                                if (p10_list.Contains(p3))
                                {
                                    p10_list[p3] = p4;
                                }
                                else
                                {
                                    p10_list.Add(p3, p4);
                                }
                                //((System.Collections.IDictionary)p1)[(string)p3] = p4;
                            };
                            continue;
                        }
                    }
                    {
                        parent        = lastTarget;
                        lastTarget    = TypeExtensions.Get(lastTarget, p11);
                        lastKey       = p11;
                        lastAllowNull = true;
                        setMethod     = (p1, p2, p3, p4) => TypeExtensions.Set(p1, (string)p3, p4);
                        continue;
                    }
                }
                else
                {
                    {
                        System.Collections.Generic.IList <object> list = lastTarget as System.Collections.Generic.IList <object>;
                        if (list != null)
                        {
                            parent = lastTarget;
                            try {
                                lastTarget = list[TypeExtensions.Convert <int>(p11, 0)];
                            } catch { lastTarget = null; }
                            lastKey       = p11;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => {
                                //((System.Collections.Generic.IList<object>)p1)[TypeExtensions.Convert<int>(p3, 0)] = p4;
                                System.Collections.Generic.IList <object> p10_list = (System.Collections.Generic.IList <object>)p1;
                                if (string.Equals("add", p3, System.StringComparison.OrdinalIgnoreCase) ||
                                    string.Equals("push", p3, System.StringComparison.OrdinalIgnoreCase))
                                {
                                    p10_list.Add(p4);
                                    return;
                                }
                                int p11_list = TypeExtensions.Convert <int>(p3, 0);
                                if ((p10_list.Count - 1) < p11_list)
                                {
                                    p10_list.Add(p4);
                                    return;
                                }
                                p10_list[p11_list] = p4;
                            };
                            continue;
                        }
                    }
                    {
                        System.Collections.IList list = lastTarget as System.Collections.IList;
                        if (list != null)
                        {
                            parent = lastTarget;
                            try {
                                lastTarget = list[TypeExtensions.Convert <int>(p11, 0)];
                            } catch { lastTarget = null; }
                            lastKey       = p11;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => {
                                System.Collections.IList p10_list = (System.Collections.IList)p1;
                                if (string.Equals("add", p3, System.StringComparison.OrdinalIgnoreCase) ||
                                    string.Equals("push", p3, System.StringComparison.OrdinalIgnoreCase))
                                {
                                    p10_list.Add(p4);
                                    return;
                                }
                                int p11_list = TypeExtensions.Convert <int>(p3, 0);
                                if ((p10_list.Count - 1) < p11_list)
                                {
                                    p10_list.Add(p4);
                                    return;
                                }
                                p10_list[p11_list] = p4;
                                //((System.Collections.IList)p1)[TypeExtensions.Convert<int>(p3, 0)] = p4;
                            };
                            continue;
                        }
                    }
                    {
                        System.Array list = lastTarget as System.Array;
                        if (list != null)
                        {
                            parent        = lastTarget;
                            lastTarget    = list.GetValue(TypeExtensions.Convert <int>(p11, 0));
                            lastKey       = p11;
                            lastAllowNull = true;
                            setMethod     = (p1, p2, p3, p4) => ((System.Array)p1).SetValue(p4, TypeExtensions.Convert <int>(p3, 0));
                            continue;
                        }
                    }
                }
                continue;
            }
            if (setMethod != null)
            {
                setMethod(parent, lastTarget, lastKey, value);
                return(true);
            }
            return(false);
        } catch {
            return(false);
        }
    }
Esempio n. 53
0
    static int Sort(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(System.Array)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                System.Array.Sort(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(System.Collections.IComparer)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                System.Collections.IComparer arg1 = (System.Collections.IComparer)ToLua.ToObject(L, 2);
                System.Array.Sort(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(System.Array)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                System.Array arg1 = (System.Array)ToLua.ToObject(L, 2);
                System.Array.Sort(arg0, arg1);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(System.Array), typeof(System.Collections.IComparer)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                System.Array arg1 = (System.Array)ToLua.ToObject(L, 2);
                System.Collections.IComparer arg2 = (System.Collections.IComparer)ToLua.ToObject(L, 3);
                System.Array.Sort(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(int), typeof(int)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                int          arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                System.Array.Sort(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(int), typeof(int), typeof(System.Collections.IComparer)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                int          arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                System.Collections.IComparer arg3 = (System.Collections.IComparer)ToLua.ToObject(L, 4);
                System.Array.Sort(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(System.Array), typeof(int), typeof(int)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                System.Array arg1 = (System.Array)ToLua.ToObject(L, 2);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                int          arg3 = (int)LuaDLL.lua_tonumber(L, 4);
                System.Array.Sort(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (count == 5 && TypeChecker.CheckTypes(L, 1, typeof(System.Array), typeof(System.Array), typeof(int), typeof(int), typeof(System.Collections.IComparer)))
            {
                System.Array arg0 = (System.Array)ToLua.ToObject(L, 1);
                System.Array arg1 = (System.Array)ToLua.ToObject(L, 2);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                int          arg3 = (int)LuaDLL.lua_tonumber(L, 4);
                System.Collections.IComparer arg4 = (System.Collections.IComparer)ToLua.ToObject(L, 5);
                System.Array.Sort(arg0, arg1, arg2, arg3, arg4);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.Sort"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    public void Draw()
    {
        if (SkillEditTempData.editingItem != null)
        {
            Dictionary <string, List <PropertyInfo> > group_items = new Dictionary <string, List <PropertyInfo> >();
            PropertyInfo[] fields = SkillEditTempData.editingItem.GetType().GetProperties();
            for (int i = 0; i < fields.Length; i++)
            {
                var displayAttributes = fields[i].GetCustomAttributes(typeof(DisplayAttribute), true) as DisplayAttribute[];//.FieldType.GetCustomAttributes<DisplayAttribute>();
                foreach (var displayAttribute in displayAttributes)
                {
                    if (!group_items.ContainsKey(displayAttribute.GroupName))
                    {
                        group_items.Add(displayAttribute.GroupName, new List <PropertyInfo>());
                    }
                    group_items[displayAttribute.GroupName].Add(fields[i]);
                }
            }
            foreach (var groupItem in group_items)
            {
                GUILayout.Label(groupItem.Key);
                for (int i = 0; i < groupItem.Value.Count; i++)
                {
                    PropertyInfo fi          = groupItem.Value[i];
                    var          displayAttr = SkillEditorUtility.GetDisplayAttr(fi);
                    GUILayout.BeginHorizontal(GUILayout.MinWidth(100));
                    GUILayout.Space(space);
                    GUILayout.Label(displayAttr.DisplayName);
                    GUILayout.Space(space);
                    if (displayAttr.ControlType == UIControlType.Range)
                    {
                        TimeLine tl      = GetTimeLine();
                        var      val     = fi.GetValue(SkillEditTempData.editingItem, null);
                        var      new_val = GUILayout.HorizontalSlider((int)val, 0, tl.FrameCount, GUILayout.MinWidth(100), GUILayout.MaxWidth(200), GUILayout.ExpandWidth(false));
                        fi.SetValue(SkillEditTempData.editingItem, (int)new_val, null);
                        GUILayout.Label(new_val.ToString("0.00"));
                    }
                    else if (displayAttr.ControlType == UIControlType.MutiSelection)
                    {
                        System.Array enumValues = System.Enum.GetValues(displayAttr.data as Type);
                        GUILayout.BeginVertical();
                        foreach (var item in enumValues)
                        {
                            int  val       = (int)item;
                            int  storedVal = (int)fi.GetValue(SkillEditTempData.editingItem, null);
                            bool check     = (storedVal & val) != 0;
                            bool new_check = GUILayout.Toggle(check, item.ToString(), GUILayout.MinWidth(70));
                            if (new_check != check)
                            {
                                if (new_check)
                                {
                                    storedVal += val;
                                }
                                else
                                {
                                    storedVal -= val;
                                }
                                fi.SetValue(SkillEditTempData.editingItem, storedVal, null);
                            }
                        }
                        GUILayout.EndVertical();
                    }

                    else if (displayAttr.ControlType == UIControlType.Default)
                    {
                        if (fi.PropertyType == typeof(string))
                        {
                            string val = fi.GetValue(SkillEditTempData.editingItem, null) as string;
                            val = val == null ? "" : val;
                            int textFieldID = GUIUtility.GetControlID("TextField".GetHashCode(), FocusType.Keyboard) + 1;
                            if (textFieldID != 0)
                            {
                                val = SkillEditorUtility.HandleCopyPaste(textFieldID) ?? val;
                            }
                            string new_val = GUILayout.TextField(val, GUILayout.MinWidth(100));
                            fi.SetValue(SkillEditTempData.editingItem, new_val, null);
                        }
                        else if (fi.PropertyType == typeof(int))
                        {
                            int    val     = (int)fi.GetValue(SkillEditTempData.editingItem, null);
                            string new_val = GUILayout.TextField(val.ToString(), GUILayout.MinWidth(70));
                            if (int.TryParse(new_val, out val))
                            {
                                fi.SetValue(SkillEditTempData.editingItem, val, null);
                            }
                        }
                        else if (fi.PropertyType == typeof(bool))
                        {
                            bool val     = (bool)fi.GetValue(SkillEditTempData.editingItem, null);
                            bool new_val = GUILayout.Toggle(val, "", GUILayout.MinWidth(70));
                            fi.SetValue(SkillEditTempData.editingItem, new_val, null);
                        }
                        else if (fi.PropertyType == typeof(float))
                        {
                            float  val     = (float)fi.GetValue(SkillEditTempData.editingItem, null);
                            string new_val = GUILayout.TextField(val.ToString(), GUILayout.MinWidth(70));
                            if (new_val != val.ToString() && float.TryParse(new_val, out val))
                            {
                                fi.SetValue(SkillEditTempData.editingItem, val, null);
                            }
                        }
                        else if (fi.PropertyType.IsEnum)
                        {
                            var val     = fi.GetValue(SkillEditTempData.editingItem, null) as Enum;
                            var new_val = EditorGUILayout.EnumPopup("", val, GUILayout.MinWidth(70));
                            fi.SetValue(SkillEditTempData.editingItem, new_val, null);
                        }
                        else if (fi.PropertyType == typeof(FixedAnimationCurve))
                        {
                            var val = fi.GetValue(SkillEditTempData.editingItem, null) as FixedAnimationCurve;
                            if (val == null)
                            {
                                val = new FixedAnimationCurve();
                            }
                            AnimationCurve ac = new AnimationCurve();
                            if (val.Keyframes.Count > 0)
                            {
                                Keyframe[] keyframes = new Keyframe[val.Keyframes.Count];
                                for (int j = 0; j < val.Keyframes.Count; j++)
                                {
                                    var ori_key = val.Keyframes[j];
                                    keyframes[j]             = new Keyframe(ori_key.time.ToFloat(), ori_key.value.ToFloat(), ori_key.inTangent.ToFloat(), ori_key.outTangent.ToFloat());
                                    keyframes[j].tangentMode = ori_key.tangentMode;
                                }
                                ac.keys = keyframes;
                            }
                            var new_val = EditorGUILayout.CurveField("", ac);
                            val.Keyframes.Clear();
                            List <FixedKeyFrame> ckfs = new List <FixedKeyFrame>();
                            for (int j = 0; j < new_val.keys.Length; j++)
                            {
                                Keyframe kf = new_val.keys[j];
                                val.AddKeyFrame(new FixedKeyFrame()
                                {
                                    time        = kf.time.ToLong(), value = kf.value.ToLong(), inTangent = kf.inTangent.ToLong(), outTangent = kf.outTangent.ToLong(),
                                    tangentMode = kf.tangentMode
                                });
                            }
                            fi.SetValue(SkillEditTempData.editingItem, val, null);
                        }
                        else if (fi.PropertyType == typeof(List <EventTrigger>))
                        {
                            GUILayout.BeginVertical();
                            var val = fi.GetValue(SkillEditTempData.editingItem, null) as List <EventTrigger>;
                            if (GUILayout.Button("添加事件", GUILayout.MaxWidth(70)))
                            {
                                val.Add(new EventTrigger());
                            }
                            for (int j = 0; j < val.Count; j++)
                            {
                                GUILayout.BeginHorizontal();
                                DisplayAttribute event_display_attr = SkillEditorUtility.GetDisplayAttr(SkillEditorUtility.GetPropertyInfo(val[j], "e"));
                                GUILayout.Label(event_display_attr.DisplayName);
                                var res = (Logic.Skill.EventType)EditorGUILayout.EnumPopup("", val[j].e, GUILayout.MinWidth(70));
                                if ((int)res < (int)Logic.Skill.EventType.MEELEEWEAPONHIT)
                                {
                                    res = Logic.Skill.EventType.MEELEEWEAPONHIT;
                                }
                                SkillEditorUtility.SetValue(val[j], "e", res);
                                GUILayout.EndHorizontal();
                                GUILayout.BeginHorizontal();
                                DisplayAttribute path_display_attr = SkillEditorUtility.GetDisplayAttr(SkillEditorUtility.GetPropertyInfo(val[j], "path"));
                                GUILayout.Label(path_display_attr.DisplayName);
                                var path = GUILayout.TextField(val[j].EventId.ToString(), GUILayout.MinWidth(70));
                                SkillEditorUtility.SetValue(val[j], "path", path);
                                GUILayout.Space(space);
                                if (GUILayout.Button("删除"))
                                {
                                    val.RemoveAt(j);
                                }
                                GUILayout.EndHorizontal();
                            }
                            fi.SetValue(SkillEditTempData.editingItem, val, null);
                            GUILayout.EndVertical();
                        }
                        else if (fi.PropertyType.Name.Contains("DataBind"))
                        {
                            object val           = fi.GetValue(SkillEditTempData.editingItem, null);
                            Type   db_type       = val.GetType();
                            var    db_properites = db_type.GetProperties((BindingFlags)int.MaxValue);
                            bool   needBind      = false;
                            for (int j = 0; j < db_properites.Length; j++)
                            {
                                if (db_properites[j].Name.Contains("needDataBind"))
                                {
                                    needBind = (bool)(db_properites[j].GetValue(val, null));
                                    GUILayout.Label("数据绑定");
                                    bool new_needBind = GUILayout.Toggle(needBind, "");
                                    if (new_needBind != needBind)
                                    {
                                        db_properites[j].SetValue(val, new_needBind, null);
                                    }
                                    break;
                                }
                            }
                            if (needBind)
                            {
                                for (int j = 0; j < db_properites.Length; j++)
                                {
                                    if (db_properites[j].Name.Contains("bindFrom"))
                                    {
                                        GUILayout.Label("数据源字段");
                                        string bindFrom = (string)(db_properites[j].GetValue(val, null));
                                        if (bindFrom == null)
                                        {
                                            bindFrom = "";
                                        }
                                        string new_bindFrom = GUILayout.TextField(bindFrom, GUILayout.Width(50));
                                        if (bindFrom != new_bindFrom)
                                        {
                                            db_properites[j].SetValue(val, new_bindFrom, null);
                                        }
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                for (int j = 0; j < db_properites.Length; j++)
                                {
                                    if (db_properites[j].Name.Contains("value_SetDirectly"))
                                    {
                                        GUILayout.Label("数据");
                                        var genericTypes = fi.PropertyType.GetGenericArguments();
                                        if (genericTypes[0] == typeof(int))
                                        {
                                            int    bindFrom         = (int)(db_properites[j].GetValue(val, null));
                                            string new_bindFrom_str = GUILayout.TextField(bindFrom.ToString(),
                                                                                          GUILayout.Width(50));
                                            int new_bindFrom;
                                            if (int.TryParse(new_bindFrom_str, out new_bindFrom))
                                            {
                                                if (bindFrom != new_bindFrom)
                                                {
                                                    db_properites[j].SetValue(val, new_bindFrom, null);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }
        }
    }
Esempio n. 55
0
 extern private bool SetPixelDataImplArray(System.Array data, int mipLevel, int face, int element, int elementSize, int dataArraySize, int sourceDataStartIndex = 0);
Esempio n. 56
0
    static int CreateInstance(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Type), typeof(int)))
            {
                System.Type  arg0 = (System.Type)ToLua.ToObject(L, 1);
                int          arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                System.Array o    = System.Array.CreateInstance(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Type), typeof(int[]), typeof(int[])))
            {
                System.Type  arg0 = (System.Type)ToLua.ToObject(L, 1);
                int[]        arg1 = ToLua.CheckNumberArray <int>(L, 2);
                int[]        arg2 = ToLua.CheckNumberArray <int>(L, 3);
                System.Array o    = System.Array.CreateInstance(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Type), typeof(int), typeof(int)))
            {
                System.Type  arg0 = (System.Type)ToLua.ToObject(L, 1);
                int          arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                System.Array o    = System.Array.CreateInstance(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Type), typeof(int), typeof(int), typeof(int)))
            {
                System.Type  arg0 = (System.Type)ToLua.ToObject(L, 1);
                int          arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int          arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                int          arg3 = (int)LuaDLL.lua_tonumber(L, 4);
                System.Array o    = System.Array.CreateInstance(arg0, arg1, arg2, arg3);
                ToLua.Push(L, o);
                return(1);
            }
            else if (TypeChecker.CheckTypes(L, 1, typeof(System.Type)) && TypeChecker.CheckParamsType(L, typeof(long), 2, count - 1))
            {
                System.Type  arg0 = (System.Type)ToLua.ToObject(L, 1);
                long[]       arg1 = ToLua.ToParamsNumber <long>(L, 2, count - 1);
                System.Array o    = System.Array.CreateInstance(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (TypeChecker.CheckTypes(L, 1, typeof(System.Type)) && TypeChecker.CheckParamsType(L, typeof(int), 2, count - 1))
            {
                System.Type  arg0 = (System.Type)ToLua.ToObject(L, 1);
                int[]        arg1 = ToLua.ToParamsNumber <int>(L, 2, count - 1);
                System.Array o    = System.Array.CreateInstance(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.CreateInstance"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 57
0
 /// <summary>
 ///      Implements the OnBeginShutdown method of the IDTExtensibility2 interface.
 ///      Receives notification that the host application is being unloaded.
 /// </summary>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnBeginShutdown(ref System.Array custom)
 {
 }
Esempio n. 58
0
 /// <summary>
 ///      Implements the OnStartupComplete method of the IDTExtensibility2 interface.
 ///      Receives notification that the host application has completed loading.
 /// </summary>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnStartupComplete(ref System.Array custom)
 {
 }
Esempio n. 59
0
 /// <summary>
 ///      Implements the OnAddInsUpdate method of the IDTExtensibility2 interface.
 ///      Receives notification that the collection of Add-ins has changed.
 /// </summary>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnAddInsUpdate(ref System.Array custom)
 {
 }
Esempio n. 60
0
        /// <summary>
        ///      Implements the OnConnection method of the IDTExtensibility2 interface.
        ///      Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param term='application'>
        ///      Root object of the host application.
        /// </param>
        /// <param term='connectMode'>
        ///      Describes how the Add-in is being loaded.
        /// </param>
        /// <param term='addInInst'>
        ///      Object representing this Add-in.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
        {
            applicationObject = (_DTE)application;
            addInInstance     = (AddIn)addInInst;
            //if(connectMode == Extensibility.ext_ConnectMode.ext_cm_UISetup)
            {
                object []    contextGUIDS = new object[] { };
                Commands     commands     = applicationObject.Commands;
                _CommandBars commandBars  = applicationObject.CommandBars;

                // When run, the Add-in wizard prepared the registry for the Add-in.
                // At a later time, the Add-in or its commands may become unavailable for reasons such as:
                //   1) You moved this project to a computer other than which is was originally created on.
                //   2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
                //   3) You add new commands or modify commands already defined.
                // You will need to re-register the Add-in by building the SmellFinderSetup project,
                // right-clicking the project in the Solution Explorer, and then choosing install.
                // Alternatively, you could execute the ReCreateCommands.reg file the Add-in Wizard generated in
                // the project directory, or run 'devenv /setup' from a command prompt.
                try
                {
                    Command command = Find(commands);
                    if (command == null)
                    {
                        command = commands.AddNamedCommand(addInInstance, "SmellFinder", "SmellFinder", "Executes the command for SmellFinder", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled);
                        CommandBar        commandBar        = (CommandBar)commandBars["Tools"];
                        CommandBarControl commandBarControl = command.AddControl(commandBar, 1);
                    }
                }
                catch (System.Exception /*e*/)
                {
                }
            }
        }