Example #1
0
 public static string CodeRepresentation(Array a)
 {
     StringBuilder ret = new StringBuilder();
     ret.Append(a.GetType().FullName);
     ret.Append("(");
     switch (a.Rank) {
         case 1: {
                 for (int i = 0; i < a.Length; i++) {
                     if (i > 0) ret.Append(", ");
                     ret.Append(Ops.StringRepr(a.GetValue(i + a.GetLowerBound(0))));
                 }
             }
             break;
         case 2: {
                 int imax = a.GetLength(0);
                 int jmax = a.GetLength(1);
                 for (int i = 0; i < imax; i++) {
                     ret.Append("\n");
                     for (int j = 0; j < jmax; j++) {
                         if (j > 0) ret.Append(", ");
                         ret.Append(Ops.StringRepr(a.GetValue(i + a.GetLowerBound(0), j + a.GetLowerBound(1))));
                     }
                 }
             }
             break;
         default:
             ret.Append(" Multi-dimensional array ");
             break;
     }
     ret.Append(")");
     return ret.ToString();
 }
Example #2
0
 public static string GetValue(Array MyValues)
 {
     String ret = "";
        ret=MyValues.GetValue(1, RowIndex) == null?"":MyValues.GetValue(1, RowIndex).ToString();
        RowIndex++;
        return ret;
 }
 /// <summary>
 /// Sort elements in an Array object, using the Order
 /// delegate to determine how items should be sorted.
 /// </summary>
 /// <param name="table">Array to be sorted</param>
 /// <param name="sortHandler">Delegate to manage
 /// sort order.</param>
 public void Sort(Array table, Order sortHandler)
 {
     if(sortHandler == null)
         throw new ArgumentNullException();
     
     bool nothingSwapped = false;
     int pass = 1;
     while(nothingSwapped == false)
     {
         nothingSwapped = true;
         for(int index = 0; index < table.Length - pass; ++index)
         {
             // Use an Order delegate to determine the sort order.
             if(sortHandler(table.GetValue(index),
                 table.GetValue(index + 1)) == false)
             {
                 nothingSwapped = false;
                 object temp = table.GetValue(index);
                 table.SetValue(table.GetValue(index + 1), index);
                 table.SetValue(temp, index + 1);
             }
         }
         ++pass;
     }
 }
