Exemple #1
0
        /// <summary>
        /// Create a clone of this Object
        /// </summary>
        /// <returns>The clone</returns>
        public override object Clone()
        {
            ResourceContainers list = new ResourceContainers();

            foreach (ResourceContainer item in this)
            {
                list.Add(item);
            }

            return(list);
        }
Exemple #2
0
        public static void Execute(SimPe.Events.ResourceContainers es)
        {
            //Select the Type
            if (Helper.WindowsRegistry.ReportFormat == Registry.ReportFormats.CSV)
            {
                Serializer.Formater = new CsvSerializer();
            }

            System.Collections.Hashtable map = new System.Collections.Hashtable();

            foreach (SimPe.Events.ResourceContainer e in es)
            {
                uint t = e.Resource.FileDescriptor.Type;
                SimPe.Events.ResourceContainers o = map[t] as SimPe.Events.ResourceContainers;
                if (o == null)
                {
                    o      = new SimPe.Events.ResourceContainers();
                    map[t] = o;
                }

                o.Add(e);
            }

            System.IO.StreamWriter sw = new System.IO.StreamWriter(new System.IO.MemoryStream());
            string error = "";
            int    ct    = 0;
            string max   = "/ " + es.Count.ToString();


            WaitingScreen.Wait();
            try
            {
                foreach (uint type in map.Keys)
                {
                    SimPe.Events.ResourceContainers rc = map[type] as SimPe.Events.ResourceContainers;
                    bool first = true;

                    foreach (SimPe.Events.ResourceContainer e in rc)
                    {
                        error += ProcessItem(sw, e, first);
                        WaitingScreen.UpdateMessage((ct++).ToString() + " / " + max.ToString());
                        first = false;
                    }
                }
                WaitingScreen.Stop();

                if (error != "")
                {
                    throw new Warning("Not all Selected Files were processed.", error);
                }

                if (f == null)
                {
                    f = new Report();
                }
                f.Execute(sw);
            }
#if !DEBUG
            catch (Exception ex)
            {
                Helper.ExceptionMessage(ex);
            }
#endif
            finally
            {
                sw.Close();
                Serializer.ResetFormater();
                WaitingScreen.Stop();
            }
        }
Exemple #3
0
 /// <summary>
 /// Create a new Isntance
 /// </summary>
 /// <param name="lp"></param>
 public ResourceEventArgs(LoadedPackage lp)
 {
     this.lp = lp;
     list    = new ResourceContainers();
 }