Inheritance: IList
Example #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);
            }
        }
Example #2
0
 static void Method1(ref byte param1)
 {
     for (; m_bFlag; param1 = param1)
     {
         Array[] a = new Array[2];
     }
 }
 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);
 }
Example #4
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;
 }
        static MyGuiEditorVoxelHandHelpers()
        {
            MyMwcLog.WriteLine("MyGuiEditorVoxelHandHelpers()");

            MyEditorVoxelHandShapeHelperTypesEnumValues = Enum.GetValues(typeof(MyVoxelHandShapeType));
            MyEditorVoxelHandModeHelperTypesEnumValues = Enum.GetValues(typeof(MyMwcVoxelHandModeTypeEnum));
        }
Example #6
0
 public static void ThrowIfIsNullOrEmpty(Array array)
 {
     if (array == null || array.Length == 0)
     {
         throw new ArgumentNullException();
     }
 }
Example #7
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);
			}
        /// <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("}");
                }
            }
        }
Example #9
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
            //    {
            //    }
            //}
        }
Example #10
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;
            }
        }
Example #11
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;
                    }
                }
            }
        }
Example #12
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");
        }
        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;
            }
        }
Example #14
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";
        }
Example #15
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( );
        }
Example #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");
        }
Example #17
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();
            }
        }
        /// <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);
            }
        }
Example #19
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);
				}
			}
		}
Example #20
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;
        }
        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;
        }
Example #22
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);
		}
Example #23
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;
            }
        }
Example #24
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);
 }
Example #25
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();            
        }
Example #26
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;
        }
Example #27
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);
			}
		}
Example #28
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");
            }
        }
        public static void Sort(string[] keys, Array items)
        {
            Debug.Assert(keys != null);
            Debug.Assert(items != null);

            Array.Sort(keys, items, InvariantComparer);
        }
 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;
 }