Example #4
0
    /// <summary>
    /// A simple bubble sort for two arrays, limited to some region of the arrays.
    /// This is a regular bubble sort, nothing fancy.
    /// </summary>
    public static void SimpleSort(Array array, Array items, int startingIndex, int length, IComparer comparer)
    {
        bool finished = false;
        while (!finished)
        {
            bool swapped = false;
            for (int g = startingIndex; g < startingIndex + length - 1; g++)
            {
                Object first = array.GetValue(g);
                Object second = array.GetValue(g + 1);
                int comparison = comparer.Compare(first, second);
                if (comparison == 1)
                {
                    Swap(g, g + 1, array, items);
                    swapped = true;

                    first = array.GetValue(g);
                    second = array.GetValue(g + 1);
                }
            }
            if (!swapped)
            {
                finished = true;
            }
        }
    }
        public bool SendEmail(string name, string email, Array arrayFrontEnd, Array arrayBackEnd, Array arrayMobile)
        {
            bool criterion = false;
            bool sucess = true;
            string subject = string.Empty;
            string content = string.Empty;
            IDictionary<int, string> dictionary = new Dictionary<int, string>();

            if (Convert.ToInt32(arrayFrontEnd.GetValue(0)) >= 7 || 10 <= Convert.ToInt32(arrayFrontEnd.GetValue(0)) &&
                Convert.ToInt32(arrayFrontEnd.GetValue(1)) >= 7 || 10 <= Convert.ToInt32(arrayFrontEnd.GetValue(1)) &&
                Convert.ToInt32(arrayFrontEnd.GetValue(2)) >= 7 || 10 <= Convert.ToInt32(arrayFrontEnd.GetValue(2)))
            {
                criterion = true;
                subject = string.Concat("Obrigado por se candidatar ", name);
                content = "Obrigado por se candidatar, assim que tivermos uma vaga disponível para programador Front-End entraremos em contato.";
                dictionary.Add(1, string.Concat(subject, "|", content));
            }

            if (Convert.ToInt32(arrayBackEnd.GetValue(0)) >= 7 || 10 <= Convert.ToInt32(arrayBackEnd.GetValue(0)) &&
                     Convert.ToInt32(arrayBackEnd.GetValue(1)) >= 7 || 10 <= Convert.ToInt32(arrayBackEnd.GetValue(1)))
            {
                criterion = true;
                subject = string.Concat("Obrigado por se candidatar ", name);
                content = "Obrigado por se candidatar, assim que tivermos uma vaga disponível para programador Back-End entraremos em contato.";
                dictionary.Add(2, string.Concat(subject, "|", content));
            }

            if (Convert.ToInt32(arrayMobile.GetValue(0)) >= 7 || 10 <= Convert.ToInt32(arrayMobile.GetValue(0)) &&
                     Convert.ToInt32(arrayMobile.GetValue(1)) >= 7 || 10 <= Convert.ToInt32(arrayMobile.GetValue(1)))
            {
                criterion = true;
                subject = string.Concat("Obrigado por se candidatar ", name);
                content = "Obrigado por se candidatar, assim que tivermos uma vaga disponível para programador Mobile entraremos em contato.";
                dictionary.Add(3, string.Concat(subject, "|", content));
            }

            if (!criterion)
            {
                subject = string.Concat("Obrigado por se candidatar ", name);
                content = "Obrigado por se candidatar, assim que tivermos uma vaga disponível para programador entraremos em contato.";
                dictionary.Add(4, string.Concat(subject, "|", content));
            }

            foreach (var item in dictionary)
            {
                List<string> stringList = new List<string>(item.Value.Split(new string[] { "|" }, StringSplitOptions.None));

                sucess = SendEmailToClient(email, stringList[0], stringList[1]);

                if (!sucess)
                    break;
            }

            if (!sucess)
                return false;
            else
                return true;
        }
    public object ConnectData(int topicId, ref Array Strings, ref bool GetNewValues)
    {
        m_source[topicId] = Strings.GetValue(0).ToString();
        m_bland[topicId] = Strings.GetValue(1).ToString();
        m_field[topicId] = Strings.GetValue(2).ToString();

        m_timer.Start();

        return "Data not found.";
    }
 public static void Shuffle(this Random rng, Array array)
 {
     int n = array.Length;
     while (n > 1) {
         int k = rng.Next (n--);
         object temp = array.GetValue (n);
         array.SetValue (array.GetValue (k), n);
         array.SetValue (temp, k);
     }
 }
Example #8
0
 public void AddToLog(Array lines, int i, Color textColor)
 {
     rtbLogText.SelectionColor = textColor;
     rtbLogText.AppendText(string.Format("{0}{1}", lines.GetValue(i) as string, Environment.NewLine));
     fullRTFcode = rtbLogText.Rtf;
     if (textColor == Color.Red)
         subsetErrorRTFList.Add((string.Format("{0}{1}", lines.GetValue(i) as string, Environment.NewLine)));
     else if (textColor == Color.DarkCyan)
         subsetWarningRTFList.Add((string.Format("{0}{1}", lines.GetValue(i) as string, Environment.NewLine)));
     else if (textColor == ForeColor)
         subsetSubmittedRTFList.Add((string.Format("{0}{1}", lines.GetValue(i) as string, Environment.NewLine)));
 }
Example #9
0
File: Helper.cs Project: d9d9/sharp
 public static bool CompareObjects(Array obj1, Array obj2)
 {
     if (obj1 == null || obj2 == null) return false;
     string s;
     string y;
     for (int i = 0; i < obj1.Length; i++)
     {
         s = obj1.GetValue(i).ToString();
         y = obj2.GetValue(i).ToString();
         if (obj1.GetValue(i).ToString() != obj2.GetValue(i).ToString()) return false;
     }
     return true;
 }
Example #10
0
 public static void Equals(Array a, Array b, string message=null) {
     if(a.Length != b.Length)
         throw new AssertFailedException("A and B are not of equal length (" + a.Length + " != " + b.Length + ")");
     for(int i=0;i<a.Length;i++) {
         var ai = a.GetValue(i);
         var bi = b.GetValue(i);
         if(ai is IComparable && bi is IComparable) {
             Equals((IComparable)ai, (IComparable)bi, message);
         } else if(ai != bi){
             throw new AssertFailedException(String.IsNullOrEmpty(message) ? a.GetValue(i).ToString() + " != " + b.GetValue(i).ToString() : message);
         }
     }
 }
Example #11
0
        protected override void SortGenericArray(Array items, int left, int right)
        {
            int lo = left;
            int hi = right;

            if (lo >= hi)
            {
                return;
            }

            int mid = (lo + hi) / 2;

            // Partition the items into two lists and Sort them recursively
            SortGenericArray(items, lo, mid);
            SortGenericArray(items, mid + 1, hi);

            // Merge the two sorted lists
            int end_lo = mid;
            int start_hi = mid + 1;

            while ((lo <= end_lo) && (start_hi <= hi))
            {

                if (this.comparer.Compare(items.GetValue(lo), items.GetValue(start_hi)) < 0)
                {
                    lo++;
                }
                else
                {
                    /*
                  *  items[lo] >= items[start_hi]
                  *  The next element comes from the second items,
                  *  move the items[start_hi] element into the next
                  *  position and shuffle all the other elements up.
                  */
                    object T = items.GetValue(start_hi);

                    for (int k = start_hi - 1; k >= lo; k--)
                    {
                        items.SetValue(items.GetValue(k), k + 1);
                    }

                    items.SetValue(T, lo);
                    lo++;
                    end_lo++;
                    start_hi++;
                }
            }
        }
Example #12
0
        /// <summary>
        ///     Tests equality of two single-dimensional arrays by checking each element
        ///     for equality.
        /// </summary>
        /// <param name="a">The first array to be checked.</param>
        /// <param name="b">The second array to be checked.</param>
        /// <returns>True if arrays are the same, false otherwise.</returns>
        public static bool AreEqual(Array a, Array b)
        {
            if (a == null && b == null)
            {
                return true;
            }

            if (a != null && b != null)
            {
                if (a.Length == b.Length)
                {
                    for (var i = 0; i < a.Length; i++)
                    {
                        var elemA = a.GetValue(i);
                        var elemB = b.GetValue(i);

                        if (elemA is Array && elemB is Array)
                        {
                            if (!AreEqual(elemA as Array, elemB as Array))
                            {
                                return false;
                            }
                        }
                        else if (!Equals(elemA, elemB))
                        {
                            return false;
                        }
                    }
                    return true;
                }
            }
            return false;
        }
Example #13
0
        public static bool IsAssignableArrayFrom(this Array source, Array target)
        {
            if (source == null || target == null)
            {
                throw new ArgumentNullException("source");
            }

            if (source == target)
            {
                return true;
            }

            if (source.Length != target.Length)
            {
                return false;
            }

            int i = 0;
            while (i < source.Length)
            {
                if (source.GetType().IsAssignableFrom(target.GetValue(i).GetType()))
                {
                    return false;
                }

                i++;
            }

            return true;
        }
Example #14
0
			public static JavaObjectFactory Array(JniWrapper vm, Type dotNetType, Array prototype)
			{
				object innerPrototype = null;
				if (prototype != null && prototype.Length > 0)
				{
					innerPrototype = prototype.GetValue(0);
				}
				JavaObjectFactory innerFactory = GetJavaType(vm, dotNetType.GetElementType(), innerPrototype);
				ArrayType javaArrayType = new ArrayType(innerFactory.JavaType);
				return new JavaObjectFactory(o =>
					{
						Array asArray = (Array)o;
						PrimitiveType asPrimitive = javaArrayType.MemberType as PrimitiveType;
						if (asPrimitive != null)
						{
							switch (asPrimitive.Kind)
							{
								case PrimitiveTypeKind.Boolean: return vm.NewBooleanArray((bool[])o);
								case PrimitiveTypeKind.Byte: return vm.NewByteArray((byte[])o);
								case PrimitiveTypeKind.Char: return vm.NewCharArray((char[])o);
								case PrimitiveTypeKind.Double: return vm.NewDoubleArray((double[])o);
								case PrimitiveTypeKind.Float: return vm.NewFloatArray((float[])o);
								case PrimitiveTypeKind.Int: return vm.NewIntArray((int[])o);
								case PrimitiveTypeKind.Long: return vm.NewLongArray((long[])o);
								case PrimitiveTypeKind.Short: return vm.NewShortArray((short[])o);
								default: throw new InvalidOperationException("Unknown primitive kind: " + asPrimitive.Kind);
							}
						}
						else
						{
							IntPtr[] elements = asArray.Cast<object>().Select(innerFactory._factory).Select(v => v.ToIntPtr()).ToArray();
							return vm.NewArray(vm.FindClass(innerFactory.JavaType.JniClassName), elements);
						}
					}, javaArrayType);
			}
Example #15
0
 public static void Encode(LittleEndianOutput out1, Array values)
 {
     for (int i = 0; i < values.Length; i++)
     {
         EncodeSingleValue(out1, values.GetValue(i));
     }
 }
Example #16
0
        /// <summary>
        /// Returns hash code for an array that is generated based on the elements.
        /// </summary>
        /// <remarks>
        /// Hash code returned by this method is guaranteed to be the same for
        /// arrays with equal elements.
        /// </remarks>
        /// <param name="array">
        /// Array to calculate hash code for.
        /// </param>
        /// <returns>
        /// A hash code for the specified array.
        /// </returns>
        public static int GetHashCode(Array array)
        {
            int hashCode = 0;

            if (array != null)
            {
                for (int i = 0; i < array.Length; i++)
                {
                    object el = array.GetValue(i);
                    if (el != null)
                    {
                        if (el is Array)
                        {
                            hashCode += 17 * GetHashCode(el as Array);
                        }
                        else
                        {
                            hashCode += 13 * el.GetHashCode();
                        }
                    }
                }
            }

            return hashCode;
        }
Example #17
0
        //-------------------------------------------------------------------//
        /// <summary>
        ///     Converts COM like 2dim array where one dimension is of length 1 to regular array.
        /// </summary>
        /// <param name="a">COM array</param>
        /// <returns>regular array</returns>
        public static object[] Com2DArray2Array(Array a)
        {
            if (a == null)
                return null;

            object[] converted = null;
            switch (a.Rank)
            {
                case 1:
                    converted = new object[a.GetLength(0)];
                    for (var i = a.GetLowerBound(0); i <= a.GetUpperBound(0); i++)
                    {
                        converted[i] = a.GetValue(i);
                    }
                    break;
                case 2:
                {
                    var d1 = a.GetLength(0);
                    var d2 = a.GetLength(1);
                    var len = (d1 > d2) ? d1 : d2;
                    converted = new object[len];
                    var dim = (d1 > d2) ? 0 : 1;
                    for (var i = a.GetLowerBound(dim); i <= a.GetUpperBound(dim); i++)
                    {
                        converted[i - a.GetLowerBound(dim)] = a.GetValue((d1 == 1 ? a.GetLowerBound(0) : i),
                            (d2 == 1 ? a.GetLowerBound(1) : i));
                    }
                }
                    break;
            }

            return converted;
        }
