示例#1
0
 public TestTaskItem(string msg) : this()
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(), msg, new object[] { msg });
     }
     _itemSpec = msg;
 }
示例#2
0
 void ICollection.CopyTo(Array array, int index)
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(), "[{0}]={1}", new object[] { array, index });
     }
     throw new NotImplementedException();
 }
示例#3
0
 IDictionaryEnumerator IDictionary.GetEnumerator()
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod());
     }
     return(new MyDictEnum(_map));
 }
示例#4
0
 internal TestTaskItem()
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod());
     }
     _map = new Dictionary <string, string>();
 }
示例#5
0
 void ITaskItem.CopyMetadataTo(ITaskItem destinationItem)
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(), "{0}={1}", new object[] { destinationItem });
     }
     throw new NotImplementedException();
 }
示例#6
0
 void ITaskItem.RemoveMetadata(string metadataName)
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(), "{0}={1}", new object[] { metadataName });
     }
     throw new NotImplementedException();
 }
示例#7
0
 void IDictionary.Remove(object key)
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(), "Key={0}", new object[] { key });
     }
     throw new NotImplementedException();
 }
示例#8
0
 void IDictionary.Clear()
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod());
     }
     _map.Clear();
 }
示例#9
0
 void IDictionary.Add(object key, object value)
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(), "{0}={1}", new object[] { key, value });
     }
     _map.Add(key.ToString(), value.ToString());
 }
示例#10
0
 internal TestTaskItem(string key, string avalue) : this()
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(), "{0}={1}", new object[] { key, avalue });
     }
     ((ITaskItem)this).ItemSpec = key;
     ((ITaskItem)this).SetMetadata(key, avalue);
 }
示例#11
0
        IDictionary ITaskItem.CloneCustomMetadata()
        {
            IDictionary ret;

            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod());
            }
            ret = new MyDictionary(_map);
            return(ret);
        }
示例#12
0
        void IEnumerator.Reset()
        {
            _nitems = _map.Count;
            _nindex = -1;

            if (verbose)
            {
                MiniLogger.log(
                    MethodBase.GetCurrentMethod(),
                    "ITEMS=" + _nitems + ", INDEX=" + _nindex);
            }
        }
示例#13
0
        bool IEnumerator.MoveNext()
        {
            bool ret;

            ret = _nitems < 0 ? false : (++_nindex < _nitems);

            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod(),
                               "returning: " + ret +
                               " [ITEMS=" + _nindex + ", INDEX=" + _nindex + "]");
            }
            return(ret);
        }
示例#14
0
        public MyDictionary(IDictionary <string, string> amap)
        {
            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod());
            }

            if (amap != null)
            {
                foreach (string aKey in amap.Keys)
                {
                    _map.Add(aKey, amap[aKey]);
                }
            }
        }
示例#15
0
        string ITaskItem.GetMetadata(string metadataName)
        {
            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod(), "{0}", new object[] { metadataName });
            }
            string ret;

            ret = _map[metadataName];
            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod(),
                               "[" + metadataName + "] : " + ret);
            }
            return(_map[metadataName]);
        }
示例#16
0
 void ITaskItem.SetMetadata(string metadataName, string metadataValue)
 {
     if (verbose)
     {
         MiniLogger.log(MethodBase.GetCurrentMethod(),
                        "{0}={1}",
                        new object[] { metadataName, metadataValue });
     }
     if (_map.ContainsKey(metadataName))
     {
         _map[metadataName] = metadataValue;
     }
     else
     {
         _map.Add(metadataName, metadataValue);
     }
 }
示例#17
0
        internal MyDictEnum(IDictionary <string, string> aMap)
        {
            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod());
            }
            _map  = aMap;
            _keys = new List <string>();
            if (_map != null)
            {
                foreach (string akey in _map.Keys)
                {
                    _keys.Add(akey);
                }
            }
            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod(), "have " + _keys.Count + " keys.");
            }

            ((IDictionaryEnumerator)this).Reset();
        }
示例#18
0
        object IDictionary.this[object key] {
            get {
                string akey = key.ToString(), ret;

                if (!_map.ContainsKey(akey))
                {
                    ret = null;
                }
                else
                {
                    ret = _map[akey];
                }
                if (verbose)
                {
                    MiniLogger.log(
                        MethodBase.GetCurrentMethod(),
                        ": key=" + akey + " returning: " + (string.IsNullOrEmpty(ret) ? "NULL" : ret));
                }
                return(ret);
            }

            set {
                string akey = key.ToString();
                if (verbose)
                {
                    MiniLogger.log(MethodBase.GetCurrentMethod(), "{0}={1}", new object[] { akey, value.ToString() });
                }
                if (_map.ContainsKey(akey))
                {
                    _map[akey] = value.ToString();
                }
                else
                {
                    _map.Add(akey, value.ToString());
                }
            }
        }
示例#19
0
        bool ITask.Execute()
        {
            string           outFile, outSpecPath, dir = null;
            FileVersionInfo  fvi;
            List <ITaskItem> content;

            if (verbose)
            {
                MiniLogger.log(MethodBase.GetCurrentMethod());
            }
            if (string.IsNullOrEmpty(NuspecPath))
            {
                showError("Property 'NuspecPath' is null!");
                return(false);
            }
            outSpecPath = Path.GetDirectoryName(Path.GetFullPath(NuspecPath));
            showMessage("NuspecPath=" + outSpecPath);
            try {
                dir = Path.GetDirectoryName(outSpecPath);
                showMessage("Check NuspecPath=" + dir);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                    showMessage("Creating NuspecPath-dir =" + dir);
                }
            } catch (Exception ex) {
                showError("error creating directory '" + dir + "'" + Environment.NewLine + MiniLogger.decompose(ex));
                return(false);
            }
            showMessage(MessageImportance.Low, "spec-path: " + outSpecPath);

            if (!string.IsNullOrEmpty(AssemblyPath))
            {
                if (File.Exists(AssemblyPath))
                {
                    fvi = FileVersionInfo.GetVersionInfo(AssemblyPath);
#if true
                    outFile = Path.GetFullPath(
                        Path.Combine(
                            outSpecPath,
                            Path.GetFileNameWithoutExtension(AssemblyPath) + ".nuspec"));
#else
                    outFile = Path.GetFullPath(Path.Combine(
                                                   Path.GetDirectoryName(AssemblyPath),
                                                   Path.GetFileNameWithoutExtension(AssemblyPath) + ".nuspec"));
#endif
                    showMessage("OUTFILE=" + outFile);
                    if (generateSpecfile(outFile, fvi, AssemblyPath, out _pkg, out content))
                    {
                        try {
#if USE_TEST_TASK_ITEM
                            _outputpath = new TestTaskItem(outFile);
#else
                            _outputpath = new TaskItem(outFile);
#endif
                            _result = true;
                            populateData("NuspecData", content);
                        } catch (ArgumentException ae) {
                            showError(ae.Message);
                        } catch (Exception ex) {
                            showError(MiniLogger.decompose(ex));
                        }
                    }
                    Trace.WriteLine("here");
                }
                else
                {
                    this.showError(AssemblyPath + " does not exist in " + Directory.GetCurrentDirectory());
                }
            }
            else
            {
                ((ITask)this).BuildEngine.LogErrorEvent(
                    new BuildErrorEventArgs("subcat", "code", "file", -1, -1, -1, -1, "empty", "help", "sender", System.DateTime.Now));
            }
            return(BuildResult);
        }
示例#20
0
 IEnumerator IEnumerable.GetEnumerator()
 {
     MiniLogger.log(MethodBase.GetCurrentMethod());
     throw new NotImplementedException();
 }