public static CleanString ( string @string ) : string | ||
@string | string | |
Результат | string |
// write this ticket to the git database public void SaveNew() { var dir = Base.CreateDirectory(TicketName); Base.AddFile(dir, "TICKET_ID", TicketName); Base.AddFile(dir, "ASSIGNED_" + CleanString(Assigned), Assigned); Debug.Assert(!string.IsNullOrEmpty(State)); Base.AddFile(dir, "STATE_" + State, State); foreach (var comment in Comments) { Base.AddFile(dir, CommentName(Email), comment.Text as string); } var tags = Tags.Select(t => t.Trim()).ToArray(); if (tags != null && tags.Length > 0) { foreach (var tag in tags) { if (tag.Length == 0) { continue; } var tag_filename = "TAG_" + Ticket.CleanString(tag); Base.AddFileIfNotExists(Path.Combine(TicketName, tag_filename), tag_filename); } } Base.Git.Commit("added ticket " + TicketName, new Author(User, Email)); }
public static string CreateTicketName(string title) { //[Time.now.to_i.to_s, Ticket.clean_string(title), rand(999).to_i.to_s].join('_') var s = new StringBuilder(); s.Append(GitSharp.Core.Util.DateTimeExtensions.ToUnixTime(DateTime.Now).ToString()); s.Append("_"); s.Append(Ticket.CleanString(title)); s.Append("_"); s.Append(m_rand.Next(999)); return(s.ToString()); }
//ConfigFile //rivate string _tic_dir; public Base(string git_dir) // , Hashtable options { if (!new DirectoryInfo(git_dir).Exists) { Directory.CreateDirectory(git_dir); Git = Repository.Init(git_dir); AddFile(".hold", "hold"); Git.Commit("initialized ticket repository", new Author(Git.Config["user.name"], Git.Config["user.email"])); } else { Git = new Repository(git_dir); } //@logger = opts[:logger] || Logger.new(STDOUT) var proj = Ticket.CleanString(Git.Directory); //@tic_dir = opts[:tic_dir] || '~/.ticgit' // @tic_working = opts[:working_directory] || File.expand_path(File.join(@tic_dir, proj, 'working')) // @tic_index = opts[:index_file] || File.expand_path(File.join(@tic_dir, proj, 'index')) // # load config file // @config_file = File.expand_path(File.join(@tic_dir, proj, 'config.yml')) // if File.exists?(config_file) // @config = YAML.load(File.read(config_file)) // else // @config = {} // end // @state = File.expand_path(File.join(@tic_dir, proj, 'state')) // if File.exists?(@state) // load_state // else // reset_ticgit // end }