Example #18
0
        public string ioPrint(Array Formats, Array StorageTypes)
        {
            string msgString = "";

            for (int iIndex = 0; iIndex < Formats.Length; iIndex++)
            {
                msgString = msgString + Formats.GetValue(iIndex);

                StorageTypeEnum lType;
                lType = (StorageTypeEnum)StorageTypes.GetValue(iIndex);

                switch(lType)
                {
                    case StorageTypeEnum.kFileOrStreamStorage:
                        msgString = msgString + "(File or Stream) ";
                        break;
                    case StorageTypeEnum.kFileStorage:
                        msgString = msgString + "(File) ";
                        break;
                    case StorageTypeEnum.kStorageStorage:
                        msgString = msgString + "(Storage) ";
                        break;
                    case StorageTypeEnum.kUnknownStorage:
                        msgString = msgString + "(Unknown) ";
                        break;
                    default:
                        msgString = msgString + "(Stream) ";
                        break;
                }
            }
            return msgString;
        }
        public static String GenerateName(Species species)
        {
            string result = "";
            string[] split = new string[1] { "\r\n" };
            char[] splitchar = new char[1] { ':' };

            switch (species)
            {
                case Species.Human:
                    srReader = new StreamReader("Data/HumanNames.txt");
                    break;
                default:
                    return "TEST";
            }

            NameCategories = srReader.ReadToEnd().Split(splitchar, System.StringSplitOptions.RemoveEmptyEntries);

            for (int i = 1; i <= NameCategories.Length - 1; i = i + 2)
            {
                SpecificNames = ((String)NameCategories.GetValue(i)).Split(split, System.StringSplitOptions.RemoveEmptyEntries);

                result = result + SpecificNames.GetValue(ran.Next(0, SpecificNames.Length - 1));
            }
            result = result.Replace("%", string.Empty);

            return result;
        }
Example #20
0
        /// <summary>
        ///     Initializes a new instance of the QTable with specified column names and data matrix.
        /// </summary>
        public QTable(string[] columns, Array data)
        {
            if (columns == null || columns.Length == 0)
            {
                throw new ArgumentException("Columns array cannot be null or 0-length");
            }

            if (data == null || data.Length == 0)
            {
                throw new ArgumentException("Data matrix cannot be null or 0-length");
            }

            if (columns.Length != data.Length)
            {
                throw new ArgumentException("Columns array and data matrix cannot have different length");
            }

            if (data.Cast<object>().Any(col => !col.GetType().IsArray))
            {
                throw new ArgumentException("Non array column found in data matrix");
            }

            columnsMap = new ListDictionary();
            for (int i = 0; i < columns.Length; i++)
            {
                columnsMap[columns[i]] = i;
            }

            this.columns = columns;
            this.data = data;
            RowsCount = ((Array)data.GetValue(0)).Length;
        }
Example #21
0
        void IMediaStatusSession.MediaStatusChange(Array tags,
                                                   Array properties)
        {
            Sink.TraceInformation("Session.MediaStatusChange called");

            for (int i = 0; i < tags.Length; i++)
            {
                MEDIASTATUSPROPERTYTAG tag =
                  (MEDIASTATUSPROPERTYTAG)tags.GetValue(i);
                object value = properties.GetValue(i);
                Sink.TraceInformation("Tag {0}={1}",
                                       tag,
                                       value);
                string tagStr = tag.ToString();
                if (tagStr.Equals("MSPROPTAG_MediaName"))
                {
                    Sink.TraceInformation("Witing to key");
                    WriteToRegistry("Name", value.ToString());

                }
                else if(tagStr.Equals("MSPROPTAG_TrackNumber"))
                {
                    WriteToRegistry("Channel", value.ToString());
                }
            }
        }
        private void fillHeftArray(int spaceDimension, int histogramResolution, Array array, Array heftArray)
        {
            int cellNO = (int)Math.Pow(histogramResolution, spaceDimension);
            int[] outerIndicesArray = new int[spaceDimension];
            int[] innerIndicesArray = new int[spaceDimension];
            int[] windowIndicesArray = new int[spaceDimension];
            for (int outerCellIdx = 0; outerCellIdx < cellNO; outerCellIdx++)
            {
                transformator.transformCellIdxToIndicesArray(histogramResolution, outerIndicesArray, outerCellIdx);

                for (int innerCellIdx = outerCellIdx; innerCellIdx < cellNO; innerCellIdx++)
                {
                    transformator.transformCellIdxToIndicesArray(histogramResolution, innerIndicesArray, innerCellIdx);
                    int[] heftArrayIndeces;
                    int cellPoints;
                    bool validHeftArrayIndeces = transformator.mergeIndicesArrays(spaceDimension, outerIndicesArray,
                        innerIndicesArray, out heftArrayIndeces, out cellPoints);
                    if (validHeftArrayIndeces)
                    {
                        int cellValue = 0;
                        for (int windowIdx = outerCellIdx; windowIdx <= innerCellIdx; windowIdx++)
                        {
                            transformator.transformCellIdxToIndicesArray(histogramResolution, windowIndicesArray, windowIdx);
                            bool validSummableArrayIndeces = transformator.validateIndicesArrays(spaceDimension,
                                outerIndicesArray, innerIndicesArray, windowIndicesArray);
                            if (validSummableArrayIndeces)
                            {
                                cellValue += (int)array.GetValue(windowIndicesArray);
                            }
                        }
                        heftArray.SetValue(cellValue, heftArrayIndeces);
                    }
                }
            }
        }
