GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Coding-iOS/Coding_iOS/Models/CodeFile.m at master · coding/Coding-iOS Expand file tree/ Copy pathCodeFile.mMore file actions executable file ·112 lines (99 loc) · 2.95 KB / Copy pathCodeFile.mFile metadata and controlsexecutable file ·112 lines (99 loc) · 2.95 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 // // CodeFile.m // Coding_iOS // // Created by 王 原闯 on 14/10/29. // Copyright (c) 2014年 Coding. All rights reserved. // #import "CodeFile.h" @implementation CodeFile + (CodeFile *)codeFileWithRef:(NSString *)ref andPath:(NSString *)path{ CodeFile *codeFile = [[CodeFile alloc] init]; codeFile.ref = ref; codeFile.path = path; return codeFile; } + (CodeFile *)codeFileWithMDPreview:(NSString *)md_html{ CodeFile *codeFile = [self codeFileWithRef:@"" andPath:@"README"]; CodeFile_RealFile *file = [CodeFile_RealFile new]; file.mode = @"file"; file.lang = @"markdown"; file.preview = md_html; codeFile.file = file; return codeFile; } + (CodeFile *)codeFileToCommitWithRef:(NSString *)ref andPath:(NSString *)path name:(NSString *)name data:(NSString *)data message:(NSString *)message headCommit:(Commit *)headCommit{ CodeFile *codeFile = [self codeFileWithRef:ref andPath:path]; codeFile.editName = name; codeFile.editData = data; codeFile.editMessage = message; codeFile.headCommit = headCommit; return codeFile; } + (CodeFile *)codeFileWithLocalURL:(NSURL *)localURL{ CodeFile *codeFile = [self new]; CodeFile_RealFile *file = [CodeFile_RealFile new]; file.mode = @"file"; NSStringEncoding enc; file.data = [NSString stringWithContentsOfURL:localURL usedEncoding:&enc error:nil]; file.lang = localURL.ea_lang ?: @""; codeFile.file = file; return codeFile; } - (NSString *)path{ if (!_path) { _path = @""; } return _path; } - (NSString *)ref{ if (!_ref) { _ref = @"master"; } return _ref; } - (NSString *)editData{ if (!_editData) { _editData = _file.data.copy; } return _editData; } - (NSString *)editName{ if (!_editName) { _editName = _file.name.copy; } return _editName; } - (NSString *)editMessage{ if (!_editMessage) { _editMessage = [NSString stringWithFormat:@"update %@", _path]; } return _editMessage; } - (NSDictionary *)toEditParams{ NSMutableDictionary *params = @{}.mutableCopy; params[@"content"] = self.editData; params[@"message"] = self.editMessage; params[@"lastCommitSha"] = self.headCommit.commitId; return params; } - (NSDictionary *)toDeleteParams{ NSMutableDictionary *params = @{}.mutableCopy; params[@"message"] = [NSString stringWithFormat:@"delete: %@", self.file.name]; params[@"lastCommitSha"] = self.headCommit.commitId; return params; } - (NSDictionary *)toCreateParams{ NSMutableDictionary *params = @{}.mutableCopy; params[@"title"] = self.editName; params[@"content"] = self.editData ?: @""; params[@"message"] = self.editMessage; params[@"lastCommitSha"] = self.headCommit.commitId ?: @""; return params; } @end @implementation CodeFile_RealFile - (void)setPreview:(NSString *)preview{ _preview = [preview stringByReplacingOccurrencesOfString:@"{{CodingUrl}}" withString:@""]; } @end |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |