Exemple #1
0
        public XElement ToXElement()
        {
            XElement xElements = new XElement("xml");

            foreach (BorgerDkElement element in Elements)
            {
                xElements.Add(element.ToXElement());
            }

            XElement xArticle = new XElement(
                "article",
                new XElement("id", Id),
                new XElement("domain", Domain),
                new XElement("url", Url),
                new XElement("municipalityid", Municipality.Code),
                new XElement("lastreloaded", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("publishingdate", Published.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("lastupdated", Modified.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("title", Title),
                new XElement("header", Header),
                new XElement("html", new XCData(Content)),
                xElements
                );

            return(xArticle);
        }
 /// <summary>
 /// Save to binary file
 /// </summary>
 public override void Save()
 {
     d.Log(true, "Attempting to save Leaderboad contents to binary file: " + d.path + "/" + File_Name, false);
     // Save Leaderboard to binary file
     try
     {
         file = new FileStream(d.path + "/" + File_Name, FileMode.OpenOrCreate);
         BinaryWriter bw = new BinaryWriter(file);
         bw.Write(Modified.ToString());
         bw.Write(d_Leaderboard.Count);
         foreach (var pair in d_Leaderboard)
         {
             bw.Write(pair.Key);
             bw.Write(pair.Value);
         }
         bw.Close();
         file.Close();
         d.Log(true, "Save Leaderboard contents to binary file successful: " + d.path + "/" + File_Name, false);
     }
     catch (Exception e)
     {
         d.Log(false, "Save Leaderboard contents to binary file failed: " + d.path + "/" + File_Name + " > " + e.Message, true);
     }
     finally
     {
         if (file != null)
         {
             file.Close();
         }
     }
 }
 /// <summary>
 /// Save to binary file
 /// </summary>
 public override void Save()
 {
     d.Log(true, "Attempting to save Store contents to binary file: " + d.path + "/" + File_Name, false);
     // Save Store to binary file
     try
     {
         file = new FileStream(d.path + "/" + File_Name, FileMode.OpenOrCreate);
         BinaryWriter bw = new BinaryWriter(file);
         bw.Write(Modified.ToString());
         bw.Write(d_Store.Count);
         foreach (var pair in d_Store)
         {
             bw.Write(pair.Key);
             bw.Write(pair.Value);
         }
         bw.Close();
         file.Close();
         d.Log(true, "Save Store contents to binary file successful: " + Path.Combine(d.path, File_Name), false);
     }
     catch (SerializationException sEx)
     {
         d.Log(false, "Save Store contents to binary file failed: " + Path.Combine(d.path, File_Name) + " > " + sEx.Message, true);
     }
     catch (Exception e)
     {
         d.Log(false, "Writing to the store .dat file failed! > " + e.Message, true);
     }
     finally
     {
         if (file != null)
         {
             file.Close();
         }
     }
 }
        private void RefreshValues()
        {
            bool   exists = SvnItem.Exists;
            string name   = string.IsNullOrEmpty(SvnItem.Name) ? SvnItem.FullPath : SvnItem.Name;

            SvnStatusData     status = SvnItem.Status;
            PendingChangeKind kind   = PendingChange.CombineStatus(status.LocalNodeStatus, status.LocalTextStatus, status.LocalPropertyStatus, SvnItem.IsTreeConflicted, SvnItem);

            if (_chg == null || _chg.State != kind)
            {
                _chg = new PendingChangeStatus(kind);
            }

            SetValues(
                name,
                Modified.ToString("g"),
                View.Context.GetService <IFileIconMapper>().GetFileType(SvnItem),
                _chg.ExplorerText,
                SvnItem.Status.IsLockedLocal ? Ankh.UI.PendingChanges.PCResources.LockedValue : "",
                SvnItem.Status.Revision.ToString(),
                SvnItem.Status.LastChangeTime.ToLocalTime().ToString(),
                SvnItem.Status.LastChangeRevision.ToString(),
                SvnItem.Status.LastChangeAuthor,
                SvnItem.Status.LocalNodeStatus.ToString(),
                SvnItem.Status.LocalPropertyStatus.ToString(),
                SvnItem.Status.IsCopied.ToString(),
                SvnItem.IsConflicted.ToString(),
                SvnItem.FullPath
                );

            StateImageIndex = (int)View.StatusMapper.GetStatusImageForSvnItem(SvnItem);
        }
Exemple #5
0
 public override void SaveData(System.IO.StreamWriter writer, FileKey fk)
 {
     writer.WriteLine("lang\t{0}", Language);
     writer.WriteLine("langid\t{0}", LanguageId);
     writer.WriteLine("modified\t{0}", Modified.ToString());
     writer.WriteLine("version\t{0}", LanguageVersion);
     for (int i = 0; i < gstr.Count; i++)
     {
         writer.WriteLine("{0}\t{1}\t{2}", i, gstr[i], (edited.ContainsKey(i) ? edited[i].ToString() : false.ToString()));
     }
 }
Exemple #6
0
 public void PrintEvent()
 {
     Console.WriteLine("ID: {0}", Id);
     Console.WriteLine("GUID: {0}", GUID);
     Console.WriteLine("Title: {0}", Title);
     Console.WriteLine("Description: {0}", Description);
     Console.WriteLine("Location: {0}", Location);
     Console.WriteLine("Start Date: {0}", StartTime.ToString());
     Console.WriteLine("End Date: {0}", EndTime.ToString());
     Console.WriteLine("Modified: {0}", Modified.ToString());
     Console.WriteLine("Event Type: {0}", EventType);
 }
Exemple #7
0
        public override string ToString()
        {
            StringBuilder writer = new StringBuilder();

            writer.AppendFormat("lang\t{0}\n", Language);
            writer.AppendFormat("langid\t{0}\n", LanguageId);
            writer.AppendFormat("modified\t{0}\n", Modified.ToString());
            writer.AppendFormat("version\t{0}\n", LanguageVersion);
            for (int i = 0; i < gstr.Count; i++)
            {
                writer.AppendFormat("{0}\t{1}\n", i, gstr[i]);
            }
            return(writer.ToString());
        }
 /// <summary>
 /// Save to binary file
 /// </summary>
 public override void Save()
 {
     d.Log(true, "Attempting to save Game State contents to binary file: " + d.path + "/" + File_Name, false);
     // Save Game State to binary file
     try
     {
         BinaryFormatter bf = new BinaryFormatter();
         file = new FileStream(d.path + "/" + File_Name, FileMode.OpenOrCreate);
         BinaryWriter bw = new BinaryWriter(file);
         bw.Write(Modified.ToString());
         bw.Write(Current_Medals);
         bw.Write(Total_Medals_Earned);
         bw.Write(Current_Gems);
         bw.Write(Total_Gems_Earned);
         bw.Write(Level_Data.Count);
         d.Log(true, "Successfully saved Game State of > [Total_Medals_Earned: " + Total_Medals_Earned + " | Current_Medals: " + Current_Medals +
               " | Total_Gems_Earned: " + Total_Gems_Earned + " | Current_Gems: " + Current_Gems + "] to binary file: " + Path.Combine(d.path, File_Name), false);
         foreach (Level_Info level in Level_Data)
         {
             if (level.Name == "" || level.Number == 0 || level.Medals == 0)
             {
                 d.Log(false, "Level #" + level.Number + " Serialization failure, a value was null > Name: " + level.Name + ", Number: " + level.Number + ", Medals: " + level.Medals + ". Skipping this level.", true);
                 continue;
             }
             bf.Serialize(bw.BaseStream, level);
             d.Log(true, "Level #" + level.Number + " - " + level.Name + " (" + level.Medals + " Medals Earned) saved to binary file: " + Path.Combine(d.path, File_Name), true);
         }
         bw.Close();
         file.Close();
         d.Log(true, "Save Game State contents to binary file successful: " + Path.Combine(d.path, File_Name), false);
     }
     catch (SerializationException e)
     {
         d.Log(false, "Save Game State contents to binary file failed: " + Path.Combine(d.path, File_Name) + " > " + e.Message, true);
     }
     finally
     {
         if (file != null)
         {
             file.Close();
         }
     }
     // Now update the database to reflect this
     Update();
 }
Exemple #9
0
        /// <summary>
        /// Returns a string representation of this object and its properties
        /// </summary>
        /// <returns>A string representing this object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            if (Type == FtpFileSystemObjectType.File)
            {
                sb.Append("FILE");
            }
            else if (Type == FtpFileSystemObjectType.Directory)
            {
                sb.Append("DIR ");
            }
            else if (Type == FtpFileSystemObjectType.Link)
            {
                sb.Append("LINK");
            }
            sb.Append("   ");
            sb.Append(Name);
            if (Type == FtpFileSystemObjectType.File)
            {
                sb.Append("      ");
                sb.Append("(");
                sb.Append(Size.FileSizeToString());
                sb.Append(")");
            }
            if (Created != DateTime.MinValue)
            {
                sb.Append("      ");
                sb.Append("Created : ");
                sb.Append(Created.ToString());
            }
            if (Modified != DateTime.MinValue)
            {
                sb.Append("      ");
                sb.Append("Modified : ");
                sb.Append(Modified.ToString());
            }
            return(sb.ToString());
        }
Exemple #10
0
        public bool SaveChanges()
        {
            //if (("").Equals(GUID) && ID == 0)
            //{
            //    throw new Exception();
            //}
            if (DoDelete)
            {
                var decisionElement = EAMain.Repository.GetElementByGUID(GUID);
                decisionElement.ParentElement = null;
                return(decisionElement.Update());
            }

            IEAElement element;

            if (string.IsNullOrEmpty(GUID) && ID == 0)
            {
                var topicElement = Topic.Element;
                element = topicElement.ParentPackage.CreateElement(Name,
                                                                   State,
                                                                   EAConstants.ActionMetaType);
                element.MetaType      = EAConstants.DecisionMetaType;
                element.ParentElement = topicElement;
                GUID = element.GUID;
                ID   = element.ID;
            }
            else
            {
                element = EAMain.Repository.GetElementByGUID(GUID);
            }


            element.Name = Name;

            if (!element.TaggedValueExists(EATaggedValueKeys.DecisionState))
            {
                element.AddTaggedValue(EATaggedValueKeys.DecisionState, element.Stereotype);
                element.AddTaggedValue(EATaggedValueKeys.DecisionStateModifiedDate,
                                       element.Modified.ToString(CultureInfo.InvariantCulture));
            }

            var lastHistoryState = History.LastOrDefault();
            var stateChanged     = lastHistoryState == null || !lastHistoryState.State.Equals(State);

            if (!element.StereotypeList.Equals(State) || stateChanged)
            {
                //History.Add(new HistoryEntry(this, element.Stereotype, element.Modified));
                History.Add(new HistoryEntry(this, State, DateTime.Now));
                element.UpdateTaggedValue(EATaggedValueKeys.DecisionStateModifiedDate,
                                          Modified.ToString(CultureInfo.InvariantCulture));
            }
            element.UpdateTaggedValue(EATaggedValueKeys.DecisionState, State);

            element.StereotypeList = State;
            element.Modified       = Modified;
            element.Author         = Author;
            SaveRationale(element);
            SaveHistory(element);
            SaveForces(element);
            SaveTraces(element);
            SaveAlternatives(element);
            SaveRelations(element);
            SaveStakeholders(element);
            element.Update();
            EAMain.Repository.AdviseElementChanged(element.ID);
            Changed = false;
            return(true);
        }
Exemple #11
0
            public void WriteHtml(StreamWriter writer, ResourceColumn[] columns)
            {
                try
                {
                    if (path != null)
                    {
                        if ((File.GetAttributes(path) & FileAttributes.Hidden) != 0)
                        {
                            return;
                        }
                    }
                }
                catch (IOException)
                {
                }

                writer.WriteLine("<tr>");

                foreach (ResourceColumn column in columns)
                {
                    writer.Write(GetColumnTd(column));
                    switch (column)
                    {
                    case ResourceColumn.Created:
                        if (path != null)
                        {
                            if (Created != DateTime.MinValue)
                            {
                                writer.Write(Created.ToString());
                            }
                        }
                        break;

                    case ResourceColumn.Modified:
                        if (path != null)
                        {
                            if (Modified != DateTime.MinValue)
                            {
                                writer.Write(Modified.ToString());
                            }
                        }
                        break;

                    case ResourceColumn.Size:
                        if (!isDir)
                        {
                            if (path != null)
                            {
                                if (Size != -1)
                                {
                                    writer.Write(ReadableDataLength.Calculate(Size));
                                }
                            }
                        }
                        break;

                    case ResourceColumn.Name:
                        writer.WriteLine("<a href=\"" + UrlEncoding.Encode(resource.Name) +
                                         (isDir ? "/\">[" : "\">") + resource.Name + (isDir ? "]" : "") + "</a>");
                        break;
                    }
                    writer.WriteLine("</td>");
                }

                writer.WriteLine("</tr>");
            }
 public string Modified_String()
 {
     return(Modified.ToString("G"));
 }
 private string Serialize()
 {
     return(String.Format("{0}" + Separator + "{1}", State, Modified.ToString(Culture)));
 }