Example #23
0
 public dynamic ConnectData(int TopicID, ref Array Strings, ref bool GetNewValues)
 {
     var start = Convert.ToInt32(Strings.GetValue(0).ToString());
     GetNewValues = true;
     _topics[TopicID] = new IncrementUpwards { CurrentValue = start };
     return start;
 }
Example #24
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;
        }
Example #25
0
		public static int GetArrayHashCode(Array arr) {
			int arrHash = arr.Length;
			for (int i = 0; i < arr.Length; ++i) {
				arrHash = arrHash ^ arr.GetValue(i).GetHashCode();
			}
			return arrHash;
		}
Example #26
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");
        }
Example #27
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 #28
0
		public static bool ArrayDeepEquals(Array arr1, Array arr2) {
			if (arr1.Length!=arr2.Length || arr1.GetType()!=arr2.GetType())
				return false;

			for (int i=0; i<arr1.Length; i++) {
				var v1 = arr1.GetValue(i);
				var v2 = arr2.GetValue(i);
				if (v1 is Array && v2 is Array)
					if (!ArrayDeepEquals((Array)v1, (Array)v2)) {
						return false;
					} else
						continue;

				if (v1==null && v2==null)
					continue;

				if (v1!=null)
					if (!v1.Equals(v2))
						return false;
				if (v2 != null)
					if (!v2.Equals(v1))
						return false;
			}
			return true;
		}
 public SArray(Array array)
 {
     Values = new ISItem[array.Length];
     for (var i = 0; i < array.Length; i++) {
         Values[i] = SConvert.ToSettings(array.GetValue(i));
     }
 }
Example #30
0
File: KRTD.cs Project: junwin/K2RTD
        object Microsoft.Office.Interop.Excel.IRtdServer.ConnectData(int TopicID, ref Array Strings, ref bool GetNewValues)
        {
            object myRet = null;
            try
            {
                string myReqType = Strings.GetValue(0) as string;
                string myTopicID = Strings.GetValue(1) as string;
                string myHeaderName = Strings.GetValue(2) as string;
                string[] stringArray = null;

                switch (myReqType)
                {

                    case "RESUB":
                        // do a resubscribe
                        m_RTDSupport.ReplaySubscriptions();

                        break;
                    case "RESUBGW":
                        // do a resubscribe for a gateway
                        //KRTDSupport.KRTDSupport.Instance().ReSubscribeGW(myTopicID);
                        break;

                    case "NOP":
                        // ignore the operation
                        break;
                    case "PX":
                        // ignore the operation
                       asStringArray(ref stringArray, Strings);
                        m_RTDSupport.ConnectData(TopicID, stringArray);
                        break;
                    default:
                        asStringArray(ref stringArray, Strings);
                        m_RTDSupport.ConnectData(TopicID, stringArray);
                        myRet = myTopicID;
                        break;
                }

                // force excel to use the new value
                GetNewValues = true;
            }
            catch (Exception myE)
            {
                //KRTDSupport.KRTDSupport.Instance().Log.Error("Microsoft.Office.Interop.Excel.IRtdServer.ConnectData", myE);
            }
            return myRet;
        }